diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index aa8a4543a..36b18edb3 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.396.8 +speakeasyVersion: 1.396.9 sources: accounting-source: sourceNamespace: accounting-source @@ -70,6 +70,13 @@ sources: tags: - latest - main + sync-for-commerce-version-1-source: + sourceNamespace: sync-for-commerce-version-1-source + sourceRevisionDigest: sha256:09d7bb14b3736b3157a46766c502598e3dde7fb338652eaaeca6fb3427b32630 + sourceBlobDigest: sha256:c00e3840ee75be94b232308b1e35ba628a278cf0eead16d5cfac18d91d5f144c + tags: + - latest + - main targets: accounting-library: source: accounting-source @@ -121,6 +128,11 @@ targets: sourceNamespace: sync-for-commerce-source sourceRevisionDigest: sha256:08f301ee27cf293afcb146e12dfcbd8c269d5210009cf214fd83f966cb9b3923 sourceBlobDigest: sha256:ab64a148f650a63d3411abb1686ffdcc252ddb1525415957d2dcd7e818882594 + sync-for-commerce-version-1-library: + source: sync-for-commerce-version-1-source + sourceNamespace: sync-for-commerce-version-1-source + sourceRevisionDigest: sha256:09d7bb14b3736b3157a46766c502598e3dde7fb338652eaaeca6fb3427b32630 + sourceBlobDigest: sha256:c00e3840ee75be94b232308b1e35ba628a278cf0eead16d5cfac18d91d5f144c workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -178,6 +190,8 @@ workflow: sync-for-commerce-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Commerce-v1.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-version-1-source sync-for-expenses-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index a07a4e558..71fff25a7 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -54,6 +54,8 @@ sources: sync-for-commerce-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Commerce-v1.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-version-1-source sync-for-expenses-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml diff --git a/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.lock b/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.lock new file mode 100644 index 000000000..cf86578ab --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.lock @@ -0,0 +1,3795 @@ +lockVersion: 2.0.0 +id: dba0a852-df7d-4a4b-9411-bece4160a3a4 +management: + docChecksum: 3637d8a1a008b4a4a714be9f44de4a91 + docVersion: "1.1" + speakeasyVersion: 1.396.9 + generationVersion: 2.415.7 + releaseVersion: 0.23.0 + configChecksum: 3347e3d17713d036a40f94773187eb0d + repoURL: https://github.com/codatio/client-sdk-go.git + repoSubDirectory: previous-versions/sync-for-commerce-version-1 + installationURL: https://github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1 + published: true +features: + go: + 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.10 + globalSecurityCallbacks: 0.1.0 + globalServerURLs: 2.82.2 + intellisenseMarkdownSupport: 0.1.0 + nameOverrides: 2.81.2 + nullables: 0.1.0 + responseFormat: 0.1.2 + retries: 2.83.0 + sdkHooks: 0.1.0 + serverEventsSentinels: 0.1.0 +generatedFiles: + - .gitattributes + - /pkg/models/operations/createaccountingaccount.go + - /pkg/models/operations/createaccountingcreditnote.go + - /pkg/models/operations/createaccountingcustomer.go + - /pkg/models/operations/createaccountingdirectincome.go + - /pkg/models/operations/createaccountinginvoice.go + - /pkg/models/operations/createaccountingjournalentry.go + - /pkg/models/operations/createaccountingpayment.go + - /pkg/models/operations/createcompany.go + - /pkg/models/operations/createconnection.go + - /pkg/models/operations/deletecompany.go + - /pkg/models/operations/deleteconnection.go + - /pkg/models/operations/getaccountingaccount.go + - /pkg/models/operations/getaccountingbankaccount.go + - /pkg/models/operations/getaccountingcompanyinfo.go + - /pkg/models/operations/getcommercecompanyinfo.go + - /pkg/models/operations/getcommercecustomer.go + - /pkg/models/operations/getcommercelocation.go + - /pkg/models/operations/getcommerceorder.go + - /pkg/models/operations/getcommercepayment.go + - /pkg/models/operations/getcommercepaymentmethod.go + - /pkg/models/operations/getcommerceproduct.go + - /pkg/models/operations/getcommercetransaction.go + - /pkg/models/operations/getcompany.go + - /pkg/models/operations/getcompanydatastatus.go + - /pkg/models/operations/getcompanypushhistory.go + - /pkg/models/operations/getconfigtextsyncflow.go + - /pkg/models/operations/getconfiguration.go + - /pkg/models/operations/getconnection.go + - /pkg/models/operations/getintegrationbranding.go + - /pkg/models/operations/getpulloperation.go + - /pkg/models/operations/getpushoperation.go + - /pkg/models/operations/getsyncflowurl.go + - /pkg/models/operations/getsyncstatus.go + - /pkg/models/operations/getvisibleaccounts.go + - /pkg/models/operations/listaccountingaccounts.go + - /pkg/models/operations/listaccountingbankaccounts.go + - /pkg/models/operations/listcommercecustomers.go + - /pkg/models/operations/listcommercelocations.go + - /pkg/models/operations/listcommerceorders.go + - /pkg/models/operations/listcommercepaymentmethods.go + - /pkg/models/operations/listcommercepayments.go + - /pkg/models/operations/listcommerceproducts.go + - /pkg/models/operations/listcommercetransactions.go + - /pkg/models/operations/listcompanies.go + - /pkg/models/operations/listconnections.go + - /pkg/models/operations/listintegrations.go + - /pkg/models/operations/listpulloperations.go + - /pkg/models/operations/refreshcompanydata.go + - /pkg/models/operations/refreshcompanyinfo.go + - /pkg/models/operations/refreshdatatype.go + - /pkg/models/operations/requestsync.go + - /pkg/models/operations/requestsyncfordaterange.go + - /pkg/models/operations/setconfiguration.go + - /pkg/models/operations/unlinkconnection.go + - /pkg/models/operations/updatecompany.go + - /pkg/models/operations/updateconfigtextsyncflow.go + - /pkg/models/operations/updateconnection.go + - /pkg/models/operations/updatevisibleaccountssyncflow.go + - /pkg/models/sdkerrors/errormessage.go + - /pkg/models/shared/accountbalance.go + - /pkg/models/shared/accountingaccount.go + - /pkg/models/shared/accountingaccounts.go + - /pkg/models/shared/accountingaddresstype.go + - /pkg/models/shared/accountingbankaccount.go + - /pkg/models/shared/accountingbankaccounts.go + - /pkg/models/shared/accountingcompanydataset.go + - /pkg/models/shared/accountingcreateaccountresponse.go + - /pkg/models/shared/accountingcreatecreditnoteresponse.go + - /pkg/models/shared/accountingcreatecustomerresponse.go + - /pkg/models/shared/accountingcreatedirectincomeresponse.go + - /pkg/models/shared/accountingcreateinvoiceresponse.go + - /pkg/models/shared/accountingcreatejournalentryresponse.go + - /pkg/models/shared/accountingcreatepaymentresponse.go + - /pkg/models/shared/accountingcreditnote.go + - /pkg/models/shared/accountingcustomer.go + - /pkg/models/shared/accountingcustomerref.go + - /pkg/models/shared/accountingdirectincome.go + - /pkg/models/shared/accountinginvoice.go + - /pkg/models/shared/accountingjournalentry.go + - /pkg/models/shared/accountingpayment.go + - /pkg/models/shared/accountoption.go + - /pkg/models/shared/accountprototype.go + - /pkg/models/shared/accountref.go + - /pkg/models/shared/accountstatus.go + - /pkg/models/shared/accounttype.go + - /pkg/models/shared/bankaccountstatus.go + - /pkg/models/shared/billedtotype.go + - /pkg/models/shared/branding.go + - /pkg/models/shared/brandingbutton.go + - /pkg/models/shared/brandingimage.go + - /pkg/models/shared/brandinglogo.go + - /pkg/models/shared/commerceaddresstype.go + - /pkg/models/shared/commercecompanyinfo.go + - /pkg/models/shared/commercecustomer.go + - /pkg/models/shared/commercecustomerref.go + - /pkg/models/shared/commercecustomers.go + - /pkg/models/shared/commercelocation.go + - /pkg/models/shared/commercelocations.go + - /pkg/models/shared/commerceorder.go + - /pkg/models/shared/commerceorders.go + - /pkg/models/shared/commercepayment.go + - /pkg/models/shared/commercepaymentmethod.go + - /pkg/models/shared/commercepaymentmethods.go + - /pkg/models/shared/commercepayments.go + - /pkg/models/shared/commerceproduct.go + - /pkg/models/shared/commerceproducts.go + - /pkg/models/shared/commercetransaction.go + - /pkg/models/shared/commercetransactions.go + - /pkg/models/shared/companies.go + - /pkg/models/shared/company.go + - /pkg/models/shared/configaccount.go + - /pkg/models/shared/configuration.go + - /pkg/models/shared/connection.go + - /pkg/models/shared/connections.go + - /pkg/models/shared/contact.go + - /pkg/models/shared/contactref.go + - /pkg/models/shared/createcompany.go + - /pkg/models/shared/creditnotelineitem.go + - /pkg/models/shared/creditnotestatus.go + - /pkg/models/shared/customer.go + - /pkg/models/shared/customerstatus.go + - /pkg/models/shared/dataconnectionerror.go + - /pkg/models/shared/dataconnectionstatus.go + - /pkg/models/shared/dataset.go + - /pkg/models/shared/datasetstatus.go + - /pkg/models/shared/datastatus.go + - /pkg/models/shared/datatype.go + - /pkg/models/shared/datatypefeature.go + - /pkg/models/shared/daterange.go + - /pkg/models/shared/directincomelineitem.go + - /pkg/models/shared/errorvalidation.go + - /pkg/models/shared/errorvalidationitem.go + - /pkg/models/shared/featurestate.go + - /pkg/models/shared/featuretype.go + - /pkg/models/shared/fees.go + - /pkg/models/shared/feessupplier.go + - /pkg/models/shared/grouping.go + - /pkg/models/shared/groupinglevels.go + - /pkg/models/shared/groupingperiod.go + - /pkg/models/shared/halref.go + - /pkg/models/shared/imagereference.go + - /pkg/models/shared/integration.go + - /pkg/models/shared/integrations.go + - /pkg/models/shared/invoicelevelselection.go + - /pkg/models/shared/invoicelineitem.go + - /pkg/models/shared/invoicelinelevelselection.go + - /pkg/models/shared/invoicestatus.go + - /pkg/models/shared/itemref.go + - /pkg/models/shared/items.go + - /pkg/models/shared/items1.go + - /pkg/models/shared/journalentryrecordref.go + - /pkg/models/shared/journalline.go + - /pkg/models/shared/links.go + - /pkg/models/shared/locale.go + - /pkg/models/shared/localization.go + - /pkg/models/shared/locationref.go + - /pkg/models/shared/metadata.go + - /pkg/models/shared/newpayments.go + - /pkg/models/shared/newtaxrates.go + - /pkg/models/shared/option.go + - /pkg/models/shared/orderdiscountallocation.go + - /pkg/models/shared/orderlineitem.go + - /pkg/models/shared/paymentallocationitems.go + - /pkg/models/shared/paymentallocationpayment.go + - /pkg/models/shared/paymentline.go + - /pkg/models/shared/paymentlinelink.go + - /pkg/models/shared/paymentlinktype.go + - /pkg/models/shared/paymentmethodref.go + - /pkg/models/shared/paymentref.go + - /pkg/models/shared/payments.go + - /pkg/models/shared/paymentstatus.go + - /pkg/models/shared/paymenttype.go + - /pkg/models/shared/phonenumberitems.go + - /pkg/models/shared/phonenumbertype.go + - /pkg/models/shared/productinventory.go + - /pkg/models/shared/productinventorylocation.go + - /pkg/models/shared/productprice.go + - /pkg/models/shared/productref.go + - /pkg/models/shared/productvariant.go + - /pkg/models/shared/productvariantref.go + - /pkg/models/shared/productvariantstatus.go + - /pkg/models/shared/pulloperation.go + - /pkg/models/shared/pulloperations.go + - /pkg/models/shared/pushchangetype.go + - /pkg/models/shared/pushoperation.go + - /pkg/models/shared/pushoperationchange.go + - /pkg/models/shared/pushoperationref.go + - /pkg/models/shared/pushoperations.go + - /pkg/models/shared/pushoperationstatus.go + - /pkg/models/shared/sales.go + - /pkg/models/shared/schemadatatype.go + - /pkg/models/shared/schemainvoicestatus.go + - /pkg/models/shared/security.go + - /pkg/models/shared/servicecharge.go + - /pkg/models/shared/servicechargetype.go + - /pkg/models/shared/sourcetype.go + - /pkg/models/shared/supplementaldata.go + - /pkg/models/shared/supportedfeature.go + - /pkg/models/shared/syncflowurl.go + - /pkg/models/shared/syncrange.go + - /pkg/models/shared/syncsummary.go + - /pkg/models/shared/synctolatestargs.go + - /pkg/models/shared/taxeitems.go + - /pkg/models/shared/taxrateamount.go + - /pkg/models/shared/taxratemapping.go + - /pkg/models/shared/taxrateref.go + - /pkg/models/shared/tracking.go + - /pkg/models/shared/trackingcategoryrefitems.go + - /pkg/models/shared/trackingrecordref.go + - /pkg/models/shared/transactionsourceref.go + - /pkg/models/shared/transactionsourcetype.go + - /pkg/models/shared/transactiontype.go + - /pkg/models/shared/updateconnection.go + - /pkg/models/shared/validation.go + - /pkg/models/shared/validationitem.go + - /pkg/models/shared/visibleaccounts.go + - /pkg/models/shared/weblinkitems.go + - /pkg/models/shared/withholdingtaxitems.go + - CONTRIBUTING.md + - USAGE.md + - accountingaccounts.go + - accountingbankaccounts.go + - accountingcompanyinfo.go + - accountingcreditnotes.go + - accountingcustomers.go + - accountingdirectincomes.go + - accountinginvoices.go + - accountingjournalentries.go + - accountingpayments.go + - codatsynccommerce.go + - commercecompanyinfo.go + - commercecustomers.go + - commercelocations.go + - commerceorders.go + - commercepayments.go + - commerceproducts.go + - commercetransactions.go + - companies.go + - companymanagement.go + - configuration.go + - connections.go + - docs/pkg/models/operations/createaccountingaccountrequest.md + - docs/pkg/models/operations/createaccountingaccountresponse.md + - docs/pkg/models/operations/createaccountingcreditnoterequest.md + - docs/pkg/models/operations/createaccountingcreditnoteresponse.md + - docs/pkg/models/operations/createaccountingcustomerrequest.md + - docs/pkg/models/operations/createaccountingcustomerresponse.md + - docs/pkg/models/operations/createaccountingdirectincomerequest.md + - docs/pkg/models/operations/createaccountingdirectincomeresponse.md + - docs/pkg/models/operations/createaccountinginvoicerequest.md + - docs/pkg/models/operations/createaccountinginvoiceresponse.md + - docs/pkg/models/operations/createaccountingjournalentryrequest.md + - docs/pkg/models/operations/createaccountingjournalentryresponse.md + - docs/pkg/models/operations/createaccountingpaymentrequest.md + - docs/pkg/models/operations/createaccountingpaymentresponse.md + - docs/pkg/models/operations/createcompanyresponse.md + - docs/pkg/models/operations/createconnectionrequest.md + - docs/pkg/models/operations/createconnectionresponse.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/getaccountingaccountrequest.md + - docs/pkg/models/operations/getaccountingaccountresponse.md + - docs/pkg/models/operations/getaccountingbankaccountrequest.md + - docs/pkg/models/operations/getaccountingbankaccountresponse.md + - docs/pkg/models/operations/getaccountingcompanyinforequest.md + - docs/pkg/models/operations/getaccountingcompanyinforesponse.md + - docs/pkg/models/operations/getcommercecompanyinforequest.md + - docs/pkg/models/operations/getcommercecompanyinforesponse.md + - docs/pkg/models/operations/getcommercecustomerrequest.md + - docs/pkg/models/operations/getcommercecustomerresponse.md + - docs/pkg/models/operations/getcommercelocationrequest.md + - docs/pkg/models/operations/getcommercelocationresponse.md + - docs/pkg/models/operations/getcommerceorderrequest.md + - docs/pkg/models/operations/getcommerceorderresponse.md + - docs/pkg/models/operations/getcommercepaymentmethodrequest.md + - docs/pkg/models/operations/getcommercepaymentmethodresponse.md + - docs/pkg/models/operations/getcommercepaymentrequest.md + - docs/pkg/models/operations/getcommercepaymentresponse.md + - docs/pkg/models/operations/getcommerceproductrequest.md + - docs/pkg/models/operations/getcommerceproductresponse.md + - docs/pkg/models/operations/getcommercetransactionrequest.md + - docs/pkg/models/operations/getcommercetransactionresponse.md + - docs/pkg/models/operations/getcompanydatastatusdatastatuses.md + - docs/pkg/models/operations/getcompanydatastatusrequest.md + - docs/pkg/models/operations/getcompanydatastatusresponse.md + - docs/pkg/models/operations/getcompanypushhistoryrequest.md + - docs/pkg/models/operations/getcompanypushhistoryresponse.md + - docs/pkg/models/operations/getcompanyrequest.md + - docs/pkg/models/operations/getcompanyresponse.md + - docs/pkg/models/operations/getconfigtextsyncflowrequest.md + - docs/pkg/models/operations/getconfigtextsyncflowresponse.md + - docs/pkg/models/operations/getconfigurationrequest.md + - docs/pkg/models/operations/getconfigurationresponse.md + - docs/pkg/models/operations/getconnectionrequest.md + - docs/pkg/models/operations/getconnectionresponse.md + - docs/pkg/models/operations/getintegrationbrandingrequest.md + - docs/pkg/models/operations/getintegrationbrandingresponse.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/getsyncflowurlrequest.md + - docs/pkg/models/operations/getsyncflowurlresponse.md + - docs/pkg/models/operations/getsyncstatusrequest.md + - docs/pkg/models/operations/getsyncstatusresponse.md + - docs/pkg/models/operations/getvisibleaccountsrequest.md + - docs/pkg/models/operations/getvisibleaccountsresponse.md + - docs/pkg/models/operations/listaccountingaccountsrequest.md + - docs/pkg/models/operations/listaccountingaccountsresponse.md + - docs/pkg/models/operations/listaccountingbankaccountsrequest.md + - docs/pkg/models/operations/listaccountingbankaccountsresponse.md + - docs/pkg/models/operations/listcommercecustomersrequest.md + - docs/pkg/models/operations/listcommercecustomersresponse.md + - docs/pkg/models/operations/listcommercelocationsrequest.md + - docs/pkg/models/operations/listcommercelocationsresponse.md + - docs/pkg/models/operations/listcommerceordersrequest.md + - docs/pkg/models/operations/listcommerceordersresponse.md + - docs/pkg/models/operations/listcommercepaymentmethodsrequest.md + - docs/pkg/models/operations/listcommercepaymentmethodsresponse.md + - docs/pkg/models/operations/listcommercepaymentsrequest.md + - docs/pkg/models/operations/listcommercepaymentsresponse.md + - docs/pkg/models/operations/listcommerceproductsrequest.md + - docs/pkg/models/operations/listcommerceproductsresponse.md + - docs/pkg/models/operations/listcommercetransactionsrequest.md + - docs/pkg/models/operations/listcommercetransactionsresponse.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/listintegrationsrequest.md + - docs/pkg/models/operations/listintegrationsresponse.md + - docs/pkg/models/operations/listpulloperationsrequest.md + - docs/pkg/models/operations/listpulloperationsresponse.md + - docs/pkg/models/operations/option.md + - docs/pkg/models/operations/refreshcompanydatarequest.md + - docs/pkg/models/operations/refreshcompanydataresponse.md + - docs/pkg/models/operations/refreshcompanyinforequest.md + - docs/pkg/models/operations/refreshcompanyinforesponse.md + - docs/pkg/models/operations/refreshdatatyperequest.md + - docs/pkg/models/operations/refreshdatatyperesponse.md + - docs/pkg/models/operations/requestsyncfordaterangerequest.md + - docs/pkg/models/operations/requestsyncfordaterangeresponse.md + - docs/pkg/models/operations/requestsyncrequest.md + - docs/pkg/models/operations/requestsyncresponse.md + - docs/pkg/models/operations/setconfigurationrequest.md + - docs/pkg/models/operations/setconfigurationresponse.md + - docs/pkg/models/operations/unlinkconnectionrequest.md + - docs/pkg/models/operations/unlinkconnectionresponse.md + - docs/pkg/models/operations/updatecompanyrequest.md + - docs/pkg/models/operations/updatecompanyresponse.md + - docs/pkg/models/operations/updateconfigtextsyncflowrequest.md + - docs/pkg/models/operations/updateconfigtextsyncflowresponse.md + - docs/pkg/models/operations/updateconnectionrequest.md + - docs/pkg/models/operations/updateconnectionresponse.md + - docs/pkg/models/operations/updatevisibleaccountssyncflowrequest.md + - docs/pkg/models/operations/updatevisibleaccountssyncflowresponse.md + - docs/pkg/models/sdkerrors/errormessage.md + - docs/pkg/models/shared/accountbalance.md + - docs/pkg/models/shared/accountingaccount.md + - docs/pkg/models/shared/accountingaccountmetadata.md + - docs/pkg/models/shared/accountingaccounts.md + - docs/pkg/models/shared/accountingaccountvaliddatatypelinks.md + - docs/pkg/models/shared/accountingaddress.md + - docs/pkg/models/shared/accountingaddresstype.md + - docs/pkg/models/shared/accountingbankaccount.md + - docs/pkg/models/shared/accountingbankaccounts.md + - docs/pkg/models/shared/accountingcompanydataset.md + - docs/pkg/models/shared/accountingcompanydatasettype.md + - docs/pkg/models/shared/accountingcreateaccountresponse.md + - docs/pkg/models/shared/accountingcreateaccountresponseaccountingaccount.md + - docs/pkg/models/shared/accountingcreateaccountresponsemetadata.md + - docs/pkg/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md + - docs/pkg/models/shared/accountingcreatecreditnoteresponse.md + - docs/pkg/models/shared/accountingcreatecreditnoteresponseaccountingcreditnote.md + - docs/pkg/models/shared/accountingcreatecustomerresponse.md + - docs/pkg/models/shared/accountingcreatecustomerresponseaccountingcustomer.md + - docs/pkg/models/shared/accountingcreatedirectincomeresponse.md + - docs/pkg/models/shared/accountingcreatedirectincomeresponseaccountingdirectincome.md + - docs/pkg/models/shared/accountingcreateinvoiceresponse.md + - docs/pkg/models/shared/accountingcreateinvoiceresponseaccountinginvoice.md + - docs/pkg/models/shared/accountingcreateinvoiceresponseaccountingpaymentallocation.md + - docs/pkg/models/shared/accountingcreateinvoiceresponseallocation.md + - docs/pkg/models/shared/accountingcreateinvoiceresponsedatatype.md + - docs/pkg/models/shared/accountingcreateinvoiceresponsesalesorderreference.md + - docs/pkg/models/shared/accountingcreateinvoiceresponsewithholdingtax.md + - docs/pkg/models/shared/accountingcreatejournalentryresponse.md + - docs/pkg/models/shared/accountingcreatejournalentryresponseaccountingjournalentry.md + - docs/pkg/models/shared/accountingcreatejournalentryresponsejournalreference.md + - docs/pkg/models/shared/accountingcreatepaymentresponse.md + - docs/pkg/models/shared/accountingcreatepaymentresponseaccountingpayment.md + - docs/pkg/models/shared/accountingcreditnote.md + - docs/pkg/models/shared/accountingcustomer.md + - docs/pkg/models/shared/accountingcustomerref.md + - docs/pkg/models/shared/accountingdirectincome.md + - docs/pkg/models/shared/accountinginvoice.md + - docs/pkg/models/shared/accountinginvoiceallocation.md + - docs/pkg/models/shared/accountinginvoicedatatype.md + - docs/pkg/models/shared/accountingjournalentry.md + - docs/pkg/models/shared/accountingpayment.md + - docs/pkg/models/shared/accountingpaymentallocation.md + - docs/pkg/models/shared/accountingprojectreference.md + - docs/pkg/models/shared/accountoption.md + - docs/pkg/models/shared/accountprototype.md + - docs/pkg/models/shared/accountref.md + - docs/pkg/models/shared/accountstatus.md + - docs/pkg/models/shared/accounttype.md + - docs/pkg/models/shared/allocation.md + - docs/pkg/models/shared/bankaccountstatus.md + - docs/pkg/models/shared/bankaccounttype.md + - docs/pkg/models/shared/billedtotype.md + - docs/pkg/models/shared/branding.md + - docs/pkg/models/shared/brandingbutton.md + - docs/pkg/models/shared/brandingimage.md + - docs/pkg/models/shared/brandinglogo.md + - docs/pkg/models/shared/commerceaddress.md + - docs/pkg/models/shared/commerceaddresstype.md + - docs/pkg/models/shared/commercecompanyinfo.md + - docs/pkg/models/shared/commercecustomer.md + - docs/pkg/models/shared/commercecustomerref.md + - docs/pkg/models/shared/commercecustomers.md + - docs/pkg/models/shared/commercelocation.md + - docs/pkg/models/shared/commercelocations.md + - docs/pkg/models/shared/commerceorder.md + - docs/pkg/models/shared/commerceorders.md + - docs/pkg/models/shared/commercepayment.md + - docs/pkg/models/shared/commercepaymentmethod.md + - docs/pkg/models/shared/commercepaymentmethods.md + - docs/pkg/models/shared/commercepayments.md + - docs/pkg/models/shared/commerceproduct.md + - docs/pkg/models/shared/commerceproducts.md + - docs/pkg/models/shared/commercetransaction.md + - docs/pkg/models/shared/commercetransactions.md + - docs/pkg/models/shared/companies.md + - docs/pkg/models/shared/company.md + - docs/pkg/models/shared/configaccount.md + - docs/pkg/models/shared/configuration.md + - docs/pkg/models/shared/connection.md + - docs/pkg/models/shared/connections.md + - docs/pkg/models/shared/contact.md + - docs/pkg/models/shared/contactref.md + - docs/pkg/models/shared/contactrefdatatype.md + - docs/pkg/models/shared/contactreference.md + - docs/pkg/models/shared/createcompany.md + - docs/pkg/models/shared/creditnotelineitem.md + - docs/pkg/models/shared/creditnotelineitemaccountingprojectreference.md + - docs/pkg/models/shared/creditnotelineitemrecordreference.md + - docs/pkg/models/shared/creditnotelineitemtracking.md + - docs/pkg/models/shared/creditnotestatus.md + - docs/pkg/models/shared/customer.md + - docs/pkg/models/shared/customerstatus.md + - docs/pkg/models/shared/dataconnectionerror.md + - docs/pkg/models/shared/dataconnectionstatus.md + - docs/pkg/models/shared/dataset.md + - docs/pkg/models/shared/datasetstatus.md + - docs/pkg/models/shared/datastatus.md + - docs/pkg/models/shared/datatype.md + - docs/pkg/models/shared/datatypefeature.md + - docs/pkg/models/shared/datatypes.md + - docs/pkg/models/shared/daterange.md + - docs/pkg/models/shared/directincomelineitem.md + - docs/pkg/models/shared/errorstatus.md + - docs/pkg/models/shared/errorvalidation.md + - docs/pkg/models/shared/errorvalidationitem.md + - docs/pkg/models/shared/featurestate.md + - docs/pkg/models/shared/featuretype.md + - docs/pkg/models/shared/fees.md + - docs/pkg/models/shared/feessupplier.md + - docs/pkg/models/shared/grouping.md + - docs/pkg/models/shared/groupinglevels.md + - docs/pkg/models/shared/groupingperiod.md + - docs/pkg/models/shared/groupreference.md + - docs/pkg/models/shared/halref.md + - docs/pkg/models/shared/imagereference.md + - docs/pkg/models/shared/integration.md + - docs/pkg/models/shared/integrations.md + - docs/pkg/models/shared/invoicelevelselection.md + - docs/pkg/models/shared/invoicelineitem.md + - docs/pkg/models/shared/invoicelinelevelselection.md + - docs/pkg/models/shared/invoicestatus.md + - docs/pkg/models/shared/itemref.md + - docs/pkg/models/shared/itemreference.md + - docs/pkg/models/shared/items.md + - docs/pkg/models/shared/journalentryrecordref.md + - docs/pkg/models/shared/journalentryrecordrefdatatype.md + - docs/pkg/models/shared/journalline.md + - docs/pkg/models/shared/journallinedatatype.md + - docs/pkg/models/shared/journallinetracking.md + - docs/pkg/models/shared/journalreference.md + - docs/pkg/models/shared/links.md + - docs/pkg/models/shared/locale.md + - docs/pkg/models/shared/localization.md + - docs/pkg/models/shared/locationref.md + - docs/pkg/models/shared/metadata.md + - docs/pkg/models/shared/newpayments.md + - docs/pkg/models/shared/newtaxrates.md + - docs/pkg/models/shared/option.md + - docs/pkg/models/shared/orderdiscountallocation.md + - docs/pkg/models/shared/orderlineitem.md + - docs/pkg/models/shared/paymentallocationitems.md + - docs/pkg/models/shared/paymentallocationpayment.md + - docs/pkg/models/shared/paymentline.md + - docs/pkg/models/shared/paymentlinelink.md + - docs/pkg/models/shared/paymentlinktype.md + - docs/pkg/models/shared/paymentmethodref.md + - docs/pkg/models/shared/paymentref.md + - docs/pkg/models/shared/payments.md + - docs/pkg/models/shared/paymentstatus.md + - docs/pkg/models/shared/paymenttype.md + - docs/pkg/models/shared/phone.md + - docs/pkg/models/shared/phonenumberitems.md + - docs/pkg/models/shared/phonenumbertype.md + - docs/pkg/models/shared/productinventory.md + - docs/pkg/models/shared/productinventorylocation.md + - docs/pkg/models/shared/productprice.md + - docs/pkg/models/shared/productref.md + - docs/pkg/models/shared/productvariant.md + - docs/pkg/models/shared/productvariantref.md + - docs/pkg/models/shared/productvariantstatus.md + - docs/pkg/models/shared/pulloperation.md + - docs/pkg/models/shared/pulloperations.md + - docs/pkg/models/shared/pushchangetype.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/pushoperationstatus.md + - docs/pkg/models/shared/recordreference.md + - docs/pkg/models/shared/sales.md + - docs/pkg/models/shared/salesorderreference.md + - docs/pkg/models/shared/schemadatatype.md + - docs/pkg/models/shared/schemainvoicestatus.md + - docs/pkg/models/shared/security.md + - docs/pkg/models/shared/servicecharge.md + - docs/pkg/models/shared/servicechargetaxcomponentref.md + - docs/pkg/models/shared/servicechargetype.md + - docs/pkg/models/shared/sourcetype.md + - docs/pkg/models/shared/status.md + - docs/pkg/models/shared/supplementaldata.md + - docs/pkg/models/shared/supportedfeature.md + - docs/pkg/models/shared/syncflowurl.md + - docs/pkg/models/shared/syncrange.md + - docs/pkg/models/shared/syncrangedaterange.md + - docs/pkg/models/shared/syncsummary.md + - docs/pkg/models/shared/synctolatestargs.md + - docs/pkg/models/shared/tags.md + - docs/pkg/models/shared/taxcomponentallocation.md + - docs/pkg/models/shared/taxcomponentref.md + - docs/pkg/models/shared/taxeitems.md + - docs/pkg/models/shared/taxrateamount.md + - docs/pkg/models/shared/taxratemapping.md + - docs/pkg/models/shared/taxrateref.md + - docs/pkg/models/shared/taxratereference.md + - docs/pkg/models/shared/tracking.md + - docs/pkg/models/shared/trackingcategoryrefitems.md + - docs/pkg/models/shared/trackingcategoryrefs.md + - docs/pkg/models/shared/trackingrecordref.md + - docs/pkg/models/shared/trackingrecordrefdatatype.md + - docs/pkg/models/shared/transactionsourceref.md + - docs/pkg/models/shared/transactionsourcetype.md + - docs/pkg/models/shared/transactiontype.md + - docs/pkg/models/shared/type.md + - docs/pkg/models/shared/updateconnection.md + - docs/pkg/models/shared/validation.md + - docs/pkg/models/shared/validationitem.md + - docs/pkg/models/shared/validdatatypelinks.md + - docs/pkg/models/shared/visibleaccounts.md + - docs/pkg/models/shared/weblink.md + - docs/pkg/models/shared/weblinkitems.md + - docs/pkg/models/shared/withholdingtax.md + - docs/pkg/models/shared/withholdingtaxitems.md + - docs/sdks/accountingaccounts/README.md + - docs/sdks/accountingbankaccounts/README.md + - docs/sdks/accountingcompanyinfo/README.md + - docs/sdks/accountingcreditnotes/README.md + - docs/sdks/accountingcustomers/README.md + - docs/sdks/accountingdirectincomes/README.md + - docs/sdks/accountinginvoices/README.md + - docs/sdks/accountingjournalentries/README.md + - docs/sdks/accountingpayments/README.md + - docs/sdks/codatsynccommerce/README.md + - docs/sdks/commercecompanyinfo/README.md + - docs/sdks/commercecustomers/README.md + - docs/sdks/commercelocations/README.md + - docs/sdks/commerceorders/README.md + - docs/sdks/commercepayments/README.md + - docs/sdks/commerceproducts/README.md + - docs/sdks/commercetransactions/README.md + - docs/sdks/companies/README.md + - docs/sdks/companymanagement/README.md + - docs/sdks/configuration/README.md + - docs/sdks/connections/README.md + - docs/sdks/integrations/README.md + - docs/sdks/pushdata/README.md + - docs/sdks/refreshdata/README.md + - docs/sdks/sync/README.md + - docs/sdks/syncflowpreferences/README.md + - go.mod + - integrations.go + - internal/hooks/hooks.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 + - pushdata.go + - refreshdata.go + - sync.go + - syncflowpreferences.go +examples: + get-config-text-sync-flow: + "": + parameters: + query: + locale: "en-us" + Unauthorized: + parameters: + query: + locale: "en-us" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-sync-flow-url: + Malformed query: + parameters: + path: + commerceKey: "" + accountingKey: "" + query: {} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-visible-accounts: + Unauthorized: + parameters: + path: + clientId: "86fe9741-738d-4f2c-8e96-9c3f84156e91" + platformKey: "gbol" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + update-config-text-sync-flow: + "": + parameters: + query: + locale: "en-us" + responses: + "200": + application/json: {} + "400": {} + Malformed query: + parameters: + query: + locale: "en-us" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + update-visible-accounts-sync-flow: + Malformed query: + parameters: + path: + platformKey: "gbol" + 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} + 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} + 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} + 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} + get-accounting-bank-account: + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "55", "accountNumber": "", "accountType": "Unknown", "balance": -352.03, "currency": "GBP", "iBan": "", "id": "c9a41bc7-6e5b-ed11-8c34-0022481b8b5b", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "nominalCode": "10500", "overdraftLimit": 0, "sortCode": "", "sourceModifiedDate": "2023-02-07T00:00:00", "status": "Active"} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "\\w3fw", "accountNumber": "A06268209", "accountType": "Debit", "availableBalance": -10484.65, "balance": -10484.65, "currency": "GBP", "id": "738783", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sortCode": "236972", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "16th Account", "accountType": "Unknown", "availableBalance": 326, "balance": 326, "currency": "GBP", "id": "765768", "modifiedDate": "2022-09-30T10:29:16Z", "nominalCode": "70700", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Checking", "accountType": "Unknown", "availableBalance": 46954.1, "balance": 46954.1, "currency": "GBP", "id": "20000-933270541", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:12:37Z", "nominalCode": "10100", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active"} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Bank Current Account", "accountNumber": "003234234", "accountType": "Unknown", "availableBalance": -20091.04, "balance": -20091.04, "currency": "GBP", "iBan": "", "id": "1200", "institution": "Lloyds Bank PLC", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:37Z", "nominalCode": "1200", "overdraftLimit": 120000, "sortCode": "23-34-34", "sourceModifiedDate": "2022-11-25T09:25:48", "status": "Active"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Abdi Internet Bank", "accountNumber": "11111", "accountType": "Unknown", "availableBalance": 49.61, "balance": 49.61, "currency": "GBP", "id": "154d05abe9f24c4babe0f6a741dec1b9", "modifiedDate": "2022-10-24T14:52:53Z", "nominalCode": "1560", "sortCode": "010101", "sourceModifiedDate": "2020-01-27T10:53:26Z", "status": "Active"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Business Bank Account", "accountNumber": "987654321", "accountType": "Debit", "balance": 6681.79, "currency": "GBP", "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "sortCode": "990404", "sourceModifiedDate": "2023-03-15T20:35:07", "status": "Active"} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Abdi Test", "accountNumber": "xxxx5678", "accountType": "Unknown", "balance": 69858.44, "currency": "GBP", "id": "104957000000060010", "institution": "Test Bank", "modifiedDate": "2022-10-03T08:40:38Z", "sortCode": "112233", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "Codat Europe Bank", "accountType": "Debit", "balance": 558.22, "currency": "GBP", "id": "825", "metadata": {"isDeleted": false}, "modifiedDate": "2023-05-02T13:24:36Z", "nominalCode": "111111122222111", "sourceModifiedDate": "2022-07-15T11:34:02", "status": "Active"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "00", "accountType": "Debit", "availableBalance": 0, "balance": 0, "currency": "GBP", "id": "164", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:57Z", "nominalCode": "123567", "sourceModifiedDate": "2022-07-20T14:11:28Z", "status": "Active"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "\\aa", "accountType": "Debit", "availableBalance": 123, "balance": 123, "currency": "GBP", "id": "202", "modifiedDate": "2023-01-18T11:02:37Z", "sourceModifiedDate": "2022-11-11T14:15:13Z", "status": "Active"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "200": + application/json: {"accountName": "CoT Credit Card", "accountType": "Credit", "currency": "GBP", "id": "CREDITCARD:55", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:46Z", "nominalCode": "10021", "sourceModifiedDate": "2023-03-27T14:11:48", "status": "Active"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + accountId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-accounting-bank-accounts: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": {} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/60acb117-5cf5-4745-b069-491551da4066/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/connections/60acb117-5cf5-4745-b069-491551da4066/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/connections/60acb117-5cf5-4745-b069-491551da4066/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "55", "accountNumber": "", "accountType": "Unknown", "balance": -352.03, "currency": "GBP", "iBan": "", "id": "c9a41bc7-6e5b-ed11-8c34-0022481b8b5b", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "nominalCode": "10500", "overdraftLimit": 0, "sortCode": "", "sourceModifiedDate": "2023-02-07T00:00:00", "status": "Active"}, {"accountName": "555", "accountNumber": "", "accountType": "Unknown", "balance": 661.79, "currency": "PLN", "iBan": "", "id": "47020f80-60e6-ec11-82f8-0022481a77f0", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "nominalCode": "40300", "overdraftLimit": 0, "sortCode": "", "sourceModifiedDate": "2022-06-07T00:00:00", "status": "Active"}], "totalResults": 28} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/4fd7c69f-ecc1-45f5-83f2-42ed3391e386/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/connections/4fd7c69f-ecc1-45f5-83f2-42ed3391e386/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/connections/4fd7c69f-ecc1-45f5-83f2-42ed3391e386/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "\\w3fw", "accountNumber": "A06268209", "accountType": "Debit", "availableBalance": -10484.65, "balance": -10484.65, "currency": "GBP", "id": "738783", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sortCode": "236972", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"accountName": "2e2bna45hy\\", "accountNumber": "D01825250", "accountType": "Debit", "availableBalance": -114.4, "balance": -114.4, "currency": "GBP", "id": "738778", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sortCode": "236972", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 82} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/ecab4f64-1a04-4c53-a343-bfd879f41f67/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/connections/ecab4f64-1a04-4c53-a343-bfd879f41f67/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/connections/ecab4f64-1a04-4c53-a343-bfd879f41f67/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "16th Account", "accountType": "Unknown", "availableBalance": 326, "balance": 326, "currency": "GBP", "id": "765768", "modifiedDate": "2022-09-30T10:29:16Z", "nominalCode": "70700", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"accountName": "1a1a", "accountType": "Unknown", "availableBalance": 0, "balance": 0, "currency": "GBP", "id": "765766", "modifiedDate": "2022-09-30T10:29:16Z", "nominalCode": "70600", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 56} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/79f8313e-210a-4dc8-b69f-ba7e5004dda7/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/connections/79f8313e-210a-4dc8-b69f-ba7e5004dda7/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/connections/79f8313e-210a-4dc8-b69f-ba7e5004dda7/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Codat Europe Bank", "accountType": "Debit", "balance": 558.22, "currency": "GBP", "id": "825", "metadata": {"isDeleted": false}, "modifiedDate": "2023-05-02T13:24:36Z", "nominalCode": "111111122222111", "sourceModifiedDate": "2022-07-15T11:34:02", "status": "Active"}, {"accountName": "Codat Europe Bank USD", "accountType": "Debit", "currency": "USD", "id": "826", "metadata": {"isDeleted": false}, "modifiedDate": "2023-05-02T13:24:36Z", "nominalCode": "1133221133", "sourceModifiedDate": "2021-03-26T10:31:40", "status": "Active"}], "totalResults": 4} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/2c26b4da-97d4-4ba9-baad-1e18b49b96ac/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/connections/2c26b4da-97d4-4ba9-baad-1e18b49b96ac/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/connections/2c26b4da-97d4-4ba9-baad-1e18b49b96ac/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Checking", "accountType": "Unknown", "availableBalance": 46954.1, "balance": 46954.1, "currency": "GBP", "id": "20000-933270541", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:12:37Z", "nominalCode": "10100", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active"}, {"accountName": "Petty Cash", "accountType": "Unknown", "availableBalance": 500, "balance": 500, "currency": "GBP", "id": "550001-1071509830", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:12:37Z", "nominalCode": "10400", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active"}], "totalResults": 3} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/1f9f6013-f8a5-4278-8a47-3ab7fdb6c24c/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/connections/1f9f6013-f8a5-4278-8a47-3ab7fdb6c24c/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/connections/1f9f6013-f8a5-4278-8a47-3ab7fdb6c24c/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "00", "accountType": "Debit", "availableBalance": 0, "balance": 0, "currency": "GBP", "id": "164", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:57Z", "nominalCode": "123567", "sourceModifiedDate": "2022-07-20T14:11:28Z", "status": "Active"}, {"accountName": "11", "accountType": "Debit", "availableBalance": 0, "balance": 0, "currency": "GBP", "id": "163", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:57Z", "sourceModifiedDate": "2022-07-20T14:11:28Z", "status": "Active"}], "totalResults": 57} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/9e28a776-f4be-425b-8a3d-ad49956de2c9/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/connections/9e28a776-f4be-425b-8a3d-ad49956de2c9/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/connections/9e28a776-f4be-425b-8a3d-ad49956de2c9/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "\\aa", "accountType": "Debit", "availableBalance": 123, "balance": 123, "currency": "GBP", "id": "202", "modifiedDate": "2023-01-18T11:02:37Z", "sourceModifiedDate": "2022-11-11T14:15:13Z", "status": "Active"}, {"accountName": "1 year ago", "accountType": "Debit", "availableBalance": 5300.02, "balance": 5300.02, "currency": "GBP", "id": "193", "modifiedDate": "2023-01-18T11:02:37Z", "sourceModifiedDate": "2023-01-18T06:05:12Z", "status": "Active"}], "totalResults": 140} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/8ee4910f-4fc1-47e6-89b1-5931fb33d8f7/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/connections/8ee4910f-4fc1-47e6-89b1-5931fb33d8f7/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/connections/8ee4910f-4fc1-47e6-89b1-5931fb33d8f7/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Bank Current Account", "accountNumber": "003234234", "accountType": "Unknown", "availableBalance": -20091.04, "balance": -20091.04, "currency": "GBP", "iBan": "", "id": "1200", "institution": "Lloyds Bank PLC", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:37Z", "nominalCode": "1200", "overdraftLimit": 120000, "sortCode": "23-34-34", "sourceModifiedDate": "2022-11-25T09:25:48", "status": "Active"}, {"accountName": "Bank Deposit Account", "accountNumber": "9/00474345", "accountType": "Unknown", "availableBalance": 3510, "balance": 3510, "currency": "GBP", "iBan": "", "id": "1210", "institution": "Halifax Building Society", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:37Z", "nominalCode": "1210", "overdraftLimit": 0, "sortCode": "45-45-45", "sourceModifiedDate": "2022-11-25T09:25:48", "status": "Active"}], "totalResults": 6} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/37916fb7-b4b8-4a78-8872-1751e20ee0cd/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/connections/37916fb7-b4b8-4a78-8872-1751e20ee0cd/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/connections/37916fb7-b4b8-4a78-8872-1751e20ee0cd/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Abdi Internet Bank", "accountNumber": "11111", "accountType": "Unknown", "availableBalance": 49.61, "balance": 49.61, "currency": "GBP", "id": "154d05abe9f24c4babe0f6a741dec1b9", "modifiedDate": "2022-10-24T14:52:53Z", "nominalCode": "1560", "sortCode": "010101", "sourceModifiedDate": "2020-01-27T10:53:26Z", "status": "Active"}, {"accountName": "Abdi Live Test", "accountNumber": "1234567", "accountType": "Unknown", "availableBalance": -225830.75, "balance": -225830.75, "currency": "GBP", "id": "565ce07212bc492c8c2d04f43f9f67e3", "modifiedDate": "2022-10-24T14:52:53Z", "nominalCode": "147852", "sortCode": "123456", "sourceModifiedDate": "2020-01-28T14:00:20Z", "status": "Active"}], "totalResults": 45} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/8f457d9c-1142-4241-a07e-71d1ee2e3052/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/connections/8f457d9c-1142-4241-a07e-71d1ee2e3052/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/connections/8f457d9c-1142-4241-a07e-71d1ee2e3052/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "CoT Credit Card", "accountType": "Credit", "currency": "GBP", "id": "CREDITCARD:55", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:46Z", "nominalCode": "10021", "sourceModifiedDate": "2023-03-27T14:11:48", "status": "Active"}, {"accountName": "Cot Credit Card 2", "accountType": "Credit", "currency": "GBP", "id": "CREDITCARD:58", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:46Z", "nominalCode": "11112", "sourceModifiedDate": "2023-03-27T14:15:11", "status": "Active"}], "totalResults": 14} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/6a4bcf97-e46a-465c-abf6-c42cec8e48c0/data/bankAccounts?page=1&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/connections/6a4bcf97-e46a-465c-abf6-c42cec8e48c0/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Business Bank Account", "accountNumber": "987654321", "accountType": "Debit", "balance": 6681.79, "currency": "GBP", "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "sortCode": "990404", "sourceModifiedDate": "2023-03-15T20:35:07", "status": "Active"}, {"accountName": "Business Savings Account", "accountNumber": "876543210", "accountType": "Debit", "balance": 0, "currency": "GBP", "id": "a8d6fb1a-8c5d-4683-90ce-bf9d28fc62ba", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "sortCode": "890303", "sourceModifiedDate": "2023-03-15T20:36:06", "status": "Active"}], "totalResults": 2} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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/connections/a2324b8e-60e9-451d-8eb1-0fdc8e8224df/data/bankAccounts?page=1&pageSize=2"}, "next": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/connections/a2324b8e-60e9-451d-8eb1-0fdc8e8224df/data/bankAccounts?page=2&pageSize=2"}, "self": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/connections/a2324b8e-60e9-451d-8eb1-0fdc8e8224df/data/bankAccounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"accountName": "Abdi Test", "accountNumber": "xxxx5678", "accountType": "Unknown", "balance": 69858.44, "currency": "GBP", "id": "104957000000060010", "institution": "Test Bank", "modifiedDate": "2022-10-03T08:40:38Z", "sortCode": "112233", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"accountName": "Abdi Test 2", "accountNumber": "", "accountType": "Unknown", "balance": 98.03, "currency": "AED", "id": "104957000000065002", "institution": "", "modifiedDate": "2022-10-03T08:40:38Z", "sortCode": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 4} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + get-commerce-customer: + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Portsmouth", "country": "United Kingdom", "line1": "My Billing Address ./*drop table", "postalCode": "PS13HJ", "region": "", "type": "Unknown"}, {"city": "Portsmouth", "country": "United Kingdom", "line1": "This is my address, I cant hit enter.", "postalCode": "PS13HJ", "region": "", "type": "Unknown"}], "createdDate": "2022-06-15T15:54:15Z", "customerName": "Amy Jones", "defaultCurrency": "XXX", "emailAddress": "a.durbanjackson+amy@codat.io", "id": "1", "modifiedDate": "2023-04-11T10:33:49Z", "phone": "07770666777", "sourceModifiedDate": "2022-06-15T15:54:15Z"} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "createdDate": "2021-09-22T13:10:12Z", "customerName": "", "defaultCurrency": "GBP", "emailAddress": "fred.smith@myCompany.com", "id": "2CBJ8R898ZJAR", "modifiedDate": "2023-01-09T11:01:03Z", "phone": "(877) 492-8687", "sourceModifiedDate": "0001-01-01T00:00:00"} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "createdDate": "2022-01-18T11:41:54", "customerName": "Frod Baggins", "defaultCurrency": "GBP", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_NUkBHQmekz", "modifiedDate": "2022-03-17T15:47:28Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "createdDate": "2022-01-18T11:41:54", "customerName": "Frod Baggins", "defaultCurrency": "EUR", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_NUkBHQmekz", "modifiedDate": "2022-08-17T11:33:19Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "City Test", "country": "US", "line1": "1 test street", "postalCode": "55678", "region": "Virginia", "type": "Unknown"}], "createdDate": "2021-09-02T07:54:26", "customerName": "Bob Smith", "defaultCurrency": "EUR", "emailAddress": "bob.smith@example.com", "id": "2", "modifiedDate": "2022-01-26T15:09:42Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2021-09-02T07:54:26"} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "301 Ink Rooms, 28 Easton St, Farringdon", "line2": "28 Easton St, Farringdon", "postalCode": "WC1X 0BE", "region": "England", "type": "Unknown"}], "createdDate": "2021-11-18T15:24:03", "customerName": "AL A", "defaultCurrency": "GBP", "emailAddress": "a.macra@codat.io", "id": "5839032287390", "modifiedDate": "2023-02-10T15:18:25Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2021-11-18T15:24:03"} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "London", "line1": "1 Main Street", "line2": "Flat 20", "postalCode": "W1A 1AA", "region": "London", "type": "Unknown"}], "createdDate": "2021-03-08T11:21:11Z", "customerName": "Fred Smith", "defaultCurrency": "USD", "emailAddress": "fake@name.com", "id": "FT9948H3VD6GF8MPDD5438KY1M", "modifiedDate": "2022-08-02T10:27:32Z", "phone": "+441234567890", "sourceModifiedDate": "2021-03-08T11:21:11Z"} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "createdDate": "2022-04-20T07:59:52Z", "customerName": "Barry Smith", "defaultCurrency": "gbp", "emailAddress": "barry@example.com", "id": "cus_LXdjls7KY5ZHaz", "modifiedDate": "2022-09-30T11:18:27Z", "note": "Test Subscription", "phone": "01224 658 999", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "createdDate": "2021-03-11T09:04:27", "customerName": "Qa Test", "defaultCurrency": "GBP", "emailAddress": "a.macra@codat.io", "id": "201694267", "modifiedDate": "2021-07-13T16:19:00Z", "phone": "", "sourceModifiedDate": "2021-03-11T09:07:00"} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "City", "country": "GB", "line1": "Line1", "postalCode": "TT1 1TT", "type": "Unknown"}], "createdDate": "2021-01-07T16:17:34", "customerName": "Firstname Lastname", "defaultCurrency": "USD", "emailAddress": "firstname.lastname@example.com", "id": "firstname.lastname@example.com", "modifiedDate": "2021-01-27T13:08:51Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2021-01-08T09:57:56"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-customers: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": [{"createdDate": "2022-10-23T00:00:00Z", "customerName": "Fred Smith", "defaultCurrency": "GBP", "emailAddress": "fred.smith@myCompany.com", "id": "7110701885", "modifiedDate": "2022-10-23T00:00:00Z", "phone": "01224 658 999", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 1} + "400": {} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Portsmouth", "country": "United Kingdom", "line1": "My Billing Address ./*drop table", "postalCode": "PS13HJ", "region": "", "type": "Unknown"}, {"city": "Portsmouth", "country": "United Kingdom", "line1": "This is my address, I cant hit enter.", "postalCode": "PS13HJ", "region": "", "type": "Unknown"}], "createdDate": "2022-06-15T15:54:15Z", "customerName": "Amy Jones", "defaultCurrency": "XXX", "emailAddress": "a.jackson@email.me", "id": "1", "modifiedDate": "2023-04-11T10:33:49Z", "phone": "07770 666777", "sourceModifiedDate": "2022-06-15T15:54:15Z"}, {"addresses": [], "createdDate": "2023-04-11T15:49:25Z", "customerName": "Cust001 Cust001", "defaultCurrency": "XXX", "emailAddress": "Cust001@example.com", "id": "2", "modifiedDate": "2023-04-17T15:42:55Z", "phone": "05442 203941", "sourceModifiedDate": "2023-04-11T15:49:25Z"}], "totalResults": 201} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "createdDate": "2021-09-22T13:10:12Z", "customerName": "", "defaultCurrency": "USD", "emailAddress": "fred.smith@myCompany.com", "id": "2CBJ8R898ZJAR", "modifiedDate": "2023-01-09T11:01:03Z", "phone": "+44 25691 154789", "sourceModifiedDate": "0001-01-01T00:00:00"}, {"addresses": [], "createdDate": "2021-09-21T14:54:38Z", "customerName": "", "defaultCurrency": "GBP", "emailAddress": "fred.smith@myCompany.com", "id": "511JV0FRN2QYC", "modifiedDate": "2023-01-09T11:01:03Z", "phone": "+44 25691 154789", "sourceModifiedDate": "0001-01-01T00:00:00"}], "totalResults": 9} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "createdDate": "2022-01-18T11:41:54", "customerName": "Frod Baggins", "defaultCurrency": "GBP", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_NUkBHQmekz", "modifiedDate": "2022-03-17T15:47:28Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"addresses": [], "createdDate": "2022-01-18T11:42:05", "customerName": "Frodo Baggins", "defaultCurrency": "GBP", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_BvBxwuwfvH", "modifiedDate": "2022-03-17T15:47:28Z", "phone": "01224 658 999", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 3} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "createdDate": "2022-01-18T11:41:54", "customerName": "Frod Baggins", "defaultCurrency": "USD", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_NUkBHQmekz", "modifiedDate": "2022-08-17T11:33:19Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"addresses": [], "createdDate": "2022-01-18T11:42:05", "customerName": "Frodo Baggins", "defaultCurrency": "EUR", "emailAddress": "frodo.baggings@theshire.com", "id": "cst_BvBxwuwfvH", "modifiedDate": "2022-08-17T11:33:19Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 3} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "City Test", "country": "US", "line1": "1 test street", "postalCode": "55678", "region": "Virginia", "type": "Unknown"}], "createdDate": "2021-09-02T07:54:26", "customerName": "Bob Smith", "defaultCurrency": "EUR", "emailAddress": "bob.smith@example.com", "id": "2", "modifiedDate": "2022-01-26T15:09:42Z", "phone": "01224 658 999", "sourceModifiedDate": "2021-09-02T07:54:26"}, {"addresses": [], "createdDate": "2021-09-03T01:55:13", "customerName": "Fake Name", "defaultCurrency": "USD", "emailAddress": "bob@bob.com", "id": "3", "modifiedDate": "2022-01-26T15:09:42Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2021-09-03T01:55:13"}], "totalResults": 5} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "country": "United Kingdom", "line1": "301 Ink Rooms, 28 Easton St, Farringdon", "line2": "28 Easton St, Farringdon", "postalCode": "WC1X 0BE", "region": "England", "type": "Unknown"}], "createdDate": "2021-11-18T15:24:03", "customerName": "AL A", "defaultCurrency": "USD", "emailAddress": "a.macra@codat.io", "id": "5839032287390", "modifiedDate": "2023-02-10T15:18:25Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2021-11-18T15:24:03"}, {"addresses": [{"city": "London", "line1": "Look Street", "postalCode": "PO16 7GZ", "type": "Unknown"}, {"city": "London", "country": "United Kingdom", "line1": "Look Street", "postalCode": "PO16 7GZ", "region": "England", "type": "Unknown"}], "createdDate": "2021-03-19T10:12:37", "customerName": "Qa Test", "defaultCurrency": "GBP", "emailAddress": "fred.smith@myCompany.com", "id": "5097398534302", "modifiedDate": "2023-02-10T15:18:25Z", "note": "", "phone": "+445593368390", "sourceModifiedDate": "2022-08-01T13:07:59"}], "totalResults": 6} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-customers?page=1&pageSize=2"}, "self": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "line1": "1 Main Street", "line2": "Flat 20", "postalCode": "W1A 1AA", "region": "London", "type": "Unknown"}], "createdDate": "2021-03-08T11:21:11Z", "customerName": "Fred Smith", "defaultCurrency": "EUR", "emailAddress": "fake@name.com", "id": "FT9948H3VD6GF8MPDD5438KY1M", "modifiedDate": "2022-08-02T10:27:32Z", "phone": "+441234567890", "sourceModifiedDate": "2021-03-08T11:21:11Z"}, {"addresses": [], "createdDate": "2020-11-19T14:56:00Z", "customerName": "Fred Smith", "defaultCurrency": "GBP", "emailAddress": "s.shandil+square@codat.io", "id": "GXQDPSZSMN6C58270SZN4YJZ8R", "modifiedDate": "2022-08-02T10:27:32Z", "phone": "+447729946295", "sourceModifiedDate": "2020-11-19T14:56:00Z"}], "totalResults": 2} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-customers?page=1&pageSize=2"}, "next": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-customers?page=2&pageSize=2"}, "self": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "createdDate": "2022-04-20T07:59:52Z", "customerName": "Barry Smith", "defaultCurrency": "gbp", "emailAddress": "barry@example.com", "id": "cus_LXdjls7KY5ZHaz", "modifiedDate": "2022-09-30T11:18:27Z", "note": "Test Subscription", "phone": "01224 658 999", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"addresses": [{"city": "London", "country": "GB", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X 0BE", "type": "Billing"}, {"city": "London", "country": "GB", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X 0BE", "type": "Delivery"}], "createdDate": "2022-04-20T07:30:01Z", "customerName": "David Dunlow", "defaultCurrency": "gbp", "emailAddress": "david@example.com", "id": "cus_LXdFFgHqqVURIv", "modifiedDate": "2022-09-30T11:18:27Z", "note": "Test Subscriptions", "phone": "+447545309714", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 14} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-customers?page=1&pageSize=2"}, "self": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "createdDate": "2021-03-11T09:04:27", "customerName": "Qa Test", "defaultCurrency": "USD", "emailAddress": "a.macra@codat.io", "id": "201694267", "modifiedDate": "2021-07-13T16:19:00Z", "phone": "", "sourceModifiedDate": "2021-03-11T09:07:00"}], "totalResults": 1} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/fe8e3158-47e6-4367-9537-7d5001295500/connections/d60b15e7-7db9-459b-92a0-9557f7ebdeea/data/commerce-customers?page=1&pageSize=2"}, "self": {"href": "/companies/fe8e3158-47e6-4367-9537-7d5001295500/connections/d60b15e7-7db9-459b-92a0-9557f7ebdeea/data/commerce-customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "City", "country": "GB", "line1": "Line1", "postalCode": "TT1 1TT", "type": "Unknown"}], "createdDate": "2021-01-07T16:17:34", "customerName": "Firstname Lastname", "defaultCurrency": "GBP", "emailAddress": "firstname.lastname@example.com", "id": "firstname.lastname@example.com", "modifiedDate": "2021-01-27T13:08:51Z", "phone": "01224 658 999", "sourceModifiedDate": "2021-01-08T09:57:56"}, {"addresses": [{"city": "London", "country": "GB", "line1": "Flat 1", "line2": "1 High Street", "region": "London", "type": "Unknown"}, {"city": "London", "country": "GB", "line1": "Flat 2", "line2": "2 High Street", "region": "London", "type": "Unknown"}], "createdDate": "2020-12-21T14:52:15", "customerName": "Joe Bloggs", "defaultCurrency": "GBP", "emailAddress": "joe@bloggs.com", "id": "joe@bloggs.com", "modifiedDate": "2021-01-27T13:08:51Z", "phone": "02012 345678", "sourceModifiedDate": "2020-12-21T14:52:15"}], "totalResults": 2} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + get-commerce-company-info: + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"accountBalances": [{"available": 20053.23, "currency": "GBP", "pending": 2034.23, "reserved": 517.23}], "addresses": [{"city": "London", "country": "United Kingdom", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X 0BE", "region": "England", "type": "Billing"}, {"city": "London", "country": "UK", "line1": "28 Easton Street", "postalCode": "WC1X 0BE", "type": "Delivery"}], "baseCurrency": "GBP", "companyLegalName": "Codat Ltd", "companyName": "Codat", "createdDate": "2019-03-07T16:50:49", "modifiedDate": "2022-03-10T15:42:13", "phoneNumbers": [{"number": "02012 345678", "type": "Landline"}, {"number": "07123 456789", "type": "Mobile"}, {"number": "02012 345678", "type": "Fax"}], "registrationNumber": "5590111724", "sourceModifiedDate": "2021-06-10T01:48:49", "sourceUrls": {"Api": "https://api.codat.io"}, "webLinks": [{"type": "Website", "url": "https://www.codat.io/"}, {"type": "Social", "url": "https://www.linkedin.com/company/codat-limited/"}]} + 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-commerce-location: + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + locationId: "" + responses: + "200": + application/json: {"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms, 28 Easton Street", "postalCode": "WC1X 0BE", "region": "London", "type": "Inventory"}, "id": "GA3WP1ZC3ZFK1", "modifiedDate": "2023-01-09T11:01:03Z", "name": "Codat", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + locationId: "" + responses: + "200": + application/json: {"address": {"country": "AU", "type": "Unknown"}, "id": "647208621834538", "modifiedDate": "2023-03-02T09:48:48Z", "name": "QA Shared - New Test Site", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + locationId: "" + responses: + "200": + application/json: {"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms, 28 Easton St", "postalCode": "WC1X 0BE", "region": "London", "type": "Inventory"}, "id": "61375348894", "modifiedDate": "2023-02-10T15:18:25Z", "name": "301 Ink Rooms, 28 Easton St", "sourceModifiedDate": "2021-03-19T10:06:06"} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + locationId: "" + responses: + "200": + application/json: {"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X0BE", "type": "Inventory"}, "id": "D8DVHD1G6NT2J", "modifiedDate": "2022-08-02T10:27:32Z", "name": "Codat Limited", "sourceModifiedDate": "2020-01-17T14:07:30Z"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + locationId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-locations: + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-locations?page=1&pageSize=2"}, "self": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-locations"}}, "pageNumber": 1, "pageSize": 2, "results": [{"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms, 28 Easton Street", "postalCode": "WC1X 0BE", "region": "London", "type": "Inventory"}, "id": "GA3WP1ZC3ZFK1", "modifiedDate": "2023-01-09T11:01:03Z", "name": "Codat", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 1} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-locations?page=1&pageSize=2"}, "self": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-locations"}}, "pageNumber": 1, "pageSize": 2, "results": [{"address": {"country": "AU", "type": "Unknown"}, "id": "647208621834538", "modifiedDate": "2023-03-02T09:48:48Z", "name": "QA Shared - New Test Site", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "totalResults": 1} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-locations?page=1&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-locations"}}, "pageNumber": 1, "pageSize": 2, "results": [{"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms, 28 Easton St", "postalCode": "WC1X 0BE", "region": "London", "type": "Inventory"}, "id": "61375348894", "modifiedDate": "2023-02-10T15:18:25Z", "name": "301 Ink Rooms, 28 Easton St", "sourceModifiedDate": "2021-03-19T10:06:06"}], "totalResults": 1} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-locations?page=1&pageSize=2"}, "self": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-locations"}}, "pageNumber": 1, "pageSize": 2, "results": [{"address": {"city": "London", "country": "GB", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X0BE", "type": "Inventory"}, "id": "D8DVHD1G6NT2J", "modifiedDate": "2022-08-02T10:27:32Z", "name": "Codat Limited", "sourceModifiedDate": "2020-01-17T14:07:30Z"}], "totalResults": 1} + 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-commerce-order: + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "US ", "createdDate": "1970-01-19T03:58:30Z", "currency": "USD", "customerRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "id": "902-1845936-5435065", "locationRef": {"id": "7110701885"}, "modifiedDate": "2023-01-09T09:12:12Z", "orderLineItems": [{"discountAllocations": [], "id": "O05015851154158", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "NABetaASINB00551Q3CS"}, "quantity": 1, "taxPercentage": 11.23, "taxes": [], "totalAmount": 10, "totalTaxAmount": 1.01, "unitPrice": 8.99}], "orderNumber": "902-1845936-5435065", "payments": [], "serviceCharges": [], "sourceModifiedDate": "1970-01-19T03:58:32Z", "totalAmount": 10, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 1.01} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "GBR", "createdDate": "2022-06-15T15:48:18Z", "currency": "GBP", "customerRef": {"id": "0"}, "id": "100", "locationRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "modifiedDate": "2023-04-11T10:33:56Z", "orderLineItems": [{"discountAllocations": [{"name": "Manual Discount", "totalAmount": 3.36}], "id": "1", "productRef": {"id": "86", "name": "[Sample] Able Brewing System"}, "productVariantRef": {"id": "66", "name": "[Sample] Able Brewing System"}, "quantity": 1, "taxPercentage": 20, "taxes": [], "totalAmount": 221.64, "totalTaxAmount": 36.94, "unitPrice": 187.5}, {"discountAllocations": [{"name": "Manual Discount", "totalAmount": 6.64}], "id": "2", "productRef": {"id": "81", "name": "[Sample] Orbit Terrarium - Small"}, "productVariantRef": {"id": "65", "name": "[Sample] Orbit Terrarium - Small"}, "quantity": 5, "taxPercentage": 19.9999, "taxes": [], "totalAmount": 438.36, "totalTaxAmount": 73.06, "unitPrice": 74.1667}], "orderNumber": "100", "payments": [], "serviceCharges": [{"description": "Shipping Charge", "quantity": 1, "taxAmount": 2.5, "taxPercentage": 20, "taxes": [], "totalAmount": 15, "type": "Shipping"}], "sourceModifiedDate": "2022-06-15T15:48:18Z", "totalAmount": 675, "totalDiscount": 10, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 112.5} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-05-24T10:33:41Z", "currency": "GBP", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "0BCZPWGFC3M16", "locationRef": {"id": "GA3WP1ZC3ZFK1", "name": "Codat"}, "modifiedDate": "2022-09-08T15:47:43Z", "orderLineItems": [{"discountAllocations": [], "id": "985WY5J4H12XY", "productRef": {"id": "NMZHKK6FKF6ZJ", "name": "Laptop"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 1, "taxPercentage": 20, "taxes": [{"taxComponentRef": {"id": "KAWQTPZP3R9VT", "name": "VAT 20%"}}], "totalAmount": 1200, "totalTaxAmount": 200, "unitPrice": 1000}], "orderNumber": "0BCZPWGFC3M16", "payments": [{"amount": -283.56, "createdDate": "2022-10-23T00:00:00Z", "currency": "USD", "dueDate": "2022-10-23T00:00:00Z", "id": "S2D924NX13T2G", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2021-05-24T10:33:45Z", "totalAmount": 1200, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 200} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-12-09T02:27:46Z", "country": "AU ", "createdDate": "2022-12-09T02:27:14Z", "currency": "AUD", "customerRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "id": "A61465.1", "locationRef": {"id": "647208621834538", "name": "QA Shared - New Test Site"}, "modifiedDate": "2023-03-08T13:49:34Z", "orderLineItems": [{"discountAllocations": [], "id": "S61465.1", "productRef": {"id": "647208621834617", "name": "Hot Chocolate"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 1, "taxPercentage": 10, "taxes": [{"taxComponentRef": {"id": "GST10", "name": "10% GST"}}], "totalAmount": 5, "totalTaxAmount": 0.45, "unitPrice": 4.5455}], "orderNumber": "A61465.1", "payments": [{"amount": 5, "createdDate": "2022-12-09T02:27:46", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "R61465.1_1_A61465.1_2022-12-09T02:27:46.273Z", "modifiedDate": "2023-03-02T09:50:43", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid", "type": "Unknown"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 5, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0.45} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "NLD", "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "customerRef": {"id": "EILBDVJVNUAGVKRQ"}, "id": "ord_2at3ck", "locationRef": {"id": "7110701885"}, "modifiedDate": "2022-03-17T15:47:28Z", "orderLineItems": [{"discountAllocations": [], "id": "odl_1.3tvc32", "productRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 1, "taxPercentage": 21, "taxes": [], "totalAmount": 329.99, "totalTaxAmount": 57.27, "unitPrice": 329.99}, {"discountAllocations": [{"name": "Discount", "totalAmount": 100}], "id": "odl_1.x95vuk", "productRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 2, "taxPercentage": 21, "taxes": [], "totalAmount": 698, "totalTaxAmount": 121.14, "unitPrice": 399}], "orderNumber": "1337", "payments": [{"amount": 1027.99, "createdDate": "2022-02-08T15:44:22", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "tr_GpHuaqHrca", "modifiedDate": "2022-03-17T15:47:28", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-02-08T16:02:02", "status": "Failed", "type": "OnlineCard"}, {"amount": 1027.99, "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "tr_w7RGQc3k3V", "modifiedDate": "2022-03-17T15:47:28", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-01-20T09:46:02", "status": "Failed", "type": "OnlineCard"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 1027.99, "totalDiscount": 100, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 178.41} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "NLD", "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "ord_2at3ck", "locationRef": {"id": "7110701885"}, "modifiedDate": "2022-08-17T11:33:19Z", "orderLineItems": [{"discountAllocations": [{"name": "Discount", "totalAmount": 100}], "id": "odl_1.x95vuk", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 2, "taxPercentage": 21, "taxes": [], "totalAmount": 698, "totalTaxAmount": 121.14, "unitPrice": 338.43}, {"discountAllocations": [], "id": "odl_1.3tvc32", "productRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 1, "taxPercentage": 21, "taxes": [], "totalAmount": 329.99, "totalTaxAmount": 57.27, "unitPrice": 272.72}], "orderNumber": "1337", "payments": [{"amount": -283.56, "createdDate": "2022-10-23T00:00:00Z", "currency": "USD", "dueDate": "2022-10-23T00:00:00Z", "id": "tr_GpHuaqHrca", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}, {"amount": 0, "createdDate": "2022-10-23T00:00:00Z", "currency": "USD", "dueDate": "2022-10-23T00:00:00Z", "id": "tr_w7RGQc3k3V", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 1027.99, "totalDiscount": 100, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 178.41} + Partner Commerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "GM ", "createdDate": "2021-02-10T01:37:23", "currency": "CAD", "customerRef": {"id": "0dc0206d-f22f-48c9-a4e5-79f8383c3426"}, "id": "6d135134-2f77-45f7-af3d-ee873e42da45", "locationRef": {"id": "d84a8ce0-d7e4-400a-b07a-d4bddd9c1873"}, "modifiedDate": "2022-05-12T07:22:02Z", "orderLineItems": [{"discountAllocations": [{"name": "Discount", "totalAmount": 8.54}, {"name": "Discount", "totalAmount": 17.09}], "id": "89f5e83a-c87d-4b60-a009-0ea9065867aa", "productRef": {"id": "98ef828e-33e1-4c23-9383-a029f1d6a3a6"}, "productVariantRef": {"id": "dffcd99e-13bb-4b89-89ef-719b3b0777e6"}, "quantity": 3, "taxPercentage": 20, "taxes": [], "totalAmount": 85.44, "totalTaxAmount": 17.09, "unitPrice": 28.48}, {"discountAllocations": [], "id": "4c65f0d9-05c8-48eb-9c4a-1774f5073e66", "productRef": {"id": "561f8efb-3429-4c1f-a014-1fa595f9b3c6"}, "productVariantRef": {"id": "e0715a7a-0179-4a2e-b40d-800fd2f36764"}, "quantity": 3, "taxPercentage": 20, "taxes": [], "totalAmount": 118.38, "totalTaxAmount": 23.68, "unitPrice": 39.46}], "orderNumber": "93128704", "payments": [{"amount": 194.12, "createdDate": "2022-10-23T00:00:00Z", "currency": "USD", "dueDate": "2022-10-23T00:00:00Z", "id": "3ec3d4c4-8003-4f77-a44e-08b3e17057bf", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2021-02-10T01:37:23", "totalAmount": 203.82, "totalDiscount": 25.63, "totalGratuity": 80.81, "totalRefund": 0, "totalTaxAmount": 40.77} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "US ", "createdDate": "2021-09-02T06:00:54", "currency": "USD", "customerRef": {"id": "1", "name": "John DOE"}, "id": "1", "locationRef": {"id": "EILBDVJVNUAGVKRQ"}, "modifiedDate": "2022-01-26T15:09:42Z", "orderLineItems": [{"discountAllocations": [], "id": "1", "productRef": {"id": "1", "name": "Hummingbird printed t-shirt"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 23.9, "totalTaxAmount": 0, "unitPrice": 23.9}, {"discountAllocations": [], "id": "2", "productRef": {"id": "2", "name": "Hummingbird printed sweater"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 35.9, "totalTaxAmount": 0, "unitPrice": 35.9}], "orderNumber": "XKBKNABJK", "payments": [], "serviceCharges": [{"description": "Shipping", "quantity": 1, "taxAmount": 0, "taxPercentage": 0, "taxes": [], "totalAmount": 2, "type": "Shipping"}], "sourceModifiedDate": "2021-09-02T06:00:54", "totalAmount": 61.8, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-19T13:18:33", "currency": "GBP", "customerRef": {"id": "5097398534302", "name": "Qa Test"}, "id": "3684119445662", "locationRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "modifiedDate": "2023-02-10T15:18:24Z", "orderLineItems": [{"discountAllocations": [], "id": "9670458146974", "productRef": {"id": "6595494117534", "name": "Monitor"}, "productVariantRef": {"id": "39444526694558", "name": "Monitor"}, "quantity": 4, "taxPercentage": 0, "taxes": [], "totalAmount": 600, "totalTaxAmount": 0, "unitPrice": 150}], "orderNumber": "1007", "payments": [{"amount": 600, "createdDate": "2021-03-19T13:17:49", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630233579678", "modifiedDate": "2023-02-10T15:18:24", "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:17:49", "status": "Failed", "type": "OnlineCard"}, {"amount": 600, "createdDate": "2021-03-19T13:18:29", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630234497182", "modifiedDate": "2023-02-10T15:18:24", "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:18:29", "status": "Paid", "type": "OnlineCard"}], "serviceCharges": [], "sourceModifiedDate": "2022-08-01T13:12:35", "totalAmount": 600, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "0001-01-01T00:00:00", "country": "GB ", "createdDate": "2021-02-14T19:38:28Z", "currency": "GBP", "customerRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "id": "BDYNvtIYyWClkTjnh99CFR3fPwKZY", "locationRef": {"id": "D8DVHD1G6NT2J", "name": "Codat Limited"}, "modifiedDate": "2022-08-02T10:27:33Z", "orderLineItems": [{"discountAllocations": [], "id": "lLJpgArKQbBEn9nTvLRHP", "productRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 50, "totalTaxAmount": 0, "unitPrice": 50}], "orderNumber": "BDYNvtIYyWClkTjnh99CFR3fPwKZY", "payments": [], "serviceCharges": [], "sourceModifiedDate": "2021-02-14T19:38:28Z", "totalAmount": 50, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-30T12:20:40Z", "currency": "GBP", "customerRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-09-14T10:58:04Z", "orderLineItems": [{"discountAllocations": [], "id": "Product undefined by SumUp", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 200, "totalTaxAmount": 0, "unitPrice": 200}], "orderNumber": "TECXTU2KT6", "payments": [{"amount": 0, "createdDate": "2022-10-23T00:00:00Z", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 200, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-03-27T23:29:38Z", "currency": "GBP", "customerRef": {"id": "200585744"}, "id": "111", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-07-11T15:35:48Z", "orderLineItems": [{"discountAllocations": [], "id": "53", "productRef": {"id": "82"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 2, "taxPercentage": 20, "taxes": [], "totalAmount": 12, "totalTaxAmount": 2, "unitPrice": 5}, {"discountAllocations": [], "id": "54", "productRef": {"id": "81"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 2, "taxPercentage": 20, "taxes": [], "totalAmount": 24, "totalTaxAmount": 4, "unitPrice": 10}], "orderNumber": "111", "payments": [], "serviceCharges": [{"description": "Royal Mail", "quantity": 1, "taxAmount": 0, "taxPercentage": 0, "taxes": [], "totalAmount": 3.5, "type": "Shipping"}], "sourceModifiedDate": "2021-04-01T13:34:59Z", "totalAmount": 39.5, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 6} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "200": + application/json: {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2020-11-23T14:27:20Z", "currency": "GBP", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "7TunRi2XEeueVK3fSQEQIw", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2021-10-27T15:22:37Z", "orderLineItems": [{"discountAllocations": [], "id": "0", "productRef": {"id": "7f9f31e4-2d97-11eb-9f55-acde48001122"}, "productVariantRef": {"id": "7f9f35ea-2d97-11eb-9f55-acde48001122"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 45, "totalTaxAmount": 0, "unitPrice": 45}], "orderNumber": "3", "payments": [{"amount": 45, "createdDate": "2020-11-23T14:27:19", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "ed97bcde-2d97-11eb-a42e-25130f2dd258", "modifiedDate": "2021-10-27T15:22:37", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "type": "Paypal"}], "serviceCharges": [], "sourceModifiedDate": "2020-11-23T14:27:20Z", "totalAmount": 45, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + orderId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-orders: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": [{"closedDate": "2022-10-23T00:00:00Z", "country": "CAN", "createdDate": "2021-03-28T03:00:14", "currency": "CAD", "customerRef": {"id": "2634d180-7205-43f0-a73d-84af6443a005", "name": "Emmy Roberts"}, "id": "01e63721-1205-478e-8503-9d8bf8a93f44", "locationRef": {"id": "47bbffc7-c045-4b0f-a3bb-ecf1f669edfa"}, "modifiedDate": "2022-02-02T11:02:45Z", "orderLineItems": [{"discountAllocations": [], "id": "116113a6-54d3-4624-ba73-26a77a5ffd51", "productRef": {"id": "ac186646-41f2-4280-afea-1012c59459ab", "name": "Intelligent Concrete Salad"}, "productVariantRef": {"id": "f9ca9de5-9e31-460d-ac81-368f4e7c8fc0", "name": "Small Incredible Wooden Soap"}, "quantity": 1, "taxPercentage": 20, "taxes": [{"taxComponentRef": {"id": "72", "name": "Sales Tax"}}, {"taxComponentRef": {"id": "72", "name": "City Tax"}}], "totalAmount": 12, "totalTaxAmount": 2, "unitPrice": 10}], "orderNumber": "99123956", "payments": [{"amount": 12, "createdDate": "2021-03-28T03:00:14", "currency": "CAD", "dueDate": "2021-04-04T03:00:14", "id": "defdceb6-83a3-4b7d-a74e-e9ef947d5f48", "modifiedDate": "2022-02-02T11:02:45", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "type": "Paypal"}], "serviceCharges": [{"description": "Service Charge", "quantity": 1, "taxAmount": 0.2, "taxPercentage": 20, "taxes": [{"taxComponentRef": {"id": "72", "name": "Service Tax"}}], "totalAmount": 1.2, "type": "Generic"}], "sourceModifiedDate": "2021-03-28T03:00:14", "totalAmount": 12, "totalDiscount": 0, "totalGratuity": 1, "totalRefund": 0, "totalTaxAmount": 2}], "totalResults": 1} + "400": {} + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-orders?page=1&pageSize=2"}, "self": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "US ", "createdDate": "1970-01-19T03:58:30Z", "currency": "USD", "customerRef": {"id": "7110701885"}, "id": "902-1845936-5435065", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2023-01-09T09:12:12Z", "orderLineItems": [{"discountAllocations": [], "id": "O05015851154158", "productRef": {"id": "7110701885"}, "productVariantRef": {"id": "NABetaASINB00551Q3CS"}, "quantity": 1, "taxPercentage": 11.23, "taxes": [], "totalAmount": 10, "totalTaxAmount": 1.01, "unitPrice": 8.99}], "orderNumber": "902-1845936-5435065", "payments": [], "serviceCharges": [], "sourceModifiedDate": "1970-01-19T03:58:32Z", "totalAmount": 10, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 1.01}], "totalResults": 1} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "GBR", "createdDate": "2022-06-15T15:48:18Z", "currency": "GBP", "customerRef": {"id": "0"}, "id": "100", "locationRef": {"id": "EILBDVJVNUAGVKRQ"}, "modifiedDate": "2023-04-11T10:33:56Z", "orderLineItems": [{"discountAllocations": [{"name": "Manual Discount", "totalAmount": 3.36}], "id": "1", "productRef": {"id": "86", "name": "[Sample] Able Brewing System"}, "productVariantRef": {"id": "66", "name": "[Sample] Able Brewing System"}, "quantity": 1, "taxPercentage": 20, "taxes": [], "totalAmount": 221.64, "totalTaxAmount": 36.94, "unitPrice": 187.5}, {"discountAllocations": [{"name": "Manual Discount", "totalAmount": 6.64}], "id": "2", "productRef": {"id": "81", "name": "[Sample] Orbit Terrarium - Small"}, "productVariantRef": {"id": "65", "name": "[Sample] Orbit Terrarium - Small"}, "quantity": 5, "taxPercentage": 19.9999, "taxes": [], "totalAmount": 438.36, "totalTaxAmount": 73.06, "unitPrice": 74.1667}], "orderNumber": "100", "payments": [], "serviceCharges": [{"description": "Shipping Charge", "quantity": 1, "taxAmount": 2.5, "taxPercentage": 20, "taxes": [], "totalAmount": 15, "type": "Shipping"}], "sourceModifiedDate": "2022-06-15T15:48:18Z", "totalAmount": 675, "totalDiscount": 10, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 112.5}, {"closedDate": "2022-10-23T00:00:00Z", "country": "GBR", "createdDate": "2022-06-15T15:49:02Z", "currency": "GBP", "customerRef": {"id": "0"}, "id": "101", "locationRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "modifiedDate": "2023-04-11T10:33:56Z", "orderLineItems": [{"discountAllocations": [{"name": "Manual Discount", "totalAmount": 3.36}], "id": "3", "productRef": {"id": "86", "name": "[Sample] Able Brewing System"}, "productVariantRef": {"id": "66", "name": "[Sample] Able Brewing System"}, "quantity": 1, "taxPercentage": 20, "taxes": [], "totalAmount": 221.64, "totalTaxAmount": 36.94, "unitPrice": 187.5}, {"discountAllocations": [{"name": "Manual Discount", "totalAmount": 6.64}], "id": "4", "productRef": {"id": "81", "name": "[Sample] Orbit Terrarium - Small"}, "productVariantRef": {"id": "65", "name": "[Sample] Orbit Terrarium - Small"}, "quantity": 5, "taxPercentage": 19.9999, "taxes": [], "totalAmount": 438.36, "totalTaxAmount": 73.06, "unitPrice": 74.1667}], "orderNumber": "101", "payments": [], "serviceCharges": [{"description": "Shipping Charge", "quantity": 1, "taxAmount": 2.5, "taxPercentage": 20, "taxes": [], "totalAmount": 15, "type": "Shipping"}], "sourceModifiedDate": "2022-06-15T15:49:02Z", "totalAmount": 675, "totalDiscount": 10, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 112.5}], "totalResults": 14} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/1535235d-5efb-4d17-9d94-491c1f35ff92/connections/ed802898-f920-486b-b553-d7b4c1ac6c8d/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/1535235d-5efb-4d17-9d94-491c1f35ff92/connections/ed802898-f920-486b-b553-d7b4c1ac6c8d/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/1535235d-5efb-4d17-9d94-491c1f35ff92/connections/ed802898-f920-486b-b553-d7b4c1ac6c8d/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-05-24T10:33:41Z", "currency": "GBP", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "0BCZPWGFC3M16", "locationRef": {"id": "GA3WP1ZC3ZFK1", "name": "Codat"}, "modifiedDate": "2022-09-08T15:47:43Z", "orderLineItems": [{"discountAllocations": [], "id": "985WY5J4H12XY", "productRef": {"id": "NMZHKK6FKF6ZJ", "name": "Laptop"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 20, "taxes": [{"taxComponentRef": {"id": "KAWQTPZP3R9VT", "name": "VAT 20%"}}], "totalAmount": 1200, "totalTaxAmount": 200, "unitPrice": 1000}], "orderNumber": "0BCZPWGFC3M16", "payments": [{"amount": -283.56, "createdDate": "2022-10-23T00:00:00Z", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "id": "S2D924NX13T2G", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2021-05-24T10:33:45Z", "totalAmount": 1200, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 200}, {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-05-24T11:24:48Z", "currency": "GBP", "customerRef": {"id": "EILBDVJVNUAGVKRQ"}, "id": "0G22TXMYQQE54", "locationRef": {"id": "GA3WP1ZC3ZFK1", "name": "Codat"}, "modifiedDate": "2022-09-08T15:47:43Z", "orderLineItems": [{"discountAllocations": [], "id": "GZ73TPFAV6NTP", "productRef": {"id": "QVAV6KM1457B0", "name": "Desktop"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 20, "taxes": [{"taxComponentRef": {"id": "KAWQTPZP3R9VT", "name": "VAT 20%"}}], "totalAmount": 1440, "totalTaxAmount": 240, "unitPrice": 1200}, {"discountAllocations": [{"name": "�10 off", "totalAmount": 100}], "id": "Discount: �10 off", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": -100, "totalTaxAmount": 0, "unitPrice": 0}], "orderNumber": "0G22TXMYQQE54", "payments": [{"amount": 0, "createdDate": "2022-10-23T00:00:00Z", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "id": "H726AAJQYE3SP", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2021-05-24T11:24:52Z", "totalAmount": 1340, "totalDiscount": 100, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 240}], "totalResults": 76} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-12-09T02:27:46Z", "country": "AU ", "createdDate": "2022-12-09T02:27:14Z", "currency": "AUD", "customerRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "id": "A61465.1", "locationRef": {"id": "647208621834538", "name": "QA Shared - New Test Site"}, "modifiedDate": "2023-03-08T13:49:34Z", "orderLineItems": [{"discountAllocations": [], "id": "S61465.1", "productRef": {"id": "647208621834617", "name": "Hot Chocolate"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 10, "taxes": [{"taxComponentRef": {"id": "GST10", "name": "10% GST"}}], "totalAmount": 5, "totalTaxAmount": 0.45, "unitPrice": 4.5455}], "orderNumber": "A61465.1", "payments": [{"amount": 5, "createdDate": "2022-12-09T02:27:46", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "R61465.1_1_A61465.1_2022-12-09T02:27:46.273Z", "modifiedDate": "2023-03-02T09:50:43", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid", "type": "Unknown"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 5, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0.45}, {"closedDate": "2022-12-12T23:21:29Z", "country": "AU ", "createdDate": "2022-12-12T23:20:12Z", "currency": "AUD", "customerRef": {"id": "7110701885"}, "id": "A61465.2", "locationRef": {"id": "647208621834538", "name": "QA Shared - New Test Site"}, "modifiedDate": "2023-03-08T13:49:34Z", "orderLineItems": [{"discountAllocations": [], "id": "S61465.2", "productRef": {"id": "647208621834663", "name": "Royal"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 10, "taxes": [{"taxComponentRef": {"id": "GST10", "name": "10% GST"}}], "totalAmount": 5, "totalTaxAmount": 0.46, "unitPrice": 4.5455}, {"discountAllocations": [], "id": "S61465.3", "productRef": {"id": "647208621834623", "name": "Mocha"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 10, "taxes": [{"taxComponentRef": {"id": "GST10", "name": "10% GST"}}], "totalAmount": 5, "totalTaxAmount": 0.45, "unitPrice": 4.5455}], "orderNumber": "A61465.2", "payments": [{"amount": 10, "createdDate": "2022-12-12T23:21:29", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "R61465.2_1_A61465.2_2022-12-12T23:21:29.006Z", "modifiedDate": "2023-03-02T09:50:43", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid", "type": "Unknown"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 10, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0.91}], "totalResults": 24} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-orders?page=1&pageSize=2"}, "self": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "NLD", "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "ord_2at3ck", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-03-17T15:47:28Z", "orderLineItems": [{"discountAllocations": [], "id": "odl_1.3tvc32", "productRef": {"id": "7110701885"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 21, "taxes": [], "totalAmount": 329.99, "totalTaxAmount": 57.27, "unitPrice": 329.99}, {"discountAllocations": [{"name": "Discount", "totalAmount": 100}], "id": "odl_1.x95vuk", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 2, "taxPercentage": 21, "taxes": [], "totalAmount": 698, "totalTaxAmount": 121.14, "unitPrice": 399}], "orderNumber": "1337", "payments": [{"amount": 1027.99, "createdDate": "2022-02-08T15:44:22", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "tr_GpHuaqHrca", "modifiedDate": "2022-03-17T15:47:28", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-02-08T16:02:02", "status": "Failed", "type": "OnlineCard"}, {"amount": 1027.99, "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "tr_w7RGQc3k3V", "modifiedDate": "2022-03-17T15:47:28", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-01-20T09:46:02", "status": "Failed", "type": "OnlineCard"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 1027.99, "totalDiscount": 100, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 178.41}], "totalResults": 1} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-orders?page=1&pageSize=2"}, "self": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "NLD", "createdDate": "2022-01-20T09:28:32", "currency": "EUR", "customerRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "id": "ord_2at3ck", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-08-17T11:33:19Z", "orderLineItems": [{"discountAllocations": [{"name": "Discount", "totalAmount": 100}], "id": "odl_1.x95vuk", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 2, "taxPercentage": 21, "taxes": [], "totalAmount": 698, "totalTaxAmount": 121.14, "unitPrice": 338.43}, {"discountAllocations": [], "id": "odl_1.3tvc32", "productRef": {"id": "EILBDVJVNUAGVKRQ"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 21, "taxes": [], "totalAmount": 329.99, "totalTaxAmount": 57.27, "unitPrice": 272.72}], "orderNumber": "1337", "payments": [{"amount": 0, "createdDate": "2022-10-23T00:00:00Z", "currency": "GBP", "dueDate": "2022-10-23T00:00:00Z", "id": "tr_GpHuaqHrca", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}, {"amount": 194.12, "createdDate": "2022-10-23T00:00:00Z", "currency": "GBP", "dueDate": "2022-10-23T00:00:00Z", "id": "tr_w7RGQc3k3V", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 1027.99, "totalDiscount": 100, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 178.41}], "totalResults": 1} + Partner Commerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/4342cb7d-d7b1-492f-851e-4aa5084933c1/connections/9e5422fa-f03f-4d58-bcf4-161b574ab350/data/commerce-orders?page=1&pageSize=2"}, "self": {"href": "/companies/4342cb7d-d7b1-492f-851e-4aa5084933c1/connections/9e5422fa-f03f-4d58-bcf4-161b574ab350/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "GM ", "createdDate": "2021-02-10T01:37:23", "currency": "CAD", "customerRef": {"id": "0dc0206d-f22f-48c9-a4e5-79f8383c3426"}, "id": "6d135134-2f77-45f7-af3d-ee873e42da45", "locationRef": {"id": "d84a8ce0-d7e4-400a-b07a-d4bddd9c1873"}, "modifiedDate": "2022-05-12T07:22:02Z", "orderLineItems": [{"discountAllocations": [{"name": "Discount", "totalAmount": 8.54}, {"name": "Discount", "totalAmount": 17.09}], "id": "89f5e83a-c87d-4b60-a009-0ea9065867aa", "productRef": {"id": "98ef828e-33e1-4c23-9383-a029f1d6a3a6"}, "productVariantRef": {"id": "dffcd99e-13bb-4b89-89ef-719b3b0777e6"}, "quantity": 3, "taxPercentage": 20, "taxes": [], "totalAmount": 85.44, "totalTaxAmount": 17.09, "unitPrice": 28.48}, {"discountAllocations": [], "id": "4c65f0d9-05c8-48eb-9c4a-1774f5073e66", "productRef": {"id": "561f8efb-3429-4c1f-a014-1fa595f9b3c6"}, "productVariantRef": {"id": "e0715a7a-0179-4a2e-b40d-800fd2f36764"}, "quantity": 3, "taxPercentage": 20, "taxes": [], "totalAmount": 118.38, "totalTaxAmount": 23.68, "unitPrice": 39.46}], "orderNumber": "93128704", "payments": [{"amount": 194.12, "createdDate": "2022-10-23T00:00:00Z", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "id": "3ec3d4c4-8003-4f77-a44e-08b3e17057bf", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2021-02-10T01:37:23", "totalAmount": 203.82, "totalDiscount": 25.63, "totalGratuity": 80.81, "totalRefund": 0, "totalTaxAmount": 40.77}], "totalResults": 1} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "US ", "createdDate": "2021-09-02T06:00:54", "currency": "USD", "customerRef": {"id": "1", "name": "John DOE"}, "id": "1", "locationRef": {"id": "7110701885"}, "modifiedDate": "2022-01-26T15:09:42Z", "orderLineItems": [{"discountAllocations": [], "id": "1", "productRef": {"id": "1", "name": "Hummingbird printed t-shirt"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 23.9, "totalTaxAmount": 0, "unitPrice": 23.9}, {"discountAllocations": [], "id": "2", "productRef": {"id": "2", "name": "Hummingbird printed sweater"}, "productVariantRef": {"id": "EILBDVJVNUAGVKRQ"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 35.9, "totalTaxAmount": 0, "unitPrice": 35.9}], "orderNumber": "XKBKNABJK", "payments": [], "serviceCharges": [{"description": "Shipping", "quantity": 1, "taxAmount": 0, "taxPercentage": 0, "taxes": [], "totalAmount": 2, "type": "Shipping"}], "sourceModifiedDate": "2021-09-02T06:00:54", "totalAmount": 61.8, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}, {"closedDate": "2022-10-23T00:00:00Z", "country": "US ", "createdDate": "2021-09-28T08:09:46", "currency": "USD", "customerRef": {"id": "5", "name": "Tobi Yinusa"}, "id": "10", "locationRef": {"id": "7110701885"}, "modifiedDate": "2022-01-26T15:09:42Z", "orderLineItems": [{"discountAllocations": [{"name": "20% Discount", "totalAmount": 4.78}], "id": "14", "productRef": {"id": "1", "name": "Hummingbird printed t-shirt"}, "productVariantRef": {"id": "7110701885"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 19.12, "totalTaxAmount": 0, "unitPrice": 23.9}], "orderNumber": "UFQZXPGQU", "payments": [], "serviceCharges": [], "sourceModifiedDate": "2021-09-28T08:09:46", "totalAmount": 19.12, "totalDiscount": 4.78, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}], "totalResults": 10} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-19T13:18:33", "currency": "GBP", "customerRef": {"id": "5097398534302", "name": "Qa Test"}, "id": "3684119445662", "locationRef": {"id": "EILBDVJVNUAGVKRQ"}, "modifiedDate": "2023-02-10T15:18:24Z", "orderLineItems": [{"discountAllocations": [], "id": "9670458146974", "productRef": {"id": "6595494117534", "name": "Monitor"}, "productVariantRef": {"id": "39444526694558", "name": "Monitor"}, "quantity": 4, "taxPercentage": 0, "taxes": [], "totalAmount": 600, "totalTaxAmount": 0, "unitPrice": 150}], "orderNumber": "1007", "payments": [{"amount": 600, "createdDate": "2021-03-19T13:17:49", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630233579678", "modifiedDate": "2023-02-10T15:18:24", "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:17:49", "status": "Failed", "type": "OnlineCard"}, {"amount": 600, "createdDate": "2021-03-19T13:18:29", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630234497182", "modifiedDate": "2023-02-10T15:18:24", "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:18:29", "status": "Paid", "type": "OnlineCard"}], "serviceCharges": [], "sourceModifiedDate": "2022-08-01T13:12:35", "totalAmount": 600, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}, {"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-19T13:57:30", "currency": "GBP", "customerRef": {"id": "5097398534302", "name": "Qa Test"}, "id": "3684180361374", "locationRef": {"id": "EILBDVJVNUAGVKRQ"}, "modifiedDate": "2023-02-10T15:18:24Z", "orderLineItems": [{"discountAllocations": [], "id": "9670570901662", "productRef": {"id": "6595497787550", "name": "Keyboard"}, "productVariantRef": {"id": "39444537213086", "name": "Keyboard"}, "quantity": 3, "taxPercentage": 0, "taxes": [], "totalAmount": 105, "totalTaxAmount": 0, "unitPrice": 35}], "orderNumber": "1011", "payments": [{"amount": 105, "createdDate": "2021-03-19T13:57:30", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630311108766", "modifiedDate": "2023-02-10T15:18:24", "paymentProvider": "Manual", "sourceModifiedDate": "2021-03-19T13:57:30", "status": "Paid", "type": "Unknown"}], "serviceCharges": [], "sourceModifiedDate": "2022-08-01T13:12:35", "totalAmount": 105, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}], "totalResults": 30} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-orders?page=1&pageSize=2"}, "self": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "0001-01-01T00:00:00", "country": "GB ", "createdDate": "2021-02-14T19:38:28Z", "currency": "GBP", "customerRef": {"id": "EILBDVJVNUAGVKRQ"}, "id": "BDYNvtIYyWClkTjnh99CFR3fPwKZY", "locationRef": {"id": "D8DVHD1G6NT2J", "name": "Codat Limited"}, "modifiedDate": "2022-08-02T10:27:33Z", "orderLineItems": [{"discountAllocations": [], "id": "lLJpgArKQbBEn9nTvLRHP", "productRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 50, "totalTaxAmount": 0, "unitPrice": 50}], "orderNumber": "BDYNvtIYyWClkTjnh99CFR3fPwKZY", "payments": [], "serviceCharges": [], "sourceModifiedDate": "2021-02-14T19:38:28Z", "totalAmount": 50, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}], "totalResults": 1} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-30T12:20:40Z", "currency": "GBP", "customerRef": {"id": "7110701885"}, "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-09-14T10:58:04Z", "orderLineItems": [{"discountAllocations": [], "id": "Product undefined by SumUp", "productRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "productVariantRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 200, "totalTaxAmount": 0, "unitPrice": 200}], "orderNumber": "TECXTU2KT6", "payments": [{"amount": -283.56, "createdDate": "2022-10-23T00:00:00Z", "currency": "USD", "dueDate": "2022-10-23T00:00:00Z", "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 200, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}, {"closedDate": "2022-10-23T00:00:00Z", "country": "XXX", "createdDate": "2021-03-26T21:09:59Z", "currency": "GBP", "customerRef": {"id": "7110701885"}, "id": "46d36a64-ea48-4e37-9340-3548cbf3ca2f", "locationRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "modifiedDate": "2022-09-14T10:58:04Z", "orderLineItems": [{"discountAllocations": [], "id": "Sale of some product", "productRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 15, "totalTaxAmount": 0, "unitPrice": 15}], "orderNumber": "TNEU7333HZ", "payments": [{"amount": 194.12, "createdDate": "2022-10-23T00:00:00Z", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "id": "46d36a64-ea48-4e37-9340-3548cbf3ca2f", "modifiedDate": "2022-10-23T00:00:00Z", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "type": "Cash"}], "serviceCharges": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 15, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}], "totalResults": 6} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/00396b78-7113-4b1f-996f-4c561b00573a/connections/b39ed7d6-5eda-44c5-85bb-647d03edd649/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/00396b78-7113-4b1f-996f-4c561b00573a/connections/b39ed7d6-5eda-44c5-85bb-647d03edd649/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/00396b78-7113-4b1f-996f-4c561b00573a/connections/b39ed7d6-5eda-44c5-85bb-647d03edd649/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-03-27T23:29:38Z", "currency": "GBP", "customerRef": {"id": "200585744"}, "id": "111", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-07-11T15:35:48Z", "orderLineItems": [{"discountAllocations": [], "id": "53", "productRef": {"id": "82"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 2, "taxPercentage": 20, "taxes": [], "totalAmount": 12, "totalTaxAmount": 2, "unitPrice": 5}, {"discountAllocations": [], "id": "54", "productRef": {"id": "81"}, "productVariantRef": {"id": "7110701885"}, "quantity": 2, "taxPercentage": 20, "taxes": [], "totalAmount": 24, "totalTaxAmount": 4, "unitPrice": 10}], "orderNumber": "111", "payments": [], "serviceCharges": [{"description": "Royal Mail", "quantity": 1, "taxAmount": 0, "taxPercentage": 0, "taxes": [], "totalAmount": 3.5, "type": "Shipping"}], "sourceModifiedDate": "2021-04-01T13:34:59Z", "totalAmount": 39.5, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 6}, {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2021-09-24T12:15:29Z", "currency": "GBP", "customerRef": {"id": "7110701885"}, "id": "145", "locationRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2"}, "modifiedDate": "2022-07-11T15:35:48Z", "orderLineItems": [{"discountAllocations": [], "id": "59", "productRef": {"id": "87"}, "productVariantRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab"}, "quantity": 2, "taxPercentage": 25, "taxes": [], "totalAmount": 27.5, "totalTaxAmount": 5.5, "unitPrice": 11}], "orderNumber": "145", "payments": [], "serviceCharges": [], "sourceModifiedDate": "2022-03-24T16:01:23Z", "totalAmount": 27.5, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 5.5}], "totalResults": 25} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-orders?page=1&pageSize=2"}, "next": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-orders?page=2&pageSize=2"}, "self": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-orders"}}, "pageNumber": 1, "pageSize": 2, "results": [{"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2020-11-23T14:27:20Z", "currency": "GBP", "customerRef": {"id": "EILBDVJVNUAGVKRQ"}, "id": "7TunRi2XEeueVK3fSQEQIw", "locationRef": {"id": "EILBDVJVNUAGVKRQ"}, "modifiedDate": "2021-10-27T15:22:37Z", "orderLineItems": [{"discountAllocations": [], "id": "0", "productRef": {"id": "7f9f31e4-2d97-11eb-9f55-acde48001122"}, "productVariantRef": {"id": "7f9f35ea-2d97-11eb-9f55-acde48001122"}, "quantity": 1, "taxPercentage": 0, "taxes": [], "totalAmount": 45, "totalTaxAmount": 0, "unitPrice": 45}], "orderNumber": "3", "payments": [{"amount": 45, "createdDate": "2020-11-23T14:27:19", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "ed97bcde-2d97-11eb-a42e-25130f2dd258", "modifiedDate": "2021-10-27T15:22:37", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "type": "Paypal"}], "serviceCharges": [], "sourceModifiedDate": "2020-11-23T14:27:20Z", "totalAmount": 45, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 0}, {"closedDate": "2022-10-23T00:00:00Z", "country": "GB ", "createdDate": "2020-11-23T14:28:05Z", "currency": "GBP", "customerRef": {"id": "EILBDVJVNUAGVKRQ"}, "id": "CV5TJC2YEeueVK3fSQEQIw", "locationRef": {"id": "7110701885"}, "modifiedDate": "2021-10-27T15:22:37Z", "orderLineItems": [{"discountAllocations": [], "id": "0", "productRef": {"id": "89570bee-2d97-11eb-9f55-acde48001122"}, "productVariantRef": {"id": "89570c52-2d97-11eb-9f55-acde48001122"}, "quantity": 1, "taxPercentage": 5, "taxes": [], "totalAmount": 25, "totalTaxAmount": 1.19, "unitPrice": 23.81}], "orderNumber": "4", "payments": [{"amount": 25, "createdDate": "2020-11-23T14:28:04", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "modifiedDate": "2021-10-27T15:22:37", "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "type": "Paypal"}], "serviceCharges": [], "sourceModifiedDate": "2020-11-23T14:28:05Z", "totalAmount": 25, "totalDiscount": 0, "totalGratuity": 0, "totalRefund": 0, "totalTaxAmount": 1.19}], "totalResults": 6} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + get-commerce-payment: + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": -64, "createdDate": "2022-06-15T17:13:13Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "103_1_1_refund", "modifiedDate": "2023-04-11T10:33:52Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "bigpaypay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 1000, "createdDate": "2021-05-24T10:35:08Z", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "01J7HV88GT6B8", "modifiedDate": "2023-01-09T11:01:02Z", "paymentMethodRef": {"id": "BR5M17TG091SP", "name": "Credit Card"}, "paymentProvider": "clover", "sourceModifiedDate": "2021-05-24T10:35:08Z", "status": "Paid"} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 0, "createdDate": "2023-01-05T03:34:50Z", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "1_A62084.1_2023-01-05T03:34:50.296Z", "modifiedDate": "2023-03-02T09:50:43Z", "paymentMethodRef": {"id": "0"}, "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": -20, "createdDate": "2022-01-17T16:00:46", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-03-17T16:15:23Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "mollie", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 20.9, "createdDate": "2021-09-08T01:52:55", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "1", "modifiedDate": "2022-01-26T15:09:42Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 600, "createdDate": "2021-03-19T13:17:49Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630233579678", "modifiedDate": "2023-02-10T15:18:24Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:17:49Z", "status": "Failed"} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 200, "createdDate": "2021-03-30T12:20:40Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "modifiedDate": "2022-03-17T16:13:46Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "sumup", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Cancelled"} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 0, "createdDate": "2021-03-11T09:07:00Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "33", "modifiedDate": "2021-07-13T16:19:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "200": + application/json: {"amount": 25, "createdDate": "2020-11-23T14:28:04Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "modifiedDate": "2021-10-27T15:22:37Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-commerce-payment-method: + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "COD", "modifiedDate": "2023-01-09T09:12:03Z", "name": "Cash On Delivery", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "bigcommerce_gift_certificate", "modifiedDate": "2023-04-11T10:33:48Z", "name": "Gift Certificate", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "0DPQ6QP48YYHW", "modifiedDate": "2023-01-09T11:01:04Z", "name": "TapMango Wallet", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "647208621834260", "modifiedDate": "2023-03-02T09:48:56Z", "name": "Cash", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "applepay", "modifiedDate": "2022-08-09T15:08:19Z", "name": "Apple Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "applepay", "modifiedDate": "2022-08-17T11:33:19Z", "name": "Apple Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "BANK_ACCOUNT", "modifiedDate": "2022-08-02T10:27:32Z", "name": "Bank Account", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "200": + application/json: {"id": "CASH", "modifiedDate": "2022-09-14T10:58:03Z", "name": "Cash", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + paymentMethodId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-payments: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": {} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": -64, "createdDate": "2022-06-15T17:13:13Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "103_1_1_refund", "modifiedDate": "2023-04-11T10:33:52Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "bigpaypay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}, {"amount": -33.95, "createdDate": "2022-06-24T13:57:01Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "105_2_2_refund", "modifiedDate": "2023-04-11T10:33:52Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "bigpaypay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 20} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 1000, "createdDate": "2021-05-24T10:35:08Z", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "01J7HV88GT6B8", "modifiedDate": "2023-01-09T11:01:02Z", "paymentMethodRef": {"id": "BR5M17TG091SP", "name": "Credit Card"}, "paymentProvider": "clover", "sourceModifiedDate": "2021-05-24T10:35:08Z", "status": "Paid"}, {"amount": 1000, "createdDate": "2021-05-24T10:35:31Z", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "0A8ZMPG40Q9AM", "modifiedDate": "2023-01-09T11:01:02Z", "paymentMethodRef": {"id": "BR5M17TG091SP", "name": "Credit Card"}, "paymentProvider": "clover", "sourceModifiedDate": "2021-05-24T10:35:31Z", "status": "Paid"}], "totalResults": 77} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 0, "createdDate": "2023-01-05T03:34:50Z", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "1_A62084.1_2023-01-05T03:34:50.296Z", "modifiedDate": "2023-03-02T09:50:43Z", "paymentMethodRef": {"id": "0"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}, {"amount": 5, "createdDate": "2022-12-09T02:27:46Z", "currency": "AUD", "dueDate": "0001-01-01T00:00:00", "id": "R61465.1_1_A61465.1_2022-12-09T02:27:46.273Z", "modifiedDate": "2023-03-02T09:50:43Z", "paymentMethodRef": {"id": "647208621834714", "name": "LSPay - Mary"}, "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 26} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/65fe5864-16d7-41f4-8823-87ae1cf3a283/connections/1dbbf0ab-a27a-45b0-982a-ae0d8985affc/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/65fe5864-16d7-41f4-8823-87ae1cf3a283/connections/1dbbf0ab-a27a-45b0-982a-ae0d8985affc/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/65fe5864-16d7-41f4-8823-87ae1cf3a283/connections/1dbbf0ab-a27a-45b0-982a-ae0d8985affc/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": -20, "createdDate": "2022-01-17T16:00:46", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-03-17T16:15:23Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "mollie", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}, {"amount": -60, "createdDate": "2022-01-17T16:00:05", "currency": "EUR", "dueDate": "0001-01-01T00:00:00", "id": "re_NPKEJhQveu", "modifiedDate": "2022-03-17T16:15:23Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "mollie", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 16} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 20.9, "createdDate": "2021-09-08T01:52:55", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "1", "modifiedDate": "2022-01-26T15:09:42Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}, {"amount": 20.9, "createdDate": "2021-09-08T01:53:28", "currency": "USD", "dueDate": "0001-01-01T00:00:00", "id": "2", "modifiedDate": "2022-01-26T15:09:42Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "SagePay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 5} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 600, "createdDate": "2021-03-19T13:17:49Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630233579678", "modifiedDate": "2023-02-10T15:18:24Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:17:49Z", "status": "Failed"}, {"amount": 600, "createdDate": "2021-03-19T13:18:29Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "4630234497182", "modifiedDate": "2023-02-10T15:18:24Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Shopify Payments", "sourceModifiedDate": "2021-03-19T13:18:29Z", "status": "Paid"}], "totalResults": 46} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d9e78460-7ee5-4a34-a3f4-9652a5946b1f/connections/60959ebe-8491-4368-bf0a-f715c3ce2e53/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/d9e78460-7ee5-4a34-a3f4-9652a5946b1f/connections/60959ebe-8491-4368-bf0a-f715c3ce2e53/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/d9e78460-7ee5-4a34-a3f4-9652a5946b1f/connections/60959ebe-8491-4368-bf0a-f715c3ce2e53/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 200, "createdDate": "2021-03-30T12:20:40Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "07efcdd0-7f61-4d82-957f-52e8f0bd3f89", "modifiedDate": "2022-03-17T16:13:46Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "sumup", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Cancelled"}, {"amount": 15, "createdDate": "2021-03-26T21:09:59Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "46d36a64-ea48-4e37-9340-3548cbf3ca2f", "modifiedDate": "2022-03-17T16:13:46Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "sumup", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 6} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 0, "createdDate": "2021-03-11T09:07:00Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "33", "modifiedDate": "2021-07-13T16:19:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}, {"amount": 30, "createdDate": "2021-03-11T09:08:56Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "35", "modifiedDate": "2021-07-13T16:19:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Paid"}], "totalResults": 5} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-payments?page=1&pageSize=2"}, "next": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-payments?page=2&pageSize=2"}, "self": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-payments"}}, "pageNumber": 1, "pageSize": 2, "results": [{"amount": 25, "createdDate": "2020-11-23T14:28:04Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "modifiedDate": "2021-10-27T15:22:37Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Checkout.com", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}, {"amount": 58.5, "createdDate": "2020-11-23T14:28:47Z", "currency": "GBP", "dueDate": "0001-01-01T00:00:00", "id": "226580d6-2d98-11eb-a35c-fed5e63de507", "modifiedDate": "2021-10-27T15:22:37Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "paymentProvider": "Amazon Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}], "totalResults": 8} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + list-commerce-payment-methods: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": {} + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "COD", "modifiedDate": "2023-01-09T09:12:03Z", "name": "Cash On Delivery", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"id": "GC", "modifiedDate": "2023-01-09T09:12:03Z", "name": "Gift Card", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 3} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-paymentMethods?page=1&pageSize=2"}, "self": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "bigcommerce_gift_certificate", "modifiedDate": "2023-04-11T10:33:48Z", "name": "Gift Certificate", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"id": "bigcommerce_store_credit", "modifiedDate": "2023-04-11T10:33:48Z", "name": "Store Credit", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 2} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "0DPQ6QP48YYHW", "modifiedDate": "2023-01-09T11:01:04Z", "name": "TapMango Wallet", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"id": "24H1ANYP1BNXG", "modifiedDate": "2023-01-09T11:01:04Z", "name": "MyTab", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 13} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "647208621834260", "modifiedDate": "2023-03-02T09:48:56Z", "name": "Cash", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"id": "647208621834261", "modifiedDate": "2023-03-02T09:48:56Z", "name": "Credit Card", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 11} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/a2503b54-143c-4705-8bec-9ef84f51ca86/connections/4c8df852-f1b3-4642-939b-c33d6f34a312/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/a2503b54-143c-4705-8bec-9ef84f51ca86/connections/4c8df852-f1b3-4642-939b-c33d6f34a312/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/a2503b54-143c-4705-8bec-9ef84f51ca86/connections/4c8df852-f1b3-4642-939b-c33d6f34a312/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "applepay", "modifiedDate": "2022-08-09T15:08:19Z", "name": "Apple Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}, {"id": "bancontact", "modifiedDate": "2022-08-09T15:08:19Z", "name": "Bancontact", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}], "totalResults": 19} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "applepay", "modifiedDate": "2022-08-17T11:33:19Z", "name": "Apple Pay", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}, {"id": "bancontact", "modifiedDate": "2022-08-17T11:33:19Z", "name": "Bancontact", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}], "totalResults": 19} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/d779fc82-a098-4107-a9fc-c2a1dda3d522/connections/9b098b74-3770-4dad-9001-4c283a39f1e5/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "BANK_ACCOUNT", "modifiedDate": "2022-08-02T10:27:32Z", "name": "Bank Account", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}, {"id": "BUY_NOW_PAY_LATER", "modifiedDate": "2022-08-02T10:27:32Z", "name": "Buy Now Pay Later", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}], "totalResults": 20} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-paymentMethods?page=1&pageSize=2"}, "next": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-paymentMethods?page=2&pageSize=2"}, "self": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-paymentMethods"}}, "pageNumber": 1, "pageSize": 2, "results": [{"id": "CASH", "modifiedDate": "2022-09-14T10:58:03Z", "name": "Cash", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"id": "CC_CUSTOMER_ENTERED", "modifiedDate": "2022-09-14T10:58:03Z", "name": "Credit Card", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 8} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + get-commerce-product: + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "DEVICE", "description": "Cast from your phone to your TV with this all new chromecast.", "id": "Chromecast", "isGiftCard": false, "name": "Chromecast", "variants": [{"barcode": "CSE370", "createdDate": "2021-02-07T12:30:01Z", "id": "packaging_asin_gating", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Chromecast in a cardboard box", "prices": [{"currency": "GBP", "unitPrice": 50}], "shippingRequired": false, "sku": "packaging_asin_gating", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Shop All, Utility", "description": "The last laundry cart you'll ever buy. This industrial non-collapsable cart is constructed with a steel framed body using heavyweight canvas capped with a soft leather rim sitting on four smooth rolling casters. Keeps the grubby garments off the floor and almost makes laundry enjoyable. Can also be used as the ideal storage solution: many people find it ideal for children's toys or a load of chopped firewood. Load it up and wheel it away. Natural Heavyweight Canvas with Vegetable Tanned Leather Rim Measure�", "id": "103", "isGiftCard": false, "name": "[Sample] Canvas Laundry Cart", "variants": [{"barcode": "", "createdDate": "0001-01-01T00:00:00", "id": "71", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "[Sample] Canvas Laundry Cart", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": true, "sku": "CLC", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}]} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Software", "description": "Coffee", "id": "DJANHKK2AVEYY", "isGiftCard": false, "name": "Coffee", "variants": [{"barcode": "1234", "createdDate": "0001-01-01T00:00:00", "id": "DJANHKK2AVEYY", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Coffee", "prices": [{"currency": "GBP", "unitPrice": 3}], "shippingRequired": false, "sku": "12222", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 20}]} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Alcoholic beverages", "description": "Alcoholic beverages", "id": "647208621834539", "isGiftCard": false, "name": "Alcoholic beverages", "variants": []} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Home - Clothes - Men", "description": "Symbol of lightness and delicacy, the hummingbird evokes curiosity and joy. Studio Design' PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional color rendering and a color, guaranteed overtime.", "id": "1", "isGiftCard": false, "name": "Hummingbird printed t-shirt", "variants": [{"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "8", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = XL, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "4", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = M, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "5", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = L, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "3", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = M, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "6", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = L, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "1", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = S, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "2", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = S, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "7", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = XL, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}]} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Asus", "description": "", "id": "6595494117534", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "", "createdDate": "2021-03-19T10:13:22Z", "id": "39444526694558", "inventory": {"locations": [], "totalQuantity": 91}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Monitor", "prices": [{"currency": "GBP", "unitPrice": 150}], "shippingRequired": true, "sku": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Hardware", "description": "1 hour of support from an agent (phone or remote)", "id": "AX54KZQ3UAVCVPUMNEGFEU35", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "564158468416486458646886484", "createdDate": "2021-02-18T15:47:31Z", "id": "A5BUT6SYUNYRSQ2R7GZ6UKN6", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Regular", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": false, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 10}]} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Software", "description": "Nice cozy cotton t shirt", "id": "prod_IaSbzLnxOHmC0i", "isGiftCard": false, "name": "Blue T Shirt", "variants": [{"barcode": "564158468416486458646886484", "createdDate": "2021-01-22T06:52:16Z", "id": "price_1ICJVEA8m8S1Gh7OIOCDOG8j", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "GBP", "unitPrice": 15}], "shippingRequired": true, "sku": "Coat-Red-Lrg", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}, {"barcode": "CSE370", "createdDate": "2021-01-22T06:47:34Z", "id": "price_1ICJQgA8m8S1Gh7OfErQdx5R", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "USD", "unitPrice": 30}], "shippingRequired": true, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}, {"barcode": "CSE370", "createdDate": "2020-12-17T08:19:48Z", "id": "price_1HzHiCA8m8S1Gh7OXZVa6r3F", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "GBP", "unitPrice": 15}], "shippingRequired": true, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}]} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Hardware", "description": "", "id": "27", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "CSE370", "createdDate": "2021-03-11T08:55:22", "id": "27", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Monitor", "prices": [{"currency": "GBP", "unitPrice": 150}], "shippingRequired": true, "sku": "A725BA2", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "200": + application/json: {"categorization": "Clothing", "description": "1tb Western Digital Hard Drive", "id": "9d21fd90-a34a-11eb-b574-ad6abe469b61", "isGiftCard": false, "name": "T-Shirt", "variants": [{"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "bb9bcf30-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Medium", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "b919df40-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Large", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "bcb5cab0-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Small", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "Coat-Red-Lrg", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}]} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + productId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-products: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": {} + Amazon Seller Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/6a59da96-e6d2-4c5c-ace7-65ba8be6a472/connections/58be1638-2c74-4ad4-8ff3-8c5b98b5f0fe/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "DEVICE", "description": "Cast from your phone to your TV with this all new chromecast.", "id": "Chromecast", "isGiftCard": false, "name": "Chromecast", "variants": [{"barcode": "564158468416486458646886484", "createdDate": "2021-02-07T12:30:01Z", "id": "packaging_asin_gating", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Chromecast in a cardboard box", "prices": [{"currency": "GBP", "unitPrice": 50}], "shippingRequired": false, "sku": "packaging_asin_gating", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]}, {"categorization": "COAT", "description": "Wind and rainproof, keeping you dry all year round.", "id": "vb554a-bl1915", "isGiftCard": false, "name": "Waterproof Jacket", "variants": [{"barcode": "CSE370", "createdDate": "2021-02-07T12:30:01Z", "id": "ARRIS,SB6141", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Waterproof Jacket (Black)", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": false, "sku": "ARRIS,SB6141", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}, {"barcode": "CSE370", "createdDate": "2021-02-07T12:30:01Z", "id": "RTN66U-N9000", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Waterproof Jacket (Blue)", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": false, "sku": "RTN66U-N9000", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}, {"barcode": "CSE370", "createdDate": "2021-02-07T12:30:01Z", "id": "TLWR841N", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Waterproof Jacket (Red)", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": false, "sku": "TLWR841N", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}]}], "totalResults": 3} + BigCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/d1ebcf6d-f7f9-4841-8a06-fec12c492a48/connections/7c0a21e8-938a-40a4-b0f7-5ab5d46804b0/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Shop All, Utility", "description": "The last laundry cart you'll ever buy. This industrial non-collapsable cart is constructed with a steel framed body using heavyweight canvas capped with a soft leather rim sitting on four smooth rolling casters. Keeps the grubby garments off the floor and almost makes laundry enjoyable. Can also be used as the ideal storage solution: many people find it ideal for children's toys or a load of chopped firewood. Load it up and wheel it away. Natural Heavyweight Canvas with Vegetable Tanned Leather Rim Measure�", "id": "103", "isGiftCard": false, "name": "[Sample] Canvas Laundry Cart", "variants": [{"barcode": "", "createdDate": "0001-01-01T00:00:00", "id": "71", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "[Sample] Canvas Laundry Cart", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": true, "sku": "CLC", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]}, {"categorization": "Shop All, Utility", "description": "This powder coated steel utility caddy ensures your cleaning essentials are stowed away in one spot ready for your household chores. Brushes, cloths, liquid soaps can all easily be stashed away. Also ideal to be used as a garden caddy to easily grab from the shed for a days work. Works well as a mop bucket too. The wood carrying handle ensures a comfortable grip when toting it from room to room. Measures 19 h x 36 w x 20 dia cm/7.5 h x 14.1 w x 7.8 dia in", "id": "104", "isGiftCard": false, "name": "[Sample] Utility Caddy", "variants": [{"barcode": "", "createdDate": "0001-01-01T00:00:00", "id": "72", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "[Sample] Utility Caddy", "prices": [{"currency": "GBP", "unitPrice": 45.95}], "shippingRequired": true, "sku": "OFSUC", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}]}], "totalResults": 18} + Clover: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/aae80eb3-1f56-41ca-a171-a59f9ee03b26/connections/4a5b633b-cd86-4715-a22b-62be98c4bcc5/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Hardware", "description": "Coffee", "id": "DJANHKK2AVEYY", "isGiftCard": false, "name": "Coffee", "variants": [{"barcode": "1234", "createdDate": "0001-01-01T00:00:00", "id": "DJANHKK2AVEYY", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Coffee", "prices": [{"currency": "GBP", "unitPrice": 3}], "shippingRequired": false, "sku": "12222", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 20}]}, {"categorization": "Hardware", "description": "Cool Laptop", "id": "NMZHKK6FKF6ZJ", "isGiftCard": false, "name": "Laptop", "variants": [{"barcode": "123", "createdDate": "0001-01-01T00:00:00", "id": "NMZHKK6FKF6ZJ", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Laptop", "prices": [{"currency": "GBP", "unitPrice": 1000}], "shippingRequired": false, "sku": "111", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 20}]}], "totalResults": 3} + Lightspeed K Trial: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/36e3213b-02f6-4264-96ce-6dd53ea69e57/connections/278ba962-466a-452b-92b0-4bdee3a23463/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Alcoholic beverages", "description": "Alcoholic beverages", "id": "647208621834539", "isGiftCard": false, "name": "Alcoholic beverages", "variants": []}, {"categorization": "NA beverages", "description": "NA beverages", "id": "647208621834542", "isGiftCard": false, "name": "NA beverages", "variants": []}], "totalResults": 39} + PrestaShop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/2bf78e61-58ca-421a-a430-5dfa59cf15b0/connections/30774c1f-fdcd-491e-9e60-47e316b3ab9b/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Home - Clothes - Men", "description": "Symbol of lightness and delicacy, the hummingbird evokes curiosity and joy. Studio Design' PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional color rendering and a color, guaranteed overtime.", "id": "1", "isGiftCard": false, "name": "Hummingbird printed t-shirt", "variants": [{"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "8", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = XL, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "4", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = M, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "5", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = L, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "3", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = M, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "6", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = L, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "1", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = S, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "2", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = S, Color = Black)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "7", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Hummingbird printed t-shirt (Size = XL, Color = White)", "prices": [{"currency": "USD", "unitPrice": 23.9}], "shippingRequired": true, "sku": "demo_1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 6}]}, {"categorization": "Home - Accessories - Home Accessories", "description": "The brown bear cushion will add a graphic and colorful touch to your sofa, armchair or bed. Create a modern and zen atmosphere that inspires relaxation. Cover 100% cotton, machine washable at 60� / Filling 100% hypoallergenic polyester.", "id": "10", "isGiftCard": false, "name": "Brown bear cushion", "variants": [{"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "24", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Brown bear cushion (Color = White)", "prices": [{"currency": "USD", "unitPrice": 18.9}], "shippingRequired": true, "sku": "demo_16", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 6}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "25", "inventory": {"locations": [], "totalQuantity": 300}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Brown bear cushion (Color = Black)", "prices": [{"currency": "USD", "unitPrice": 18.9}], "shippingRequired": true, "sku": "demo_16", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 6}]}], "totalResults": 22} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Asus", "description": "", "id": "6595494117534", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "", "createdDate": "2021-03-19T10:13:22Z", "id": "39444526694558", "inventory": {"locations": [], "totalQuantity": 91}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Monitor", "prices": [{"currency": "GBP", "unitPrice": 150}], "shippingRequired": true, "sku": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]}, {"categorization": "Logitech", "description": "", "id": "6595497066654", "isGiftCard": false, "name": "Mouse", "variants": [{"barcode": "", "createdDate": "2021-03-19T10:14:01Z", "id": "39444533706910", "inventory": {"locations": [], "totalQuantity": 71}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Mouse", "prices": [{"currency": "GBP", "unitPrice": 25}], "shippingRequired": true, "sku": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}]}], "totalResults": 4} + Square: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/25debd39-e024-41a1-a86c-4fd47f29c853/connections/d5071fdf-a769-48f3-b39e-e588d515bb83/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/25debd39-e024-41a1-a86c-4fd47f29c853/connections/d5071fdf-a769-48f3-b39e-e588d515bb83/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/25debd39-e024-41a1-a86c-4fd47f29c853/connections/d5071fdf-a769-48f3-b39e-e588d515bb83/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Hardware", "description": "Install of Windows 11 (Professional Edition)", "id": "AX54KZQ3UAVCVPUMNEGFEU35", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "CSE370", "createdDate": "2021-02-18T15:47:31Z", "id": "A5BUT6SYUNYRSQ2R7GZ6UKN6", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Regular", "prices": [{"currency": "GBP", "unitPrice": 200}], "shippingRequired": false, "sku": "A725BA2", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 10}]}, {"categorization": "Furniture", "description": "1tb Western Digital Hard Drive", "id": "FYRIQNFTFRGQNQZGZG66MJWI", "isGiftCard": false, "name": "Desk", "variants": [{"barcode": "564158468416486458646886484", "createdDate": "2021-02-18T15:47:45Z", "id": "VMKSQEABA3WIYGXNAV63JOTZ", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Regular", "prices": [{"currency": "GBP", "unitPrice": 70}], "shippingRequired": false, "sku": "A725BA2", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 10}]}], "totalResults": 4} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Hardware", "description": "Nice cozy cotton t shirt", "id": "prod_IaSbzLnxOHmC0i", "isGiftCard": false, "name": "Blue T Shirt", "variants": [{"barcode": "CSE370", "createdDate": "2021-01-22T06:52:16Z", "id": "price_1ICJVEA8m8S1Gh7OIOCDOG8j", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "GBP", "unitPrice": 15}], "shippingRequired": true, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}, {"barcode": "CSE370", "createdDate": "2021-01-22T06:47:34Z", "id": "price_1ICJQgA8m8S1Gh7OfErQdx5R", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "USD", "unitPrice": 30}], "shippingRequired": true, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 0}, {"barcode": "564158468416486458646886484", "createdDate": "2020-12-17T08:19:48Z", "id": "price_1HzHiCA8m8S1Gh7OXZVa6r3F", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Blue T Shirt - Standard Price", "prices": [{"currency": "GBP", "unitPrice": 15}], "shippingRequired": true, "sku": "A725BA2", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}]}, {"categorization": "Support Services", "description": "1tb Western Digital Hard Drive", "id": "prod_IQ6G1MDsvUb87Y", "isGiftCard": false, "name": "Laptop", "variants": [{"barcode": "CSE370", "createdDate": "2020-11-19T16:32:45Z", "id": "price_1HpG3tA8m8S1Gh7Oa6bGLvVD", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": false, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Laptop - Standard Price", "prices": [{"currency": "GBP", "unitPrice": 100}], "shippingRequired": false, "sku": "Coat-Red-Lrg", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 0}]}], "totalResults": 4} + WooCommerce: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-products?page=1&pageSize=2"}, "next": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-products?page=2&pageSize=2"}, "self": {"href": "/companies/010c6f53-8fc8-40ab-9ed5-41191cf9c6b5/connections/7545ca2e-5f58-4f98-8af2-3b2c38bb8074/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Hardware", "description": "", "id": "27", "isGiftCard": false, "name": "Monitor", "variants": [{"barcode": "CSE370", "createdDate": "2021-03-11T08:55:22", "id": "27", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Monitor", "prices": [{"currency": "GBP", "unitPrice": 150}], "shippingRequired": true, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}]}, {"categorization": "Hardware", "description": "", "id": "28", "isGiftCard": false, "name": "Keyboard", "variants": [{"barcode": "CSE370", "createdDate": "2021-03-11T09:02:58", "id": "28", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Keyboard", "prices": [{"currency": "GBP", "unitPrice": 30}], "shippingRequired": true, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 0}]}], "totalResults": 3} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-products?page=1&pageSize=2"}, "self": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-products"}}, "pageNumber": 1, "pageSize": 2, "results": [{"categorization": "Clothing", "description": "1 hour of support from an agent (phone or remote)", "id": "9d21fd90-a34a-11eb-b574-ad6abe469b61", "isGiftCard": false, "name": "T-Shirt", "variants": [{"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "bb9bcf30-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Medium", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "Coat-Red-Lrg", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "b919df40-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Large", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "bcb5cab0-a34a-11eb-b574-ad6abe469b61", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Small", "prices": [{"currency": "GBP", "unitPrice": 10}], "shippingRequired": false, "sku": "Coat-Black-Md", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}]}, {"categorization": "Clothing", "description": "1 hour of support from an agent (phone or remote)", "id": "e02c2930-a34a-11eb-b9db-8f5efc0924aa", "isGiftCard": false, "name": "Hoodie", "variants": [{"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "fa180e40-a34a-11eb-b9db-8f5efc0924aa", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Medium", "prices": [{"currency": "GBP", "unitPrice": 30}], "shippingRequired": false, "sku": "Coat-Red-Lrg", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "meters", "vatPercentage": 20}, {"barcode": "CSE370", "createdDate": "0001-01-01T00:00:00", "id": "fc412fd0-a34a-11eb-b9db-8f5efc0924aa", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Extra Large", "prices": [{"currency": "GBP", "unitPrice": 30}], "shippingRequired": false, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "f8a03b50-a34a-11eb-b9db-8f5efc0924aa", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Small", "prices": [{"currency": "GBP", "unitPrice": 30}], "shippingRequired": false, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "m", "vatPercentage": 20}, {"barcode": "564158468416486458646886484", "createdDate": "0001-01-01T00:00:00", "id": "fac1bbc0-a34a-11eb-b9db-8f5efc0924aa", "inventory": {"locations": [], "totalQuantity": 0}, "isTaxEnabled": true, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Large", "prices": [{"currency": "GBP", "unitPrice": 30}], "shippingRequired": false, "sku": "LargeBrownHat", "sourceModifiedDate": "2022-10-23T00:00:00Z", "unitOfMeasure": "kg", "vatPercentage": 20}]}], "totalResults": 2} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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} + get-commerce-transaction: + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2022-01-17T16:00:46", "currency": "EUR", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-03-17T15:47:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "CardPayment", "totalAmount": -20, "transactionSourceRef": {"id": "7110701885", "type": "Fee"}, "type": "Refund"} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2022-01-17T16:00:46", "currency": "EUR", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-08-17T11:33:19Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PaymentRefund", "totalAmount": -20, "transactionSourceRef": {"id": "7110701885", "type": "Fee"}, "type": "Refund"} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2021-03-19T13:16:26", "currency": "GBP", "id": "ShopifyPayment-1633176289438", "modifiedDate": "2023-02-10T15:18:23Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2021-03-19T13:16:26", "subType": "charge", "totalAmount": 175, "transactionSourceRef": {"id": "3684116791454", "type": "Order"}, "type": "Payment"} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2020-11-19T16:56:06Z", "currency": "GBP", "id": "txn_1HpGQUA8m8S1Gh7OR21pB0Yj", "modifiedDate": "2022-09-30T11:18:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "charge", "totalAmount": 50, "transactionSourceRef": {"id": "ch_1HpGQUA8m8S1Gh7Ot4WDTus5", "type": "Payment"}, "type": "Payment"} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2021-03-26T21:09:59Z", "currency": "GBP", "id": "46d36a64-ea48-4e37-9340-3548cbf3ca2f", "modifiedDate": "2022-09-14T10:58:03Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PAYMENT", "totalAmount": 15, "transactionSourceRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "type": "Order"}, "type": "Payment"} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "200": + application/json: {"createdDate": "2020-11-23T14:27:38Z", "currency": "GBP", "id": "PAYMENT:09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "modifiedDate": "2021-10-27T15:23:04Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2020-11-25T23:10:01Z", "subType": "CardPayment", "totalAmount": 25, "transactionSourceRef": {"id": "09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "type": "Unknown"}, "type": "Payment"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + transactionId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-commerce-transactions: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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": {} + Mollie: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/a68cb447-182d-4bbe-be1a-f526d11d69d5/connections/dfbf847b-cde8-4b00-b2f9-af51dec0d337/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2022-01-17T16:00:46", "currency": "EUR", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-03-17T15:47:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "CardPayment", "totalAmount": -20, "transactionSourceRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "type": "ServiceCharge"}, "type": "Refund"}, {"createdDate": "2022-01-17T16:00:05", "currency": "EUR", "id": "re_NPKEJhQveu", "modifiedDate": "2022-03-17T15:47:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "Invoice payment", "totalAmount": -60, "transactionSourceRef": {"id": "7110701885", "type": "ServiceCharge"}, "type": "Refund"}], "totalResults": 7} + Mollie Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/b978f9fe-8d63-4cfc-b2c2-b61b72e22785/connections/d564f8fd-0766-4ab8-a427-7c893f9b9ff6/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2022-01-17T16:00:46", "currency": "EUR", "id": "re_Azhe8TzfUK", "modifiedDate": "2022-08-17T11:33:19Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PaymentRefund", "totalAmount": -20, "transactionSourceRef": {"id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "type": "Order"}, "type": "Refund"}, {"createdDate": "2022-01-17T16:00:05", "currency": "EUR", "id": "re_NPKEJhQveu", "modifiedDate": "2022-08-17T11:33:19Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PaymentRefund", "totalAmount": -60, "transactionSourceRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2", "type": "Unknown"}, "type": "Refund"}], "totalResults": 7} + Shopify: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/0bc1cc44-c6d2-4537-9591-b1ad6b5e3c94/connections/d38fa6d3-d712-4cf6-9d9d-f03bacd87595/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2021-03-19T13:16:26", "currency": "GBP", "id": "ShopifyPayment-1633176289438", "modifiedDate": "2023-02-10T15:18:23Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2021-03-19T13:16:26", "subType": "charge", "totalAmount": 175, "transactionSourceRef": {"id": "3684116791454", "type": "Order"}, "type": "Payment"}, {"createdDate": "2021-03-19T13:16:26", "currency": "GBP", "id": "ShopifyPayment-1633176289438:Fee", "modifiedDate": "2023-02-10T15:18:23Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2021-03-19T13:16:26", "subType": "charge", "totalAmount": -4.05, "transactionSourceRef": {"id": "3684116791454", "type": "Order"}, "type": "PaymentFee"}], "totalResults": 64} + Stripe Test: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/8206e78e-e340-411e-b315-473c4ab73b48/connections/43e58373-0a1d-44a0-97f0-9fa9993a14fa/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2020-11-19T16:56:06Z", "currency": "GBP", "id": "txn_1HpGQUA8m8S1Gh7OR21pB0Yj", "modifiedDate": "2022-09-30T11:18:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "charge", "totalAmount": 50, "transactionSourceRef": {"id": "ch_1HpGQUA8m8S1Gh7Ot4WDTus5", "type": "Payment"}, "type": "Payment"}, {"createdDate": "2020-11-19T16:56:06Z", "currency": "GBP", "id": "txn_1HpGQUA8m8S1Gh7OR21pB0Yj:Stripe processing fees", "modifiedDate": "2022-09-30T11:18:28Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "stripe_fee", "totalAmount": -0.9, "transactionSourceRef": {"id": "ch_1HpGQUA8m8S1Gh7Ot4WDTus5", "type": "Payment"}, "type": "PaymentFee"}], "totalResults": 70} + SumUp: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/e170dbe2-be50-474f-b449-82add37108de/connections/1e631dd5-a30b-4bad-ad5c-315c9743535b/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2021-03-26T21:09:59Z", "currency": "GBP", "id": "46d36a64-ea48-4e37-9340-3548cbf3ca2f", "modifiedDate": "2022-09-14T10:58:03Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PAYMENT", "totalAmount": 15, "transactionSourceRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2", "type": "Fee"}, "type": "Payment"}, {"createdDate": "2021-03-30T12:22:14Z", "currency": "GBP", "id": "471914a4-a82f-4fc4-b39b-9986fd706d26", "modifiedDate": "2022-09-14T10:58:03Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subType": "PAYMENT", "totalAmount": 215, "transactionSourceRef": {"id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2", "type": "Unknown"}, "type": "Payment"}], "totalResults": 3} + Zettle: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-transactions?page=1&pageSize=2"}, "next": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-transactions?page=2&pageSize=2"}, "self": {"href": "/companies/9d448ad0-4508-47fc-bd3b-6950493151f1/connections/c7baa8da-3302-464b-8aa1-edcd4c900902/data/commerce-transactions"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdDate": "2020-11-23T14:27:38Z", "currency": "GBP", "id": "PAYMENT:09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "modifiedDate": "2021-10-27T15:23:04Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2020-11-25T23:10:01Z", "subType": "Invoice payment", "totalAmount": 25, "transactionSourceRef": {"id": "09b94cfc-2d98-11eb-8021-0e1b9dcbeca1", "type": "Unknown"}, "type": "Payment"}, {"createdDate": "2020-11-23T14:28:20Z", "currency": "GBP", "id": "PAYMENT:226580d6-2d98-11eb-a35c-fed5e63de507", "modifiedDate": "2021-10-27T15:23:04Z", "sourceCreatedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2020-11-25T23:10:02Z", "subType": "CardPayment", "totalAmount": 58.5, "transactionSourceRef": {"id": "226580d6-2d98-11eb-a35c-fed5e63de507", "type": "Unknown"}, "type": "Payment"}], "totalResults": 16} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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-accounting-account: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "GBP", "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-accounting-account: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Current", "fullyQualifiedName": "Asset.Current.Accounts Receivable", "id": "1b6266d1-1e44-46c5-8eb5-a8f98e03124e", "isBankAccount": false, "modifiedDate": "2023-04-26T12:38:15Z", "name": "Accounts Receivable", "nominalCode": "610", "sourceModifiedDate": "2022-12-10T16:39:00", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": " .", "fullyQualifiedName": "..", "id": "8eaed16d-c69f-ec11-80f1-0022481b4546", "isBankAccount": false, "modifiedDate": "2023-03-27T14:21:18Z", "name": "", "nominalCode": "45422026-68CA-4EF2-9", "sourceModifiedDate": "2022-03-09T16:31:54Z", "status": "Active", "type": "Unknown", "validDatatypeLinks": [{"links": ["DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "EUR", "currentBalance": 864435.44, "description": "Debiteuren", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.Debiteuren.PaymentsEnabled", "id": "ef2fde36-4416-4bc5-b239-315b2929348c", "isBankAccount": false, "modifiedDate": "2022-10-26T13:36:17Z", "name": "Debiteuren", "nominalCode": "1300", "sourceModifiedDate": "2020-01-08T09:42:54Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Some thing account", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.Some thing account.PaymentsEnabled", "id": "ca2b96b7-cc45-4e35-9fa3-82a2ba1eec40", "isBankAccount": false, "modifiedDate": "2022-10-26T13:35:15Z", "name": "Some thing account", "nominalCode": "THING", "sourceModifiedDate": "2017-08-01T17:31:12Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Capital", "fullyQualifiedName": "Asset.Capital.Capital Asset Brought Forward", "id": "601", "isBankAccount": false, "modifiedDate": "2023-04-25T14:19:12Z", "name": "Capital Asset Brought Forward", "nominalCode": "601", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 51445.53, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset", "fullyQualifiedName": "Asset.Accounts Receivable", "id": "67357", "isBankAccount": false, "modifiedDate": "2023-03-24T16:07:24Z", "name": "Accounts Receivable", "nominalCode": "1200", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.BankAccount", "fullyQualifiedName": "Asset.BankAccount.16th Account", "id": "27840056", "isBankAccount": true, "modifiedDate": "2022-09-30T10:29:16Z", "name": "16th Account", "nominalCode": "70700", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "EUR", "currentBalance": -635.55, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "AcctPay.AcctPay", "fullyQualifiedName": "AcctPay.AcctPay.Accounts Payable", "id": "111", "isBankAccount": false, "modifiedDate": "2023-01-30T14:48:33Z", "name": "Accounts Payable", "nominalCode": "610", "sourceModifiedDate": "2021-08-11T12:51:21", "status": "Active", "type": "Liability", "validDatatypeLinks": []} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 93007.93, "description": "Accounts Receivable", "fullyQualifiedCategory": "Asset.CurrentAsset.AccountsReceivable", "fullyQualifiedName": "Asset.CurrentAsset.AccountsReceivable.Accounts Receivable", "id": "40000-933270541", "isBankAccount": false, "modifiedDate": "2023-04-26T09:06:23Z", "name": "Accounts Receivable", "nominalCode": "11000", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 41289.37, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors", "id": "62", "isBankAccount": false, "modifiedDate": "2023-01-18T11:02:34Z", "name": "Debtors", "nominalCode": "246", "sourceModifiedDate": "2022-12-08T15:42:59Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 3041173.77, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors", "id": "70", "isBankAccount": false, "modifiedDate": "2023-04-26T09:35:55Z", "name": "Debtors", "nominalCode": "610", "sourceModifiedDate": "2023-04-26T01:18:15Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Sage 200cloud: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "EUR", "currentBalance": 0, "description": "Bank Account", "fullyQualifiedCategory": "Asset.Bank Account", "fullyQualifiedName": "Asset.Bank Account.Bank Account", "id": "2864", "isBankAccount": false, "modifiedDate": "2022-10-14T09:35:52Z", "name": "Bank Account", "nominalCode": "1200", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived", "type": "Asset", "validDatatypeLinks": []} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 90640.61, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.CurrentAssets.Debtors", "fullyQualifiedName": "Asset.CurrentAssets.Debtors.Debtors Control Account", "id": "1100", "isBankAccount": false, "modifiedDate": "2023-03-30T14:42:44Z", "name": "Debtors Control Account", "nominalCode": "1100", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 49.61, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Abdi Internet Bank", "id": "e5889b459f544926ac5b8e6756df2ad4", "isBankAccount": true, "modifiedDate": "2022-10-24T14:52:53Z", "name": "Abdi Internet Bank", "nominalCode": "1560", "sourceModifiedDate": "2020-01-27T10:53:26Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable", "fullyQualifiedName": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable.Accounts Receivable", "id": "2", "isBankAccount": false, "modifiedDate": "2023-04-04T16:31:51Z", "name": "Accounts Receivable", "nominalCode": "12100", "sourceModifiedDate": "2020-01-29T01:42:43", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Wave: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 0, "description": "Test Balance Sheet", "fullyQualifiedCategory": "Asset.CashAndBank", "fullyQualifiedName": "Asset.CashAndBank.Abdi Bank", "id": "QWNjb3VudDo5MjIzNDE3NjkzMzk3NjA2MzM7QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2", "isBankAccount": true, "modifiedDate": "2022-11-16T18:15:17Z", "name": "Abdi Bank", "nominalCode": "610", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": 924.25, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Business Bank Account", "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", "isBankAccount": true, "modifiedDate": "2023-03-15T20:35:08Z", "name": "Business Bank Account", "nominalCode": "A090", "sourceModifiedDate": "2023-02-17T11:10:49", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id", "DirectIncome.LineItems.AccountRef.Id", "DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "200": + application/json: {"currency": "GBP", "currentBalance": -959.64, "description": "The money that customers owe you becomes the accounts receivable. A good example of this is a payment expected from an invoice sent to your customer.", "fullyQualifiedCategory": "Asset.accounts_receivable", "fullyQualifiedName": "Asset.accounts_receivable.Accounts Receivable", "id": "104957000000000352", "isBankAccount": false, "modifiedDate": "2022-10-03T08:40:43Z", "name": "Accounts Receivable", "nominalCode": "", "sourceModifiedDate": "2020-02-05T14:58:44", "status": "Active", "type": "Asset", "validDatatypeLinks": []} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-accounting-accounts: + "": + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Current", "fullyQualifiedName": "Asset.Current.Accounts Receivable", "id": "1b6266d1-1e44-46c5-8eb5-a8f98e03124e", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:15Z", "name": "Accounts Receivable", "nominalCode": "610", "sourceModifiedDate": "2022-12-10T16:39:00", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "A provision anticipating that a portion of accounts receivable will never be collected.", "fullyQualifiedCategory": "Asset.Current", "fullyQualifiedName": "Asset.Current.Accounts Receivable", "id": "76d5f23b-9623-4e3b-89cd-da57228764d3", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:15Z", "name": "Accounts Receivable", "nominalCode": "611", "sourceModifiedDate": "2022-10-19T05:49:00", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 98} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": " .", "fullyQualifiedName": "..", "id": "8eaed16d-c69f-ec11-80f1-0022481b4546", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:18Z", "name": "", "nominalCode": "45422026-68CA-4EF2-9", "sourceModifiedDate": "2022-03-09T16:31:54Z", "status": "Active", "type": "Unknown", "validDatatypeLinks": [{"links": ["DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]}, {"currency": "GBP", "currentBalance": 27.34, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": " .", "fullyQualifiedName": "..Account no cat Balance Sheet", "id": "c0861a65-c69f-ec11-80f1-0022481b4546", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:18Z", "name": "Account no cat Balance Sheet", "nominalCode": "10", "sourceModifiedDate": "2022-09-13T14:45:01Z", "status": "Active", "type": "Unknown", "validDatatypeLinks": [{"links": ["DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]}], "totalResults": 122} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "EUR", "currentBalance": 864435.44, "description": "Debiteuren", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.Debiteuren.PaymentsEnabled", "id": "ef2fde36-4416-4bc5-b239-315b2929348c", "isBankAccount": false, "modifiedDate": "2022-10-26T13:36:17Z", "name": "Debiteuren", "nominalCode": "1300", "sourceModifiedDate": "2020-01-08T09:42:54Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}, {"currency": "EUR", "currentBalance": 2174.82, "description": "One more AR account", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.One more AR account.PaymentsEnabled", "id": "2052b65b-20e9-4da1-85d8-fd5ca0ea3d38", "isBankAccount": false, "modifiedDate": "2022-10-26T13:36:17Z", "name": "One more AR account", "nominalCode": "888777888", "sourceModifiedDate": "2021-06-10T11:00:20Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}], "totalResults": 230} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Some thing account", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.Some thing account.PaymentsEnabled", "id": "ca2b96b7-cc45-4e35-9fa3-82a2ba1eec40", "isBankAccount": false, "modifiedDate": "2022-10-26T13:35:15Z", "name": "Some thing account", "nominalCode": "THING", "sourceModifiedDate": "2017-08-01T17:31:12Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}, {"currency": "GBP", "currentBalance": 4484655.39, "description": "Trade Debtors", "fullyQualifiedCategory": "Asset.Assets.AccountsReceivable", "fullyQualifiedName": "Asset.Assets.AccountsReceivable.Trade Debtors.PaymentsEnabled", "id": "cf9572e7-8afa-4339-9113-af32a66d9df9", "isBankAccount": false, "modifiedDate": "2022-10-26T13:35:15Z", "name": "Trade Debtors", "nominalCode": "15400", "sourceModifiedDate": "2020-01-08T13:48:38Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Transfer.To.AccountRef.Id", "Transfer.From.AccountRef.Id", "Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}], "totalResults": 121} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Capital", "fullyQualifiedName": "Asset.Capital.Capital Asset Brought Forward", "id": "601", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "name": "Capital Asset Brought Forward", "nominalCode": "601", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Capital", "fullyQualifiedName": "Asset.Capital.Capital Asset Depreciation Brought Forward", "id": "605", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "name": "Capital Asset Depreciation Brought Forward", "nominalCode": "605", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 292} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 51445.53, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset", "fullyQualifiedName": "Asset.Accounts Receivable", "id": "67357", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:24Z", "name": "Accounts Receivable", "nominalCode": "1200", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 51445.53, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable", "fullyQualifiedName": "Asset.Accounts Receivable.Accounts Receivable", "id": "128611", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:24Z", "name": "Accounts Receivable", "nominalCode": "1200-1", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 96} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.BankAccount", "fullyQualifiedName": "Asset.BankAccount.16th Account", "id": "27840056", "isBankAccount": true, "modifiedDate": "2022-09-30T10:29:16Z", "name": "16th Account", "nominalCode": "70700", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.BankAccount", "fullyQualifiedName": "Asset.BankAccount.1a1a", "id": "27840049", "isBankAccount": true, "modifiedDate": "2022-09-30T10:29:16Z", "name": "1a1a", "nominalCode": "70600", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 157} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "EUR", "currentBalance": -635.55, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "AcctPay.AcctPay", "fullyQualifiedName": "AcctPay.AcctPay.Accounts Payable", "id": "111", "isBankAccount": false, "modifiedDate": "2023-01-30T14:48:33Z", "name": "Accounts Payable", "nominalCode": "610", "sourceModifiedDate": "2021-08-11T12:51:21", "status": "Active", "type": "Liability", "validDatatypeLinks": []}, {"currency": "USD", "currentBalance": -565, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "AcctRec.AcctRec", "fullyQualifiedName": "AcctRec.AcctRec.Accounts Receivable", "id": "119", "isBankAccount": false, "modifiedDate": "2023-01-30T14:48:33Z", "name": "Accounts Receivable", "nominalCode": "610", "sourceModifiedDate": "2021-09-08T15:23:31", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 44} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 93007.93, "description": "Accounts Receivable", "fullyQualifiedCategory": "Asset.CurrentAsset.AccountsReceivable", "fullyQualifiedName": "Asset.CurrentAsset.AccountsReceivable.Accounts Receivable", "id": "40000-933270541", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:06:23Z", "name": "Accounts Receivable", "nominalCode": "11000", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 46954.1, "description": "Cash", "fullyQualifiedCategory": "Asset.CurrentAsset.Bank", "fullyQualifiedName": "Asset.CurrentAsset.Bank.Checking", "id": "20000-933270541", "isBankAccount": true, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:06:23Z", "name": "Checking", "nominalCode": "10100", "sourceModifiedDate": "2023-12-16T05:06:45", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["BillLineItem.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}], "totalResults": 116} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 41289.37, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors", "id": "62", "isBankAccount": false, "modifiedDate": "2023-01-18T11:02:34Z", "name": "Debtors", "nominalCode": "246", "sourceModifiedDate": "2022-12-08T15:42:59Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "AED", "currentBalance": -1533.44, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors - AED", "id": "92", "isBankAccount": false, "modifiedDate": "2023-01-18T11:02:34Z", "name": "Debtors - AED", "nominalCode": "247", "sourceModifiedDate": "2021-02-19T14:04:45Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 234} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 3041173.77, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors", "id": "70", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:55Z", "name": "Debtors", "nominalCode": "610", "sourceModifiedDate": "2023-04-26T01:18:15Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "USD", "currentBalance": 54822.37, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Accounts Receivable.AccountsReceivable", "fullyQualifiedName": "Asset.Accounts Receivable.AccountsReceivable.Debtors - USD", "id": "80", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:55Z", "name": "Debtors - USD", "nominalCode": "610", "sourceModifiedDate": "2023-04-12T15:10:38Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 186} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "USD", "currentBalance": 0, "description": "Bank Account", "fullyQualifiedCategory": "Asset.Bank Account", "fullyQualifiedName": "Asset.Bank Account.Bank Account", "id": "2864", "isBankAccount": false, "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-14T09:35:52Z", "name": "Bank Account", "nominalCode": "1200", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Bank Current Account", "fullyQualifiedCategory": "Asset.Bank Account", "fullyQualifiedName": "Asset.Bank Account.Bank Current Account", "id": "2368", "isBankAccount": true, "modifiedDate": "2022-10-14T09:35:52Z", "name": "Bank Current Account", "nominalCode": "1200", "sourceModifiedDate": "2020-09-11T13:53:12Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 344} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 90640.61, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.CurrentAssets.Debtors", "fullyQualifiedName": "Asset.CurrentAssets.Debtors.Debtors Control Account", "id": "1100", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:44Z", "name": "Debtors Control Account", "nominalCode": "1100", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.CurrentAssets.Debtors", "fullyQualifiedName": "Asset.CurrentAssets.Debtors.Other Debtors", "id": "1102", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:44Z", "name": "Other Debtors", "nominalCode": "1102", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 155} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 49.61, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Abdi Internet Bank", "id": "e5889b459f544926ac5b8e6756df2ad4", "isBankAccount": true, "modifiedDate": "2022-10-24T14:52:53Z", "name": "Abdi Internet Bank", "nominalCode": "1560", "sourceModifiedDate": "2020-01-27T10:53:26Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}, {"currency": "GBP", "currentBalance": 225830.75, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Abdi Live Test", "id": "b17083bc9b2748b4ab321b024e260eda", "isBankAccount": true, "modifiedDate": "2022-10-24T14:52:53Z", "name": "Abdi Live Test", "nominalCode": "147852", "sourceModifiedDate": "2020-01-28T14:00:20Z", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id"], "property": "Id"}]}], "totalResults": 283} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable", "fullyQualifiedName": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable.Accounts Receivable", "id": "2", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:51Z", "name": "Accounts Receivable", "nominalCode": "12100", "sourceModifiedDate": "2020-01-29T01:42:43", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable", "fullyQualifiedName": "Assets.Current Assets.Account Receivable, Net of Allowance.Accounts Receivable.Accounts Receivable.AR - Retainage", "id": "155", "isBankAccount": false, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:51Z", "name": "AR - Retainage", "nominalCode": "12710", "sourceModifiedDate": "2020-10-15T15:33:15", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 181} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 0, "description": "Test Balance Sheet", "fullyQualifiedCategory": "Asset.CashAndBank", "fullyQualifiedName": "Asset.CashAndBank.Abdi Bank", "id": "QWNjb3VudDo5MjIzNDE3NjkzMzk3NjA2MzM7QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2", "isBankAccount": true, "modifiedDate": "2022-11-16T18:15:17Z", "name": "Abdi Bank", "nominalCode": "610", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 0, "description": "Cash you haven�t deposited in the bank. Add your bank and credit card accounts to accurately categorize transactions that aren't cash.", "fullyQualifiedCategory": "Asset.CashAndBank", "fullyQualifiedName": "Asset.CashAndBank.Cash on Hand", "id": "QWNjb3VudDo3OTE3NTA1OTcwOTQxNzQ3MTU7QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2", "isBankAccount": true, "modifiedDate": "2022-11-16T18:15:17Z", "name": "Cash on Hand", "nominalCode": "610", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 85} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": 924.25, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Business Bank Account", "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", "isBankAccount": true, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:35:08Z", "name": "Business Bank Account", "nominalCode": "A090", "sourceModifiedDate": "2023-02-17T11:10:49", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id", "DirectIncome.LineItems.AccountRef.Id", "DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]}, {"currency": "GBP", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Bank", "fullyQualifiedName": "Asset.Bank.Business Savings Account", "id": "a8d6fb1a-8c5d-4683-90ce-bf9d28fc62ba", "isBankAccount": true, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:35:08Z", "name": "Business Savings Account", "nominalCode": "A091", "sourceModifiedDate": "2023-02-17T11:10:49", "status": "Active", "type": "Asset", "validDatatypeLinks": [{"links": ["Payment.AccountRef.Id", "BillPayment.AccountRef.Id", "DirectIncome.LineItems.AccountRef.Id", "DirectCost.LineItems.AccountRef.Id"], "property": "Id"}]}], "totalResults": 90} + 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/accounts?page=1&pageSize=2"}, "next": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/accounts?page=2&pageSize=2"}, "self": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/accounts"}}, "pageNumber": 1, "pageSize": 2, "results": [{"currency": "GBP", "currentBalance": -959.64, "description": "The money that customers owe you becomes the accounts receivable. A good example of this is a payment expected from an invoice sent to your customer.", "fullyQualifiedCategory": "Asset.accounts_receivable", "fullyQualifiedName": "Asset.accounts_receivable.Accounts Receivable", "id": "104957000000000352", "isBankAccount": false, "modifiedDate": "2022-10-03T08:40:43Z", "name": "Accounts Receivable", "nominalCode": "", "sourceModifiedDate": "2020-02-05T14:58:44", "status": "Active", "type": "Asset", "validDatatypeLinks": []}, {"currency": "GBP", "currentBalance": 69858.44, "description": "", "fullyQualifiedCategory": "Asset.bank", "fullyQualifiedName": "Asset.bank.Abdi Test", "id": "104957000000060010", "isBankAccount": true, "modifiedDate": "2022-10-03T08:40:43Z", "name": "Abdi Test", "nominalCode": "", "sourceModifiedDate": "2020-02-17T12:19:47", "status": "Active", "type": "Asset", "validDatatypeLinks": []}], "totalResults": 68} + 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-accounting-credit-note: + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"allocatedOnDate": "2022-10-23T00:00:00Z", "creditNoteNumber": "09/03 17.15", "currency": "USD", "currencyRate": 1, "customerRef": {"id": "80000002-1674552702"}, "discountPercentage": 0, "issueDate": "2023-03-09T02:21:26.726327+00:00", "lineItems": [{"description": "banana", "itemRef": {"id": "80000004-1675280003", "name": "test income item 1"}, "quantity": 1, "subTotal": 1.25, "taxAmount": 0, "totalAmount": 1.25, "tracking": {"categoryRefs": [], "isBilledTo": "Unknown", "isRebilledTo": "NotApplicable", "recordRef": {"dataType": "accountTransaction"}}, "unitAmount": 1.25}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "credit note 20230309 17.15", "paymentAllocations": [], "remainingCredit": 0, "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Submitted", "subTotal": 10.2, "totalAmount": 1.25, "totalDiscount": 0, "totalTaxAmount": 0} + 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": "e0aa590e-4b91-4def-b49d-b4ab6b626e21", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Failed", "statusCode": 114056} + "400": {} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"additionalTaxAmount": 0, "additionalTaxPercentage": 0, "allocatedOnDate": "2023-03-06T18:23:43.781Z", "creditNoteNumber": "07/03 14.24", "currency": "GBP", "currencyRate": 1, "customerRef": {"companyName": "string", "id": "CUST1"}, "discountPercentage": 0, "issueDate": "2023-03-07T18:23:43.781Z", "lineItems": [{"accountRef": {"id": "4000", "name": "string"}, "description": "credit note line 1", "discountAmount": 0, "discountPercentage": 0, "isDirectIncome": true, "quantity": 1, "subTotal": 60, "taxAmount": 0, "taxRateRef": {"effectiveTaxRate": 0, "id": "9", "name": "string"}, "totalAmount": 60, "tracking": {"categoryRefs": [{"id": "5049"}], "customerRef": {"id": "LND1203-139"}, "isBilledTo": "Unknown", "isRebilledTo": "Unknown", "projectRef": {"id": "D4039"}, "recordRef": {"dataType": "accountTransaction"}}, "trackingCategoryRefs": [{"id": "department_1"}], "unitAmount": 60}], "modifiedDate": "2022-10-23T00:00:00Z", "paymentAllocations": [], "remainingCredit": 60, "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Submitted", "subTotal": 60, "totalAmount": 60, "totalDiscount": 0, "totalTaxAmount": 0, "withholdingTax": [{"amount": 0, "name": "string"}]} + 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": "b2f9e5c0-bdc2-46ce-ae2b-284d5abcc9da", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "TimedOut", "statusCode": 743413} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"allocatedOnDate": "2022-10-23T00:00:00Z", "currency": "USD", "discountPercentage": "8726.47", "issueDate": "2022-10-23T00:00:00Z", "lineItems": [], "modifiedDate": "2022-10-23T00:00:00Z", "paymentAllocations": [], "remainingCredit": "3693.65", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Void", "subTotal": "1915.04", "totalAmount": "5893.9", "totalDiscount": "579.23", "totalTaxAmount": "3881.42"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-accounting-customer: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + 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-accounting-direct-income: + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"contactRef": {"dataType": "customers", "id": "80000002-1674552702"}, "currency": "USD", "issueDate": "2023-02-01T16:27:40.023Z", "lineItems": [{"accountRef": {"id": "80000007-1671793811"}, "description": "line description 1", "discountAmount": 0, "discountPercentage": 0, "quantity": 68, "subTotal": 5320, "taxAmount": 37, "totalAmount": 12, "trackingCategoryRefs": [{"id": "80000002-1674553271", "name": "string"}], "unitAmount": 9100}], "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "note": "test note", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2023-02-01T16:27:40.023Z", "currency": "USD", "currencyRate": 1, "totalAmount": 560}, "payment": {"accountRef": {"id": "80000028-1671794219"}, "currency": "USD", "currencyRate": 1, "id": "3594002235", "note": "payment allocations note", "paidOnDate": "2023-02-01T16:27:40.023Z", "reference": "230202 1217", "totalAmount": 560}}], "reference": null, "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": 0, "taxAmount": 9999, "totalAmount": 9999} + 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": "074ebc45-4f0a-4661-bb0d-6ce9482163af", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 484265} + "400": {} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "USD", "currencyRate": 0.5, "issueDate": "2023-03-31T00:00:00", "lineItems": [{"accountRef": {"id": "195"}, "quantity": 1, "taxRateRef": {"id": "99"}, "trackingCategoryRefs": [{"id": "DEPARTMENT-2", "name": "Services"}, {"id": "LOCATION-8", "name": "United Kingdom"}], "unitAmount": 9.99}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "Test 1", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2023-03-31T00:00:00", "currency": "USD", "totalAmount": 11.99}, "payment": {"accountRef": {"id": "289"}, "currency": "USD", "id": "4355", "note": "test note", "paidOnDate": "2023-03-31T00:00:00", "reference": "test reference", "totalAmount": 11.99}}], "reference": "test ref", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": 9.99, "taxAmount": 2, "totalAmount": 11.99} + responses: + "200": + application/json: {"changes": [{"recordRef": {"dataType": "directIncomes"}, "type": "Created"}], "companyId": "d7f743a9-1804-4116-8c8a-e606f7e2f66c", "completedOnUtc": "2022-10-23T00:00:00Z", "data": {"currency": "USD", "currencyRate": 0.5, "issueDate": "2023-03-31T00:00:00", "lineItems": [{"accountRef": {"id": "195"}, "quantity": 1, "taxRateRef": {"id": "99"}, "trackingCategoryRefs": [{"id": "DEPARTMENT-2", "name": "Services"}, {"id": "LOCATION-8", "name": "United Kingdom"}], "unitAmount": 9.99}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "Test 1", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2023-03-31T00:00:00", "currency": "USD", "totalAmount": 11.99}, "payment": {"accountRef": {"id": "289"}, "currency": "USD", "id": "4355", "note": "test note", "paidOnDate": "2023-03-31T00:00:00", "reference": "test reference", "totalAmount": 11.99}}], "reference": "test ref", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": 9.99, "taxAmount": 2, "totalAmount": 11.99}, "dataConnectionKey": "fa139396-523a-4a58-bf2b-8da82c8a673f", "dataType": "directIncomes", "pushOperationKey": "cc99d39b-5d87-4160-b582-42c69353d05b", "requestedOnUtc": "2023-03-31T14:24:46.2780738Z", "status": "Pending", "statusCode": 202, "validation": {"errors": [], "warnings": [{"itemId": "PaymentAllocations[0].Allocation.Currency", "message": "PaymentAllocations[0].Allocation.Currency is not supported, and will be ignored.", "validatorName": "Allocation"}, {"itemId": "PaymentAllocations[0].Allocation.TotalAmount", "message": "PaymentAllocations[0].Allocation.TotalAmount is not supported, and will be ignored.", "validatorName": "Allocation"}, {"itemId": "PaymentAllocations[0].Allocation.AllocatedOnDate", "message": "PaymentAllocations[0].Allocation.AllocatedOnDate is not supported, and will be ignored.", "validatorName": "Allocation"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.Id", "message": "PaymentAllocations[0].PaymentAllocationPayment.Id is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.Note", "message": "PaymentAllocations[0].PaymentAllocationPayment.Note is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.Reference", "message": "PaymentAllocations[0].PaymentAllocationPayment.Reference is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.Currency", "message": "PaymentAllocations[0].PaymentAllocationPayment.Currency is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.TotalAmount", "message": "PaymentAllocations[0].PaymentAllocationPayment.TotalAmount is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "PaymentAllocations[0].PaymentAllocationPayment.PaidOnDate", "message": "PaymentAllocations[0].PaymentAllocationPayment.PaidOnDate is not supported, and will be ignored.", "validatorName": "PaymentAllocationPayment"}, {"itemId": "SubTotal", "message": "SubTotal is not supported, and will be ignored.", "validatorName": "DirectIncome"}, {"itemId": "TotalAmount", "message": "TotalAmount is not supported, and will be ignored.", "validatorName": "DirectIncome"}, {"itemId": "TaxAmount", "message": "TaxAmount is not supported, and will be ignored.", "validatorName": "DirectIncome"}]}} + "400": {} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"contactRef": {"dataType": "suppliers", "id": "699f0091-b127-4796-9f15-41a2f42abeb2"}, "currency": "GBP", "issueDate": "2023-02-25", "lineItems": [{"accountRef": {"id": "c563b607-fb0e-4d06-9ddb-76fdeef20ae3"}, "description": "negative direct income", "quantity": -1, "subTotal": -35, "taxAmount": -7, "taxRateRef": {"id": "OUTPUT2"}, "totalAmount": -42, "unitAmount": 35}], "modifiedDate": "2022-10-23T00:00:00Z", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2022-10-23T00:00:00Z", "currency": "EUR", "totalAmount": -42}, "payment": {"accountRef": {"id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4"}, "currency": "GBP", "paidOnDate": "2022-10-23T00:00:00Z"}}], "reference": "Scenario One neg DI", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": -35, "taxAmount": -7, "totalAmount": -42} + responses: + "200": + application/json: {"changes": [{"recordRef": {"dataType": "directIncomes"}, "type": "Unknown"}], "companyId": "b5efee61-3fab-4a5d-9247-de03d6eda6db", "completedOnUtc": "2022-10-23T00:00:00Z", "data": {"contactRef": {"dataType": "suppliers", "id": "699f0091-b127-4796-9f15-41a2f42abeb2"}, "currency": "GBP", "issueDate": "2023-02-25T00:00:00", "lineItems": [{"accountRef": {"id": "c563b607-fb0e-4d06-9ddb-76fdeef20ae3"}, "description": "negative direct income", "quantity": -1, "subTotal": -35, "taxAmount": -7, "taxRateRef": {"id": "OUTPUT2"}, "totalAmount": -42, "trackingCategoryRefs": [], "unitAmount": 35}], "modifiedDate": "2022-10-23T00:00:00Z", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2022-10-23T00:00:00Z", "currency": "GBP", "totalAmount": -42}, "payment": {"accountRef": {"id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4"}, "currency": "GBP", "paidOnDate": "0001-01-01T00:00:00", "totalAmount": 0}}], "reference": "Scenario One neg DI", "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": 0, "taxAmount": -7, "totalAmount": -42}, "dataConnectionKey": "1e355304-4476-422e-95cb-fa2a6d47fab4", "dataType": "directIncomes", "pushOperationKey": "c3be9bb9-a771-4e5b-8b50-9e52748a730a", "requestedOnUtc": "2023-02-27T15:58:48.9160948Z", "status": "Pending", "statusCode": 202, "validation": {"errors": [], "warnings": []}} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "EUR", "issueDate": "2022-10-23T00:00:00Z", "lineItems": [], "modifiedDate": "2022-10-23T00:00:00Z", "paymentAllocations": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "subTotal": "6259.31", "taxAmount": "3251.14", "totalAmount": "9336.75"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-accounting-invoice: + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"additionalTaxAmount": 0, "additionalTaxPercentage": 0, "amountDue": 87326532, "currency": "USD", "currencyRate": 1, "customerRef": {"companyName": "Test Customer 1", "id": "80000002-1674552702"}, "discountPercentage": 0, "dueDate": "2023-05-24T11:09:01.438Z", "invoiceNumber": "18/04 15.26", "issueDate": "2023-04-18T11:09:01.438Z", "lineItems": [{"accountRef": {"id": "80000006-1671793811", "name": "Consulting Income"}, "description": "lineItems.description 1", "discountAmount": 0, "discountPercentage": 0, "itemRef": {"id": "80000004-1675280003", "name": "test income item 1"}, "quantity": 2, "subTotal": 30, "taxAmount": 0, "taxRateRef": {"effectiveTaxRate": 0, "id": "80000002-1671793802", "name": "Non (TAX CODE)"}, "totalAmount": 30, "tracking": {"categoryRefs": [], "isBilledTo": "Project", "isRebilledTo": "Project", "recordRef": {"dataType": "journalEntry"}}, "trackingCategoryRefs": [{"id": "80000004-1674554660", "name": "Class 3"}], "unitAmount": 15}], "modifiedDate": "2023-02-14T11:09:01.438Z", "note": "invoice push 20230418 15.26", "paidOnDate": "2023-02-10T11:09:01.438Z", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2023-02-14T11:09:01.438Z", "currency": "USD", "currencyRate": 1, "totalAmount": 725}, "payment": {"accountRef": {"id": "string", "name": "string"}, "currency": "USD", "currencyRate": 1, "id": "80000004-1789341990", "note": "string", "paidOnDate": "2023-02-14T11:09:01.438Z", "reference": "string", "totalAmount": 725}}], "salesOrderRefs": [], "sourceModifiedDate": "2023-02-14T11:09:01.438Z", "status": "Submitted", "subTotal": 30, "totalAmount": 30, "totalDiscount": 0, "totalTaxAmount": 0, "withholdingTax": [{"amount": 0, "name": "string"}]} + 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": "db9e9214-6b0c-41dd-b614-bbc4f2716597", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 240981} + "400": {} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"additionalTaxAmount": 0, "additionalTaxPercentage": 0, "amountDue": 0, "currency": "GBP", "currencyRate": 40, "customerRef": {"companyName": "string", "id": "CUST1"}, "discountPercentage": 0, "dueDate": "2023-05-04T12:58:21.273Z", "invoiceNumber": "22/03 11.36", "issueDate": "2022-03-22T12:58:21.273Z", "lineItems": [{"accountRef": {"id": "4000", "name": "string"}, "description": "desc 1", "discountAmount": 0, "discountPercentage": 0, "isDirectIncome": true, "itemRef": {"id": "string", "name": "string"}, "quantity": 2, "subTotal": 26, "taxAmount": 5.2, "taxRateRef": {"effectiveTaxRate": 0, "id": "1", "name": "string"}, "totalAmount": 31.2, "tracking": {"categoryRefs": [{"id": "D44"}], "customerRef": {"id": "cust_d12oe2jd4Ds"}, "isBilledTo": "Unknown", "isRebilledTo": "Unknown", "projectRef": {"id": "project_PROJ_TEST1"}, "recordRef": {"dataType": "accountTransaction"}}, "trackingCategoryRefs": [{"id": "department_1", "name": "string"}, {"id": "project_PROJ_TEST1", "name": "string"}], "unitAmount": 13}], "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "note": "note", "paidOnDate": "2022-12-05T12:58:21.273Z", "paymentAllocations": [{"allocation": {"allocatedOnDate": "2022-12-05T12:58:21.273Z", "currency": "GBP", "totalAmount": 0}, "payment": {"accountRef": {"id": "ad339_D22kd"}, "currency": "EUR", "id": "pay_d21230s", "note": "string", "paidOnDate": "2022-12-05T12:58:21.273Z", "reference": "REF12402", "totalAmount": 0}}], "salesOrderRefs": [{"dataType": "salesOrders", "id": "SO001"}], "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Submitted", "subTotal": null, "totalAmount": 0, "totalDiscount": 0, "totalTaxAmount": 0, "withholdingTax": [{"amount": 0, "name": "string"}]} + 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": "581c24a7-bde3-427d-b0c1-101f4c416fa0", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Failed", "statusCode": 959828} + "400": {} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"additionalTaxAmount": 0, "additionalTaxPercentage": 0, "amountDue": 0, "currency": "GBP", "currencyRate": 40, "customerRef": {"companyName": "Stanley Test", "id": "1291"}, "discountPercentage": 0, "dueDate": "2023-05-04T12:58:21.273Z", "invoiceNumber": "IN9923", "issueDate": "2022-04-06T12:58:21.273Z", "lineItems": [{"accountRef": {"id": "273", "name": "Transactor Clearing"}, "description": "desc line 1", "discountAmount": 0, "discountPercentage": 0, "quantity": 1, "subTotal": 400, "taxAmount": 300, "taxRateRef": {"effectiveTaxRate": 0, "id": "99", "name": "UK Sale Goods Standard Rate"}, "totalAmount": 999, "tracking": {"categoryRefs": [], "isBilledTo": "Project", "isRebilledTo": "Project", "recordRef": {"dataType": "invoice"}}, "trackingCategoryRefs": [{"id": "LOCATION-8", "name": "United Kingdom"}], "unitAmount": 400}], "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "note": "note 10.50 invoice", "paidOnDate": "2022-12-05T12:58:21.273Z", "paymentAllocations": [], "salesOrderRefs": [{"dataType": "salesOrders", "id": "104045"}], "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Submitted", "subTotal": null, "totalAmount": 0, "totalDiscount": 0, "totalTaxAmount": 0, "withholdingTax": [{"amount": 0, "name": "string"}]} + 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": "380c2d64-3a01-4eed-a97b-8e9a0add690a", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 279834} + "400": {} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"additionalTaxAmount": 0, "additionalTaxPercentage": 0, "amountDue": 100, "currency": "GBP", "currencyRate": 1, "customerRef": {"id": "69"}, "dueDate": "2023-04-02T00:00:00", "issueDate": "2023-04-02T00:00:00", "lineItems": [{"accountRef": {"id": "136", "name": "Services"}, "description": "Any random item", "isDirectIncome": false, "itemRef": {"id": "27"}, "quantity": 10, "subTotal": 100, "taxAmount": 0, "taxRateRef": {"id": "24_Invoices"}, "totalAmount": 100, "tracking": {"categoryRefs": [], "isBilledTo": "Project", "isRebilledTo": "NotApplicable", "recordRef": {"dataType": "transfer"}}, "trackingCategoryRefs": [], "unitAmount": 10}], "modifiedDate": "2022-10-23T00:00:00Z", "paidOnDate": "2022-10-23T00:00:00Z", "paymentAllocations": [], "salesOrderRefs": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Submitted", "totalAmount": 100, "totalDiscount": 0, "totalTaxAmount": 0, "withholdingTax": []} + 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": "5a0201e8-6ecb-4cda-b5ed-c6e6c6c98bf6", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Failed", "statusCode": 748502} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"amountDue": "598.23", "currency": "EUR", "dueDate": "2022-10-23T00:00:00Z", "issueDate": "2022-10-23T00:00:00Z", "lineItems": [], "modifiedDate": "2022-10-23T00:00:00Z", "paidOnDate": "2022-10-23T00:00:00Z", "paymentAllocations": [], "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Draft", "totalAmount": "7283.9", "totalTaxAmount": "1357.13"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-accounting-journal-entry: + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"createdOn": "2023-02-22T19:49:16.052Z", "description": "record level description", "journalLines": [{"accountRef": {"id": "80000019-1671793811", "name": "Office Supplies"}, "currency": "USD", "description": "journalLines.description debit", "netAmount": 23.02, "tracking": {"recordRefs": [{"dataType": "customers", "id": "80000001-1674553252"}]}}, {"accountRef": {"id": "8000001E-1671793811", "name": "Utilities"}, "currency": "USD", "description": "journalLines.description credit", "netAmount": -23.02, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "80000002-1674553271"}]}}], "journalRef": {"id": "12"}, "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "postedOn": "2023-02-23T19:49:16.052Z", "recordRef": {"dataType": "bills", "id": "80000002-6722155312"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2023-02-21T19:49:16.052Z"} + 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": "af724567-bd64-4a2d-90a2-7b1fbdeb024e", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 702098} + "400": {} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"createdOn": "2022-10-23T00:00:00Z", "description": "test", "journalLines": [{"accountRef": {"id": "151"}, "currency": "GBP", "description": "line desc 1", "netAmount": 9, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "154"}, "currency": "GBP", "description": "line desc 2", "netAmount": -9, "tracking": {"recordRefs": []}}], "journalRef": {"id": "207"}, "modifiedDate": "2022-10-23T00:00:00Z", "postedOn": "2023-03-29T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"} + responses: + "200": + application/json: {"changes": [{"recordRef": {"dataType": "journalEntries"}, "type": "Created"}], "companyId": "d7f743a9-1804-4116-8c8a-e606f7e2f66c", "completedOnUtc": "2022-10-23T00:00:00Z", "data": {"createdOn": "2022-10-23T00:00:00Z", "description": "test", "journalLines": [{"accountRef": {"id": "151"}, "currency": "GBP", "description": "line desc 1", "netAmount": 9, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "154"}, "currency": "GBP", "description": "line desc 2", "netAmount": -9, "tracking": {"recordRefs": []}}], "journalRef": {"id": "207"}, "modifiedDate": "2022-10-23T00:00:00Z", "postedOn": "2023-03-29T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"}, "dataConnectionKey": "fa139396-523a-4a58-bf2b-8da82c8a673f", "dataType": "journalEntries", "pushOperationKey": "b9c1381a-8742-4a45-9dc5-528101dbd0e3", "requestedOnUtc": "2023-03-31T14:53:44.6401039Z", "status": "Pending", "statusCode": 202} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"createdOn": "2022-10-23T00:00:00Z", "journalLines": [], "modifiedDate": "2022-10-23T00:00:00Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-accounting-payment: + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountRef": {"id": "8000002E-1675267199", "name": "Undeposited Funds"}, "currency": "USD", "currencyRate": 1, "customerRef": {"companyName": "string", "id": "80000002-1674552702"}, "date": "2023-02-10T11:47:04.792Z", "lines": [{"allocatedOnDate": "2023-02-11T11:47:04.792Z", "amount": 28, "links": [{"amount": -28, "currencyRate": 1, "id": "181-1676374586", "type": "Invoice"}]}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "note 14/02 1147", "paymentMethodRef": {"id": "string", "name": "string"}, "reference": "ref 14/02 1147", "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 28} + 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": "d734bfab-8067-45c0-8ca9-1ce975a60fec", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Success", "statusCode": 938323} + "400": {} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountRef": {"id": "1200", "name": "Bank Current Account"}, "currency": "GBP", "currencyRate": 1, "customerRef": {"id": "CUST1"}, "date": "2023-03-17T11:47:04.792Z", "lines": [{"allocatedOnDate": "2023-02-11T11:47:04.792Z", "amount": 4, "links": [{"amount": -4, "currencyRate": 1, "id": "INV-31", "type": "Invoice"}]}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "note 07/03 14.31", "paymentMethodRef": {"id": "4405"}, "reference": "ref", "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 4} + 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": "4b3850b8-7e69-45b0-8bd6-1d43368b8451", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 165949} + "400": {} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountRef": {"id": "9a25937b267a11e797950a57719b2edb", "name": "Current"}, "currency": "GBP", "currencyRate": 1, "customerRef": {"companyName": "Stanley test customer", "id": "30444c5bd4964fd787c7f8e2e5301ce1"}, "date": "2023-03-20T11:47:04.792Z", "lines": [{"allocatedOnDate": "2023-02-11T11:47:04.792Z", "amount": 0.17, "links": [{"amount": -0.17, "currencyRate": 1, "id": "bb85db9226d7450fb99eb83e7fb37505", "type": "Invoice"}]}], "modifiedDate": "2022-10-23T00:00:00Z", "note": "Need to send products asap.", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "reference": "normal payment 20/03 17.05", "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 0.17} + 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": "668899ff-d7a3-4d2b-8463-6b5654597c74", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Success", "statusCode": 955450} + "400": {} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountRef": {"id": "81"}, "currency": "EUR", "customerRef": {"id": "19"}, "date": "2022-03-12T00:00:00", "lines": [{"allocatedOnDate": "2022-10-23T00:00:00Z", "amount": 0, "links": [{"amount": -1.1, "id": "246", "type": "Invoice"}, {"amount": 1.1, "id": "280", "type": "CreditNote"}]}], "modifiedDate": "2022-10-23T00:00:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 0} + responses: + "200": + application/json: {"changes": [], "companyId": "ffa6368e-fde4-4165-9a0a-4bda1a6f916e", "completedOnUtc": "2022-10-23T00:00:00Z", "data": {"accountRef": {"id": "81"}, "currency": "EUR", "customerRef": {"id": "19"}, "date": "2022-03-12T00:00:00", "lines": [{"allocatedOnDate": "2022-10-23T00:00:00Z", "amount": 0, "links": [{"amount": -1.1, "id": "246", "type": "Invoice"}, {"amount": 1.1, "id": "280", "type": "CreditNote"}]}], "modifiedDate": "2022-10-23T00:00:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "totalAmount": 0}, "dataConnectionKey": "bbecdbf3-913a-43ae-9c91-e830b3686657", "dataType": "payments", "pushOperationKey": "673f5d97-1c53-41ef-b9c8-cc9a8415d17c", "requestedOnUtc": "0001-01-01T00:00:00", "status": "Pending", "statusCode": 202} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "EUR", "date": "2022-10-23T00:00:00Z", "lines": [], "modifiedDate": "2022-10-23T00:00:00Z", "paymentMethodRef": {"id": "EILBDVJVNUAGVKRQ", "name": "AliPay"}, "sourceModifiedDate": "2022-10-23T00:00:00Z"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + refresh-company-data: + 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-company-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} + get-accounting-company-info: + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"accountingPlatformRef": "1700060034_ETD", "addresses": [{"city": "London", "country": "United Kingdom", "line1": "301 Ink Rooms", "line2": "28 Easton Street", "postalCode": "WC1X 0BE", "region": "England", "type": "Billing"}, {"city": "London", "country": "UK", "line1": "28 Easton Street", "postalCode": "WC1X 0BE", "type": "Delivery"}], "baseCurrency": "GBP", "companyLegalName": "Codat Ltd", "companyName": "Codat", "createdDate": "2020-03-09T15:19:26", "financialYearStartDate": "2023-04-01T00:00:00", "ledgerLockDate": "2022-10-23T00:00:00Z", "phoneNumbers": [{"number": "02012 345678", "type": "Landline"}, {"number": "07123 456789", "type": "Mobile"}, {"number": "02012 345678", "type": "Fax"}], "registrationNumber": "5590111724", "sourceUrls": {"Api": "https://api.codat.io"}, "taxNumber": "74111622555799035846", "webLinks": [{"type": "Website", "url": "https://www.codat.io/"}, {"type": "Social", "url": "https://www.linkedin.com/company/codat-limited/"}]} + 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-company-info: + 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-push-operation: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + pushOperationKey: "59acd79e-29d3-4138-91d3-91d4641bf7ed" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-company-push-history: + "": + 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} + get-sync-status: + 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} + request-sync: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"syncTo": "2022-10-23T00:00:00Z"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + request-sync-for-date-range: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"dateRange": {"finish": "2022-10-23T00:00:00Z", "start": "2022-10-23T00:00:00Z"}} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-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-configuration: + 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} + get-integration-branding: + Unauthorized: + parameters: + path: + platformKey: "gbol" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-integrations: + "": + 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": [{"dataProvidedBy": "string", "datatypeFeatures": [{"dataType": "invoices", "supportedFeatures": [{"featureState": "Alpha", "featureType": "GetAttachments"}]}], "enabled": true, "integrationId": "497a18ca-284e-40c0-985d-f72be35d468e", "isBeta": true, "isOfflineConnector": true, "key": "gbol", "logoUrl": "http://example.com", "name": "Xero", "sourceId": "accounting", "sourceType": "Unknown"}], "totalResults": 1} + "400": {} + 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} + create-company: + "": + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "string"} + 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"} + "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} + create-connection: + 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": {} + 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} + 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": {} + 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-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} diff --git a/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.yaml b/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.yaml index fb040b821..f433d4ac6 100644 --- a/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.yaml +++ b/previous-versions/sync-for-commerce-version-1/.speakeasy/gen.yaml @@ -1,28 +1,19 @@ -configVersion: 1.0.0 -management: - docChecksum: 1d7cc7d07be3f391ff109aaa9777a017 - docVersion: '1.1' - speakeasyVersion: 1.126.3 - generationVersion: 2.214.3 +configVersion: 2.0.0 generation: - comments: {} sdkClassName: CodatSyncCommerce - repoURL: https://github.com/codatio/client-sdk-go.git usageSnippets: optionalPropertyRendering: withExample + fixes: + nameResolutionDec2023: false + parameterOrderingFeb2024: false + requestResponseComponentNamesFeb2024: false + auth: + oAuth2ClientCredentialsEnabled: false telemetryEnabled: true -features: - go: - constsAndDefaults: 0.1.2 - core: 3.2.0 - deprecations: 2.81.1 - examples: 2.81.3 - globalSecurity: 2.82.3 - globalServerURLs: 2.82.1 - nameOverrides: 2.81.1 - retries: 2.82.1 go: - version: 0.22.0 + version: 0.23.0 + additionalDependencies: {} + allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true flattenGlobalSecurity: false imports: @@ -34,9 +25,8 @@ go: shared: pkg/models/shared webhooks: pkg/models/webhooks inputModelSuffix: input - installationURL: https://github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1 maxMethodParams: 0 + methodArguments: require-security-and-request outputModelSuffix: output packageName: github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1 - published: true - repoSubDirectory: previous-versions/sync-for-commerce-version-1 + responseFormat: envelope diff --git a/previous-versions/sync-for-commerce-version-1/CONTRIBUTING.md b/previous-versions/sync-for-commerce-version-1/CONTRIBUTING.md new file mode 100644 index 000000000..d585717fc --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/README.md b/previous-versions/sync-for-commerce-version-1/README.md index fe6d7ec1b..2b679918d 100644 --- a/previous-versions/sync-for-commerce-version-1/README.md +++ b/previous-versions/sync-for-commerce-version-1/README.md @@ -4,9 +4,68 @@ Embedded accounting integrations for POS and eCommerce platforms. + +## Summary + +Sync for Commerce (v1): The API for Sync for Commerce V1. + +Sync for Commerce automatically replicates and reconciles sales data from a merchant’s source PoS, Payments, and eCommerce systems into their accounting software. This eliminates manual processing by merchants and transforms their ability to run and grow their business. + + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Company management | Create new and manage existing Sync for Commerce companies. | +| Configuration | Expressively configure preferences for any given Sync for Commerce company. | +| Sync flow preferences | Configure preferences for any given Sync for Commerce company using sync flow. | +| Sync | Initiate a sync of Sync for Commerce company data into their respective accounting software. | +| Integrations | View useful information about codat's integrations. | +| Companies | Create and manage your Codat companies. | +| Connections | Manage your companies' data connections. | +| Refresh data | Asynchronously retrieve data from an integration to refresh data in Codat. | +| Push data | View push options and get push statuses. | +| Accounting accounts | Retrieve standardized Accounts from linked accounting software. | +| Accounting credit notes | Retrieve standardized Credit notes from linked accounting software. | +| Accounting customers | Retrieve standardized Customers from linked accounting software. | +| Accounting direct incomes | Retrieve standardized Direct incomes from linked accounting software. | +| Accounting company info | Retrieve standardized Accounting company info from linked accounting software. | +| Accounting invoices | Retrieve standardized Invoices from linked accounting software. | +| Accounting journal entries | Retrieve standardized Journal entries from linked accounting software. | +| Accounting payments | Retrieve standardized Payments from linked accounting software. | +| Accounting bank accounts | Retrieve standardized Bank accounts from linked accounting software. | +| Commerce customers | Retrieve standardized Commerce customers from linked commerce software. | +| Commerce company info | Retrieve standardized Commerce company info from linked commerce software. | +| Commerce locations | Retrieve standardized Commerce locations from linked commerce software. | +| Commerce orders | Retrieve standardized Commerce orders from linked commerce software. | +| Commerce payments | Retrieve standardized Commerce payments from linked commerce software. | +| Commerce products | Retrieve standardized Commerce products from linked commerce software. | +| Commerce transactions | Retrieve standardized Commerce transactions from linked commerce software. | + + +[Read More...](https://docs.codat.io/commerce/overview) + +Not seeing what you expect? [See the main Sync for Commerce API](https://docs.codat.io/sync-for-commerce-api). + + + +## 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/previous-versions/sync-for-commerce-version-1 ``` @@ -43,7 +102,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -55,40 +113,59 @@ func main() { ## Available Resources and Operations -### [SyncFlowPreferences](docs/sdks/syncflowpreferences/README.md) - -* [GetConfigTextSyncFlow](docs/sdks/syncflowpreferences/README.md#getconfigtextsyncflow) - Retrieve preferences for text fields on sync flow -* [GetSyncFlowURL](docs/sdks/syncflowpreferences/README.md#getsyncflowurl) - Retrieve sync flow url -* [GetVisibleAccounts](docs/sdks/syncflowpreferences/README.md#getvisibleaccounts) - List visible accounts -* [UpdateConfigTextSyncFlow](docs/sdks/syncflowpreferences/README.md#updateconfigtextsyncflow) - Update preferences for text fields on sync flow -* [UpdateVisibleAccountsSyncFlow](docs/sdks/syncflowpreferences/README.md#updatevisibleaccountssyncflow) - Update the visible accounts on sync flow +
+Available methods -### [Companies](docs/sdks/companies/README.md) - -* [DeleteCompany](docs/sdks/companies/README.md#deletecompany) - Delete a company -* [GetCompany](docs/sdks/companies/README.md#getcompany) - Get company -* [UpdateCompany](docs/sdks/companies/README.md#updatecompany) - Update company - -### [Connections](docs/sdks/connections/README.md) +### [AccountingAccounts](docs/sdks/accountingaccounts/README.md) -* [DeleteConnection](docs/sdks/connections/README.md#deleteconnection) - Delete connection -* [GetConnection](docs/sdks/connections/README.md#getconnection) - Get connection -* [Unlink](docs/sdks/connections/README.md#unlink) - Unlink connection +* [CreateAccountingAccount](docs/sdks/accountingaccounts/README.md#createaccountingaccount) - Create account +* [GetAccountingAccount](docs/sdks/accountingaccounts/README.md#getaccountingaccount) - Get account +* [ListAccountingAccounts](docs/sdks/accountingaccounts/README.md#listaccountingaccounts) - List accounts ### [AccountingBankAccounts](docs/sdks/accountingbankaccounts/README.md) * [GetAccountingBankAccount](docs/sdks/accountingbankaccounts/README.md#getaccountingbankaccount) - Get bank account * [ListAccountingBankAccounts](docs/sdks/accountingbankaccounts/README.md#listaccountingbankaccounts) - List bank accounts -### [CommerceCustomers](docs/sdks/commercecustomers/README.md) +### [AccountingCompanyInfo](docs/sdks/accountingcompanyinfo/README.md) + +* [GetAccountingCompanyInfo](docs/sdks/accountingcompanyinfo/README.md#getaccountingcompanyinfo) - Get company info +* [Refresh](docs/sdks/accountingcompanyinfo/README.md#refresh) - Refresh company info + +### [AccountingCreditNotes](docs/sdks/accountingcreditnotes/README.md) + +* [CreateAccountingCreditNote](docs/sdks/accountingcreditnotes/README.md#createaccountingcreditnote) - Create credit note + +### [AccountingCustomers](docs/sdks/accountingcustomers/README.md) + +* [CreateAccountingCustomer](docs/sdks/accountingcustomers/README.md#createaccountingcustomer) - Create customer + +### [AccountingDirectIncomes](docs/sdks/accountingdirectincomes/README.md) + +* [CreateAccountingDirectIncome](docs/sdks/accountingdirectincomes/README.md#createaccountingdirectincome) - Create direct income + +### [AccountingInvoices](docs/sdks/accountinginvoices/README.md) + +* [CreateAccountingInvoice](docs/sdks/accountinginvoices/README.md#createaccountinginvoice) - Create invoice + +### [AccountingJournalEntries](docs/sdks/accountingjournalentries/README.md) + +* [CreateAccountingJournalEntry](docs/sdks/accountingjournalentries/README.md#createaccountingjournalentry) - Create journal entry + +### [AccountingPayments](docs/sdks/accountingpayments/README.md) + +* [CreateAccountingPayment](docs/sdks/accountingpayments/README.md#createaccountingpayment) - Create payment -* [GetCommerceCustomer](docs/sdks/commercecustomers/README.md#getcommercecustomer) - Get customer -* [ListCommerceCustomers](docs/sdks/commercecustomers/README.md#listcommercecustomers) - List customers ### [CommerceCompanyInfo](docs/sdks/commercecompanyinfo/README.md) * [GetCommerceCompanyInfo](docs/sdks/commercecompanyinfo/README.md#getcommercecompanyinfo) - Get company info +### [CommerceCustomers](docs/sdks/commercecustomers/README.md) + +* [GetCommerceCustomer](docs/sdks/commercecustomers/README.md#getcommercecustomer) - Get customer +* [ListCommerceCustomers](docs/sdks/commercecustomers/README.md#listcommercecustomers) - List customers + ### [CommerceLocations](docs/sdks/commercelocations/README.md) * [GetCommerceLocation](docs/sdks/commercelocations/README.md#getcommercelocation) - Get location @@ -116,35 +193,40 @@ func main() { * [GetCommerceTransaction](docs/sdks/commercetransactions/README.md#getcommercetransaction) - Get transaction * [ListCommerceTransactions](docs/sdks/commercetransactions/README.md#listcommercetransactions) - List transactions -### [AccountingAccounts](docs/sdks/accountingaccounts/README.md) - -* [CreateAccountingAccount](docs/sdks/accountingaccounts/README.md#createaccountingaccount) - Create account -* [GetAccountingAccount](docs/sdks/accountingaccounts/README.md#getaccountingaccount) - Get account -* [ListAccountingAccounts](docs/sdks/accountingaccounts/README.md#listaccountingaccounts) - List accounts - -### [AccountingCreditNotes](docs/sdks/accountingcreditnotes/README.md) +### [Companies](docs/sdks/companies/README.md) -* [CreateAccountingCreditNote](docs/sdks/accountingcreditnotes/README.md#createaccountingcreditnote) - Create credit note +* [DeleteCompany](docs/sdks/companies/README.md#deletecompany) - Delete a company +* [GetCompany](docs/sdks/companies/README.md#getcompany) - Get company +* [UpdateCompany](docs/sdks/companies/README.md#updatecompany) - Update company -### [AccountingCustomers](docs/sdks/accountingcustomers/README.md) +### [CompanyManagement](docs/sdks/companymanagement/README.md) -* [CreateAccountingCustomer](docs/sdks/accountingcustomers/README.md#createaccountingcustomer) - Create customer +* [CreateCompany](docs/sdks/companymanagement/README.md#createcompany) - Create sync for commerce company +* [CreateConnection](docs/sdks/companymanagement/README.md#createconnection) - Create connection +* [ListCompanies](docs/sdks/companymanagement/README.md#listcompanies) - List companies +* [ListConnections](docs/sdks/companymanagement/README.md#listconnections) - List data connections +* [UpdateConnection](docs/sdks/companymanagement/README.md#updateconnection) - Update data connection -### [AccountingDirectIncomes](docs/sdks/accountingdirectincomes/README.md) +### [Configuration](docs/sdks/configuration/README.md) -* [CreateAccountingDirectIncome](docs/sdks/accountingdirectincomes/README.md#createaccountingdirectincome) - Create direct income +* [GetConfiguration](docs/sdks/configuration/README.md#getconfiguration) - Retrieve config preferences set for a company +* [SetConfiguration](docs/sdks/configuration/README.md#setconfiguration) - Create or update configuration -### [AccountingInvoices](docs/sdks/accountinginvoices/README.md) +### [Connections](docs/sdks/connections/README.md) -* [CreateAccountingInvoice](docs/sdks/accountinginvoices/README.md#createaccountinginvoice) - Create invoice +* [DeleteConnection](docs/sdks/connections/README.md#deleteconnection) - Delete connection +* [GetConnection](docs/sdks/connections/README.md#getconnection) - Get connection +* [Unlink](docs/sdks/connections/README.md#unlink) - Unlink connection -### [AccountingJournalEntries](docs/sdks/accountingjournalentries/README.md) +### [Integrations](docs/sdks/integrations/README.md) -* [CreateAccountingJournalEntry](docs/sdks/accountingjournalentries/README.md#createaccountingjournalentry) - Create journal entry +* [GetIntegrationBranding](docs/sdks/integrations/README.md#getintegrationbranding) - Get branding for an integration +* [ListIntegrations](docs/sdks/integrations/README.md#listintegrations) - List integrations -### [AccountingPayments](docs/sdks/accountingpayments/README.md) +### [PushData](docs/sdks/pushdata/README.md) -* [CreateAccountingPayment](docs/sdks/accountingpayments/README.md#createaccountingpayment) - Create payment +* [GetOperation](docs/sdks/pushdata/README.md#getoperation) - Get push operation +* [ListOperations](docs/sdks/pushdata/README.md#listoperations) - List push operations ### [RefreshData](docs/sdks/refreshdata/README.md) @@ -154,39 +236,21 @@ func main() { * [GetPullOperation](docs/sdks/refreshdata/README.md#getpulloperation) - Get pull operation * [ListPullOperations](docs/sdks/refreshdata/README.md#listpulloperations) - List pull operations -### [AccountingCompanyInfo](docs/sdks/accountingcompanyinfo/README.md) - -* [GetAccountingCompanyInfo](docs/sdks/accountingcompanyinfo/README.md#getaccountingcompanyinfo) - Get company info -* [Refresh](docs/sdks/accountingcompanyinfo/README.md#refresh) - Refresh company info - -### [PushData](docs/sdks/pushdata/README.md) - -* [GetOperation](docs/sdks/pushdata/README.md#getoperation) - Get push operation -* [ListOperations](docs/sdks/pushdata/README.md#listoperations) - List push operations - ### [Sync](docs/sdks/sync/README.md) * [GetSyncStatus](docs/sdks/sync/README.md#getsyncstatus) - Get status for a company's syncs * [RequestSync](docs/sdks/sync/README.md#requestsync) - Sync new * [RequestSyncForDateRange](docs/sdks/sync/README.md#requestsyncfordaterange) - Sync range -### [Configuration](docs/sdks/configuration/README.md) - -* [GetConfiguration](docs/sdks/configuration/README.md#getconfiguration) - Retrieve config preferences set for a company -* [SetConfiguration](docs/sdks/configuration/README.md#setconfiguration) - Create or update configuration - -### [Integrations](docs/sdks/integrations/README.md) - -* [GetIntegrationBranding](docs/sdks/integrations/README.md#getintegrationbranding) - Get branding for an integration -* [ListIntegrations](docs/sdks/integrations/README.md#listintegrations) - List integrations +### [SyncFlowPreferences](docs/sdks/syncflowpreferences/README.md) -### [CompanyManagement](docs/sdks/companymanagement/README.md) +* [GetConfigTextSyncFlow](docs/sdks/syncflowpreferences/README.md#getconfigtextsyncflow) - Retrieve preferences for text fields on sync flow +* [GetSyncFlowURL](docs/sdks/syncflowpreferences/README.md#getsyncflowurl) - Retrieve sync flow url +* [GetVisibleAccounts](docs/sdks/syncflowpreferences/README.md#getvisibleaccounts) - List visible accounts +* [UpdateConfigTextSyncFlow](docs/sdks/syncflowpreferences/README.md#updateconfigtextsyncflow) - Update preferences for text fields on sync flow +* [UpdateVisibleAccountsSyncFlow](docs/sdks/syncflowpreferences/README.md#updatevisibleaccountssyncflow) - Update the visible accounts on sync flow -* [CreateCompany](docs/sdks/companymanagement/README.md#createcompany) - Create sync for commerce company -* [CreateConnection](docs/sdks/companymanagement/README.md#createconnection) - Create connection -* [ListCompanies](docs/sdks/companymanagement/README.md#listcompanies) - List companies -* [ListConnections](docs/sdks/companymanagement/README.md#listconnections) - List data connections -* [UpdateConnection](docs/sdks/companymanagement/README.md#updateconnection) - Update data connection +
@@ -202,9 +266,9 @@ func main() { ## Retries -Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. +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: +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 @@ -213,7 +277,7 @@ import ( syncforcommerceversion1 "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" - "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "log" "pkg/models/operations" ) @@ -229,9 +293,9 @@ func main() { res, err := s.SyncFlowPreferences.GetConfigTextSyncFlow(ctx, operations.GetConfigTextSyncFlowRequest{ Locale: shared.LocaleEnUs, }, operations.WithRetries( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -242,7 +306,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -250,7 +313,7 @@ func main() { ``` -If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization: +If you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization: ```go package main @@ -259,16 +322,16 @@ import ( syncforcommerceversion1 "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" - "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "log" ) func main() { s := syncforcommerceversion1.New( syncforcommerceversion1.WithRetryConfig( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -288,7 +351,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -305,7 +367,7 @@ Handling errors in this SDK should largely match your expectations. All operati | Error Object | Status Code | Content Type | | ----------------------- | ----------------------- | ----------------------- | | sdkerrors.ErrorMessage | 401,402,403,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | ### Example @@ -391,7 +453,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -429,7 +490,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -504,7 +564,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } diff --git a/previous-versions/sync-for-commerce-version-1/RELEASES.md b/previous-versions/sync-for-commerce-version-1/RELEASES.md index b05219f82..82241a0ec 100644 --- a/previous-versions/sync-for-commerce-version-1/RELEASES.md +++ b/previous-versions/sync-for-commerce-version-1/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [go v0.22.0] previous-versions/sync-for-commerce-version-1 ### Releases -- [Go v0.22.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/sync-for-commerce-version-1/v0.22.0 - previous-versions/sync-for-commerce-version-1 \ No newline at end of file +- [Go v0.22.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/sync-for-commerce-version-1/v0.22.0 - previous-versions/sync-for-commerce-version-1 + +## 2024-09-14 08:51:44 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.396.9 (2.415.7) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.23.0] previous-versions/sync-for-commerce-version-1 +### Releases +- [Go v0.23.0] https://github.com/codatio/client-sdk-go/releases/tag/previous-versions/sync-for-commerce-version-1/v0.23.0 - previous-versions/sync-for-commerce-version-1 \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/USAGE.md b/previous-versions/sync-for-commerce-version-1/USAGE.md index c50d25d11..9279c4a5a 100644 --- a/previous-versions/sync-for-commerce-version-1/USAGE.md +++ b/previous-versions/sync-for-commerce-version-1/USAGE.md @@ -24,7 +24,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } diff --git a/previous-versions/sync-for-commerce-version-1/accountingaccounts.go b/previous-versions/sync-for-commerce-version-1/accountingaccounts.go index 62fd4467c..e02cd1c03 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/accountingaccounts.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingAccounts - Accounts +// AccountingAccounts - Retrieve standardized Accounts from linked accounting software. type AccountingAccounts struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingAccounts(sdkConfig sdkConfiguration) *AccountingAccounts { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=chartOfAccounts) for integrations that support creating an account. func (s *AccountingAccounts) CreateAccountingAccount(ctx context.Context, request operations.CreateAccountingAccountRequest, opts ...operations.Option) (*operations.CreateAccountingAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingAccounts) CreateAccountingAccount(ctx context.Context, reques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/accounts", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/accounts", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AccountPrototype", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingAccounts) CreateAccountingAccount(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.CreateAccountingAccountResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateAccountResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingAccounts) CreateAccountingAccount(ctx context.Context, reques res.AccountingCreateAccountResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,22 +244,46 @@ func (s *AccountingAccounts) CreateAccountingAccount(ctx context.Context, reques fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetAccountingAccount - Get account @@ -178,9 +295,17 @@ func (s *AccountingAccounts) CreateAccountingAccount(ctx context.Context, reques // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request operations.GetAccountingAccountRequest, opts ...operations.Option) (*operations.GetAccountingAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-accounting-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -188,28 +313,43 @@ func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request o return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/accounts/{accountId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/accounts/{accountId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -217,46 +357,109 @@ func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request o }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + 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 + } + } + } res := &operations.GetAccountingAccountResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingAccount if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -264,7 +467,12 @@ func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request o res.AccountingAccount = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -282,22 +490,46 @@ func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request o fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListAccountingAccounts - List accounts @@ -307,9 +539,17 @@ func (s *AccountingAccounts) GetAccountingAccount(ctx context.Context, request o // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *AccountingAccounts) ListAccountingAccounts(ctx context.Context, request operations.ListAccountingAccountsRequest, opts ...operations.Option) (*operations.ListAccountingAccountsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-accounting-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -317,32 +557,47 @@ func (s *AccountingAccounts) ListAccountingAccounts(ctx context.Context, request return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/accounts", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/accounts", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -350,46 +605,109 @@ func (s *AccountingAccounts) ListAccountingAccounts(ctx context.Context, request }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + 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 + } + } + } res := &operations.ListAccountingAccountsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingAccounts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -397,7 +715,12 @@ func (s *AccountingAccounts) ListAccountingAccounts(ctx context.Context, request res.AccountingAccounts = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -417,20 +740,44 @@ func (s *AccountingAccounts) ListAccountingAccounts(ctx context.Context, request fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingbankaccounts.go b/previous-versions/sync-for-commerce-version-1/accountingbankaccounts.go index 50d5d64cd..d934a2020 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingbankaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/accountingbankaccounts.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingBankAccounts - Bank accounts +// AccountingBankAccounts - Retrieve standardized Bank accounts from linked accounting software. type AccountingBankAccounts struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newAccountingBankAccounts(sdkConfig sdkConfiguration) *AccountingBankAccoun // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, request operations.GetAccountingBankAccountRequest, opts ...operations.Option) (*operations.GetAccountingBankAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-accounting-bank-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, r return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{accountId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{accountId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, r }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetAccountingBankAccountResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingBankAccount if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, r res.AccountingBankAccount = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, r fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListAccountingBankAccounts - List bank accounts @@ -163,9 +281,17 @@ func (s *AccountingBankAccounts) GetAccountingBankAccount(ctx context.Context, r // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *AccountingBankAccounts) ListAccountingBankAccounts(ctx context.Context, request operations.ListAccountingBankAccountsRequest, opts ...operations.Option) (*operations.ListAccountingBankAccountsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-accounting-bank-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,32 +299,47 @@ func (s *AccountingBankAccounts) ListAccountingBankAccounts(ctx context.Context, return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/bankAccounts", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -206,46 +347,109 @@ func (s *AccountingBankAccounts) ListAccountingBankAccounts(ctx context.Context, }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListAccountingBankAccountsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingBankAccounts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,7 +457,12 @@ func (s *AccountingBankAccounts) ListAccountingBankAccounts(ctx context.Context, res.AccountingBankAccounts = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -273,20 +482,44 @@ func (s *AccountingBankAccounts) ListAccountingBankAccounts(ctx context.Context, fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingcompanyinfo.go b/previous-versions/sync-for-commerce-version-1/accountingcompanyinfo.go index 15a85a55d..b4ca48187 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingcompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/accountingcompanyinfo.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingCompanyInfo - Company info +// AccountingCompanyInfo - Retrieve standardized Accounting company info from linked accounting software. type AccountingCompanyInfo struct { sdkConfiguration sdkConfiguration } @@ -28,9 +31,17 @@ func newAccountingCompanyInfo(sdkConfig sdkConfiguration) *AccountingCompanyInfo // GetAccountingCompanyInfo - Get company info // Gets the latest basic info for a company. func (s *AccountingCompanyInfo) GetAccountingCompanyInfo(ctx context.Context, request operations.GetAccountingCompanyInfoRequest, opts ...operations.Option) (*operations.GetAccountingCompanyInfoResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-accounting-company-info", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -38,28 +49,43 @@ func (s *AccountingCompanyInfo) GetAccountingCompanyInfo(ctx context.Context, re return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/info", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/info", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -67,46 +93,109 @@ func (s *AccountingCompanyInfo) GetAccountingCompanyInfo(ctx context.Context, re }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetAccountingCompanyInfoResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCompanyDataset if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -114,7 +203,12 @@ func (s *AccountingCompanyInfo) GetAccountingCompanyInfo(ctx context.Context, re res.AccountingCompanyDataset = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -132,30 +226,62 @@ func (s *AccountingCompanyInfo) GetAccountingCompanyInfo(ctx context.Context, re fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // Refresh company info // Initiates the process of synchronising basic info for a company func (s *AccountingCompanyInfo) Refresh(ctx context.Context, request operations.RefreshCompanyInfoRequest, opts ...operations.Option) (*operations.RefreshCompanyInfoResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "refresh-company-info", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -163,28 +289,43 @@ func (s *AccountingCompanyInfo) Refresh(ctx context.Context, request operations. return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/info", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/info", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -192,46 +333,109 @@ func (s *AccountingCompanyInfo) Refresh(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.RefreshCompanyInfoResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Dataset if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -239,7 +443,12 @@ func (s *AccountingCompanyInfo) Refresh(ctx context.Context, request operations. res.Dataset = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -255,20 +464,44 @@ func (s *AccountingCompanyInfo) Refresh(ctx context.Context, request operations. fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingcreditnotes.go b/previous-versions/sync-for-commerce-version-1/accountingcreditnotes.go index f9e32ac19..9de591fa7 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingcreditnotes.go +++ b/previous-versions/sync-for-commerce-version-1/accountingcreditnotes.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingCreditNotes - Credit notes +// AccountingCreditNotes - Retrieve standardized Credit notes from linked accounting software. type AccountingCreditNotes struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingCreditNotes(sdkConfig sdkConfiguration) *AccountingCreditNotes // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=creditNotes) for integrations that support creating an account. func (s *AccountingCreditNotes) CreateAccountingCreditNote(ctx context.Context, request operations.CreateAccountingCreditNoteRequest, opts ...operations.Option) (*operations.CreateAccountingCreditNoteResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-credit-note", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingCreditNotes) CreateAccountingCreditNote(ctx context.Context, return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/creditNotes", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/creditNotes", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingCreditNote", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingCreditNotes) CreateAccountingCreditNote(ctx context.Context, }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingCreditNoteResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateCreditNoteResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingCreditNotes) CreateAccountingCreditNote(ctx context.Context, res.AccountingCreateCreditNoteResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingCreditNotes) CreateAccountingCreditNote(ctx context.Context, fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingcustomers.go b/previous-versions/sync-for-commerce-version-1/accountingcustomers.go index ee1fade84..19cfc5f6b 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingcustomers.go +++ b/previous-versions/sync-for-commerce-version-1/accountingcustomers.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingCustomers - Customers +// AccountingCustomers - Retrieve standardized Customers from linked accounting software. type AccountingCustomers struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingCustomers(sdkConfig sdkConfiguration) *AccountingCustomers { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support creating an account. func (s *AccountingCustomers) CreateAccountingCustomer(ctx context.Context, request operations.CreateAccountingCustomerRequest, opts ...operations.Option) (*operations.CreateAccountingCustomerResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-customer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingCustomers) CreateAccountingCustomer(ctx context.Context, requ return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/customers", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/customers", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingCustomer", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingCustomers) CreateAccountingCustomer(ctx context.Context, requ }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingCustomerResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateCustomerResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingCustomers) CreateAccountingCustomer(ctx context.Context, requ res.AccountingCreateCustomerResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingCustomers) CreateAccountingCustomer(ctx context.Context, requ fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingdirectincomes.go b/previous-versions/sync-for-commerce-version-1/accountingdirectincomes.go index 5ea00f021..c6567d290 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingdirectincomes.go +++ b/previous-versions/sync-for-commerce-version-1/accountingdirectincomes.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingDirectIncomes - Direct incomes +// AccountingDirectIncomes - Retrieve standardized Direct incomes from linked accounting software. type AccountingDirectIncomes struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingDirectIncomes(sdkConfig sdkConfiguration) *AccountingDirectInc // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=directIncomes) for integrations that support creating an account. func (s *AccountingDirectIncomes) CreateAccountingDirectIncome(ctx context.Context, request operations.CreateAccountingDirectIncomeRequest, opts ...operations.Option) (*operations.CreateAccountingDirectIncomeResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-direct-income", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingDirectIncomes) CreateAccountingDirectIncome(ctx context.Conte return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/directIncomes", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/directIncomes", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingDirectIncome", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingDirectIncomes) CreateAccountingDirectIncome(ctx context.Conte }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingDirectIncomeResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateDirectIncomeResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingDirectIncomes) CreateAccountingDirectIncome(ctx context.Conte res.AccountingCreateDirectIncomeResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingDirectIncomes) CreateAccountingDirectIncome(ctx context.Conte fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountinginvoices.go b/previous-versions/sync-for-commerce-version-1/accountinginvoices.go index 9722b1362..0e92c69bd 100644 --- a/previous-versions/sync-for-commerce-version-1/accountinginvoices.go +++ b/previous-versions/sync-for-commerce-version-1/accountinginvoices.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingInvoices - Invoices +// AccountingInvoices - Retrieve standardized Invoices from linked accounting software. type AccountingInvoices struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingInvoices(sdkConfig sdkConfiguration) *AccountingInvoices { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=invoices) for integrations that support creating an account. func (s *AccountingInvoices) CreateAccountingInvoice(ctx context.Context, request operations.CreateAccountingInvoiceRequest, opts ...operations.Option) (*operations.CreateAccountingInvoiceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-invoice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingInvoices) CreateAccountingInvoice(ctx context.Context, reques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/invoices", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/invoices", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingInvoice", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingInvoices) CreateAccountingInvoice(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingInvoiceResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateInvoiceResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingInvoices) CreateAccountingInvoice(ctx context.Context, reques res.AccountingCreateInvoiceResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingInvoices) CreateAccountingInvoice(ctx context.Context, reques fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingjournalentries.go b/previous-versions/sync-for-commerce-version-1/accountingjournalentries.go index 108e86112..981ac124e 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingjournalentries.go +++ b/previous-versions/sync-for-commerce-version-1/accountingjournalentries.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingJournalEntries - Journal entries +// AccountingJournalEntries - Retrieve standardized Journal entries from linked accounting software. type AccountingJournalEntries struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingJournalEntries(sdkConfig sdkConfiguration) *AccountingJournalE // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=journalEntries) for integrations that support creating an account. func (s *AccountingJournalEntries) CreateAccountingJournalEntry(ctx context.Context, request operations.CreateAccountingJournalEntryRequest, opts ...operations.Option) (*operations.CreateAccountingJournalEntryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-journal-entry", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingJournalEntries) CreateAccountingJournalEntry(ctx context.Cont return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/journalEntries", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/journalEntries", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingJournalEntry", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingJournalEntries) CreateAccountingJournalEntry(ctx context.Cont }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingJournalEntryResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreateJournalEntryResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingJournalEntries) CreateAccountingJournalEntry(ctx context.Cont res.AccountingCreateJournalEntryResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingJournalEntries) CreateAccountingJournalEntry(ctx context.Cont fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/accountingpayments.go b/previous-versions/sync-for-commerce-version-1/accountingpayments.go index dd584d2c6..766c45893 100644 --- a/previous-versions/sync-for-commerce-version-1/accountingpayments.go +++ b/previous-versions/sync-for-commerce-version-1/accountingpayments.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// AccountingPayments - Payments +// AccountingPayments - Retrieve standardized Payments from linked accounting software. type AccountingPayments struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccountingPayments(sdkConfig sdkConfiguration) *AccountingPayments { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=payments) for integrations that support creating an account. func (s *AccountingPayments) CreateAccountingPayment(ctx context.Context, request operations.CreateAccountingPaymentRequest, opts ...operations.Option) (*operations.CreateAccountingPaymentResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-accounting-payment", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -46,39 +57,53 @@ func (s *AccountingPayments) CreateAccountingPayment(ctx context.Context, reques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/payments", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/payments", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AccountingPayment", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,46 +111,109 @@ func (s *AccountingPayments) CreateAccountingPayment(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateAccountingPaymentResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.AccountingCreatePaymentResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,7 +221,12 @@ func (s *AccountingPayments) CreateAccountingPayment(ctx context.Context, reques res.AccountingCreatePaymentResponse = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -151,20 +244,44 @@ func (s *AccountingPayments) CreateAccountingPayment(ctx context.Context, reques fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/codatsynccommerce.go b/previous-versions/sync-for-commerce-version-1/codatsynccommerce.go index f6162c5e2..753a8e57e 100644 --- a/previous-versions/sync-for-commerce-version-1/codatsynccommerce.go +++ b/previous-versions/sync-for-commerce-version-1/codatsynccommerce.go @@ -1,11 +1,13 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforcommerceversion1 import ( "context" "fmt" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "net/http" "time" @@ -40,9 +42,11 @@ 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 { - DefaultClient HTTPClient - SecurityClient HTTPClient + Client HTTPClient Security func(context.Context) (interface{}, error) ServerURL string ServerIndex int @@ -51,7 +55,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,6 +72,38 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // // Sync for Commerce automatically replicates and reconciles sales data from a merchant’s source PoS, Payments, and eCommerce systems into their accounting software. This eliminates manual processing by merchants and transforms their ability to run and grow their business. // +// +// ## Endpoints +// +// | Endpoints | Description | +// | :- |:- | +// | Company management | Create new and manage existing Sync for Commerce companies. | +// | Configuration | Expressively configure preferences for any given Sync for Commerce company. | +// | Sync flow preferences | Configure preferences for any given Sync for Commerce company using sync flow. | +// | Sync | Initiate a sync of Sync for Commerce company data into their respective accounting software. | +// | Integrations | View useful information about codat's integrations. | +// | Companies | Create and manage your Codat companies. | +// | Connections | Manage your companies' data connections. | +// | Refresh data | Asynchronously retrieve data from an integration to refresh data in Codat. | +// | Push data | View push options and get push statuses. | +// | Accounting accounts | Retrieve standardized Accounts from linked accounting software. | +// | Accounting credit notes | Retrieve standardized Credit notes from linked accounting software. | +// | Accounting customers | Retrieve standardized Customers from linked accounting software. | +// | Accounting direct incomes | Retrieve standardized Direct incomes from linked accounting software. | +// | Accounting company info | Retrieve standardized Accounting company info from linked accounting software. | +// | Accounting invoices | Retrieve standardized Invoices from linked accounting software. | +// | Accounting journal entries | Retrieve standardized Journal entries from linked accounting software. | +// | Accounting payments | Retrieve standardized Payments from linked accounting software. | +// | Accounting bank accounts | Retrieve standardized Bank accounts from linked accounting software. | +// | Commerce customers | Retrieve standardized Commerce customers from linked commerce software. | +// | Commerce company info | Retrieve standardized Commerce company info from linked commerce software. | +// | Commerce locations | Retrieve standardized Commerce locations from linked commerce software. | +// | Commerce orders | Retrieve standardized Commerce orders from linked commerce software. | +// | Commerce payments | Retrieve standardized Commerce payments from linked commerce software. | +// | Commerce products | Retrieve standardized Commerce products from linked commerce software. | +// | Commerce transactions | Retrieve standardized Commerce transactions from linked commerce software. | +// +// // [Read More...](https://docs.codat.io/commerce/overview) // // Not seeing what you expect? [See the main Sync for Commerce API](https://docs.codat.io/sync-for-commerce-api). @@ -76,39 +114,39 @@ type CodatSyncCommerce struct { Companies *Companies // Manage your companies' data connections. Connections *Connections - // Bank accounts + // Retrieve standardized Bank accounts from linked accounting software. AccountingBankAccounts *AccountingBankAccounts - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce customers from linked commerce software. CommerceCustomers *CommerceCustomers - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce company info from linked commerce software. CommerceCompanyInfo *CommerceCompanyInfo - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce locations from linked commerce software. CommerceLocations *CommerceLocations - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce orders from linked commerce software. CommerceOrders *CommerceOrders - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce payments from linked commerce software. CommercePayments *CommercePayments - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce products from linked commerce software. CommerceProducts *CommerceProducts - // Retrieve standardized data from linked commerce platforms. + // Retrieve standardized Commerce transactions from linked commerce software. CommerceTransactions *CommerceTransactions - // Accounts + // Retrieve standardized Accounts from linked accounting software. AccountingAccounts *AccountingAccounts - // Credit notes + // Retrieve standardized Credit notes from linked accounting software. AccountingCreditNotes *AccountingCreditNotes - // Customers + // Retrieve standardized Customers from linked accounting software. AccountingCustomers *AccountingCustomers - // Direct incomes + // Retrieve standardized Direct incomes from linked accounting software. AccountingDirectIncomes *AccountingDirectIncomes - // Invoices + // Retrieve standardized Invoices from linked accounting software. AccountingInvoices *AccountingInvoices - // Journal entries + // Retrieve standardized Journal entries from linked accounting software. AccountingJournalEntries *AccountingJournalEntries - // Payments + // Retrieve standardized Payments from linked accounting software. AccountingPayments *AccountingPayments // Asynchronously retrieve data from an integration to refresh data in Codat. RefreshData *RefreshData - // Company info + // Retrieve standardized Accounting company info from linked accounting software. AccountingCompanyInfo *AccountingCompanyInfo // View push options and get push statuses. PushData *PushData @@ -158,20 +196,14 @@ func WithServerIndex(serverIndex int) SDKOption { // WithClient allows the overriding of the default HTTP client used by the SDK func WithClient(client HTTPClient) SDKOption { return func(sdk *CodatSyncCommerce) { - sdk.sdkConfiguration.DefaultClient = client - } -} - -func withSecurity(security interface{}) func(context.Context) (interface{}, error) { - return func(context.Context) (interface{}, error) { - return &security, nil + sdk.sdkConfiguration.Client = client } } // WithSecurity configures the SDK to use the provided security details func WithSecurity(security shared.Security) SDKOption { return func(sdk *CodatSyncCommerce) { - sdk.sdkConfiguration.Security = withSecurity(security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) } } @@ -184,21 +216,29 @@ func WithSecuritySource(security func(context.Context) (shared.Security, error)) } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *CodatSyncCommerce) { sdk.sdkConfiguration.RetryConfig = &retryConfig } } +// WithTimeout Optional request timeout applied to each operation +func WithTimeout(timeout time.Duration) SDKOption { + return func(sdk *CodatSyncCommerce) { + sdk.sdkConfiguration.Timeout = &timeout + } +} + // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *CodatSyncCommerce { sdk := &CodatSyncCommerce{ sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.1", - SDKVersion: "0.22.0", - GenVersion: "2.214.3", - UserAgent: "speakeasy-sdk/go 0.22.0 2.214.3 1.1 github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1", + SDKVersion: "0.23.0", + GenVersion: "2.415.7", + UserAgent: "speakeasy-sdk/go 0.23.0 2.415.7 1.1 github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1", + Hooks: hooks.New(), }, } for _, opt := range opts { @@ -206,15 +246,15 @@ func New(opts ...SDKOption) *CodatSyncCommerce { } // Use WithClient to override the default client if you would like to customize the timeout - if sdk.sdkConfiguration.DefaultClient == nil { - sdk.sdkConfiguration.DefaultClient = &http.Client{Timeout: 60 * time.Second} + if sdk.sdkConfiguration.Client == nil { + sdk.sdkConfiguration.Client = &http.Client{Timeout: 60 * time.Second} } - if sdk.sdkConfiguration.SecurityClient == nil { - if sdk.sdkConfiguration.Security != nil { - sdk.sdkConfiguration.SecurityClient = utils.ConfigureSecurityClient(sdk.sdkConfiguration.DefaultClient, sdk.sdkConfiguration.Security) - } else { - sdk.sdkConfiguration.SecurityClient = sdk.sdkConfiguration.DefaultClient - } + + currentServerURL, _ := sdk.sdkConfiguration.GetServerDetails() + serverURL := currentServerURL + serverURL, sdk.sdkConfiguration.Client = sdk.sdkConfiguration.Hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) + if serverURL != currentServerURL { + sdk.sdkConfiguration.ServerURL = serverURL } sdk.SyncFlowPreferences = newSyncFlowPreferences(sdk.sdkConfiguration) diff --git a/previous-versions/sync-for-commerce-version-1/commercecompanyinfo.go b/previous-versions/sync-for-commerce-version-1/commercecompanyinfo.go index 56fcb2a67..44af58b4a 100644 --- a/previous-versions/sync-for-commerce-version-1/commercecompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/commercecompanyinfo.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceCompanyInfo - Retrieve standardized data from linked commerce platforms. +// CommerceCompanyInfo - Retrieve standardized Commerce company info from linked commerce software. type CommerceCompanyInfo struct { sdkConfiguration sdkConfiguration } @@ -26,13 +29,21 @@ func newCommerceCompanyInfo(sdkConfig sdkConfiguration) *CommerceCompanyInfo { } // GetCommerceCompanyInfo - Get company info -// Retrieve information about the company, as seen in the commerce platform. +// Retrieve information about the company, as seen in the commerce software. // // This may include information like addresses, tax registration details and social media or website information. func (s *CommerceCompanyInfo) GetCommerceCompanyInfo(ctx context.Context, request operations.GetCommerceCompanyInfoRequest, opts ...operations.Option) (*operations.GetCommerceCompanyInfoResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-company-info", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -40,28 +51,43 @@ func (s *CommerceCompanyInfo) GetCommerceCompanyInfo(ctx context.Context, reques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-info", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-info", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -69,46 +95,109 @@ func (s *CommerceCompanyInfo) GetCommerceCompanyInfo(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceCompanyInfoResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceCompanyInfo if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -116,7 +205,12 @@ func (s *CommerceCompanyInfo) GetCommerceCompanyInfo(ctx context.Context, reques res.CommerceCompanyInfo = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -134,20 +228,44 @@ func (s *CommerceCompanyInfo) GetCommerceCompanyInfo(ctx context.Context, reques fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commercecustomers.go b/previous-versions/sync-for-commerce-version-1/commercecustomers.go index 01cbbdada..6412705c8 100644 --- a/previous-versions/sync-for-commerce-version-1/commercecustomers.go +++ b/previous-versions/sync-for-commerce-version-1/commercecustomers.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceCustomers - Retrieve standardized data from linked commerce platforms. +// CommerceCustomers - Retrieve standardized Commerce customers from linked commerce software. type CommerceCustomers struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommerceCustomers(sdkConfig sdkConfiguration) *CommerceCustomers { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request operations.GetCommerceCustomerRequest, opts ...operations.Option) (*operations.GetCommerceCustomerResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-customer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request ope return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request ope }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceCustomerResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceCustomer if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request ope res.CommerceCustomer = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request ope fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommerceCustomers - List customers @@ -163,9 +281,17 @@ func (s *CommerceCustomers) GetCommerceCustomer(ctx context.Context, request ope // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceCustomers) ListCommerceCustomers(ctx context.Context, request operations.ListCommerceCustomersRequest, opts ...operations.Option) (*operations.ListCommerceCustomersResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-customers", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,32 +299,47 @@ func (s *CommerceCustomers) ListCommerceCustomers(ctx context.Context, request o return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-customers", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-customers", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -206,46 +347,109 @@ func (s *CommerceCustomers) ListCommerceCustomers(ctx context.Context, request o }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommerceCustomersResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceCustomers if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,7 +457,12 @@ func (s *CommerceCustomers) ListCommerceCustomers(ctx context.Context, request o res.CommerceCustomers = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -273,20 +482,44 @@ func (s *CommerceCustomers) ListCommerceCustomers(ctx context.Context, request o fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commercelocations.go b/previous-versions/sync-for-commerce-version-1/commercelocations.go index 7a201bb66..eac52c29a 100644 --- a/previous-versions/sync-for-commerce-version-1/commercelocations.go +++ b/previous-versions/sync-for-commerce-version-1/commercelocations.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceLocations - Retrieve standardized data from linked commerce platforms. +// CommerceLocations - Retrieve standardized Commerce locations from linked commerce software. type CommerceLocations struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommerceLocations(sdkConfig sdkConfiguration) *CommerceLocations { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request operations.GetCommerceLocationRequest, opts ...operations.Option) (*operations.GetCommerceLocationResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-location", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request ope return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request ope }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceLocationResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceLocation if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request ope res.CommerceLocation = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request ope fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommerceLocations - List locations @@ -163,9 +281,17 @@ func (s *CommerceLocations) GetCommerceLocation(ctx context.Context, request ope // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceLocations) ListCommerceLocations(ctx context.Context, request operations.ListCommerceLocationsRequest, opts ...operations.Option) (*operations.ListCommerceLocationsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-locations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,28 +299,43 @@ func (s *CommerceLocations) ListCommerceLocations(ctx context.Context, request o return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-locations", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-locations", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -202,46 +343,109 @@ func (s *CommerceLocations) ListCommerceLocations(ctx context.Context, request o }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommerceLocationsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceLocations if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -249,7 +453,12 @@ func (s *CommerceLocations) ListCommerceLocations(ctx context.Context, request o res.CommerceLocations = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -267,20 +476,44 @@ func (s *CommerceLocations) ListCommerceLocations(ctx context.Context, request o fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commerceorders.go b/previous-versions/sync-for-commerce-version-1/commerceorders.go index a84abcdab..e1895609d 100644 --- a/previous-versions/sync-for-commerce-version-1/commerceorders.go +++ b/previous-versions/sync-for-commerce-version-1/commerceorders.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceOrders - Retrieve standardized data from linked commerce platforms. +// CommerceOrders - Retrieve standardized Commerce orders from linked commerce software. type CommerceOrders struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommerceOrders(sdkConfig sdkConfiguration) *CommerceOrders { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operations.GetCommerceOrderRequest, opts ...operations.Option) (*operations.GetCommerceOrderResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-order", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operation return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-orders/{orderId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-orders/{orderId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operation }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceOrderResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceOrder if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operation res.CommerceOrder = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operation fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommerceOrders - List orders @@ -163,9 +281,17 @@ func (s *CommerceOrders) GetCommerceOrder(ctx context.Context, request operation // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceOrders) ListCommerceOrders(ctx context.Context, request operations.ListCommerceOrdersRequest, opts ...operations.Option) (*operations.ListCommerceOrdersResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-orders", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,32 +299,47 @@ func (s *CommerceOrders) ListCommerceOrders(ctx context.Context, request operati return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-orders", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-orders", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -206,46 +347,109 @@ func (s *CommerceOrders) ListCommerceOrders(ctx context.Context, request operati }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommerceOrdersResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceOrders if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,7 +457,12 @@ func (s *CommerceOrders) ListCommerceOrders(ctx context.Context, request operati res.CommerceOrders = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -273,20 +482,44 @@ func (s *CommerceOrders) ListCommerceOrders(ctx context.Context, request operati fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commercepayments.go b/previous-versions/sync-for-commerce-version-1/commercepayments.go index 078e5535e..f58071fd4 100644 --- a/previous-versions/sync-for-commerce-version-1/commercepayments.go +++ b/previous-versions/sync-for-commerce-version-1/commercepayments.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommercePayments - Retrieve standardized data from linked commerce platforms. +// CommercePayments - Retrieve standardized Commerce payments from linked commerce software. type CommercePayments struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommercePayments(sdkConfig sdkConfiguration) *CommercePayments { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommercePayments) GetCommercePayment(ctx context.Context, request operations.GetCommercePaymentRequest, opts ...operations.Option) (*operations.GetCommercePaymentResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-payment", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommercePayments) GetCommercePayment(ctx context.Context, request opera return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommercePayments) GetCommercePayment(ctx context.Context, request opera }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommercePaymentResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommercePayment if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommercePayments) GetCommercePayment(ctx context.Context, request opera res.CommercePayment = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommercePayments) GetCommercePayment(ctx context.Context, request opera fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetMethod - Get payment method @@ -165,9 +283,17 @@ func (s *CommercePayments) GetCommercePayment(ctx context.Context, request opera // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommercePayments) GetMethod(ctx context.Context, request operations.GetCommercePaymentMethodRequest, opts ...operations.Option) (*operations.GetCommercePaymentMethodResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-payment-method", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -175,28 +301,43 @@ func (s *CommercePayments) GetMethod(ctx context.Context, request operations.Get return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -204,46 +345,109 @@ func (s *CommercePayments) GetMethod(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommercePaymentMethodResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommercePaymentMethod if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -251,7 +455,12 @@ func (s *CommercePayments) GetMethod(ctx context.Context, request operations.Get res.CommercePaymentMethod = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -269,22 +478,46 @@ func (s *CommercePayments) GetMethod(ctx context.Context, request operations.Get fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommercePayments - List payments @@ -294,9 +527,17 @@ func (s *CommercePayments) GetMethod(ctx context.Context, request operations.Get // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommercePayments) ListCommercePayments(ctx context.Context, request operations.ListCommercePaymentsRequest, opts ...operations.Option) (*operations.ListCommercePaymentsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-payments", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -304,32 +545,47 @@ func (s *CommercePayments) ListCommercePayments(ctx context.Context, request ope return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-payments", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-payments", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -337,46 +593,109 @@ func (s *CommercePayments) ListCommercePayments(ctx context.Context, request ope }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommercePaymentsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommercePayments if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -384,7 +703,12 @@ func (s *CommercePayments) ListCommercePayments(ctx context.Context, request ope res.CommercePayments = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -404,22 +728,46 @@ func (s *CommercePayments) ListCommercePayments(ctx context.Context, request ope fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListMethods - List payment methods @@ -429,9 +777,17 @@ func (s *CommercePayments) ListCommercePayments(ctx context.Context, request ope // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommercePayments) ListMethods(ctx context.Context, request operations.ListCommercePaymentMethodsRequest, opts ...operations.Option) (*operations.ListCommercePaymentMethodsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-payment-methods", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -439,32 +795,47 @@ func (s *CommercePayments) ListMethods(ctx context.Context, request operations.L return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -472,46 +843,109 @@ func (s *CommercePayments) ListMethods(ctx context.Context, request operations.L }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommercePaymentMethodsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommercePaymentMethods if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -519,7 +953,12 @@ func (s *CommercePayments) ListMethods(ctx context.Context, request operations.L res.CommercePaymentMethods = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -539,20 +978,44 @@ func (s *CommercePayments) ListMethods(ctx context.Context, request operations.L fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commerceproducts.go b/previous-versions/sync-for-commerce-version-1/commerceproducts.go index d8ae384ae..400c184b4 100644 --- a/previous-versions/sync-for-commerce-version-1/commerceproducts.go +++ b/previous-versions/sync-for-commerce-version-1/commerceproducts.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceProducts - Retrieve standardized data from linked commerce platforms. +// CommerceProducts - Retrieve standardized Commerce products from linked commerce software. type CommerceProducts struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommerceProducts(sdkConfig sdkConfiguration) *CommerceProducts { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request operations.GetCommerceProductRequest, opts ...operations.Option) (*operations.GetCommerceProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-product", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request opera return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request opera }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceProductResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceProduct if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request opera res.CommerceProduct = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request opera fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommerceProducts - List products @@ -163,9 +281,17 @@ func (s *CommerceProducts) GetCommerceProduct(ctx context.Context, request opera // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceProducts) ListCommerceProducts(ctx context.Context, request operations.ListCommerceProductsRequest, opts ...operations.Option) (*operations.ListCommerceProductsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-products", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,32 +299,47 @@ func (s *CommerceProducts) ListCommerceProducts(ctx context.Context, request ope return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-products", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-products", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -206,46 +347,109 @@ func (s *CommerceProducts) ListCommerceProducts(ctx context.Context, request ope }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommerceProductsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceProducts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,7 +457,12 @@ func (s *CommerceProducts) ListCommerceProducts(ctx context.Context, request ope res.CommerceProducts = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -273,20 +482,44 @@ func (s *CommerceProducts) ListCommerceProducts(ctx context.Context, request ope fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/commercetransactions.go b/previous-versions/sync-for-commerce-version-1/commercetransactions.go index 48bba9aef..000af203d 100644 --- a/previous-versions/sync-for-commerce-version-1/commercetransactions.go +++ b/previous-versions/sync-for-commerce-version-1/commercetransactions.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 syncforcommerceversion1 @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" ) -// CommerceTransactions - Retrieve standardized data from linked commerce platforms. +// CommerceTransactions - Retrieve standardized Commerce transactions from linked commerce software. type CommerceTransactions struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCommerceTransactions(sdkConfig sdkConfiguration) *CommerceTransactions { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, request operations.GetCommerceTransactionRequest, opts ...operations.Option) (*operations.GetCommerceTransactionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-commerce-transaction", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -44,28 +55,43 @@ func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, reque return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-transactions/{transactionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-transactions/{transactionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -73,46 +99,109 @@ func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, reque }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.GetCommerceTransactionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceTransaction if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -120,7 +209,12 @@ func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, reque res.CommerceTransaction = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -138,22 +232,46 @@ func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, reque fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCommerceTransactions - List transactions @@ -163,9 +281,17 @@ func (s *CommerceTransactions) GetCommerceTransaction(ctx context.Context, reque // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/refresh-company-data). func (s *CommerceTransactions) ListCommerceTransactions(ctx context.Context, request operations.ListCommerceTransactionsRequest, opts ...operations.Option) (*operations.ListCommerceTransactionsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-commerce-transactions", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -173,32 +299,47 @@ func (s *CommerceTransactions) ListCommerceTransactions(ctx context.Context, req return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-transactions", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/data/commerce-transactions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -206,46 +347,109 @@ func (s *CommerceTransactions) ListCommerceTransactions(ctx context.Context, req }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.ListCommerceTransactionsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CommerceTransactions if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,7 +457,12 @@ func (s *CommerceTransactions) ListCommerceTransactions(ctx context.Context, req res.CommerceTransactions = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -273,20 +482,44 @@ func (s *CommerceTransactions) ListCommerceTransactions(ctx context.Context, req fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/companies.go b/previous-versions/sync-for-commerce-version-1/companies.go index 9241612c9..865c44d79 100644 --- a/previous-versions/sync-for-commerce-version-1/companies.go +++ b/previous-versions/sync-for-commerce-version-1/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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -26,12 +29,22 @@ func newCompanies(sdkConfig sdkConfiguration) *Companies { } // DeleteCompany - Delete a company +// The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) and any cached data. This operation is irreversible. // -// Permanently deletes a company, its connections and any cached data. This operation is irreversible. If the company ID does not exist an error is returned. +// A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +// Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. func (s *Companies) DeleteCompany(ctx context.Context, request operations.DeleteCompanyRequest, opts ...operations.Option) (*operations.DeleteCompanyResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "delete-company", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -39,28 +52,43 @@ func (s *Companies) DeleteCompany(ctx context.Context, request operations.Delete return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -68,42 +96,100 @@ func (s *Companies) DeleteCompany(ctx context.Context, request operations.Delete }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + }) - contentType := httpRes.Header.Get("Content-Type") + 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.DeleteCompanyResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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 == 204: case httpRes.StatusCode == 401: @@ -120,30 +206,65 @@ func (s *Companies) DeleteCompany(ctx context.Context, request operations.Delete fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetCompany - Get company -// Returns the company for a valid identifier. If the identifier is for a deleted company, a not found response is returned. +// The *Get company* endpoint returns a single company for a given `companyId`. +// +// A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +// Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. func (s *Companies) GetCompany(ctx context.Context, request operations.GetCompanyRequest, opts ...operations.Option) (*operations.GetCompanyResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-company", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -151,28 +272,43 @@ func (s *Companies) GetCompany(ctx context.Context, request operations.GetCompan return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -180,46 +316,109 @@ func (s *Companies) GetCompany(ctx context.Context, request operations.GetCompan }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetCompanyResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -227,7 +426,12 @@ func (s *Companies) GetCompany(ctx context.Context, request operations.GetCompan res.Company = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -243,30 +447,66 @@ func (s *Companies) GetCompany(ctx context.Context, request operations.GetCompan fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // UpdateCompany - Update company -// Updates both the name and description of the company. +// Use the *Update company* endpoint to update both the name and description of the company. +// If you use [groups](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Group) to manage a set of companies, use the [Add company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/add-company-to-group) or [Remove company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/remove-company-from-group) endpoints to add or remove a company from a group. +// +// A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +// Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. func (s *Companies) UpdateCompany(ctx context.Context, request operations.UpdateCompanyRequest, opts ...operations.Option) (*operations.UpdateCompanyResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-company", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -274,35 +514,49 @@ func (s *Companies) UpdateCompany(ctx context.Context, request operations.Update return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateCompany", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - req, err := http.NewRequestWithContext(ctx, "PUT", url, bodyReader) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -310,46 +564,109 @@ func (s *Companies) UpdateCompany(ctx context.Context, request operations.Update }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + }) - contentType := httpRes.Header.Get("Content-Type") + 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.UpdateCompanyResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -357,7 +674,12 @@ func (s *Companies) UpdateCompany(ctx context.Context, request operations.Update res.Company = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -373,20 +695,44 @@ func (s *Companies) UpdateCompany(ctx context.Context, request operations.Update fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/companymanagement.go b/previous-versions/sync-for-commerce-version-1/companymanagement.go index cb1f43ce4..3d3468bdc 100644 --- a/previous-versions/sync-for-commerce-version-1/companymanagement.go +++ b/previous-versions/sync-for-commerce-version-1/companymanagement.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 syncforcommerceversion1 @@ -6,13 +6,16 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" - "strings" + "net/url" ) // CompanyManagement - Create new and manage existing Sync for Commerce companies. @@ -29,9 +32,17 @@ func newCompanyManagement(sdkConfig sdkConfiguration) *CompanyManagement { // CreateCompany - Create sync for commerce company // Creates a Codat company with a commerce partner data connection. func (s *CompanyManagement) CreateCompany(ctx context.Context, request *shared.CreateCompany, opts ...operations.Option) (*operations.CreateCompanyResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-company", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -39,32 +50,49 @@ func (s *CompanyManagement) CreateCompany(ctx context.Context, request *shared.C return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/meta/companies/sync" + opURL, err := url.JoinPath(baseURL, "/meta/companies/sync") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -72,46 +100,109 @@ func (s *CompanyManagement) CreateCompany(ctx context.Context, request *shared.C }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateCompanyResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -119,7 +210,12 @@ func (s *CompanyManagement) CreateCompany(ctx context.Context, request *shared.C res.Company = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -137,30 +233,62 @@ func (s *CompanyManagement) CreateCompany(ctx context.Context, request *shared.C fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // CreateConnection - Create connection // Create a data connection for company. func (s *CompanyManagement) CreateConnection(ctx context.Context, request operations.CreateConnectionRequest, opts ...operations.Option) (*operations.CreateConnectionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-connection", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -168,35 +296,49 @@ func (s *CompanyManagement) CreateConnection(ctx context.Context, request operat return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections", 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, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -204,46 +346,109 @@ func (s *CompanyManagement) CreateConnection(ctx context.Context, request operat }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.CreateConnectionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -251,7 +456,12 @@ func (s *CompanyManagement) CreateConnection(ctx context.Context, request operat res.Connection = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -267,30 +477,62 @@ func (s *CompanyManagement) CreateConnection(ctx context.Context, request operat fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListCompanies - List companies // Retrieve a list of all companies the client has created. func (s *CompanyManagement) ListCompanies(ctx context.Context, request operations.ListCompaniesRequest, opts ...operations.Option) (*operations.ListCompaniesResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-companies", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -298,29 +540,47 @@ func (s *CompanyManagement) ListCompanies(ctx context.Context, request operation return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/meta/companies" + opURL, err := url.JoinPath(baseURL, "/meta/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", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -328,46 +588,109 @@ func (s *CompanyManagement) ListCompanies(ctx context.Context, request operation }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.ListCompaniesResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -375,7 +698,12 @@ func (s *CompanyManagement) ListCompanies(ctx context.Context, request operation res.Companies = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -393,30 +721,62 @@ func (s *CompanyManagement) ListCompanies(ctx context.Context, request operation fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListConnections - List data connections // Retrieve previously created data connections. func (s *CompanyManagement) ListConnections(ctx context.Context, request operations.ListConnectionsRequest, opts ...operations.Option) (*operations.ListConnectionsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-connections", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -424,32 +784,47 @@ func (s *CompanyManagement) ListConnections(ctx context.Context, request operati return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -457,46 +832,109 @@ func (s *CompanyManagement) ListConnections(ctx context.Context, request operati }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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) + } - contentType := httpRes.Header.Get("Content-Type") + 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.ListConnectionsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -504,7 +942,12 @@ func (s *CompanyManagement) ListConnections(ctx context.Context, request operati res.Connections = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -522,30 +965,62 @@ func (s *CompanyManagement) ListConnections(ctx context.Context, request operati fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // UpdateConnection - Update data connection // Update a data connection func (s *CompanyManagement) UpdateConnection(ctx context.Context, request operations.UpdateConnectionRequest, opts ...operations.Option) (*operations.UpdateConnectionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-connection", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -553,35 +1028,49 @@ func (s *CompanyManagement) UpdateConnection(ctx context.Context, request operat return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections/{connectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateConnection", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - req, err := http.NewRequestWithContext(ctx, "PATCH", url, bodyReader) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -589,46 +1078,109 @@ func (s *CompanyManagement) UpdateConnection(ctx context.Context, request operat }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.UpdateConnectionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -636,7 +1188,12 @@ func (s *CompanyManagement) UpdateConnection(ctx context.Context, request operat res.Connection = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -652,20 +1209,44 @@ func (s *CompanyManagement) UpdateConnection(ctx context.Context, request operat fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/configuration.go b/previous-versions/sync-for-commerce-version-1/configuration.go index 0be63531b..29f26d32a 100644 --- a/previous-versions/sync-for-commerce-version-1/configuration.go +++ b/previous-versions/sync-for-commerce-version-1/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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -28,9 +31,17 @@ func newConfiguration(sdkConfig sdkConfiguration) *Configuration { // GetConfiguration - Retrieve config preferences set for a company // Retrieve current config preferences. func (s *Configuration) GetConfiguration(ctx context.Context, request operations.GetConfigurationRequest, opts ...operations.Option) (*operations.GetConfigurationResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -38,28 +49,43 @@ func (s *Configuration) GetConfiguration(ctx context.Context, request operations return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/config/companies/{companyId}/sync/commerce", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/config/companies/{companyId}/sync/commerce", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -67,46 +93,109 @@ func (s *Configuration) GetConfiguration(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetConfigurationResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Configuration if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -114,7 +203,12 @@ func (s *Configuration) GetConfiguration(ctx context.Context, request operations res.Configuration = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -130,30 +224,62 @@ func (s *Configuration) GetConfiguration(ctx context.Context, request operations fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // SetConfiguration - Create or update configuration // Make changes to configuration preferences. func (s *Configuration) SetConfiguration(ctx context.Context, request operations.SetConfigurationRequest, opts ...operations.Option) (*operations.SetConfigurationResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "set-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -161,28 +287,43 @@ func (s *Configuration) SetConfiguration(ctx context.Context, request operations return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/config/companies/{companyId}/sync/commerce", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/config/companies/{companyId}/sync/commerce", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -190,46 +331,109 @@ func (s *Configuration) SetConfiguration(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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 + } + } + } res := &operations.SetConfigurationResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Configuration if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -237,7 +441,12 @@ func (s *Configuration) SetConfiguration(ctx context.Context, request operations res.Configuration = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -257,20 +466,44 @@ func (s *Configuration) SetConfiguration(ctx context.Context, request operations fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/connections.go b/previous-versions/sync-for-commerce-version-1/connections.go index cac68d3a4..42a6b9b57 100644 --- a/previous-versions/sync-for-commerce-version-1/connections.go +++ b/previous-versions/sync-for-commerce-version-1/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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -29,9 +32,17 @@ func newConnections(sdkConfig sdkConfiguration) *Connections { // Revoke and remove a connection from a company. // This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company. func (s *Connections) DeleteConnection(ctx context.Context, request operations.DeleteConnectionRequest, opts ...operations.Option) (*operations.DeleteConnectionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "delete-connection", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -39,28 +50,43 @@ func (s *Connections) DeleteConnection(ctx context.Context, request operations.D return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -68,42 +94,100 @@ func (s *Connections) DeleteConnection(ctx context.Context, request operations.D }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + }) - contentType := httpRes.Header.Get("Content-Type") + 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.DeleteConnectionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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: case httpRes.StatusCode == 401: @@ -120,30 +204,62 @@ func (s *Connections) DeleteConnection(ctx context.Context, request operations.D fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetConnection - Get connection // Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. func (s *Connections) GetConnection(ctx context.Context, request operations.GetConnectionRequest, opts ...operations.Option) (*operations.GetConnectionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-connection", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -151,28 +267,43 @@ func (s *Connections) GetConnection(ctx context.Context, request operations.GetC return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -180,46 +311,109 @@ func (s *Connections) GetConnection(ctx context.Context, request operations.GetC }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetConnectionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -227,7 +421,12 @@ func (s *Connections) GetConnection(ctx context.Context, request operations.GetC res.Connection = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -243,30 +442,62 @@ func (s *Connections) GetConnection(ctx context.Context, request operations.GetC fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 // 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. func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConnectionRequest, opts ...operations.Option) (*operations.UnlinkConnectionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "unlink-connection", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -274,35 +505,49 @@ 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()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateConnection", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -310,46 +555,109 @@ 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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.UnlinkConnectionResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -357,7 +665,12 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne res.Connection = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -373,20 +686,44 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createaccountingcreditnoterequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createaccountingcreditnoterequest.md index 339d67874..c5b281183 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createaccountingcreditnoterequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createaccountingcreditnoterequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `AccountingCreditNote` | [*shared.AccountingCreditNote](../../../pkg/models/shared/accountingcreditnote.md) | :heavy_minus_sign: | N/A | | -| `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 +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountingCreditNote` | [*shared.AccountingCreditNote](../../../pkg/models/shared/accountingcreditnote.md) | :heavy_minus_sign: | N/A | [
{
"id": "0316bd24-8a01-4a3a-a0e5-a73f14ebcbec",
"creditNoteNumber": "5239277",
"customerRef": {
"id": "b5511228-b9ef-4713-91b1-ad2cf60eadb1",
"companyName": "Tool Hire Company"
},
"totalAmount": 550,
"totalDiscount": 0,
"subTotal": 0,
"totalTaxAmount": 0,
"discountPercentage": 0,
"remainingCredit": 550,
"status": "Submitted",
"issueDate": "2018-03-28T21:28:58.249Z",
"allocatedOnDate": null,
"note": "More information available on request.",
"currency": "USD",
"currencyRate": null,
"lineItems": [
{
"description": "Anvil10000Lb",
"unitAmount": 50,
"quantity": 10,
"discountAmount": 0,
"subTotal": 500,
"taxAmount": 50,
"totalAmount": 550,
"accountRef": {
"id": "3f267b10-757d-44c0-bef9-20f70cc8fbe3",
"name": null
},
"discountPercentage": null,
"taxRateRef": {
"id": "6c88aff3-7cb9-4980-a3d3-443e72e02498",
"name": null
},
"itemRef": {
"id": "1",
"name": null
}
}
],
"paymentAllocations": [],
"modifiedDate": null,
"sourceModifiedDate": null
}
] | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createcompanyresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createcompanyresponse.md index be27c0b95..b26b55552 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createcompanyresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | Success | -| `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: | Success | {
"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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createconnectionresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createconnectionresponse.md index a392d98ce..891566077 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createconnectionresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/createconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | Success | {
"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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getaccountingcompanyinforesponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getaccountingcompanyinforesponse.md index c4cf1703e..7fb4a0d58 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getaccountingcompanyinforesponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getaccountingcompanyinforesponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `AccountingCompanyDataset` | [*shared.AccountingCompanyDataset](../../../pkg/models/shared/accountingcompanydataset.md) | :heavy_minus_sign: | Success | -| `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 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountingCompanyDataset` | [*shared.AccountingCompanyDataset](../../../pkg/models/shared/accountingcompanydataset.md) | :heavy_minus_sign: | Success | {
"companyName": "ACME Corporation",
"accountingPlatformRef": "4444e827-401b-4925-92cb-d79086bf3b6b",
"companyLegalName": "ACME Corporation Ltd.",
"addresses": [
{
"type": "Billing",
"line1": "Warner House",
"line2": "98 Theobald's Road",
"city": "London",
"region": "",
"country": "United Kingdom",
"postalcode": "WC1X 8WB"
},
{
"type": "Unknown",
"line1": "123 Sierra Way",
"line2": "",
"city": "San Pablo",
"region": "CA",
"country": "",
"postalCode": "87999"
}
],
"phoneNumbers": [
{
"number": "010 1234 5678",
"type": "Landline"
}
],
"webLinks": [
{
"type": "Website",
"url": "https://www.wbsl.com/"
}
],
"ledgerLockDate": "2019-03-04T12:08:01.881Z",
"registrationNumber": "1234567890",
"taxNumber": "GB 123456789",
"financialYearStartDate": "2019-04-01T00:00:00Z",
"baseCurrency": "USD",
"sourceUrls": {
"url1": "https://go.xero.com/organisationlogin/default.aspx?shortcode=!rxs0Q",
"url2": "https://reporting.xero.com/!rxs0Q"
},
"createdDate": "2020-02-03T16:42:02Z"
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercecustomerresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercecustomerresponse.md index 62a7a2c40..70f4af709 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercecustomerresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercecustomerresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `CommerceCustomer` | [*shared.CommerceCustomer](../../../pkg/models/shared/commercecustomer.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceCustomer` | [*shared.CommerceCustomer](../../../pkg/models/shared/commercecustomer.md) | :heavy_minus_sign: | OK | {
"customers": [
{
"id": "15",
"customerName": "Daffy Duck",
"emailAddress": "d.duck@warnerbros.com",
"defaultCurrency": "GBP",
"phone": "(877) 492-8687",
"addresses": [
{
"type": "billing",
"line1": "301 Duck Pond",
"line2": "28 Green Street",
"city": "London",
"region": "England",
"country": "United Kingdom",
"postalCode": "WX1X 0BE"
},
{
"type": "delivery",
"line1": "Bread Street",
"line2": "Bird Avenue",
"city": "Paris",
"region": "France",
"country": "France",
"postalCode": "WDF 123"
}
],
"note": "Regular customer",
"createdDate": "0001-01-01T00:00:00",
"modifiedDate": null,
"sourceModifiedDate": "2020-09-15T23:52:28"
},
{
"id": "18",
"customerName": "Tasmanian Devil",
"emailAddress": "t.devil@warnerbros.com",
"defaultCurrency": "GBP",
"phone": "+1-202-555-0181",
"addresses": [
{
"type": "billing",
"line1": "101 Fire Rooms",
"line2": "Engine Street",
"city": "London",
"region": "England",
"country": "United Kingdom",
"postalCode": "WC1X 0BE"
}
],
"note": "Handle with care",
"createdDate": "0001-01-01T00:00:00",
"modifiedDate": null,
"sourceModifiedDate": "2020-04-16T02:41:52"
},
{
"id": "a99f5e0c-a4db-452f-8d2c-8fd15482b384",
"customerName": "Bugs Bunny",
"emailAddress": "b.bunny@warnerbros.com",
"defaultCurrency": "GBP",
"phone": "",
"addresses": [
{
"type": "billing",
"line1": "301 Carrot Street",
"line2": "Orange Town",
"city": "Yorkshire",
"region": "England",
"country": "United Kingdom",
"postalCode": "WF1X 0BE"
},
{
"type": "delivery",
"line1": "424 Field Street",
"line2": "The Meadow",
"city": "Paris",
"region": "France",
"country": "France",
"postalCode": "WDF 123"
}
],
"note": "Regular customer",
"createdDate": "0001-01-01T00:00:00",
"modifiedDate": null,
"sourceModifiedDate": "2020-08-12T14:37:37"
}
]
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercelocationresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercelocationresponse.md index fca5f7033..6fab97266 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercelocationresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommercelocationresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `CommerceLocation` | [*shared.CommerceLocation](../../../pkg/models/shared/commercelocation.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 +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceLocation` | [*shared.CommerceLocation](../../../pkg/models/shared/commercelocation.md) | :heavy_minus_sign: | OK | {
"id": "15",
"name": "London Warehouse",
"address": {
"type": "Inventory",
"line1": "Warner House",
"line2": "98 Theobald's Road",
"city": "London",
"region": "",
"country": "United Kingdom",
"postalCode": "WC1X 8WB"
},
"modifiedDate": "2020-08-12T14:37:37",
"sourceModifiedDate": "2020-08-12T14:37:37"
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommerceorderresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommerceorderresponse.md index fcf884606..90ac148f1 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommerceorderresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcommerceorderresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `CommerceOrder` | [*shared.CommerceOrder](../../../pkg/models/shared/commerceorder.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 +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceOrder` | [*shared.CommerceOrder](../../../pkg/models/shared/commerceorder.md) | :heavy_minus_sign: | OK | {
"id": "01e63721-1205-478e-8503-9d8bf8a93f44",
"orderNumber": "99123956",
"country": "CAN",
"currency": "CAD",
"createdDate": "2021-03-28T03:00:14",
"totalAmount": 12,
"totalRefund": 0,
"totalTaxAmount": 2,
"totalDiscount": 0,
"totalGratuity": 1,
"orderLineItems": [
{
"id": "116113a6-54d3-4624-ba73-26a77a5ffd51",
"quantity": 1,
"taxPercentage": 20,
"totalAmount": 12,
"totalTaxAmount": 2,
"unitPrice": 10,
"taxes": [
{
"taxComponentRef": {
"id": "72",
"name": "Sales Tax"
},
"taxAmount": ""
},
{
"taxComponentRef": {
"id": "72",
"name": "City Tax"
},
"taxAmount": ""
}
],
"productRef": {
"id": "ac186646-41f2-4280-afea-1012c59459ab",
"name": "Intelligent Concrete Salad"
},
"productVariantRef": {
"id": "f9ca9de5-9e31-460d-ac81-368f4e7c8fc0",
"name": "Small Incredible Wooden Soap"
},
"discountAllocations": []
}
],
"payments": [
{
"id": "defdceb6-83a3-4b7d-a74e-e9ef947d5f48",
"amount": 12,
"currency": "CAD",
"type": "Paypal",
"status": "Unknown",
"dueDate": "2021-04-04T03:00:14",
"createdDate": "2021-03-28T03:00:14",
"modifiedDate": "2022-02-02T11:02:45"
}
],
"serviceCharges": [
{
"description": "Service Charge",
"totalAmount": 1.2,
"taxPercentage": 20,
"taxAmount": 0.2,
"taxes": [
{
"taxComponentRef": {
"id": "72",
"name": "Service Tax"
},
"taxAmount": ""
}
],
"quantity": 1,
"type": "Generic"
}
],
"locationRef": {
"id": "47bbffc7-c045-4b0f-a3bb-ecf1f669edfa"
},
"customerRef": {
"id": "2634d180-7205-43f0-a73d-84af6443a005",
"name": "Emmy Roberts"
},
"modifiedDate": "2022-02-02T11:02:45Z",
"sourceModifiedDate": "2021-03-28T03:00:14"
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusdatastatuses.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusdatastatuses.md new file mode 100644 index 000000000..1c8bfec02 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusdatastatuses.md @@ -0,0 +1,52 @@ +# GetCompanyDataStatusDataStatuses + +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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusresponse.md index 8b9cce424..175ad772c 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanydatastatusresponse.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.GetCompanyDataStatusDataStatuses](../../../pkg/models/operations/getcompanydatastatusdatastatuses.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryrequest.md index efadd52b7..a4f980e0d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryrequest.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryresponse.md index 094cfcf0b..164969cc1 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanypushhistoryresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `PushOperations` | [*shared.PushOperations](../../../pkg/models/shared/pushoperations.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 | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `PushOperations` | [*shared.PushOperations](../../../pkg/models/shared/pushoperations.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanyresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanyresponse.md index b655813a0..8bc3efda8 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanyresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.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 +| 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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconfigtextsyncflowrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconfigtextsyncflowrequest.md index 2a31f1768..b193bdd95 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconfigtextsyncflowrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconfigtextsyncflowrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `Locale` | [shared.Locale](../../../pkg/models/shared/locale.md) | :heavy_check_mark: | Localization identifier for English (US) or French. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `Locale` | [shared.Locale](../../../pkg/models/shared/locale.md) | :heavy_check_mark: | Localization identifier for English (US) or French. | en-us | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconnectionresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconnectionresponse.md index 1e5295f59..30b35ef1b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconnectionresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | OK | {
"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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingrequest.md index 9e2f5f913..c7db0678d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. | gbol | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. | gbol | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingresponse.md index cbf54f2e7..f418b90cc 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getintegrationbrandingresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `Branding` | [*shared.Branding](../../../pkg/models/shared/branding.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Branding` | [*shared.Branding](../../../pkg/models/shared/branding.md) | :heavy_minus_sign: | Success | {
"logo": {
"full": {
"image": {
"src": "https://static.codat.io/public/officialLogos/Full/8A156A5A-39CB-4F9D-856E-76EF9B9A9607.png",
"alt": "xero full icon"
}
},
"square": {
"image": {
"src": "https://static.codat.io/public/officialLogos/Square/8A156A5A-39CB-4F9D-856E-76EF9B2W3607.png",
"alt": "xero square icon"
}
}
},
"button": {
"default": {
"image": {
"src": "https://static.codat.io/public/officialButtons/Full/8A156A5A-39CB-4F9D-856E-76EF9Q7A9607.png",
"alt": "xero default button icon"
}
},
"hover": {
"image": {
"src": "https://static.codat.io/public/officialLogos/Full/8A156A5A-39CB-4F9D-856E-76EF9B9A9607.png",
"alt": "xero hover button icon"
}
}
},
"sourceId": "35b92968-9851-4095-ad60-395c95cbcba4"
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getpulloperationresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getpulloperationresponse.md index 64bb0ca5e..7568d1fbb 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getpulloperationresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getpulloperationresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `PullOperation` | [*shared.PullOperation](../../../pkg/models/shared/pulloperation.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 | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `PullOperation` | [*shared.PullOperation](../../../pkg/models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {
"id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b",
"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5",
"connectionId": "51baa045-4836-4317-a42e-3542e991e581",
"dataType": "invoices",
"status": "Initial",
"statusDescription": "Paused until 2022-10-23T00:00:00.000Z",
"requested": "2022-11-14T11:18:37.2798351Z",
"progress": 10,
"isCompleted": false,
"isErrored": false
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getvisibleaccountsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getvisibleaccountsrequest.md index 1f7c975e9..461786495 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getvisibleaccountsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/getvisibleaccountsrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ClientID` | *string* | :heavy_check_mark: | Unique identifier for your client in Codat. | | -| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. | gbol | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `ClientID` | *string* | :heavy_check_mark: | Unique identifier for your client in Codat. | | +| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. | gbol | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsrequest.md index b0c178e60..b7781788b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsrequest.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsresponse.md index 1086314e3..1de74e983 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingaccountsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `AccountingAccounts` | [*shared.AccountingAccounts](../../../pkg/models/shared/accountingaccounts.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountingAccounts` | [*shared.AccountingAccounts](../../../pkg/models/shared/accountingaccounts.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsrequest.md index 4dce0bca6..6175f33c7 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsresponse.md index ca0b2404e..289e75d41 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listaccountingbankaccountsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `AccountingBankAccounts` | [*shared.AccountingBankAccounts](../../../pkg/models/shared/accountingbankaccounts.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountingBankAccounts` | [*shared.AccountingBankAccounts](../../../pkg/models/shared/accountingbankaccounts.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersrequest.md index 12d46aa4a..2a45e0569 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersresponse.md index bd6bcf401..5dfa31824 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercecustomersresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `CommerceCustomers` | [*shared.CommerceCustomers](../../../pkg/models/shared/commercecustomers.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceCustomers` | [*shared.CommerceCustomers](../../../pkg/models/shared/commercecustomers.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercelocationsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercelocationsresponse.md index 6ecdc310c..74f08828a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercelocationsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercelocationsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `CommerceLocations` | [*shared.CommerceLocations](../../../pkg/models/shared/commercelocations.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceLocations` | [*shared.CommerceLocations](../../../pkg/models/shared/commercelocations.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersrequest.md index 83eee9650..e2e72b900 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersresponse.md index f5f6e2d35..fee92c55d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceordersresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `CommerceOrders` | [*shared.CommerceOrders](../../../pkg/models/shared/commerceorders.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceOrders` | [*shared.CommerceOrders](../../../pkg/models/shared/commerceorders.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsrequest.md index 1fb19ff4c..f5cae54c6 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsresponse.md index e0247da80..7035d20e3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentmethodsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `CommercePaymentMethods` | [*shared.CommercePaymentMethods](../../../pkg/models/shared/commercepaymentmethods.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommercePaymentMethods` | [*shared.CommercePaymentMethods](../../../pkg/models/shared/commercepaymentmethods.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsrequest.md index c892270ce..077323e7f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsresponse.md index 0f55d5530..5aea47755 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercepaymentsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `CommercePayments` | [*shared.CommercePayments](../../../pkg/models/shared/commercepayments.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommercePayments` | [*shared.CommercePayments](../../../pkg/models/shared/commercepayments.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsrequest.md index c3676b9f2..b7c061521 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsresponse.md index f93aae89c..3eb05adb7 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommerceproductsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `CommerceProducts` | [*shared.CommerceProducts](../../../pkg/models/shared/commerceproducts.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceProducts` | [*shared.CommerceProducts](../../../pkg/models/shared/commerceproducts.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsrequest.md index ab99497ef..98db247e4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsrequest.md @@ -10,4 +10,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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsresponse.md index d5800d4e7..ae0b228a4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcommercetransactionsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `CommerceTransactions` | [*shared.CommerceTransactions](../../../pkg/models/shared/commercetransactions.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CommerceTransactions` | [*shared.CommerceTransactions](../../../pkg/models/shared/commercetransactions.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesrequest.md index ee176cc37..cccb983e3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesrequest.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesresponse.md index a95a344f5..26b2b9a8d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listcompaniesresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `Companies` | [*shared.Companies](../../../pkg/models/shared/companies.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Companies` | [*shared.Companies](../../../pkg/models/shared/companies.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsrequest.md index df5ebd3fc..c28099519 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsresponse.md index 4a1d91200..545604547 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listconnectionsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `Connections` | [*shared.Connections](../../../pkg/models/shared/connections.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Connections` | [*shared.Connections](../../../pkg/models/shared/connections.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsrequest.md index c86c797b6..eb5a9b90a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsrequest.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsresponse.md index 1d176e5e0..71696da9f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listintegrationsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `Integrations` | [*shared.Integrations](../../../pkg/models/shared/integrations.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `Integrations` | [*shared.Integrations](../../../pkg/models/shared/integrations.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsrequest.md index 6c5f80bfc..bfea8f9b6 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsrequest.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsresponse.md index 0ccf5c1b9..0aceb5994 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/listpulloperationsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `PullOperations` | [*shared.PullOperations](../../../pkg/models/shared/pulloperations.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 | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `PullOperations` | [*shared.PullOperations](../../../pkg/models/shared/pulloperations.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/option.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/option.md index 9167702bf..35d8a1e2a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/option.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/refreshdatatyperesponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/refreshdatatyperesponse.md index 3c0f7d7b6..baddccc06 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/refreshdatatyperesponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/refreshdatatyperesponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `PullOperation` | [*shared.PullOperation](../../../pkg/models/shared/pulloperation.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 | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `PullOperation` | [*shared.PullOperation](../../../pkg/models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {
"id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b",
"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5",
"connectionId": "51baa045-4836-4317-a42e-3542e991e581",
"dataType": "invoices",
"status": "Initial",
"statusDescription": "Paused until 2022-10-23T00:00:00.000Z",
"requested": "2022-11-14T11:18:37.2798351Z",
"progress": 10,
"isCompleted": false,
"isErrored": false
} | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/unlinkconnectionresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/unlinkconnectionresponse.md index 2ff6760d0..e407eadee 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/unlinkconnectionresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/unlinkconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | OK | {
"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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatecompanyresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatecompanyresponse.md index 4b2267d84..30b2e9856 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatecompanyresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatecompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.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 +| 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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconfigtextsyncflowrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconfigtextsyncflowrequest.md index bab033d2a..e95eb4f3d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconfigtextsyncflowrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconfigtextsyncflowrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `RequestBody` | map[string][shared.Localization](../../../pkg/models/shared/localization.md) | :heavy_minus_sign: | N/A | -| `Locale` | [shared.Locale](../../../pkg/models/shared/locale.md) | :heavy_check_mark: | Localization identifier for English (US) or French. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `RequestBody` | map[string][shared.Localization](../../../pkg/models/shared/localization.md) | :heavy_minus_sign: | N/A | | +| `Locale` | [shared.Locale](../../../pkg/models/shared/locale.md) | :heavy_check_mark: | Localization identifier for English (US) or French. | en-us | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconnectionresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconnectionresponse.md index 8a0b271e8..5fa22d0e1 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconnectionresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updateconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | Success | -| `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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Connection` | [*shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | Success | {
"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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatevisibleaccountssyncflowrequest.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatevisibleaccountssyncflowrequest.md index 6009b6e66..1ebf081e2 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatevisibleaccountssyncflowrequest.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/operations/updatevisibleaccountssyncflowrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `VisibleAccounts` | [*shared.VisibleAccounts](../../../pkg/models/shared/visibleaccounts.md) | :heavy_minus_sign: | N/A | | -| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. | gbol | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `VisibleAccounts` | [*shared.VisibleAccounts](../../../pkg/models/shared/visibleaccounts.md) | :heavy_minus_sign: | N/A | | +| `PlatformKey` | *string* | :heavy_check_mark: | A unique 4-letter key to represent a platform in each integration. | gbol | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/sdkerrors/errormessage.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/sdkerrors/errormessage.md index d79d02c01..f95c4e2f6 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/sdkerrors/errormessage.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/sdkerrors/errormessage.md @@ -5,11 +5,12 @@ Your API request was not properly authorized. ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `CanBeRetried` | **string* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | -| `CorrelationID` | **string* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | -| `DetailedErrorCode` | **int64* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | -| `Error` | **string* | :heavy_minus_sign: | A brief description of the error. | -| `Service` | **string* | :heavy_minus_sign: | Codat's service the returned the error. | -| `StatusCode` | **int64* | :heavy_minus_sign: | The HTTP status code returned by the error. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `CanBeRetried` | **string* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | +| `CorrelationID` | **string* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | +| `DetailedErrorCode` | **int64* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | +| `Error` | **string* | :heavy_minus_sign: | A brief description of the error. | +| `Service` | **string* | :heavy_minus_sign: | Codat's service the returned the error. | +| `StatusCode` | **int64* | :heavy_minus_sign: | The HTTP status code returned by the error. | +| `Validation` | [*shared.ErrorValidation](../../../pkg/models/shared/errorvalidation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountbalance.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountbalance.md index afe626e0e..349ac0510 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountbalance.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountbalance.md @@ -8,4 +8,4 @@ | `Available` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The account's current balance | | | `Currency` | **string* | :heavy_minus_sign: | The currency of the account | GBP | | `Pending` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Funds that are not yet available in the balance | | -| `Reserved` | *interface{}* | :heavy_minus_sign: | Funds reserved as holdings | | \ No newline at end of file +| `Reserved` | *any* | :heavy_minus_sign: | Funds reserved as holdings | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccount.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccount.md index 5f7080f3b..3b949ac60 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccount.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccount.md @@ -47,6 +47,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.AccountingAccountValidDataTypeLinks](../../../pkg/models/shared/accountingaccountvaliddatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/accounting-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccounts.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccounts.md index ef7c3f23f..8fd8e70f3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccounts.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingaccounts.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.AccountingAccount](../../../pkg/models/shared/accountingaccount.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.AccountingAccount](../../../pkg/models/shared/accountingaccount.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccount.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccount.md index e02c31a99..9b34ad03f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccount.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccount.md @@ -13,7 +13,7 @@ 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 platform. +* The name and ID of the account in the accounting software. * The currency and balance of the account. * The sort code and account number. @@ -22,14 +22,14 @@ Bank accounts data includes: | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AccountName` | **string* | :heavy_minus_sign: | Name of the bank account in the accounting platform. | | +| `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 platform. | | +| `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 | @@ -37,4 +37,5 @@ Bank accounts data includes: | `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 | -| `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. | | \ No newline at end of file +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccounts.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccounts.md index 942c4d4a9..f1dca0d56 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccounts.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingbankaccounts.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.AccountingBankAccount](../../../pkg/models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.AccountingBankAccount](../../../pkg/models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcompanydataset.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcompanydataset.md index a11d07773..76756e2f9 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcompanydataset.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcompanydataset.md @@ -6,16 +6,16 @@ Company info provides standard details about a linked company such as their addr > **Company information or companies?** > -> Company profile is standard information that is held in the accounting platform about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. +> Company profile is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. ## Fields | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AccountingPlatformRef` | **string* | :heavy_minus_sign: | Identifier or reference for the company in the accounting platform. | | +| `AccountingPlatformRef` | **string* | :heavy_minus_sign: | Identifier or reference for the company in the accounting software. | | | `Addresses` | [][shared.AccountingAddress](../../../pkg/models/shared/accountingaddress.md) | :heavy_minus_sign: | An array of Addresses. | | -| `BaseCurrency` | **string* | :heavy_minus_sign: | Currency set in the accounting platform of the linked company. Used by the currency rate. | | +| `BaseCurrency` | **string* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. Used by the currency rate. | | | `CompanyLegalName` | **string* | :heavy_minus_sign: | Registered legal name of the linked company. | | | `CompanyName` | **string* | :heavy_minus_sign: | Name of the linked company. | | | `CreatedDate` | **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 | @@ -24,6 +24,6 @@ Company info provides standard details about a linked company such as their addr | `PhoneNumbers` | [][shared.Phone](../../../pkg/models/shared/phone.md) | :heavy_minus_sign: | An array of phone numbers. | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House. | | | `SourceUrls` | map[string]*string* | :heavy_minus_sign: | URL addresses for the accounting source.

For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero). | | -| `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. | | | `WebLinks` | [][shared.Weblink](../../../pkg/models/shared/weblink.md) | :heavy_minus_sign: | An array of weblinks. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponse.md index af55cc59a..19966ae5e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingAccount](../../../pkg/models/shared/accountingaccount.md) | :heavy_minus_sign: | > **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**.

View the coverage for accounts in the Data coverage explorer.

## Overview

Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company.

The categories for an account include:
* Asset
* Expense
* Income
* Liability
* Equity.

The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online.

At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided.

To determine the list of allowed categories for a specific integration, you can:
- Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/accounting-api#/operations/get-create-chartOfAccounts-model).
- Refer to the integration's own documentation.

> **Accounts with no category**
>
> If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`.
>
> This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. | | -| `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 +| 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.AccountingCreateAccountResponseAccountingAccount](../../../pkg/models/shared/accountingcreateaccountresponseaccountingaccount.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponseaccountingaccount.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponseaccountingaccount.md new file mode 100644 index 000000000..7f9f5bc2f --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponseaccountingaccount.md @@ -0,0 +1,54 @@ +# ~~AccountingCreateAccountResponseAccountingAccount~~ + +> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. + +View the coverage for accounts in the Data coverage explorer. + +## Overview + +Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. + +The categories for an account include: +* Asset +* Expense +* Income +* Liability +* Equity. + +The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. + +At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. + +To determine the list of allowed categories for a specific integration, you can: +- Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/accounting-api#/operations/get-create-chartOfAccounts-model). +- Refer to the integration's own documentation. + +> **Accounts with no category** +> +> If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. +> +> This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Currency` | **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 | +| `CurrentBalance` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Current balance in the account. | 0 | +| `Description` | **string* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | +| `FullyQualifiedCategory` | **string* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | +| `FullyQualifiedName` | **string* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | Cash On Hand | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the account, unique for the company. | 1b6266d1-1e44-46c5-8eb5-a8f98e03124e | +| `IsBankAccount` | **bool* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | +| `Metadata` | [*shared.AccountingCreateAccountResponseMetadata](../../../pkg/models/shared/accountingcreateaccountresponsemetadata.md) | :heavy_minus_sign: | N/A | | +| `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `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 | +| `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 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.AccountingCreateAccountResponseValidDataTypeLinks](../../../pkg/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/accounting-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsemetadata.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsemetadata.md new file mode 100644 index 000000000..a2d7d5226 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsemetadata.md @@ -0,0 +1,8 @@ +# AccountingCreateAccountResponseMetadata + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `IsDeleted` | **bool* | :heavy_minus_sign: | Indicates whether the record has been deleted in the third-party system this record originated from. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md new file mode 100644 index 000000000..398fff12a --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md @@ -0,0 +1,50 @@ +# AccountingCreateAccountResponseValidDataTypeLinks + +When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. + +For example, `validDatatypeLinks` might indicate the following references: + +- Which tax rates are valid to use on the line item of a bill. +- Which items can be used when creating an invoice. + +You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. + +## `validDatatypeLinks` example + +The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. + +```json validDatatypeLinks for an account +{ + "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", + "nominalCode": "090", + "name": "Business Bank Account", + #... + "validDatatypeLinks": [ + { + "property": "Id", + "links": [ + "Payment.AccountRef.Id", + "BillPayment.AccountRef.Id", + "DirectIncome.LineItems.AccountRef.Id", + "DirectCost.LineItems.AccountRef.Id" + ] + } + ] + } +``` + + + +## Support for `validDatatypeLinks` + +Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. + +If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `Links` | []*string* | :heavy_minus_sign: | Supported `dataTypes` that the record can be linked to. | +| `Property` | **string* | :heavy_minus_sign: | The property from the account that can be linked. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponse.md index 16501ebfe..07a2dc16e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingCreditNote](../../../pkg/models/shared/accountingcreditnote.md) | :heavy_minus_sign: | > View the coverage for credit notes in the Data coverage explorer.

## Overview

Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely.

In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/accounting-api#/schemas/Customer) accounts receivable.

It contains details of:
* The amount of credit remaining and its status.
* Payment allocations against the payments type, in this case an invoice.
* Which customers the credit notes have been issued to. | | -| `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 +| 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.AccountingCreateCreditNoteResponseAccountingCreditNote](../../../pkg/models/shared/accountingcreatecreditnoteresponseaccountingcreditnote.md) | :heavy_minus_sign: | N/A | [
{
"id": "0316bd24-8a01-4a3a-a0e5-a73f14ebcbec",
"creditNoteNumber": "5239277",
"customerRef": {
"id": "b5511228-b9ef-4713-91b1-ad2cf60eadb1",
"companyName": "Tool Hire Company"
},
"totalAmount": 550,
"totalDiscount": 0,
"subTotal": 0,
"totalTaxAmount": 0,
"discountPercentage": 0,
"remainingCredit": 550,
"status": "Submitted",
"issueDate": "2018-03-28T21:28:58.249Z",
"allocatedOnDate": null,
"note": "More information available on request.",
"currency": "USD",
"currencyRate": null,
"lineItems": [
{
"description": "Anvil10000Lb",
"unitAmount": 50,
"quantity": 10,
"discountAmount": 0,
"subTotal": 500,
"taxAmount": 50,
"totalAmount": 550,
"accountRef": {
"id": "3f267b10-757d-44c0-bef9-20f70cc8fbe3",
"name": null
},
"discountPercentage": null,
"taxRateRef": {
"id": "6c88aff3-7cb9-4980-a3d3-443e72e02498",
"name": null
},
"itemRef": {
"id": "1",
"name": null
}
}
],
"paymentAllocations": [],
"modifiedDate": null,
"sourceModifiedDate": null
}
] | +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponseaccountingcreditnote.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponseaccountingcreditnote.md new file mode 100644 index 000000000..ba62dbf98 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecreditnoteresponseaccountingcreditnote.md @@ -0,0 +1,46 @@ +# ~~AccountingCreateCreditNoteResponseAccountingCreditNote~~ + +> View the coverage for credit notes in the Data coverage explorer. + +## Overview + +Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. + +In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/accounting-api#/schemas/Customer) accounts receivable. + +It contains details of: +* The amount of credit remaining and its status. +* Payment allocations against the payments type, in this case an invoice. +* Which customers the credit notes have been issued to. + +> :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 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to credit note. | | +| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the credit note. | | +| `AllocatedOnDate` | **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 | +| `CreditNoteNumber` | **string* | :heavy_minus_sign: | Friendly reference for the credit note. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Percentage rate (from 0 to 100) of discounts applied to the credit note. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the credit note, unique to the company in the accounting software. | | +| `IssueDate` | **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 | +| `LineItems` | [][shared.CreditNoteLineItem](../../../pkg/models/shared/creditnotelineitem.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. | | +| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_minus_sign: | An array of payment allocations. | | +| `RemainingCredit` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Unused balance of totalAmount originally raised. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [shared.CreditNoteStatus](../../../pkg/models/shared/creditnotestatus.md) | :heavy_check_mark: | Current state of the credit note. | | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Value of the credit note, including discounts and excluding tax. | | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Total amount of credit that has been applied to the customer's accounts receivable | | +| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any discounts applied to the credit note amount. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any tax applied to the credit note amount. | | +| `WithholdingTax` | [][shared.WithholdingTaxItems](../../../pkg/models/shared/withholdingtaxitems.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponse.md index 17cc95468..4f3364f49 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponse.md @@ -8,9 +8,9 @@ | `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.AccountingCustomer](../../../pkg/models/shared/accountingcustomer.md) | :heavy_minus_sign: | > View the coverage for customers in the Data coverage explorer.

## Overview

A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers).

Customers' data links to accounts receivable [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice).
| | +| `Data` | [*shared.AccountingCreateCustomerResponseAccountingCustomer](../../../pkg/models/shared/accountingcreatecustomerresponseaccountingcustomer.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 | +| `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 | diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponseaccountingcustomer.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponseaccountingcustomer.md new file mode 100644 index 000000000..72aa52c1b --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatecustomerresponseaccountingcustomer.md @@ -0,0 +1,33 @@ +# ~~AccountingCreateCustomerResponseAccountingCustomer~~ + +> View the coverage for customers in the Data coverage explorer. + +## Overview + +A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). + +Customers' data links to accounts receivable [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice). + + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Addresses` | [][shared.Items1](../../../pkg/models/shared/items1.md) | :heavy_minus_sign: | An array of Addresses. | | +| `ContactName` | **string* | :heavy_minus_sign: | Name of the main contact for the identified customer. | | +| `Contacts` | [][shared.Contact](../../../pkg/models/shared/contact.md) | :heavy_minus_sign: | An array of Contacts. | | +| `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 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 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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponse.md index 56863042f..0775c846c 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingDirectIncome](../../../pkg/models/shared/accountingdirectincome.md) | :heavy_minus_sign: | > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting platforms.

> View the coverage for direct incomes in the Data coverage explorer.

## Overview

Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes.

Direct incomes include:

- Selling an item directly to a contact, and receiving payment at the point of the sale.
- Refunding an item in cash to a contact.
- Depositing money into a bank account.

Direct incomes is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction).
| | -| `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 +| 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.AccountingCreateDirectIncomeResponseAccountingDirectIncome](../../../pkg/models/shared/accountingcreatedirectincomeresponseaccountingdirectincome.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponseaccountingdirectincome.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponseaccountingdirectincome.md new file mode 100644 index 000000000..8552e0b98 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatedirectincomeresponseaccountingdirectincome.md @@ -0,0 +1,42 @@ +# ~~AccountingCreateDirectIncomeResponseAccountingDirectIncome~~ + +> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. + +> View the coverage for direct incomes in the Data coverage explorer. + +## Overview + +Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes. + +Direct incomes include: + +- Selling an item directly to a contact, and receiving payment at the point of the sale. +- Refunding an item in cash to a contact. +- Depositing money into a bank account. + +Direct incomes is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). + + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContactRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `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_minus_sign: | Identifier of the direct income, unique for the company. | | +| `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 | +| `LineItems` | [][shared.DirectIncomeLineItem](../../../pkg/models/shared/directincomelineitem.md) | :heavy_check_mark: | An array of line items. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. | | +| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_check_mark: | N/A | | +| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the direct income. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of the direct incomes, excluding any taxes. | | +| `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. | | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of tax on the direct incomes. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The amount of the direct incomes, inclusive of tax. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponse.md index 33b1798ee..322910d04 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingInvoice](../../../pkg/models/shared/accountinginvoice.md) | :heavy_minus_sign: | > **Invoices or bills?**
>
> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice.
>
> See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills.

View the coverage for invoices in the Data coverage explorer.

## Overview

An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer).

In Codat, an invoice contains details of:

- The timeline of the invoice—when it was raised, marked as paid, last edited, and so on.
- How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in.
- Who the invoice has been raised to; the _customer_.
- The breakdown of what the invoice is for; the _line items_.
- Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_.

> **Invoice PDF downloads**
>
> You can download a PDF version of an invoice for supported integrations.
>
> The filename will be invoice-{number}.pdf.

> **Referencing an invoice in Sage 50 and ClearBooks**
>
> In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. | | -| `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 +| 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.AccountingCreateInvoiceResponseAccountingInvoice](../../../pkg/models/shared/accountingcreateinvoiceresponseaccountinginvoice.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountinginvoice.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountinginvoice.md new file mode 100644 index 000000000..df8f87cc9 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountinginvoice.md @@ -0,0 +1,65 @@ +# ~~AccountingCreateInvoiceResponseAccountingInvoice~~ + +> **Invoices or bills?** +> +> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. +> +> See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills. + +View the coverage for invoices in the Data coverage explorer. + +## Overview + +An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer). + +In Codat, an invoice contains details of: + +- The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. +- How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. +- Who the invoice has been raised to; the _customer_. +- The breakdown of what the invoice is for; the _line items_. +- Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. + +> **Invoice PDF downloads** +> +> You can download a PDF version of an invoice for supported integrations. +> +> The filename will be invoice-{number}.pdf. + +> **Referencing an invoice in Sage 50 and ClearBooks** +> +> In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. + +> :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 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to invoice. | | +| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the invoice. | | +| `AmountDue` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount outstanding on the invoice. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. | | +| `DueDate` | **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: | Identifier for the invoice, unique to the company in the accounting software. | | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. | | +| `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 | +| `LineItems` | [][shared.InvoiceLineItem](../../../pkg/models/shared/invoicelineitem.md) | :heavy_minus_sign: | An array of line items. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. | | +| `PaidOnDate` | **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 | +| `PaymentAllocations` | [][shared.AccountingCreateInvoiceResponseAccountingPaymentAllocation](../../../pkg/models/shared/accountingcreateinvoiceresponseaccountingpaymentallocation.md) | :heavy_minus_sign: | An array of payment allocations. | | +| `SalesOrderRefs` | [][shared.AccountingCreateInvoiceResponseSalesOrderReference](../../../pkg/models/shared/accountingcreateinvoiceresponsesalesorderreference.md) | :heavy_minus_sign: | List of references to related Sales orders. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [shared.InvoiceStatus](../../../pkg/models/shared/invoicestatus.md) | :heavy_check_mark: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it (amountDue == totalAmount).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount (0 < amountDue < totalAmount).
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid (amountDue == 0).
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the invoice excluding any taxes. | | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the invoice, inclusive of tax. | | +| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Numerical value of discounts applied to the invoice. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of tax on the invoice. | | +| `WithholdingTax` | [][shared.AccountingCreateInvoiceResponseWithholdingTax](../../../pkg/models/shared/accountingcreateinvoiceresponsewithholdingtax.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountingpaymentallocation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountingpaymentallocation.md new file mode 100644 index 000000000..de70a185e --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseaccountingpaymentallocation.md @@ -0,0 +1,9 @@ +# AccountingCreateInvoiceResponseAccountingPaymentAllocation + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `Allocation` | [shared.AccountingCreateInvoiceResponseAllocation](../../../pkg/models/shared/accountingcreateinvoiceresponseallocation.md) | :heavy_check_mark: | N/A | +| `Payment` | [shared.PaymentAllocationPayment](../../../pkg/models/shared/paymentallocationpayment.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseallocation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseallocation.md new file mode 100644 index 000000000..c94b50663 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponseallocation.md @@ -0,0 +1,11 @@ +# AccountingCreateInvoiceResponseAllocation + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllocatedOnDate` | **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 | +| `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 | +| `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. \| | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsedatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsedatatype.md new file mode 100644 index 000000000..6037b5b99 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsedatatype.md @@ -0,0 +1,10 @@ +# AccountingCreateInvoiceResponseDataType + +The underlying data type associated to the reference `id`. + + +## Values + +| Name | Value | +| ---------------------------------------------------- | ---------------------------------------------------- | +| `AccountingCreateInvoiceResponseDataTypeSalesOrders` | salesOrders | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsesalesorderreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsesalesorderreference.md new file mode 100644 index 000000000..a09c76400 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsesalesorderreference.md @@ -0,0 +1,9 @@ +# AccountingCreateInvoiceResponseSalesOrderReference + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `DataType` | [*shared.AccountingCreateInvoiceResponseDataType](../../../pkg/models/shared/accountingcreateinvoiceresponsedatatype.md) | :heavy_minus_sign: | The underlying data type associated to the reference `id`. | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier to a record in `dataType`. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsewithholdingtax.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsewithholdingtax.md new file mode 100644 index 000000000..59345aaa4 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreateinvoiceresponsewithholdingtax.md @@ -0,0 +1,9 @@ +# AccountingCreateInvoiceResponseWithholdingTax + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of tax withheld. | +| `Name` | *string* | :heavy_check_mark: | Name assigned to withheld tax. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponse.md index ac4b39f65..647b64dfa 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingJournalEntry](../../../pkg/models/shared/accountingjournalentry.md) | :heavy_minus_sign: | > **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/accounting-api#/schemas/Journal) data type

> View the coverage for journal entries in the Data coverage explorer.

## Overview

A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/accounting-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance.

A journal entry line item is a single transaction line on the journal entry. For example:

- When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items.
- When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue.

In Codat a journal entry contains details of:

- The date on which the entry was created and posted.
- Itemised lines, including amounts and currency.
- A reference to the associated accounts.
- A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger.

> **Pushing journal entries**
> Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. | | -| `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 +| 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.AccountingCreateJournalEntryResponseAccountingJournalEntry](../../../pkg/models/shared/accountingcreatejournalentryresponseaccountingjournalentry.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponseaccountingjournalentry.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponseaccountingjournalentry.md new file mode 100644 index 000000000..6b9170be8 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponseaccountingjournalentry.md @@ -0,0 +1,44 @@ +# ~~AccountingCreateJournalEntryResponseAccountingJournalEntry~~ + +> **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/accounting-api#/schemas/Journal) data type + +> View the coverage for journal entries in the Data coverage explorer. + +## Overview + +A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/accounting-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. + +A journal entry line item is a single transaction line on the journal entry. For example: + +- When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. +- When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. + +In Codat a journal entry contains details of: + +- The date on which the entry was created and posted. +- Itemised lines, including amounts and currency. +- A reference to the associated accounts. +- A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. + +> **Pushing journal entries** +> Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. + +> :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 | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CreatedOn` | **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 | +| `Description` | **string* | :heavy_minus_sign: | Optional description of the journal entry. | | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the journal entry for the company in the accounting software. | | +| `JournalLines` | [][shared.JournalLine](../../../pkg/models/shared/journalline.md) | :heavy_minus_sign: | An array of journal lines. | | +| `JournalRef` | [*shared.AccountingCreateJournalEntryResponseJournalReference](../../../pkg/models/shared/accountingcreatejournalentryresponsejournalreference.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | +| `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 | +| `PostedOn` | **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 | +| `RecordRef` | [*shared.JournalEntryRecordRef](../../../pkg/models/shared/journalentryrecordref.md) | :heavy_minus_sign: | Links a journal entry to the underlying record that created it. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `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. | | +| `UpdatedOn` | **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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponsejournalreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponsejournalreference.md new file mode 100644 index 000000000..77e10df13 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatejournalentryresponsejournalreference.md @@ -0,0 +1,11 @@ +# AccountingCreateJournalEntryResponseJournalReference + +Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `ID` | *string* | :heavy_check_mark: | GUID of the underlying journal. | +| `Name` | **string* | :heavy_minus_sign: | Name of journal | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponse.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponse.md index 10ad1df21..caa0db5a3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponse.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponse.md @@ -3,19 +3,19 @@ ## 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.AccountingPayment](../../../pkg/models/shared/accountingpayment.md) | :heavy_minus_sign: | > **Payments or bill payments?**
>
> In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/accounting-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/accounting-api#/schemas/Bill) and credit notes against bills.

> View the coverage for payments in the Data coverage explorer.

## Overview

Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote).

A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to:

- A payment made against an invoice, like a credit card, cheque, or cash payment.
- An allocation of a customer's credit note, either to an invoice or maybe a refund.
- A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account.

Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details.

In Codat, a payment contains details of:

- When the payment was recorded in the accounting system.
- How much it is for and in what currency that amount is in.
- Who the payment was _paid by_ – the _customer_.
- The payment method used.
- The breakdown of the types of payments – the _line items_.

Payments is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction).

## Payment types

## Payment of an invoice

A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties:

- An _amount_ that indicates the amount of the invoice that was paid. This is always positive.
- A **links** array containing one element with the following properties:
- A **type** that indicates the type of **link**, in this case an `Invoice`.
- An **id** that contains the ID of the invoice that was paid.
- An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`.

The **amount** field on the **line** equals the **totalAmount** on the payment.

## Payment of multiple invoices

A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books:

- The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice).
- The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available.

Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment.

## Payments and refunds on account

A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties:

- A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive.
- A **links** array containing one element with the following properties:
- A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`.
- The **id** containing the ID of the customer.
- The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund.

It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above.

## Using a credit note to pay an invoice

The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties:

- An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other.
- A **links** array containing two elements:
- The first **link** has:
- A **type** that indicates the type of **link**, in this case an `Invoice`.
- An **id** that contains the ID of the invoice that was paid.
- The second **link** has:
- A **type** that indicates the type of **link**, in this case a `CreditNote`.
- An **id** that contains the ID of the credit note used by this payment.

The **amount** field on the **line** equals the **totalAmount** on the payment.

## Refunding a credit note

A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties:

- An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund.
- A **links** array that contains one element with the following properties:
- A **type** that indicates the type of **link**, in this case a `CreditNote`.
- An **id** that contains the ID of the credit note that was refunded.

The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable.

## Refunding a payment

If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records:

- One for the incoming over payment.
- Another for the outgoing refund.

The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties:

- An **amount** that indicates the amount that was refunded. This is always negative.
- A **links** array that contains one element with the following properties:
- A **type** that indicates the type of **link**, in this case a `Payment`.
- An **id** that contains the ID of the payment that was refunded.

The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable.

The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice.

For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines:

- One for £1,000 linked to the invoice that was paid.
- Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment.

The **line** linked to the payment has the following properties:

- An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund.
- A **links** array containing one element with the following properties:
- A **type** that indicates the type of **link**, in this case a `Refund`.
- An **id** that contains the ID of the payment that refunded this line.

> **Support for linked payments**
>
> Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account.

## Foreign currencies

There are two types of currency rate that are included in the payments data type:

Payment currency rate:

- Base currency of the accounts receivable account.
- Foreign currency of the payment.

Payment line link currency rate:

- Base currency of the item the link represents.
- Foreign currency of the payment.

These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either:

- The base currency for the accounts receivable account.
- The currency of the item.

```json title="Currency rate example"
{
"id": "123",
"note": "",
"totalAmount": 99.99,
"currency": "GBP",
"lines": [
{
"amount": 99.99,
"links": [
{
"type": "Invoice",
"id": "178",
"amount": -50,
"currencyRate": 1.9998
}
]
}
]
}
```



## Example data

> **Object properties**
>
> For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments).

## Simple examples

```json title="Payment for invoice"
{
"totalAmount": 1000,
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
}
]
}
]
}
```



```json title="Allocation of credit note"
{
"totalAmount": 0,
"lines": [
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
}
]
}
]
}
```



```json title="Payment of invoice and payment on account"
{
"totalAmount": 2000,
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "PaymentOnAccount",
"id" : "y",
"amount" : -1000
}
]
}
]
}
```



```json title="Refund of credit note"
{
"totalAmount": -1000,
"lines": [
{
"amount" : -1000,
"links" : [
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
}
]
}
]
}
```



```json title="Refund on accounts receivable account"
{
"totalAmount": -1000,
"lines": [
{
"amount" : -1000,
"links" : [
{
"type" : "PaymentOnAccount",
"id" : "y",
"amount" : 1000
}
]
}
]
}
```



```json title="Linked refund on accounts receivable account"
{
"id" : "payment-001",
"totalAmount": 1000,
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Refund",
"id" : "refund-001",
"amount" : -1000
}
]
}
]
}
{
"id" : "refund-001",
"totalAmount": -1000,
"lines": [
{
"amount" : -1000,
"links" : [
{
"type" : "Payment",
"id" : "payment-001",
"amount" : 1000
}
]
}
]
}
```



```json title="Using a credit note and cash to pay an invoice"
{
"totalAmount": 250,
"lines": [
{
"amount": 0,
"links": [
{
"type": "Invoice",
"id": "x",
"amount": -750
},
{
"type": "CreditNote",
"id": "y",
"amount": 750
}
]
},
{
"amount": 250,
"links": [
{
"type": "Invoice",
"id": "x",
"amount": -250
}
]
}
]
}
```



## Complex examples

```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice"
{
"totalAmount": 1000,
"lines": [
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
}
]
},
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "z",
"amount" : 1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
}
]
}
]
}
```



```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'"
{
"totalAmount": 2000,
"lines": [
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
}
]
},
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "z",
"amount" : 1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "PaymentOnAccount",
"id" : "customer-001",
"amount" : -1000
}
]
}
]
}
```



```json title="Two credit notes pay two invoices with no allocation amount specified"
{
"totalAmount": 0,
"lines": [
{
"amount" : 0,
"links" : [
{
"type" : "Invoice",
"id" : "w",
"amount" : -1000
},
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
},
{
"type" : "CreditNote",
"id" : "z",
"amount" : 1000
}
]
}
]
}
```



```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash"
{
"totalAmount": 2000,
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "w",
"amount" : -1000
},
{
"type" : "Invoice",
"id" : "x",
"amount" : -1000
},
{
"type" : "Invoice",
"id" : "u",
"amount" : -1000
},
{
"type" : "CreditNote",
"id" : "y",
"amount" : 1000
},
{
"type" : "CreditNote",
"id" : "z",
"amount" : 1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "Refund",
"id" : "refund-001",
"amount" : -1000
}
]
}
]
}
{
"id" : "refund-001",
"totalAmount": -1000,
"lines": [
{
"amount" : -1000,
"links" : [
{
"type" : "Payment",
"id" : "payment-001",
"amount" : 1000
}
]
}
]
}
```



In this example, a payment on account is used to pay the same invoice in January and again in February.

```json title="January"
{
"id": "001",
"totalAmount": 5000,
"date" : "1901-01-01",
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "Invoice-x",
"amount" : -1000
}
]
},
{
"amount" : 4000,
"links" : [
{
"type" : "PaymentOnAccount",
"id" : "PaymentOnAccount-y",
"amount" : -4000
}
]
}
]
}
```



```json title="February"
{
"id": "001",
"totalAmount": 5000,
"date" : "1901-02-01",
"lines": [
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "Invoice-x",
"amount" : -1000
}
]
},
{
"amount" : 1000,
"links" : [
{
"type" : "Invoice",
"id" : "Invoice-y",
"amount" : -1000
}
]
},
{
"amount" : 3000,
"links" : [
{
"type" : "PaymentOnAccount",
"id" : "PaymentOnAccount-y",
"amount" : -3000
}
]
}
]
}
```



```json title="Two credit notes and some cash pay two invoices with no allocations specified"
{
"totalAmount": 500,
"lines": [
{
"amount": 500,
"links": [{
"type": "Invoice",
"id": "a",
"amount": -1000
}, {
"type": "Invoice",
"id": "b",
"amount": -1000
}, {
"type": "CreditNote",
"id": "y",
"amount": 750
},{
"type": "CreditNote",
"id": "z",
"amount": 750
}
]
}
]
}
``` | | -| `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 +| 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.AccountingCreatePaymentResponseAccountingPayment](../../../pkg/models/shared/accountingcreatepaymentresponseaccountingpayment.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponseaccountingpayment.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponseaccountingpayment.md new file mode 100644 index 000000000..cafd81c3f --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreatepaymentresponseaccountingpayment.md @@ -0,0 +1,703 @@ +# ~~AccountingCreatePaymentResponseAccountingPayment~~ + +> **Payments or bill payments?** +> +> In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/accounting-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/accounting-api#/schemas/Bill) and credit notes against bills. + +> View the coverage for payments in the Data coverage explorer. + +## Overview + +Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote). + +A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: + +- A payment made against an invoice, like a credit card, cheque, or cash payment. +- An allocation of a customer's credit note, either to an invoice or maybe a refund. +- A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. + +Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. + +In Codat, a payment contains details of: + +- When the payment was recorded in the accounting system. +- How much it is for and in what currency that amount is in. +- Who the payment was _paid by_ – the _customer_. +- The payment method used. +- The breakdown of the types of payments – the _line items_. + +Payments is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). + +## Payment types + +## Payment of an invoice + +A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: + +- An _amount_ that indicates the amount of the invoice that was paid. This is always positive. +- A **links** array containing one element with the following properties: + - A **type** that indicates the type of **link**, in this case an `Invoice`. + - An **id** that contains the ID of the invoice that was paid. + - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. + +The **amount** field on the **line** equals the **totalAmount** on the payment. + +## Payment of multiple invoices + +A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: + +- The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). +- The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. + +Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. + +## Payments and refunds on account + +A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: + +- A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. +- A **links** array containing one element with the following properties: +- A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. +- The **id** containing the ID of the customer. +- The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. + +It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. + +## Using a credit note to pay an invoice + +The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: + +- An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. +- A **links** array containing two elements: + - The first **link** has: + - A **type** that indicates the type of **link**, in this case an `Invoice`. + - An **id** that contains the ID of the invoice that was paid. + - The second **link** has: + - A **type** that indicates the type of **link**, in this case a `CreditNote`. + - An **id** that contains the ID of the credit note used by this payment. + +The **amount** field on the **line** equals the **totalAmount** on the payment. + +## Refunding a credit note + +A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: + +- An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. +- A **links** array that contains one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `CreditNote`. + - An **id** that contains the ID of the credit note that was refunded. + +The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. + +## Refunding a payment + +If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: + +- One for the incoming over payment. +- Another for the outgoing refund. + +The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: + +- An **amount** that indicates the amount that was refunded. This is always negative. +- A **links** array that contains one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `Payment`. + - An **id** that contains the ID of the payment that was refunded. + +The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. + +The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. + +For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: + +- One for £1,000 linked to the invoice that was paid. +- Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. + +The **line** linked to the payment has the following properties: + +- An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. +- A **links** array containing one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `Refund`. + - An **id** that contains the ID of the payment that refunded this line. + +> **Support for linked payments** +> +> Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. + +## Foreign currencies + +There are two types of currency rate that are included in the payments data type: + +Payment currency rate: + +- Base currency of the accounts receivable account. +- Foreign currency of the payment. + +Payment line link currency rate: + +- Base currency of the item the link represents. +- Foreign currency of the payment. + +These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: + +- The base currency for the accounts receivable account. +- The currency of the item. + + ```json title="Currency rate example" + { + "id": "123", + "note": "", + "totalAmount": 99.99, + "currency": "GBP", + "lines": [ + { + "amount": 99.99, + "links": [ + { + "type": "Invoice", + "id": "178", + "amount": -50, + "currencyRate": 1.9998 + } + ] + } + ] + } + ``` + + + +## Example data + +> **Object properties** +> +> For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). + +## Simple examples + + ```json title="Payment for invoice" + { + "totalAmount": 1000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Allocation of credit note" + { + "totalAmount": 0, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Payment of invoice and payment on account" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "y", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Refund of credit note" + { + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Refund on accounts receivable account" + { + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Linked refund on accounts receivable account" + { + "id" : "payment-001", + "totalAmount": 1000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Refund", + "id" : "refund-001", + "amount" : -1000 + } + ] + } + ] + } + { + "id" : "refund-001", + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "Payment", + "id" : "payment-001", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Using a credit note and cash to pay an invoice" + { + "totalAmount": 250, + "lines": [ + { + "amount": 0, + "links": [ + { + "type": "Invoice", + "id": "x", + "amount": -750 + }, + { + "type": "CreditNote", + "id": "y", + "amount": 750 + } + ] + }, + { + "amount": 250, + "links": [ + { + "type": "Invoice", + "id": "x", + "amount": -250 + } + ] + } + ] + } + ``` + + + +## Complex examples + + ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" + { + "totalAmount": 1000, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + }, + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + }, + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "customer-001", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes pay two invoices with no allocation amount specified" + { + "totalAmount": 0, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "w", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "w", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "u", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Refund", + "id" : "refund-001", + "amount" : -1000 + } + ] + } + ] + } + { + "id" : "refund-001", + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "Payment", + "id" : "payment-001", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + +In this example, a payment on account is used to pay the same invoice in January and again in February. + + ```json title="January" + { + "id": "001", + "totalAmount": 5000, + "date" : "1901-01-01", + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-x", + "amount" : -1000 + } + ] + }, + { + "amount" : 4000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "PaymentOnAccount-y", + "amount" : -4000 + } + ] + } + ] + } + ``` + + + + ```json title="February" + { + "id": "001", + "totalAmount": 5000, + "date" : "1901-02-01", + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-y", + "amount" : -1000 + } + ] + }, + { + "amount" : 3000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "PaymentOnAccount-y", + "amount" : -3000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes and some cash pay two invoices with no allocations specified" + { + "totalAmount": 500, + "lines": [ + { + "amount": 500, + "links": [{ + "type": "Invoice", + "id": "a", + "amount": -1000 + }, { + "type": "Invoice", + "id": "b", + "amount": -1000 + }, { + "type": "CreditNote", + "id": "y", + "amount": 750 + },{ + "type": "CreditNote", + "id": "z", + "amount": 750 + } + ] + } + ] + } + ``` + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `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_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | | +| `Lines` | [][shared.PaymentLine](../../../pkg/models/shared/paymentline.md) | :heavy_minus_sign: | An array of payment lines. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information associated with the payment. | | +| `PaymentMethodRef` | [*shared.PaymentMethodRef](../../../pkg/models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | +| `Reference` | **string* | :heavy_minus_sign: | Friendly reference for the payment. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreditnote.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreditnote.md index 574a39014..efddf99a5 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreditnote.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcreditnote.md @@ -16,29 +16,29 @@ It contains details of: ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to credit note. | | -| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the credit note. | | -| `AllocatedOnDate` | **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 | -| `CreditNoteNumber` | **string* | :heavy_minus_sign: | Friendly reference for the credit note. | | -| `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 | -| `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. \| | | -| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Percentage rate (from 0 to 100) of discounts applied to the credit note. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the credit note, unique to the company in the accounting platform. | | -| `IssueDate` | **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 | -| `LineItems` | [][shared.CreditNoteLineItem](../../../pkg/models/shared/creditnotelineitem.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `Note` | **string* | :heavy_minus_sign: | Any additional information about the credit note. Where possible, Codat links to a data field in the accounting platform that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting platform to the customer. | | -| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_minus_sign: | An array of payment allocations. | | -| `RemainingCredit` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Unused balance of totalAmount originally raised. | | -| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `Status` | [shared.CreditNoteStatus](../../../pkg/models/shared/creditnotestatus.md) | :heavy_check_mark: | Current state of the credit note. | | -| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Value of the credit note, including discounts and excluding tax. | | -| `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. | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Total amount of credit that has been applied to the customer's accounts receivable | | -| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any discounts applied to the credit note amount. | | -| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any tax applied to the credit note amount. | | -| `WithholdingTax` | [][shared.WithholdingTaxItems](../../../pkg/models/shared/withholdingtaxitems.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to credit note. | | +| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the credit note. | | +| `AllocatedOnDate` | **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 | +| `CreditNoteNumber` | **string* | :heavy_minus_sign: | Friendly reference for the credit note. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Percentage rate (from 0 to 100) of discounts applied to the credit note. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the credit note, unique to the company in the accounting software. | | +| `IssueDate` | **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 | +| `LineItems` | [][shared.CreditNoteLineItem](../../../pkg/models/shared/creditnotelineitem.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. | | +| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_minus_sign: | An array of payment allocations. | | +| `RemainingCredit` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Unused balance of totalAmount originally raised. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [shared.CreditNoteStatus](../../../pkg/models/shared/creditnotestatus.md) | :heavy_check_mark: | Current state of the credit note. | | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Value of the credit note, including discounts and excluding tax. | | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Total amount of credit that has been applied to the customer's accounts receivable | | +| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any discounts applied to the credit note amount. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Any tax applied to the credit note amount. | | +| `WithholdingTax` | [][shared.WithholdingTaxItems](../../../pkg/models/shared/withholdingtaxitems.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcustomer.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcustomer.md index 0ead4f4ed..b8da08398 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcustomer.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingcustomer.md @@ -20,12 +20,12 @@ Customers' data links to accounts receivable [invoices](https://docs.codat.io/ac | `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingdirectincome.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingdirectincome.md index 1e1dfe442..7c5be4f1b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingdirectincome.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingdirectincome.md @@ -1,6 +1,6 @@ # AccountingDirectIncome -> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting platforms. +> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. > View the coverage for direct incomes in the Data coverage explorer. @@ -20,21 +20,21 @@ Direct incomes is a child data type of [account transactions](https://docs.codat ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ContactRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | A customer or supplier associated with the direct income. | | -| `Currency` | *string* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | -| `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_minus_sign: | Identifier of the direct income, unique for the company. | | -| `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 | -| `LineItems` | [][shared.DirectIncomeLineItem](../../../pkg/models/shared/directincomelineitem.md) | :heavy_check_mark: | An array of line items. | | -| `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 | -| `Note` | **string* | :heavy_minus_sign: | An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. | | -| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_check_mark: | N/A | | -| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the direct income. | | -| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of the direct incomes, excluding any taxes. | | -| `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. | | -| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of tax on the direct incomes. | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The amount of the direct incomes, inclusive of tax. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContactRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `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_minus_sign: | Identifier of the direct income, unique for the company. | | +| `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 | +| `LineItems` | [][shared.DirectIncomeLineItem](../../../pkg/models/shared/directincomelineitem.md) | :heavy_check_mark: | An array of line items. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. | | +| `PaymentAllocations` | [][shared.PaymentAllocationItems](../../../pkg/models/shared/paymentallocationitems.md) | :heavy_check_mark: | N/A | | +| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the direct income. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of the direct incomes, excluding any taxes. | | +| `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. | | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The total amount of tax on the direct incomes. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | The amount of the direct incomes, inclusive of tax. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoice.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoice.md index e93819318..42fd6cbe1 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoice.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoice.md @@ -33,31 +33,31 @@ In Codat, an invoice contains details of: ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to invoice. | | -| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the invoice. | | -| `AmountDue` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount outstanding on the invoice. | | -| `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 | -| `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. \| | | -| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. | | -| `DueDate` | **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: | Identifier for the invoice, unique to the company in the accounting platform. | | -| `InvoiceNumber` | **string* | :heavy_minus_sign: | Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. | | -| `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 | -| `LineItems` | [][shared.InvoiceLineItem](../../../pkg/models/shared/invoicelineitem.md) | :heavy_minus_sign: | An array of line items. | | -| `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 | -| `Note` | **string* | :heavy_minus_sign: | Any additional information about the invoice. Where possible, Codat links to a data field in the accounting platform that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting platform to the customer. | | -| `PaidOnDate` | **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 | -| `PaymentAllocations` | [][shared.AccountingPaymentAllocation](../../../pkg/models/shared/accountingpaymentallocation.md) | :heavy_minus_sign: | An array of payment allocations. | | -| `SalesOrderRefs` | [][shared.SalesOrderReference](../../../pkg/models/shared/salesorderreference.md) | :heavy_minus_sign: | List of references to related Sales orders. | | -| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `Status` | [shared.InvoiceStatus](../../../pkg/models/shared/invoicestatus.md) | :heavy_check_mark: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it (amountDue == totalAmount).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount (0 < amountDue < totalAmount).
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid (amountDue == 0).
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | -| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the invoice excluding any taxes. | | -| `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. | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the invoice, inclusive of tax. | | -| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Numerical value of discounts applied to the invoice. | | -| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of tax on the invoice. | | -| `WithholdingTax` | [][shared.WithholdingTax](../../../pkg/models/shared/withholdingtax.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdditionalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Additional tax amount applied to invoice. | | +| `AdditionalTaxPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate of any additional tax applied to the invoice. | | +| `AmountDue` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount outstanding on the invoice. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. | | +| `DueDate` | **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: | Identifier for the invoice, unique to the company in the accounting software. | | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. | | +| `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 | +| `LineItems` | [][shared.InvoiceLineItem](../../../pkg/models/shared/invoicelineitem.md) | :heavy_minus_sign: | An array of line items. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. | | +| `PaidOnDate` | **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 | +| `PaymentAllocations` | [][shared.AccountingPaymentAllocation](../../../pkg/models/shared/accountingpaymentallocation.md) | :heavy_minus_sign: | An array of payment allocations. | | +| `SalesOrderRefs` | [][shared.SalesOrderReference](../../../pkg/models/shared/salesorderreference.md) | :heavy_minus_sign: | List of references to related Sales orders. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [shared.InvoiceStatus](../../../pkg/models/shared/invoicestatus.md) | :heavy_check_mark: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it (amountDue == totalAmount).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount (0 < amountDue < totalAmount).
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid (amountDue == 0).
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the invoice excluding any taxes. | | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the invoice, inclusive of tax. | | +| `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Numerical value of discounts applied to the invoice. | | +| `TotalTaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of tax on the invoice. | | +| `WithholdingTax` | [][shared.WithholdingTax](../../../pkg/models/shared/withholdingtax.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoiceallocation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoiceallocation.md index efb746bf0..c1082fdfb 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoiceallocation.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoiceallocation.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AllocatedOnDate` | **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 | -| `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 | -| `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. \| | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllocatedOnDate` | **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 | +| `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 | +| `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. \| | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoicedatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoicedatatype.md new file mode 100644 index 000000000..d29cf26d1 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountinginvoicedatatype.md @@ -0,0 +1,10 @@ +# AccountingInvoiceDataType + +The underlying data type associated to the reference `id`. + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `AccountingInvoiceDataTypeSalesOrders` | salesOrders | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingjournalentry.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingjournalentry.md index 36a00b4a8..e280d5709 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingjournalentry.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingjournalentry.md @@ -30,13 +30,13 @@ In Codat a journal entry contains details of: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CreatedOn` | **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 | | `Description` | **string* | :heavy_minus_sign: | Optional description of the journal entry. | | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the journal entry for the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the journal entry for the company in the accounting software. | | | `JournalLines` | [][shared.JournalLine](../../../pkg/models/shared/journalline.md) | :heavy_minus_sign: | An array of journal lines. | | | `JournalRef` | [*shared.JournalReference](../../../pkg/models/shared/journalreference.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | | `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 | | `PostedOn` | **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 | -| `RecordRef` | [*shared.RecordReference](../../../pkg/models/shared/recordreference.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | | +| `RecordRef` | [*shared.JournalEntryRecordRef](../../../pkg/models/shared/journalentryrecordref.md) | :heavy_minus_sign: | Links a journal entry to the underlying record that created it. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `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. | | | `UpdatedOn` | **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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingpayment.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingpayment.md index 5be4fbd25..69de33cfe 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingpayment.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountingpayment.md @@ -16,7 +16,7 @@ A payment in Codat usually represents an allocation of money within any customer - An allocation of a customer's credit note, either to an invoice or maybe a refund. - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. -Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details. +Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. In Codat, a payment contains details of: @@ -121,7 +121,7 @@ The **line** linked to the payment has the following properties: > **Support for linked payments** > -> Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. +> Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. ## Foreign currencies @@ -682,20 +682,20 @@ In this example, a payment on account is used to pay the same invoice in January ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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. | | -| `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 | -| `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. \| | | -| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `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_minus_sign: | Identifier for the payment, unique to the company in the accounting platform. | | -| `Lines` | [][shared.PaymentLine](../../../pkg/models/shared/paymentline.md) | :heavy_minus_sign: | An array of payment lines. | | -| `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 | -| `Note` | **string* | :heavy_minus_sign: | Any additional information associated with the payment. | | -| `PaymentMethodRef` | [*shared.PaymentMethodRef](../../../pkg/models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce platform. | | -| `Reference` | **string* | :heavy_minus_sign: | Friendly reference for the payment. | | -| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `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. | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | | +| `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 | +| `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. \| | | +| `CustomerRef` | [*shared.AccountingCustomerRef](../../../pkg/models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | +| `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_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | | +| `Lines` | [][shared.PaymentLine](../../../pkg/models/shared/paymentline.md) | :heavy_minus_sign: | An array of payment lines. | | +| `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 | +| `Note` | **string* | :heavy_minus_sign: | Any additional information associated with the payment. | | +| `PaymentMethodRef` | [*shared.PaymentMethodRef](../../../pkg/models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | +| `Reference` | **string* | :heavy_minus_sign: | Friendly reference for the payment. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `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. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountprototype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountprototype.md index b4395f484..bca4723a3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/accountprototype.md +++ b/previous-versions/sync-for-commerce-version-1/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](/accounting-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/allocation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/allocation.md index 8982baae5..169c1064a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/allocation.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/allocation.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AllocatedOnDate` | **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 | -| `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 | -| `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. \| | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllocatedOnDate` | **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 | +| `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 | +| `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. \| | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/bankaccountstatus.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/bankaccountstatus.md new file mode 100644 index 000000000..40d8b757e --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecompanyinfo.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecompanyinfo.md index 744bef8da..3990c5cea 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecompanyinfo.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecompanyinfo.md @@ -14,7 +14,7 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `AccountBalances` | [][shared.AccountBalance](../../../pkg/models/shared/accountbalance.md) | :heavy_minus_sign: | The available and current cash balances for the company's accounts | | | `Addresses` | [][shared.Items](../../../pkg/models/shared/items.md) | :heavy_minus_sign: | Addresses associated with the company | | | `BaseCurrency` | **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 | -| `CommercePlatformRef` | **string* | :heavy_minus_sign: | Identifier or reference for the company in the commerce platform | | +| `CommercePlatformRef` | **string* | :heavy_minus_sign: | Identifier or reference for the company in the commerce software | | | `CompanyLegalName` | **string* | :heavy_minus_sign: | The full legal name of the company | Codat Limited | | `CompanyName` | **string* | :heavy_minus_sign: | The name of the company | Codat | | `CreatedDate` | **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 | @@ -22,5 +22,5 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `PhoneNumbers` | [][shared.PhoneNumberItems](../../../pkg/models/shared/phonenumberitems.md) | :heavy_minus_sign: | Phone numbers associated with the company | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | The registration number of the company | 10480375 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `SourceUrls` | map[string]*string* | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | {"url1":"https://connect.sandbox.com/v2/customers","url2":"https://connect.sandbox.com/v2/disputes"} | +| `SourceUrls` | map[string]*string* | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | {
"url1": "https://connect.sandbox.com/v2/customers",
"url2": "https://connect.sandbox.com/v2/disputes"
} | | `WebLinks` | [][shared.WebLinkItems](../../../pkg/models/shared/weblinkitems.md) | :heavy_minus_sign: | Weblinks associated with the company | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecustomers.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecustomers.md index 0113e3720..36d60036c 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecustomers.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercecustomers.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommerceCustomer](../../../pkg/models/shared/commercecustomer.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommerceCustomer](../../../pkg/models/shared/commercecustomer.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercelocations.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercelocations.md index e2914f248..2c66c6cdb 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercelocations.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercelocations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommerceLocation](../../../pkg/models/shared/commercelocation.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommerceLocation](../../../pkg/models/shared/commercelocation.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorder.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorder.md index eb218d549..5e4ade47f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorder.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorder.md @@ -23,7 +23,7 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `Payments` | [][shared.PaymentRef](../../../pkg/models/shared/paymentref.md) | :heavy_minus_sign: | N/A | | | `ServiceCharges` | [][shared.ServiceCharge](../../../pkg/models/shared/servicecharge.md) | :heavy_minus_sign: | N/A | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `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. | | | `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. | | | `TotalDiscount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order). | | | `TotalGratuity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Extra amount added to the order. | | diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorders.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorders.md index c3aa07332..57d4f87e5 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorders.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceorders.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommerceOrder](../../../pkg/models/shared/commerceorder.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommerceOrder](../../../pkg/models/shared/commerceorder.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayment.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayment.md index c03202b2f..f101f3c97 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayment.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayment.md @@ -19,8 +19,8 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `DueDate` | **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_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `PaymentMethodRef` | [*shared.PaymentMethodRef](../../../pkg/models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce platform. | | +| `PaymentMethodRef` | [*shared.PaymentMethodRef](../../../pkg/models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | | `PaymentProvider` | **string* | :heavy_minus_sign: | Service provider of the payment, if applicable. | Amazon Pay | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [*shared.PaymentStatus](../../../pkg/models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | -| `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. | | \ No newline at end of file +| `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepaymentmethods.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepaymentmethods.md index f4114e828..8f422a1e1 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepaymentmethods.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepaymentmethods.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommercePaymentMethod](../../../pkg/models/shared/commercepaymentmethod.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommercePaymentMethod](../../../pkg/models/shared/commercepaymentmethod.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayments.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayments.md index b6729107f..00ddebf0c 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayments.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercepayments.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommercePayment](../../../pkg/models/shared/commercepayment.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommercePayment](../../../pkg/models/shared/commercepayment.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproduct.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproduct.md index f41f25a8e..1eac9e341 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproduct.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproduct.md @@ -15,5 +15,5 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `ID` | *string* | :heavy_check_mark: | A unique, persistent identifier for this record | 13d946f0-c5d5-42bc-b092-97ece17923ab | | `IsGiftCard` | **bool* | :heavy_minus_sign: | Whether the product represents a gift card or voucher that
can be redeemed in the commerce or POS platform.
| | | `Name` | **string* | :heavy_minus_sign: | Name of the product in the commerce or POS system | Hard Drive | -| `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. | | | `Variants` | [][shared.ProductVariant](../../../pkg/models/shared/productvariant.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproducts.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproducts.md index f3f4918b9..e33c18c27 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproducts.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commerceproducts.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommerceProduct](../../../pkg/models/shared/commerceproduct.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommerceProduct](../../../pkg/models/shared/commerceproduct.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransaction.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransaction.md index 6032d8622..c50e1f8c9 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransaction.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransaction.md @@ -22,8 +22,8 @@ Explore our [data coverage](https://knowledge.codat.io/supported-features/commer | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `SourceCreatedDate` | **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 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `SubType` | **string* | :heavy_minus_sign: | Non-standardised transaction type data from the commerce platform | CardPayment | -| `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. | | +| `SubType` | **string* | :heavy_minus_sign: | Non-standardised transaction type data from the commerce software | CardPayment | +| `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. | | | `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | The total transaction amount | 194.12 | | `TransactionSourceRef` | [*shared.TransactionSourceRef](../../../pkg/models/shared/transactionsourceref.md) | :heavy_minus_sign: | Link to the source event which triggered this transaction | | | `Type` | [*shared.TransactionType](../../../pkg/models/shared/transactiontype.md) | :heavy_minus_sign: | The type of the platform transaction:
- `Unknown`
- `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account.
- `Payment` — Credit and debit card payments.
- `PaymentFee` — Payment provider's fee on each card payment.
- `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller.
- `Payout` — Transfer of funds from the seller's merchant account to their bank account.
- `Refund` — Refunds to a customer's credit or debit card.
- `Transfer` — Secure transfer of funds to the seller's bank account. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransactions.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransactions.md index 869480521..bbfde3de4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransactions.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/commercetransactions.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.CommerceTransaction](../../../pkg/models/shared/commercetransaction.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.CommerceTransaction](../../../pkg/models/shared/commercetransaction.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/companies.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/companies.md index 69cdb4781..320f6c913 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/companies.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/companies.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/company.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/company.md index 80fd41364..3ee7dc449 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/company.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/company.md @@ -18,5 +18,5 @@ When you create a company, you can specify a `name` and we will automatically ge | `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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connection.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connection.md index 761d267cb..469b22d58 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connection.md +++ b/previous-versions/sync-for-commerce-version-1/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 | | @@ -27,5 +27,5 @@ Before you can use a data connection to pull or push data, the company must gran | `LinkURL` | *string* | :heavy_check_mark: | The link URL your customers can use to authorize access to their business application. | https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/2e2eb431-c1fa-4dc9-93fa-d29781c12bcd/start | | `PlatformName` | *string* | :heavy_check_mark: | Name of integration connected to company. | | | `SourceID` | *string* | :heavy_check_mark: | A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`. | 35b92968-9851-4095-ad60-395c95cbcba4 | -| `SourceType` | [shared.ConnectionSourceType](../../../pkg/models/shared/connectionsourcetype.md) | :heavy_check_mark: | The type of platform of the connection. | Accounting | +| `SourceType` | [shared.SourceType](../../../pkg/models/shared/sourcetype.md) | :heavy_check_mark: | The type of platform of the connection. | Accounting | | `Status` | [shared.DataConnectionStatus](../../../pkg/models/shared/dataconnectionstatus.md) | :heavy_check_mark: | The current authorization status of the data connection. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connections.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connections.md index 040385d65..4fe3ef571 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connections.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connections.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connectionsourcetype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connectionsourcetype.md deleted file mode 100644 index e9f3060f8..000000000 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/connectionsourcetype.md +++ /dev/null @@ -1,14 +0,0 @@ -# ConnectionSourceType - -The type of platform of the connection. - - -## Values - -| Name | Value | -| -------------------------------- | -------------------------------- | -| `ConnectionSourceTypeAccounting` | Accounting | -| `ConnectionSourceTypeBanking` | Banking | -| `ConnectionSourceTypeCommerce` | Commerce | -| `ConnectionSourceTypeOther` | Other | -| `ConnectionSourceTypeUnknown` | Unknown | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactref.md index d72937c79..ab733d1b2 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactref.md @@ -1,11 +1,9 @@ # ContactRef -A customer or supplier associated with the direct income. - ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices | -| `ID` | *string* | :heavy_check_mark: | Unique identifier for a customer or supplier. | | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `DataType` | [*shared.ContactRefDataType](../../../pkg/models/shared/contactrefdatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | +| `ID` | *string* | :heavy_check_mark: | Unique identifier for a customer or supplier. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactrefdatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactrefdatatype.md new file mode 100644 index 000000000..7b625be61 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactrefdatatype.md @@ -0,0 +1,11 @@ +# ContactRefDataType + +Allowed name of the 'dataType'. + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `ContactRefDataTypeCustomers` | customers | +| `ContactRefDataTypeSuppliers` | suppliers | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactreference.md new file mode 100644 index 000000000..2bdc8bae1 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/contactreference.md @@ -0,0 +1,9 @@ +# ContactReference + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `DataType` | [*shared.JournalLineDataType](../../../pkg/models/shared/journallinedatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | +| `ID` | *string* | :heavy_check_mark: | Unique identifier for a customer or supplier. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/createcompany.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/createcompany.md index 500cbe20b..9761c30c2 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/createcompany.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/createcompany.md @@ -6,4 +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.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/recordref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemrecordreference.md similarity index 97% rename from previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/recordref.md rename to previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemrecordreference.md index b03c96fc6..62c682458 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/recordref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemrecordreference.md @@ -1,4 +1,4 @@ -# RecordRef +# CreditNoteLineItemRecordReference Links the current record to the underlying record or data type that created it. diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemtracking.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemtracking.md index fb6c178c1..17c6a7bf3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemtracking.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/creditnotelineitemtracking.md @@ -12,4 +12,4 @@ Categories, and a project and customer, against which the item is tracked. | `IsBilledTo` | [shared.BilledToType](../../../pkg/models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | | `IsRebilledTo` | [shared.BilledToType](../../../pkg/models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | | `ProjectRef` | [*shared.CreditNoteLineItemAccountingProjectReference](../../../pkg/models/shared/creditnotelineitemaccountingprojectreference.md) | :heavy_minus_sign: | N/A | -| `RecordRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | \ No newline at end of file +| `RecordRef` | [*shared.CreditNoteLineItemRecordReference](../../../pkg/models/shared/creditnotelineitemrecordreference.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataconnectionerror.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataconnectionerror.md index 350df632c..1d234b89a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataconnectionerror.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataset.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataset.md index 5b26dbe14..97c5947ce 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataset.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/dataset.md @@ -8,7 +8,7 @@ | `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `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 for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `DataType` | [*shared.DataTypes](../../../pkg/models/shared/datatypes.md) | :heavy_minus_sign: | Available Data types | invoices | +| `DataType` | [*shared.DataTypes](../../../pkg/models/shared/datatypes.md) | :heavy_minus_sign: | Available data types | invoices | | `DatasetLogsURL` | **string* | :heavy_minus_sign: | URI to the dataset's logs. | | | `ErrorMessage` | **string* | :heavy_minus_sign: | A brief message about the error. | | | `ID` | *string* | :heavy_check_mark: | Identifier for the dataset. | | diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datastatus.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datastatus.md index 871f271d5..e6c4bab6d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datastatus.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datastatus.md @@ -7,8 +7,8 @@ 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. | | -| `DataType` | [shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_check_mark: | Available Data types | invoices | +| `CurrentStatus` | [shared.DatasetStatus](../../../pkg/models/shared/datasetstatus.md) | :heavy_check_mark: | The current status of the dataset. | | +| `DataType` | [shared.DataType](../../../pkg/models/shared/datatype.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 | | `LatestSyncID` | **string* | :heavy_minus_sign: | Unique identifier for most recent sync of data type. | ad474a37-2003-478e-baee-9af9f1ec2fe3 | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatype.md index 550f76533..a44e87a38 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatype.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatype.md @@ -1,6 +1,6 @@ # DataType -Available Data types +Available data types ## Values diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypefeature.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypefeature.md index c3e5c89c0..b400edec4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypefeature.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypefeature.md @@ -7,5 +7,5 @@ Describes support for a given datatype and associated operations | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices | +| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | | `SupportedFeatures` | [][shared.SupportedFeature](../../../pkg/models/shared/supportedfeature.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypes.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypes.md index 3aa7e83b1..61fa6bc31 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypes.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/datatypes.md @@ -1,6 +1,6 @@ # DataTypes -Available Data types +Available data types ## Values diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorstatus.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorstatus.md new file mode 100644 index 000000000..0164bbe93 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidation.md new file mode 100644 index 000000000..9d2fa4558 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidation.md @@ -0,0 +1,11 @@ +# ErrorValidation + +A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `Errors` | [][shared.ErrorValidationItem](../../../pkg/models/shared/errorvalidationitem.md) | :heavy_minus_sign: | N/A | +| `Warnings` | [][shared.ErrorValidationItem](../../../pkg/models/shared/errorvalidationitem.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidationitem.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidationitem.md new file mode 100644 index 000000000..3d68d9302 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/errorvalidationitem.md @@ -0,0 +1,10 @@ +# ErrorValidationItem + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `ItemID` | **string* | :heavy_minus_sign: | Unique identifier for a validation item. | +| `Message` | **string* | :heavy_minus_sign: | A message outlining validation item's issue. | +| `ValidatorName` | **string* | :heavy_minus_sign: | Name of validator. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/groupreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/groupreference.md new file mode 100644 index 000000000..6bf386bd0 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/groupreference.md @@ -0,0 +1,8 @@ +# GroupReference + + +## 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 diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/integrations.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/integrations.md index 2aa82c492..a5fb34eae 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/integrations.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/integrations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.Integration](../../../pkg/models/shared/integration.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.Integration](../../../pkg/models/shared/integration.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/invoicelineitem.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/invoicelineitem.md index 3c2276072..52a27286a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/invoicelineitem.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/invoicelineitem.md @@ -3,19 +3,19 @@ ## 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. | -| `Description` | **string* | :heavy_minus_sign: | Friendly name of the goods or services provided. | -| `DiscountAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Numerical value of any discounts applied. | -| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any discounts applied to the unit amount. | -| `IsDirectIncome` | **bool* | :heavy_minus_sign: | The invoice is a direct income if `True`. | -| `ItemRef` | [*shared.ItemRef](../../../pkg/models/shared/itemref.md) | :heavy_minus_sign: | Reference to the product, service type, or inventory item to which the direct cost is linked. | -| `Quantity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Number of units of goods or services provided. | -| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | -| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | -| `TaxRateRef` | [*shared.TaxRateRef](../../../pkg/models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the line item is linked. | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified. | -| `Tracking` | [*shared.Tracking](../../../pkg/models/shared/tracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | -| ~~`TrackingCategoryRefs`~~ | [][shared.TrackingCategoryRefItems](../../../pkg/models/shared/trackingcategoryrefitems.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Reference to the tracking categories to which the line item is linked. | -| `UnitAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Price of each unit of goods or services. | \ No newline at end of file +| 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. | +| `Description` | **string* | :heavy_minus_sign: | Friendly name of the goods or services provided. | +| `DiscountAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Numerical value of any discounts applied. | +| `DiscountPercentage` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any discounts applied to the unit amount. | +| `IsDirectIncome` | **bool* | :heavy_minus_sign: | The invoice is a direct income if `True`. | +| `ItemRef` | [*shared.ItemRef](../../../pkg/models/shared/itemref.md) | :heavy_minus_sign: | Reference to the product, service type, or inventory item to which the direct cost is linked. | +| `Quantity` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Number of units of goods or services provided. | +| `SubTotal` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | +| `TaxRateRef` | [*shared.TaxRateRef](../../../pkg/models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the line item is linked. | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified. | +| `Tracking` | [*shared.Tracking](../../../pkg/models/shared/tracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | +| `TrackingCategoryRefs` | [][shared.TrackingCategoryRefItems](../../../pkg/models/shared/trackingcategoryrefitems.md) | :heavy_minus_sign: | Reference to the tracking categories to which the line item is linked. | +| `UnitAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Price of each unit of goods or services. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemref.md index 1a6bdf9de..a76220354 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemref.md @@ -7,5 +7,5 @@ Reference to the product, service type, or inventory item to which the direct co | Field | Type | Required | Description | | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | Unique identifier for the item in the accounting platform. | -| `Name` | **string* | :heavy_minus_sign: | Name of the item in the accounting platform. | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | Unique identifier for the item in the accounting software. | +| `Name` | **string* | :heavy_minus_sign: | Name of the item in the accounting software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemreference.md index 21c97cbff..04b84ed8b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemreference.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/itemreference.md @@ -7,5 +7,5 @@ Reference to the product, service type, or inventory item to which the direct co | Field | Type | Required | Description | | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | Unique identifier for the item in the accounting platform. | -| `Name` | **string* | :heavy_minus_sign: | Name of the item in the accounting platform. | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | Unique identifier for the item in the accounting software. | +| `Name` | **string* | :heavy_minus_sign: | Name of the item in the accounting software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/items1.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/items1.md deleted file mode 100644 index 4056351d4..000000000 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/items1.md +++ /dev/null @@ -1,14 +0,0 @@ -# Items1 - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `City` | **string* | :heavy_minus_sign: | City of the customer address. | -| `Country` | **string* | :heavy_minus_sign: | Country of the customer address. | -| `Line1` | **string* | :heavy_minus_sign: | Line 1 of the customer address. | -| `Line2` | **string* | :heavy_minus_sign: | Line 2 of the customer address. | -| `PostalCode` | **string* | :heavy_minus_sign: | Postal code or zip code. | -| `Region` | **string* | :heavy_minus_sign: | Region of the customer address. | -| `Type` | [shared.AccountingAddressType](../../../pkg/models/shared/accountingaddresstype.md) | :heavy_check_mark: | The type of the address | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordref.md new file mode 100644 index 000000000..921b519c9 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordref.md @@ -0,0 +1,11 @@ +# JournalEntryRecordRef + +Links a journal entry to the underlying record that created it. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `DataType` | [*shared.JournalEntryRecordRefDataType](../../../pkg/models/shared/journalentryrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | transfers | +| `ID` | **string* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordrefdatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordrefdatatype.md new file mode 100644 index 000000000..607ee0eab --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalentryrecordrefdatatype.md @@ -0,0 +1,20 @@ +# JournalEntryRecordRefDataType + +Name of underlying data type. + + +## Values + +| Name | Value | +| ----------------------------------------------- | ----------------------------------------------- | +| `JournalEntryRecordRefDataTypeBankTransactions` | bankTransactions | +| `JournalEntryRecordRefDataTypeBillCreditNotes` | billCreditNotes | +| `JournalEntryRecordRefDataTypeBillPayments` | billPayments | +| `JournalEntryRecordRefDataTypeBills` | bills | +| `JournalEntryRecordRefDataTypeCreditNotes` | creditNotes | +| `JournalEntryRecordRefDataTypeDirectCosts` | directCosts | +| `JournalEntryRecordRefDataTypeDirectIncomes` | directIncomes | +| `JournalEntryRecordRefDataTypeInvoices` | invoices | +| `JournalEntryRecordRefDataTypeJournalEntries` | journalEntries | +| `JournalEntryRecordRefDataTypePayments` | payments | +| `JournalEntryRecordRefDataTypeTransfers` | transfers | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalline.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalline.md index 951513850..426b6a087 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalline.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journalline.md @@ -6,6 +6,7 @@ | 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. | +| `ContactRef` | [*shared.ContactReference](../../../pkg/models/shared/contactreference.md) | :heavy_minus_sign: | N/A | | `Currency` | **string* | :heavy_minus_sign: | Currency for the journal line item. | | `Description` | **string* | :heavy_minus_sign: | Description of the journal line item. | | `NetAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative. | diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinedatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinedatatype.md new file mode 100644 index 000000000..32b204bed --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinedatatype.md @@ -0,0 +1,11 @@ +# JournalLineDataType + +Allowed name of the 'dataType'. + + +## Values + +| Name | Value | +| ------------------------------ | ------------------------------ | +| `JournalLineDataTypeCustomers` | customers | +| `JournalLineDataTypeSuppliers` | suppliers | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinetracking.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinetracking.md index 4fe1e306a..fda4093ec 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinetracking.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/journallinetracking.md @@ -5,6 +5,6 @@ List of record refs associated with the tracking information for the line (eg to ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `RecordRefs` | [][shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `RecordRefs` | [][shared.TrackingRecordRef](../../../pkg/models/shared/trackingrecordref.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentallocationpayment.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentallocationpayment.md index 8ebeed6df..0bdf3baf0 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentallocationpayment.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentallocationpayment.md @@ -3,13 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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. | | -| `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 | -| `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_minus_sign: | Identifier of the allocated payment. | | -| `Note` | **string* | :heavy_minus_sign: | Notes attached to the allocated payment. | | -| `PaidOnDate` | **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 | -| `Reference` | **string* | :heavy_minus_sign: | Reference to the allocated payment. | | -| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount that was paid. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | | +| `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 | +| `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_minus_sign: | Identifier of the allocated payment. | | +| `Note` | **string* | :heavy_minus_sign: | Notes attached to the allocated payment. | | +| `PaidOnDate` | **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 | +| `Reference` | **string* | :heavy_minus_sign: | Reference to the allocated payment. | | +| `TotalAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total amount that was paid. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentlinelink.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentlinelink.md index 4e1d51696..7111605a0 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentlinelink.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentlinelink.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity.
A negative link amount _reduces_ the outstanding amount on the accounts receivable account.
A positive link amount _increases_ the outstanding amount on the accounts receivable account. | -| `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_minus_sign: | Unique identifier of the transaction represented by the link. | -| `Type` | [shared.PaymentLinkType](../../../pkg/models/shared/paymentlinktype.md) | :heavy_check_mark: | Types of payment line links, either:
`Unknown`
`Unlinked` - Not used
`Invoice` - ID refers to the invoice
`CreditNote` - ID refers to the credit note
`Refund` - ID refers to the sibling payment
`Payment` - ID refers to the sibling payment
`PaymentOnAccount` - ID refers to the customer
`Other` - ID refers to the customer
`Manual Journal`
`Discount` - ID refers to the payment | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity.
A negative link amount _reduces_ the outstanding amount on the accounts receivable account.
A positive link amount _increases_ the outstanding amount on the accounts receivable account. | +| `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_minus_sign: | Unique identifier of the transaction represented by the link. | +| `Type` | [shared.PaymentLinkType](../../../pkg/models/shared/paymentlinktype.md) | :heavy_check_mark: | Types of payment line links, either:
`Unknown`
`Unlinked` - Not used
`Invoice` - ID refers to the invoice
`CreditNote` - ID refers to the credit note
`Refund` - ID refers to the sibling payment
`Payment` - ID refers to the sibling payment
`PaymentOnAccount` - ID refers to the customer
`Other` - ID refers to the customer
`Manual Journal`
`Discount` - ID refers to the payment | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentmethodref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentmethodref.md index 26eaa8224..1b66d5c93 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentmethodref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/paymentmethodref.md @@ -1,6 +1,6 @@ # PaymentMethodRef -The payment method the record is linked to in the accounting or commerce platform. +The payment method the record is linked to in the accounting or commerce software. ## Fields diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phone.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phone.md index f7a820ebe..e94357490 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phone.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phone.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `Number` | *string* | :heavy_check_mark: | A phone number. | +44 25691 154789 | +| `Number` | **string* | :heavy_minus_sign: | A phone number. | +44 25691 154789 | | `Type` | [shared.PhoneNumberType](../../../pkg/models/shared/phonenumbertype.md) | :heavy_check_mark: | The type of phone number | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phonenumberitems.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phonenumberitems.md index 6400f46b9..a2c5b02af 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phonenumberitems.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/phonenumberitems.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `Number` | *string* | :heavy_check_mark: | A phone number. | +44 25691 154789 | +| `Number` | **string* | :heavy_minus_sign: | A phone number. | +44 25691 154789 | | `Type` | [shared.PhoneNumberType](../../../pkg/models/shared/phonenumbertype.md) | :heavy_check_mark: | The type of phone number | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperation.md index 6b0aab84f..e2cf3dce8 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperation.md +++ b/previous-versions/sync-for-commerce-version-1/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.PullOperationStatus](../../../pkg/models/shared/pulloperationstatus.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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperations.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperations.md index 1a9c503f3..f4e835f26 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperations.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.PullOperation](../../../pkg/models/shared/pulloperation.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.PullOperation](../../../pkg/models/shared/pulloperation.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperationstatus.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperationstatus.md deleted file mode 100644 index ec9307c85..000000000 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pulloperationstatus.md +++ /dev/null @@ -1,32 +0,0 @@ -# PullOperationStatus - -The current status of the pull operation. - - -## Values - -| Name | Value | -| --------------------------------------- | --------------------------------------- | -| `PullOperationStatusInitial` | Initial | -| `PullOperationStatusQueued` | Queued | -| `PullOperationStatusFetching` | Fetching | -| `PullOperationStatusMapQueued` | MapQueued | -| `PullOperationStatusMapping` | Mapping | -| `PullOperationStatusComplete` | Complete | -| `PullOperationStatusFetchError` | FetchError | -| `PullOperationStatusMapError` | MapError | -| `PullOperationStatusInternalError` | InternalError | -| `PullOperationStatusProcessingQueued` | ProcessingQueued | -| `PullOperationStatusProcessing` | Processing | -| `PullOperationStatusProcessingError` | ProcessingError | -| `PullOperationStatusValidationQueued` | ValidationQueued | -| `PullOperationStatusValidating` | Validating | -| `PullOperationStatusValidationError` | ValidationError | -| `PullOperationStatusAuthError` | AuthError | -| `PullOperationStatusCancelled` | Cancelled | -| `PullOperationStatusRouting` | Routing | -| `PullOperationStatusRoutingError` | RoutingError | -| `PullOperationStatusNotSupported` | NotSupported | -| `PullOperationStatusRateLimitError` | RateLimitError | -| `PullOperationStatusPermissionsError` | PermissionsError | -| `PullOperationStatusPrerequisiteNotMet` | PrerequisiteNotMet | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperation.md index b8c816fba..c666911a8 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperation.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperation.md @@ -9,7 +9,7 @@ | `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 | | `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 | +| `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 | diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperationref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperationref.md index 12980b5fd..f7aeaed0b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperationref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperationref.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices | +| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | | `ID` | **string* | :heavy_minus_sign: | Unique identifier for a push operation. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperations.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperations.md index 6ca532324..f036eee36 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperations.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/pushoperations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | -| `Results` | [][shared.PushOperation](../../../pkg/models/shared/pushoperation.md) | :heavy_minus_sign: | N/A | -| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | +| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | +| `Results` | [][shared.PushOperation](../../../pkg/models/shared/pushoperation.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/salesorderreference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/salesorderreference.md index f21adcbe1..71a8f2a2e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/salesorderreference.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/salesorderreference.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier to a record in `dataType`. | | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `DataType` | [*shared.AccountingInvoiceDataType](../../../pkg/models/shared/accountinginvoicedatatype.md) | :heavy_minus_sign: | The underlying data type associated to the reference `id`. | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier to a record in `dataType`. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/schemadatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/schemadatatype.md index d2910a0d3..e1d1293a4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/schemadatatype.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/schemadatatype.md @@ -1,6 +1,6 @@ # SchemaDataType -Available Data types +Available data types ## Values diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/servicechargetaxcomponentref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/servicechargetaxcomponentref.md index 9331dc2f1..510c7607e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/servicechargetaxcomponentref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/servicechargetaxcomponentref.md @@ -1,6 +1,6 @@ # ServiceChargeTaxComponentRef -Taxes rates reference object depending on the rates being available on source commerce package. +Taxes rates reference object depending on the rates being available on source commerce software. ## Fields diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/sourcetype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/sourcetype.md index c140f4ee2..b03dd8136 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/sourcetype.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/sourcetype.md @@ -9,6 +9,8 @@ The type of platform of the connection. | ---------------------- | ---------------------- | | `SourceTypeAccounting` | Accounting | | `SourceTypeBanking` | Banking | +| `SourceTypeBankFeed` | BankFeed | | `SourceTypeCommerce` | Commerce | +| `SourceTypeExpense` | Expense | | `SourceTypeOther` | Other | | `SourceTypeUnknown` | Unknown | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/supplementaldata.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/supplementaldata.md index 691487372..48a2c1fe3 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/supplementaldata.md +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tags.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tags.md new file mode 100644 index 000000000..6de993aa8 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentallocation.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentallocation.md index f8d1c2da8..654be741f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentallocation.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentallocation.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce platform. | -| `TaxComponentRef` | [*shared.ServiceChargeTaxComponentRef](../../../pkg/models/shared/servicechargetaxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce package. | \ No newline at end of file +| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce software. | +| `TaxComponentRef` | [*shared.ServiceChargeTaxComponentRef](../../../pkg/models/shared/servicechargetaxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentref.md index c978f8404..67b95a11a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxcomponentref.md @@ -1,6 +1,6 @@ # TaxComponentRef -Taxes rates reference object depending on the rates being available on source commerce package. +Taxes rates reference object depending on the rates being available on source commerce software. ## Fields diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxeitems.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxeitems.md index 389e2467b..30d7d08e9 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxeitems.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxeitems.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce platform. | -| `TaxComponentRef` | [*shared.TaxComponentRef](../../../pkg/models/shared/taxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce package. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Rate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce software. | +| `TaxComponentRef` | [*shared.TaxComponentRef](../../../pkg/models/shared/taxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxrateref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxrateref.md index 93ad60686..30328721d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxrateref.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxrateref.md @@ -8,5 +8,5 @@ Reference to the tax rate to which the line item is linked. | Field | Type | Required | Description | | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `EffectiveTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Applicable tax rate. | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting platform. | -| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting platform. | \ No newline at end of file +| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | +| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxratereference.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxratereference.md index 935b1bee2..cc470e328 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxratereference.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/taxratereference.md @@ -8,5 +8,5 @@ Reference to the tax rate to which the line item is linked. | Field | Type | Required | Description | | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `EffectiveTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Applicable tax rate. | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting platform. | -| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting platform. | \ No newline at end of file +| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | +| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting software. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tracking.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tracking.md index 172639f87..ba82dcf76 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tracking.md +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/tracking.md @@ -12,4 +12,4 @@ Categories, and a project and customer, against which the item is tracked. | `IsBilledTo` | [shared.BilledToType](../../../pkg/models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | | `IsRebilledTo` | [shared.BilledToType](../../../pkg/models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | | `ProjectRef` | [*shared.AccountingProjectReference](../../../pkg/models/shared/accountingprojectreference.md) | :heavy_minus_sign: | N/A | -| `RecordRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | \ No newline at end of file +| `RecordRef` | [*shared.RecordReference](../../../pkg/models/shared/recordreference.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordref.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordref.md new file mode 100644 index 000000000..4bb0be522 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordref.md @@ -0,0 +1,11 @@ +# TrackingRecordRef + +Links to the customer or tracking category. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `DataType` | [*shared.TrackingRecordRefDataType](../../../pkg/models/shared/trackingrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | trackingCategories | +| `ID` | **string* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordrefdatatype.md b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordrefdatatype.md new file mode 100644 index 000000000..d84596274 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/docs/pkg/models/shared/trackingrecordrefdatatype.md @@ -0,0 +1,12 @@ +# TrackingRecordRefDataType + +Name of underlying data type. + + +## Values + +| Name | Value | +| --------------------------------------------- | --------------------------------------------- | +| `TrackingRecordRefDataTypeCustomers` | customers | +| `TrackingRecordRefDataTypeSuppliers` | suppliers | +| `TrackingRecordRefDataTypeTrackingCategories` | trackingCategories | \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingaccounts/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingaccounts/README.md index 3e5e14770..a29bddaad 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingaccounts/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingaccounts/README.md @@ -3,7 +3,7 @@ ## Overview -Accounts +Retrieve standardized Accounts from linked accounting software. ### Available Operations @@ -56,21 +56,7 @@ func main() { Name: syncforcommerceversion1.String("Accounts Receivable"), NominalCode: syncforcommerceversion1.String("610"), Status: shared.AccountStatusActive.ToPointer(), - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, Type: shared.AccountTypeAsset.ToPointer(), - ValidDatatypeLinks: []shared.ValidDataTypeLinks{ - shared.ValidDataTypeLinks{ - Links: []string{ - "string", - }, - }, - }, }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -78,7 +64,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateAccountResponse != nil { // handle response } @@ -93,14 +78,17 @@ func main() { | `request` | [operations.CreateAccountingAccountRequest](../../pkg/models/operations/createaccountingaccountrequest.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.CreateAccountingAccountResponse](../../pkg/models/operations/createaccountingaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetAccountingAccount @@ -135,13 +123,12 @@ func main() { ctx := context.Background() res, err := s.AccountingAccounts.GetAccountingAccount(ctx, operations.GetAccountingAccountRequest{ - AccountID: "string", + AccountID: "", CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { log.Fatal(err) } - if res.AccountingAccount != nil { // handle response } @@ -156,14 +143,17 @@ func main() { | `request` | [operations.GetAccountingAccountRequest](../../pkg/models/operations/getaccountingaccountrequest.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.GetAccountingAccountResponse](../../pkg/models/operations/getaccountingaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListAccountingAccounts @@ -199,11 +189,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.AccountingAccounts != nil { // handle response } @@ -218,11 +208,13 @@ func main() { | `request` | [operations.ListAccountingAccountsRequest](../../pkg/models/operations/listaccountingaccountsrequest.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.ListAccountingAccountsResponse](../../pkg/models/operations/listaccountingaccountsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingbankaccounts/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingbankaccounts/README.md index 9e473d189..43d79f3dc 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingbankaccounts/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingbankaccounts/README.md @@ -3,7 +3,7 @@ ## Overview -Bank accounts +Retrieve standardized Bank accounts from linked accounting software. ### Available Operations @@ -43,14 +43,13 @@ func main() { ctx := context.Background() res, err := s.AccountingBankAccounts.GetAccountingBankAccount(ctx, operations.GetAccountingBankAccountRequest{ - AccountID: "string", + AccountID: "", CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.AccountingBankAccount != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetAccountingBankAccountRequest](../../pkg/models/operations/getaccountingbankaccountrequest.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.GetAccountingBankAccountResponse](../../pkg/models/operations/getaccountingbankaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListAccountingBankAccounts @@ -110,11 +112,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.AccountingBankAccounts != nil { // handle response } @@ -129,11 +131,13 @@ func main() { | `request` | [operations.ListAccountingBankAccountsRequest](../../pkg/models/operations/listaccountingbankaccountsrequest.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.ListAccountingBankAccountsResponse](../../pkg/models/operations/listaccountingbankaccountsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcompanyinfo/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcompanyinfo/README.md index 1c92d6edc..3634da442 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcompanyinfo/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcompanyinfo/README.md @@ -3,7 +3,7 @@ ## Overview -Company info +Retrieve standardized Accounting company info from linked accounting software. ### Available Operations @@ -41,7 +41,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCompanyDataset != nil { // handle response } @@ -56,14 +55,17 @@ func main() { | `request` | [operations.GetAccountingCompanyInfoRequest](../../pkg/models/operations/getaccountingcompanyinforequest.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.GetAccountingCompanyInfoResponse](../../pkg/models/operations/getaccountingcompanyinforesponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## Refresh @@ -96,7 +98,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Dataset != nil { // handle response } @@ -111,11 +112,13 @@ func main() { | `request` | [operations.RefreshCompanyInfoRequest](../../pkg/models/operations/refreshcompanyinforequest.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.RefreshCompanyInfoResponse](../../pkg/models/operations/refreshcompanyinforesponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcreditnotes/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcreditnotes/README.md index 02c37f5d9..09f91a737 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcreditnotes/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcreditnotes/README.md @@ -3,7 +3,7 @@ ## Overview -Credit notes +Retrieve standardized Credit notes from linked accounting software. ### Available Operations @@ -47,81 +47,38 @@ func main() { res, err := s.AccountingCreditNotes.CreateAccountingCreditNote(ctx, operations.CreateAccountingCreditNoteRequest{ AccountingCreditNote: &shared.AccountingCreditNote{ AllocatedOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Currency: syncforcommerceversion1.String("GBP"), + CreditNoteNumber: syncforcommerceversion1.String("09/03 17.15"), + Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), CustomerRef: &shared.AccountingCustomerRef{ - ID: "", + ID: "80000002-1674552702", }, - DiscountPercentage: types.MustNewDecimalFromString("3961.39"), - IssueDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + DiscountPercentage: types.MustNewDecimalFromString("0"), + IssueDate: syncforcommerceversion1.String("2023-03-09T02:21:26.726327+00:00"), LineItems: []shared.CreditNoteLineItem{ - shared.CreditNoteLineItem{ - AccountRef: &shared.AccountRef{}, - ItemRef: &shared.ItemRef{ - ID: "", - }, - Quantity: types.MustNewDecimalFromString("1740.95"), - TaxRateRef: &shared.TaxRateRef{}, - Tracking: &shared.CreditNoteLineItemTracking{ - CategoryRefs: []shared.TrackingCategoryRefItems{ - shared.TrackingCategoryRefItems{ - ID: "", - }, - }, - CustomerRef: &shared.AccountingCustomerRef{ - ID: "", - }, - IsBilledTo: shared.BilledToTypeProject, - IsRebilledTo: shared.BilledToTypeProject, - ProjectRef: &shared.CreditNoteLineItemAccountingProjectReference{ - ID: "", - }, - RecordRef: &shared.RecordRef{ - DataType: syncforcommerceversion1.String("accountTransaction"), - }, - }, - TrackingCategoryRefs: []shared.TrackingCategoryRefItems{ - shared.TrackingCategoryRefItems{ - ID: "", - }, - }, - UnitAmount: types.MustNewDecimalFromString("6472.07"), - }, + }, - Metadata: &shared.Metadata{}, ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + Note: syncforcommerceversion1.String("credit note 20230309 17.15"), PaymentAllocations: []shared.PaymentAllocationItems{ shared.PaymentAllocationItems{ Allocation: shared.Allocation{ AllocatedOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Currency: syncforcommerceversion1.String("EUR"), + Currency: syncforcommerceversion1.String("USD"), }, Payment: shared.PaymentAllocationPayment{ - AccountRef: &shared.AccountRef{}, - Currency: syncforcommerceversion1.String("USD"), + Currency: syncforcommerceversion1.String("EUR"), PaidOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), }, }, }, - RemainingCredit: types.MustNewDecimalFromString("3693.65"), + RemainingCredit: types.MustNewDecimalFromString("0"), SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Status: shared.CreditNoteStatusVoid, - SubTotal: types.MustNewDecimalFromString("1915.04"), - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, - TotalAmount: types.MustNewDecimalFromString("5893.9"), - TotalDiscount: types.MustNewDecimalFromString("579.23"), - TotalTaxAmount: types.MustNewDecimalFromString("3881.42"), - WithholdingTax: []shared.WithholdingTaxItems{ - shared.WithholdingTaxItems{ - Amount: types.MustNewDecimalFromString("7369.44"), - Name: "string", - }, - }, + Status: shared.CreditNoteStatusSubmitted, + SubTotal: types.MustNewDecimalFromString("10.2"), + TotalAmount: types.MustNewDecimalFromString("1.25"), + TotalDiscount: types.MustNewDecimalFromString("0"), + TotalTaxAmount: types.MustNewDecimalFromString("0"), }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -129,7 +86,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateCreditNoteResponse != nil { // handle response } @@ -144,11 +100,13 @@ func main() { | `request` | [operations.CreateAccountingCreditNoteRequest](../../pkg/models/operations/createaccountingcreditnoterequest.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.CreateAccountingCreditNoteResponse](../../pkg/models/operations/createaccountingcreditnoteresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcustomers/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcustomers/README.md index f0f5d3a04..8ccafec5f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcustomers/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingcustomers/README.md @@ -3,7 +3,7 @@ ## Overview -Customers +Retrieve standardized Customers from linked accounting software. ### Available Operations @@ -45,38 +45,22 @@ func main() { ctx := context.Background() res, err := s.AccountingCustomers.CreateAccountingCustomer(ctx, operations.CreateAccountingCustomerRequest{ AccountingCustomer: &shared.AccountingCustomer{ - Addresses: []shared.Items1{ - shared.Items1{ - Type: shared.AccountingAddressTypeDelivery, - }, - }, Contacts: []shared.Contact{ shared.Contact{ - Address: &shared.Items1{ - Type: shared.AccountingAddressTypeUnknown, - }, ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), Phone: []shared.PhoneNumberItems{ shared.PhoneNumberItems{ - Number: "+44 25691 154789", + Number: syncforcommerceversion1.String("+44 25691 154789"), Type: shared.PhoneNumberTypePrimary, }, }, Status: shared.CustomerStatusActive, }, }, - DefaultCurrency: syncforcommerceversion1.String("GBP"), - Metadata: &shared.Metadata{}, + DefaultCurrency: syncforcommerceversion1.String("EUR"), ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), Status: shared.CustomerStatusUnknown, - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -84,7 +68,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateCustomerResponse != nil { // handle response } @@ -99,11 +82,13 @@ func main() { | `request` | [operations.CreateAccountingCustomerRequest](../../pkg/models/operations/createaccountingcustomerrequest.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.CreateAccountingCustomerResponse](../../pkg/models/operations/createaccountingcustomerresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingdirectincomes/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingdirectincomes/README.md index 240524422..b94204cae 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingdirectincomes/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingdirectincomes/README.md @@ -3,7 +3,7 @@ ## Overview -Direct incomes +Retrieve standardized Direct incomes from linked accounting software. ### Available Operations @@ -47,53 +47,64 @@ func main() { res, err := s.AccountingDirectIncomes.CreateAccountingDirectIncome(ctx, operations.CreateAccountingDirectIncomeRequest{ AccountingDirectIncome: &shared.AccountingDirectIncome{ ContactRef: &shared.ContactRef{ - DataType: shared.DataTypeInvoices.ToPointer(), - ID: "", + DataType: shared.ContactRefDataTypeCustomers.ToPointer(), + ID: "80000002-1674552702", }, - Currency: "GBP", - IssueDate: "2022-10-23T00:00:00Z", + Currency: "USD", + IssueDate: "2023-02-01T16:27:40.023Z", LineItems: []shared.DirectIncomeLineItem{ shared.DirectIncomeLineItem{ - AccountRef: &shared.AccountRef{}, - ItemRef: &shared.ItemReference{ - ID: "", + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("80000007-1671793811"), }, - Quantity: types.MustNewDecimalFromString("3642.55"), - TaxRateRef: &shared.TaxRateReference{}, + Description: syncforcommerceversion1.String("line description 1"), + DiscountAmount: types.MustNewDecimalFromString("0"), + DiscountPercentage: types.MustNewDecimalFromString("0"), + Quantity: types.MustNewDecimalFromString("68"), + SubTotal: types.MustNewDecimalFromString("5320"), + TaxAmount: types.MustNewDecimalFromString("37"), + TotalAmount: types.MustNewDecimalFromString("12"), TrackingCategoryRefs: []shared.TrackingCategoryRefs{ shared.TrackingCategoryRefs{ - ID: "", + ID: "80000002-1674553271", + Name: syncforcommerceversion1.String("string"), }, }, - UnitAmount: types.MustNewDecimalFromString("7950.78"), + UnitAmount: types.MustNewDecimalFromString("9100"), }, }, - Metadata: &shared.Metadata{}, + Metadata: &shared.Metadata{ + IsDeleted: syncforcommerceversion1.Bool(true), + }, ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + Note: syncforcommerceversion1.String("test note"), PaymentAllocations: []shared.PaymentAllocationItems{ shared.PaymentAllocationItems{ Allocation: shared.Allocation{ - AllocatedOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Currency: syncforcommerceversion1.String("EUR"), + AllocatedOnDate: syncforcommerceversion1.String("2023-02-01T16:27:40.023Z"), + Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), + TotalAmount: types.MustNewDecimalFromString("560"), }, Payment: shared.PaymentAllocationPayment{ - AccountRef: &shared.AccountRef{}, + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("80000028-1671794219"), + }, Currency: syncforcommerceversion1.String("USD"), - PaidOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + CurrencyRate: types.MustNewDecimalFromString("1"), + ID: syncforcommerceversion1.String("3594002235"), + Note: syncforcommerceversion1.String("payment allocations note"), + PaidOnDate: syncforcommerceversion1.String("2023-02-01T16:27:40.023Z"), + Reference: syncforcommerceversion1.String("230202 1217"), + TotalAmount: types.MustNewDecimalFromString("560"), }, }, }, + Reference: nil, SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - SubTotal: types.MustNewDecimalFromString("5786.44"), - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, - TaxAmount: types.MustNewDecimalFromString("2812.91"), - TotalAmount: types.MustNewDecimalFromString("6636.11"), + SubTotal: types.MustNewDecimalFromString("0"), + TaxAmount: types.MustNewDecimalFromString("9999"), + TotalAmount: types.MustNewDecimalFromString("9999"), }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -101,7 +112,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateDirectIncomeResponse != nil { // handle response } @@ -116,11 +126,13 @@ func main() { | `request` | [operations.CreateAccountingDirectIncomeRequest](../../pkg/models/operations/createaccountingdirectincomerequest.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.CreateAccountingDirectIncomeResponse](../../pkg/models/operations/createaccountingdirectincomeresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountinginvoices/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountinginvoices/README.md index 98ff725e8..1346fff2b 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountinginvoices/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountinginvoices/README.md @@ -3,7 +3,7 @@ ## Overview -Invoices +Retrieve standardized Invoices from linked accounting software. ### Available Operations @@ -46,82 +46,60 @@ func main() { ctx := context.Background() res, err := s.AccountingInvoices.CreateAccountingInvoice(ctx, operations.CreateAccountingInvoiceRequest{ AccountingInvoice: &shared.AccountingInvoice{ - AmountDue: types.MustNewDecimalFromString("9907.57"), - Currency: syncforcommerceversion1.String("EUR"), + AdditionalTaxAmount: types.MustNewDecimalFromString("0"), + AdditionalTaxPercentage: types.MustNewDecimalFromString("0"), + AmountDue: types.MustNewDecimalFromString("87326532"), + Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), CustomerRef: &shared.AccountingCustomerRef{ - ID: "", + CompanyName: syncforcommerceversion1.String("Test Customer 1"), + ID: "80000002-1674552702", }, - DueDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - IssueDate: "2022-10-23T00:00:00Z", + DiscountPercentage: types.MustNewDecimalFromString("0"), + DueDate: syncforcommerceversion1.String("2023-05-24T11:09:01.438Z"), + InvoiceNumber: syncforcommerceversion1.String("18/04 15.26"), + IssueDate: "2023-04-18T11:09:01.438Z", LineItems: []shared.InvoiceLineItem{ - shared.InvoiceLineItem{ - AccountRef: &shared.AccountRef{}, - ItemRef: &shared.ItemRef{ - ID: "", - }, - Quantity: types.MustNewDecimalFromString("1021.57"), - TaxRateRef: &shared.TaxRateRef{}, - Tracking: &shared.Tracking{ - CategoryRefs: []shared.TrackingCategoryRefItems{ - shared.TrackingCategoryRefItems{ - ID: "", - }, - }, - CustomerRef: &shared.AccountingCustomerRef{ - ID: "", - }, - IsBilledTo: shared.BilledToTypeUnknown, - IsRebilledTo: shared.BilledToTypeProject, - ProjectRef: &shared.AccountingProjectReference{ - ID: "", - }, - RecordRef: &shared.RecordRef{ - DataType: syncforcommerceversion1.String("journalEntry"), - }, - }, - TrackingCategoryRefs: []shared.TrackingCategoryRefItems{ - shared.TrackingCategoryRefItems{ - ID: "", - }, - }, - UnitAmount: types.MustNewDecimalFromString("7432.38"), - }, + }, - Metadata: &shared.Metadata{}, - ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - PaidOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + ModifiedDate: syncforcommerceversion1.String("2023-02-14T11:09:01.438Z"), + Note: syncforcommerceversion1.String("invoice push 20230418 15.26"), + PaidOnDate: syncforcommerceversion1.String("2023-02-10T11:09:01.438Z"), PaymentAllocations: []shared.AccountingPaymentAllocation{ shared.AccountingPaymentAllocation{ Allocation: shared.AccountingInvoiceAllocation{ - AllocatedOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + AllocatedOnDate: syncforcommerceversion1.String("2023-02-14T11:09:01.438Z"), Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), + TotalAmount: types.MustNewDecimalFromString("725"), }, Payment: shared.PaymentAllocationPayment{ - AccountRef: &shared.AccountRef{}, - Currency: syncforcommerceversion1.String("EUR"), - PaidOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("string"), + Name: syncforcommerceversion1.String("string"), + }, + Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), + ID: syncforcommerceversion1.String("80000004-1789341990"), + Note: syncforcommerceversion1.String("string"), + PaidOnDate: syncforcommerceversion1.String("2023-02-14T11:09:01.438Z"), + Reference: syncforcommerceversion1.String("string"), + TotalAmount: types.MustNewDecimalFromString("725"), }, }, }, SalesOrderRefs: []shared.SalesOrderReference{ - shared.SalesOrderReference{ - DataType: shared.DataTypeInvoices.ToPointer(), - }, - }, - SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Status: shared.InvoiceStatusPartiallyPaid, - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, + shared.SalesOrderReference{}, }, - TotalAmount: types.MustNewDecimalFromString("1416.23"), - TotalTaxAmount: types.MustNewDecimalFromString("9069.87"), + SourceModifiedDate: syncforcommerceversion1.String("2023-02-14T11:09:01.438Z"), + Status: shared.InvoiceStatusSubmitted, + SubTotal: types.MustNewDecimalFromString("30"), + TotalAmount: types.MustNewDecimalFromString("30"), + TotalDiscount: types.MustNewDecimalFromString("0"), + TotalTaxAmount: types.MustNewDecimalFromString("0"), WithholdingTax: []shared.WithholdingTax{ shared.WithholdingTax{ - Amount: types.MustNewDecimalFromString("598.23"), + Amount: types.MustNewDecimalFromString("0"), Name: "string", }, }, @@ -132,7 +110,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateInvoiceResponse != nil { // handle response } @@ -147,11 +124,13 @@ func main() { | `request` | [operations.CreateAccountingInvoiceRequest](../../pkg/models/operations/createaccountinginvoicerequest.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.CreateAccountingInvoiceResponse](../../pkg/models/operations/createaccountinginvoiceresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingjournalentries/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingjournalentries/README.md index 07ec668b6..95f0c5360 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingjournalentries/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingjournalentries/README.md @@ -3,7 +3,7 @@ ## Overview -Journal entries +Retrieve standardized Journal entries from linked accounting software. ### Available Operations @@ -46,38 +46,58 @@ func main() { ctx := context.Background() res, err := s.AccountingJournalEntries.CreateAccountingJournalEntry(ctx, operations.CreateAccountingJournalEntryRequest{ AccountingJournalEntry: &shared.AccountingJournalEntry{ - CreatedOn: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + CreatedOn: syncforcommerceversion1.String("2023-02-22T19:49:16.052Z"), + Description: syncforcommerceversion1.String("record level description"), JournalLines: []shared.JournalLine{ shared.JournalLine{ - AccountRef: &shared.AccountRef{}, - NetAmount: types.MustNewDecimalFromString("9326.53"), + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("80000019-1671793811"), + Name: syncforcommerceversion1.String("Office Supplies"), + }, + Currency: syncforcommerceversion1.String("USD"), + Description: syncforcommerceversion1.String("journalLines.description debit"), + NetAmount: types.MustNewDecimalFromString("23.02"), + Tracking: &shared.JournalLineTracking{ + RecordRefs: []shared.TrackingRecordRef{ + shared.TrackingRecordRef{ + DataType: shared.TrackingRecordRefDataTypeCustomers.ToPointer(), + ID: syncforcommerceversion1.String("80000001-1674553252"), + }, + }, + }, + }, + shared.JournalLine{ + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("8000001E-1671793811"), + Name: syncforcommerceversion1.String("Utilities"), + }, + Currency: syncforcommerceversion1.String("USD"), + Description: syncforcommerceversion1.String("journalLines.description credit"), + NetAmount: types.MustNewDecimalFromString("-23.02"), Tracking: &shared.JournalLineTracking{ - RecordRefs: []shared.RecordRef{ - shared.RecordRef{ - DataType: syncforcommerceversion1.String("journalEntry"), + RecordRefs: []shared.TrackingRecordRef{ + shared.TrackingRecordRef{ + DataType: shared.TrackingRecordRefDataTypeTrackingCategories.ToPointer(), + ID: syncforcommerceversion1.String("80000002-1674553271"), }, }, }, }, }, JournalRef: &shared.JournalReference{ - ID: "", + ID: "12", + }, + Metadata: &shared.Metadata{ + IsDeleted: syncforcommerceversion1.Bool(true), }, - Metadata: &shared.Metadata{}, ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - PostedOn: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - RecordRef: &shared.RecordReference{ - DataType: syncforcommerceversion1.String("journalEntry"), + PostedOn: syncforcommerceversion1.String("2023-02-23T19:49:16.052Z"), + RecordRef: &shared.JournalEntryRecordRef{ + DataType: shared.JournalEntryRecordRefDataTypeBills.ToPointer(), + ID: syncforcommerceversion1.String("80000002-6722155312"), }, SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, - UpdatedOn: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + UpdatedOn: syncforcommerceversion1.String("2023-02-21T19:49:16.052Z"), }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -85,7 +105,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreateJournalEntryResponse != nil { // handle response } @@ -100,11 +119,13 @@ func main() { | `request` | [operations.CreateAccountingJournalEntryRequest](../../pkg/models/operations/createaccountingjournalentryrequest.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.CreateAccountingJournalEntryResponse](../../pkg/models/operations/createaccountingjournalentryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingpayments/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingpayments/README.md index b3eccf81a..0a4166947 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingpayments/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingpayments/README.md @@ -3,7 +3,7 @@ ## Overview -Payments +Retrieve standardized Payments from linked accounting software. ### Available Operations @@ -46,36 +46,40 @@ func main() { ctx := context.Background() res, err := s.AccountingPayments.CreateAccountingPayment(ctx, operations.CreateAccountingPaymentRequest{ AccountingPayment: &shared.AccountingPayment{ - AccountRef: &shared.AccountRef{}, - Currency: syncforcommerceversion1.String("EUR"), + AccountRef: &shared.AccountRef{ + ID: syncforcommerceversion1.String("8000002E-1675267199"), + Name: syncforcommerceversion1.String("Undeposited Funds"), + }, + Currency: syncforcommerceversion1.String("USD"), + CurrencyRate: types.MustNewDecimalFromString("1"), CustomerRef: &shared.AccountingCustomerRef{ - ID: "", + CompanyName: syncforcommerceversion1.String("string"), + ID: "80000002-1674552702", }, - Date: "2022-10-23T00:00:00Z", + Date: "2023-02-10T11:47:04.792Z", Lines: []shared.PaymentLine{ shared.PaymentLine{ - AllocatedOnDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - Amount: types.MustNewDecimalFromString("9211.94"), + AllocatedOnDate: syncforcommerceversion1.String("2023-02-11T11:47:04.792Z"), + Amount: types.MustNewDecimalFromString("28"), Links: []shared.PaymentLineLink{ shared.PaymentLineLink{ - Type: shared.PaymentLinkTypeUnlinked, + Amount: types.MustNewDecimalFromString("-28"), + CurrencyRate: types.MustNewDecimalFromString("1"), + ID: syncforcommerceversion1.String("181-1676374586"), + Type: shared.PaymentLinkTypeInvoice, }, }, }, }, - Metadata: &shared.Metadata{}, ModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), + Note: syncforcommerceversion1.String("note 14/02 1147"), PaymentMethodRef: &shared.PaymentMethodRef{ - ID: "", + ID: "string", + Name: syncforcommerceversion1.String("string"), }, + Reference: syncforcommerceversion1.String("ref 14/02 1147"), SourceModifiedDate: syncforcommerceversion1.String("2022-10-23T00:00:00Z"), - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "key": map[string]interface{}{ - "key": "string", - }, - }, - }, + TotalAmount: types.MustNewDecimalFromString("28"), }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -83,7 +87,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.AccountingCreatePaymentResponse != nil { // handle response } @@ -98,11 +101,13 @@ func main() { | `request` | [operations.CreateAccountingPaymentRequest](../../pkg/models/operations/createaccountingpaymentrequest.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.CreateAccountingPaymentResponse](../../pkg/models/operations/createaccountingpaymentresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/codatsynccommerce/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/codatsynccommerce/README.md index a54faa6a7..52e8ade9e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/codatsynccommerce/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/codatsynccommerce/README.md @@ -1,15 +1,43 @@ # CodatSyncCommerce SDK - ## Overview Sync for Commerce (v1): The API for Sync for Commerce V1. Sync for Commerce automatically replicates and reconciles sales data from a merchant’s source PoS, Payments, and eCommerce systems into their accounting software. This eliminates manual processing by merchants and transforms their ability to run and grow their business. - -[Read More...](https://docs.codat.io/commerce/overview) -Not seeing what you expect? [See the main Sync for Commerce API](https://docs.codat.io/sync-for-commerce-api). + +## Endpoints -### Available Operations +| Endpoints | Description | +| :- |:- | +| Company management | Create new and manage existing Sync for Commerce companies. | +| Configuration | Expressively configure preferences for any given Sync for Commerce company. | +| Sync flow preferences | Configure preferences for any given Sync for Commerce company using sync flow. | +| Sync | Initiate a sync of Sync for Commerce company data into their respective accounting software. | +| Integrations | View useful information about codat's integrations. | +| Companies | Create and manage your Codat companies. | +| Connections | Manage your companies' data connections. | +| Refresh data | Asynchronously retrieve data from an integration to refresh data in Codat. | +| Push data | View push options and get push statuses. | +| Accounting accounts | Retrieve standardized Accounts from linked accounting software. | +| Accounting credit notes | Retrieve standardized Credit notes from linked accounting software. | +| Accounting customers | Retrieve standardized Customers from linked accounting software. | +| Accounting direct incomes | Retrieve standardized Direct incomes from linked accounting software. | +| Accounting company info | Retrieve standardized Accounting company info from linked accounting software. | +| Accounting invoices | Retrieve standardized Invoices from linked accounting software. | +| Accounting journal entries | Retrieve standardized Journal entries from linked accounting software. | +| Accounting payments | Retrieve standardized Payments from linked accounting software. | +| Accounting bank accounts | Retrieve standardized Bank accounts from linked accounting software. | +| Commerce customers | Retrieve standardized Commerce customers from linked commerce software. | +| Commerce company info | Retrieve standardized Commerce company info from linked commerce software. | +| Commerce locations | Retrieve standardized Commerce locations from linked commerce software. | +| Commerce orders | Retrieve standardized Commerce orders from linked commerce software. | +| Commerce payments | Retrieve standardized Commerce payments from linked commerce software. | +| Commerce products | Retrieve standardized Commerce products from linked commerce software. | +| Commerce transactions | Retrieve standardized Commerce transactions from linked commerce software. | + + +[Read More...](https://docs.codat.io/commerce/overview) +Not seeing what you expect? [See the main Sync for Commerce API](https://docs.codat.io/sync-for-commerce-api). \ No newline at end of file diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecompanyinfo/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecompanyinfo/README.md index 0fe9b33f3..f0b530b74 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecompanyinfo/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecompanyinfo/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce company info from linked commerce software. ### Available Operations @@ -11,7 +11,7 @@ Retrieve standardized data from linked commerce platforms. ## GetCommerceCompanyInfo -Retrieve information about the company, as seen in the commerce platform. +Retrieve information about the company, as seen in the commerce software. This may include information like addresses, tax registration details and social media or website information. @@ -43,7 +43,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.CommerceCompanyInfo != nil { // handle response } @@ -58,11 +57,13 @@ func main() { | `request` | [operations.GetCommerceCompanyInfoRequest](../../pkg/models/operations/getcommercecompanyinforequest.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.GetCommerceCompanyInfoResponse](../../pkg/models/operations/getcommercecompanyinforesponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecustomers/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecustomers/README.md index 4eaa69ac5..c2018456f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecustomers/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercecustomers/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce customers from linked commerce software. ### Available Operations @@ -45,12 +45,11 @@ func main() { res, err := s.CommerceCustomers.GetCommerceCustomer(ctx, operations.GetCommerceCustomerRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - CustomerID: "string", + CustomerID: "", }) if err != nil { log.Fatal(err) } - if res.CommerceCustomer != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetCommerceCustomerRequest](../../pkg/models/operations/getcommercecustomerrequest.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.GetCommerceCustomerResponse](../../pkg/models/operations/getcommercecustomerresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommerceCustomers @@ -110,11 +112,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommerceCustomers != nil { // handle response } @@ -129,11 +131,13 @@ func main() { | `request` | [operations.ListCommerceCustomersRequest](../../pkg/models/operations/listcommercecustomersrequest.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.ListCommerceCustomersResponse](../../pkg/models/operations/listcommercecustomersresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercelocations/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercelocations/README.md index 9b252d666..b69413447 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercelocations/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercelocations/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce locations from linked commerce software. ### Available Operations @@ -45,12 +45,11 @@ func main() { res, err := s.CommerceLocations.GetCommerceLocation(ctx, operations.GetCommerceLocationRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - LocationID: "string", + LocationID: "", }) if err != nil { log.Fatal(err) } - if res.CommerceLocation != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetCommerceLocationRequest](../../pkg/models/operations/getcommercelocationrequest.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.GetCommerceLocationResponse](../../pkg/models/operations/getcommercelocationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommerceLocations @@ -111,7 +113,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.CommerceLocations != nil { // handle response } @@ -126,11 +127,13 @@ func main() { | `request` | [operations.ListCommerceLocationsRequest](../../pkg/models/operations/listcommercelocationsrequest.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.ListCommerceLocationsResponse](../../pkg/models/operations/listcommercelocationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceorders/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceorders/README.md index 29b6d1d2a..f7d0f011f 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceorders/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceorders/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce orders from linked commerce software. ### Available Operations @@ -45,12 +45,11 @@ func main() { res, err := s.CommerceOrders.GetCommerceOrder(ctx, operations.GetCommerceOrderRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - OrderID: "string", + OrderID: "", }) if err != nil { log.Fatal(err) } - if res.CommerceOrder != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetCommerceOrderRequest](../../pkg/models/operations/getcommerceorderrequest.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.GetCommerceOrderResponse](../../pkg/models/operations/getcommerceorderresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommerceOrders @@ -110,11 +112,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommerceOrders != nil { // handle response } @@ -129,11 +131,13 @@ func main() { | `request` | [operations.ListCommerceOrdersRequest](../../pkg/models/operations/listcommerceordersrequest.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.ListCommerceOrdersResponse](../../pkg/models/operations/listcommerceordersresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercepayments/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercepayments/README.md index c2c18d16d..f623dc41a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercepayments/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercepayments/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce payments from linked commerce software. ### Available Operations @@ -47,12 +47,11 @@ func main() { res, err := s.CommercePayments.GetCommercePayment(ctx, operations.GetCommercePaymentRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - PaymentID: "string", + PaymentID: "", }) if err != nil { log.Fatal(err) } - if res.CommercePayment != nil { // handle response } @@ -67,14 +66,17 @@ func main() { | `request` | [operations.GetCommercePaymentRequest](../../pkg/models/operations/getcommercepaymentrequest.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.GetCommercePaymentResponse](../../pkg/models/operations/getcommercepaymentresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetMethod @@ -111,12 +113,11 @@ func main() { res, err := s.CommercePayments.GetMethod(ctx, operations.GetCommercePaymentMethodRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - PaymentMethodID: "string", + PaymentMethodID: "", }) if err != nil { log.Fatal(err) } - if res.CommercePaymentMethod != nil { // handle response } @@ -131,14 +132,17 @@ func main() { | `request` | [operations.GetCommercePaymentMethodRequest](../../pkg/models/operations/getcommercepaymentmethodrequest.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.GetCommercePaymentMethodResponse](../../pkg/models/operations/getcommercepaymentmethodresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommercePayments @@ -176,11 +180,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommercePayments != nil { // handle response } @@ -195,14 +199,17 @@ func main() { | `request` | [operations.ListCommercePaymentsRequest](../../pkg/models/operations/listcommercepaymentsrequest.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.ListCommercePaymentsResponse](../../pkg/models/operations/listcommercepaymentsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListMethods @@ -240,11 +247,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommercePaymentMethods != nil { // handle response } @@ -259,11 +266,13 @@ func main() { | `request` | [operations.ListCommercePaymentMethodsRequest](../../pkg/models/operations/listcommercepaymentmethodsrequest.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.ListCommercePaymentMethodsResponse](../../pkg/models/operations/listcommercepaymentmethodsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceproducts/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceproducts/README.md index 440c8a0ae..5108ee9f4 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceproducts/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commerceproducts/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce products from linked commerce software. ### Available Operations @@ -45,12 +45,11 @@ func main() { res, err := s.CommerceProducts.GetCommerceProduct(ctx, operations.GetCommerceProductRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - ProductID: "string", + ProductID: "", }) if err != nil { log.Fatal(err) } - if res.CommerceProduct != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetCommerceProductRequest](../../pkg/models/operations/getcommerceproductrequest.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.GetCommerceProductResponse](../../pkg/models/operations/getcommerceproductresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommerceProducts @@ -110,11 +112,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommerceProducts != nil { // handle response } @@ -129,11 +131,13 @@ func main() { | `request` | [operations.ListCommerceProductsRequest](../../pkg/models/operations/listcommerceproductsrequest.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.ListCommerceProductsResponse](../../pkg/models/operations/listcommerceproductsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercetransactions/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercetransactions/README.md index a26db0998..aabf47f2d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/commercetransactions/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/commercetransactions/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve standardized data from linked commerce platforms. +Retrieve standardized Commerce transactions from linked commerce software. ### Available Operations @@ -45,12 +45,11 @@ func main() { res, err := s.CommerceTransactions.GetCommerceTransaction(ctx, operations.GetCommerceTransactionRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - TransactionID: "string", + TransactionID: "", }) if err != nil { log.Fatal(err) } - if res.CommerceTransaction != nil { // handle response } @@ -65,14 +64,17 @@ func main() { | `request` | [operations.GetCommerceTransactionRequest](../../pkg/models/operations/getcommercetransactionrequest.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.GetCommerceTransactionResponse](../../pkg/models/operations/getcommercetransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCommerceTransactions @@ -110,11 +112,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.CommerceTransactions != nil { // handle response } @@ -129,11 +131,13 @@ func main() { | `request` | [operations.ListCommerceTransactionsRequest](../../pkg/models/operations/listcommercetransactionsrequest.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.ListCommerceTransactionsResponse](../../pkg/models/operations/listcommercetransactionsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/companies/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/companies/README.md index d719c790a..679052cbb 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/companies/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/companies/README.md @@ -13,8 +13,11 @@ Create and manage your Codat companies. ## DeleteCompany - -Permanently deletes a company, its connections and any cached data. This operation is irreversible. If the company ID does not exist an error is returned. +The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) and any cached data. This operation is irreversible. + +A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + ### Example Usage @@ -27,7 +30,6 @@ import( "context" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "log" - "net/http" ) func main() { @@ -44,8 +46,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -59,18 +60,25 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCompany -Returns the company for a valid identifier. If the identifier is for a deleted company, a not found response is returned. +The *Get company* endpoint returns a single company for a given `companyId`. + +A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + ### Example Usage @@ -99,7 +107,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -114,18 +121,25 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdateCompany -Updates both the name and description of the company. +Use the *Update company* endpoint to update both the name and description of the company. +If you use [groups](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Group) to manage a set of companies, use the [Add company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/add-company-to-group) or [Remove company](https://docs.codat.io/sync-for-commerce-v1-api#/operations/remove-company-from-group) endpoints to add or remove a company from a group. + +A [company](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. ### Example Usage @@ -151,14 +165,18 @@ func main() { res, err := s.Companies.UpdateCompany(ctx, operations.UpdateCompanyRequest{ CreateCompany: &shared.CreateCompany{ Description: syncforcommerceversion1.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforcommerceversion1.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "New Name", }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -173,11 +191,13 @@ 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 | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/companymanagement/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/companymanagement/README.md index 3c3c1ee53..ced657440 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/companymanagement/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/companymanagement/README.md @@ -39,12 +39,16 @@ func main() { ctx := context.Background() res, err := s.CompanyManagement.CreateCompany(ctx, &shared.CreateCompany{ Description: syncforcommerceversion1.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforcommerceversion1.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "string", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -59,14 +63,17 @@ func main() { | `request` | [shared.CreateCompany](../../pkg/models/shared/createcompany.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,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## CreateConnection @@ -99,7 +106,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -114,14 +120,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListCompanies @@ -152,11 +161,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Companies != nil { // handle response } @@ -171,14 +180,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListConnections @@ -210,11 +222,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Connections != nil { // handle response } @@ -229,14 +241,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdateConnection @@ -264,14 +279,12 @@ func main() { ctx := context.Background() res, err := s.CompanyManagement.UpdateConnection(ctx, operations.UpdateConnectionRequest{ - UpdateConnection: &shared.UpdateConnection{}, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -286,11 +299,13 @@ func main() { | `request` | [operations.UpdateConnectionRequest](../../pkg/models/operations/updateconnectionrequest.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.UpdateConnectionResponse](../../pkg/models/operations/updateconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/configuration/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/configuration/README.md index 0b523d0fd..78fc94e2c 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/configuration/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/configuration/README.md @@ -41,7 +41,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Configuration != nil { // handle response } @@ -56,14 +55,17 @@ func main() { | `request` | [operations.GetConfigurationRequest](../../pkg/models/operations/getconfigurationrequest.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.GetConfigurationResponse](../../pkg/models/operations/getconfigurationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## SetConfiguration @@ -96,7 +98,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Configuration != nil { // handle response } @@ -111,11 +112,13 @@ func main() { | `request` | [operations.SetConfigurationRequest](../../pkg/models/operations/setconfigurationrequest.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.SetConfigurationResponse](../../pkg/models/operations/setconfigurationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/connections/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/connections/README.md index 44bfe426e..6d573a16a 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/connections/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/connections/README.md @@ -27,7 +27,6 @@ import( "context" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "log" - "net/http" ) func main() { @@ -45,8 +44,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -60,14 +58,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetConnection @@ -101,7 +102,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -116,14 +116,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## Unlink @@ -151,14 +154,15 @@ func main() { ctx := context.Background() res, err := s.Connections.Unlink(ctx, operations.UnlinkConnectionRequest{ - UpdateConnection: &shared.UpdateConnection{}, + UpdateConnection: &shared.UpdateConnection{ + Status: shared.DataConnectionStatusUnlinked.ToPointer(), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -173,11 +177,13 @@ 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 | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/integrations/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/integrations/README.md index cc5ac16c0..c1ba8d6e0 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/integrations/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/integrations/README.md @@ -41,7 +41,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Branding != nil { // handle response } @@ -56,14 +55,17 @@ func main() { | `request` | [operations.GetIntegrationBrandingRequest](../../pkg/models/operations/getintegrationbrandingrequest.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.GetIntegrationBrandingResponse](../../pkg/models/operations/getintegrationbrandingresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListIntegrations @@ -94,11 +96,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Integrations != nil { // handle response } @@ -113,11 +115,13 @@ func main() { | `request` | [operations.ListIntegrationsRequest](../../pkg/models/operations/listintegrationsrequest.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.ListIntegrationsResponse](../../pkg/models/operations/listintegrationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/pushdata/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/pushdata/README.md index 1fa2bfb2e..ec9bec07d 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/pushdata/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/pushdata/README.md @@ -42,7 +42,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PushOperation != nil { // handle response } @@ -57,14 +56,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListOperations @@ -96,11 +98,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.PushOperations != nil { // handle response } @@ -115,11 +117,13 @@ func main() { | `request` | [operations.GetCompanyPushHistoryRequest](../../pkg/models/operations/getcompanypushhistoryrequest.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.GetCompanyPushHistoryResponse](../../pkg/models/operations/getcompanypushhistoryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/refreshdata/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/refreshdata/README.md index 9ba520822..b95ac3ab2 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/refreshdata/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/refreshdata/README.md @@ -32,7 +32,6 @@ import( "context" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "log" - "net/http" ) func main() { @@ -49,8 +48,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -64,14 +62,17 @@ func main() { | `request` | [operations.RefreshCompanyDataRequest](../../pkg/models/operations/refreshcompanydatarequest.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.RefreshCompanyDataResponse](../../pkg/models/operations/refreshcompanydataresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ByDataType @@ -107,7 +108,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PullOperation != nil { // handle response } @@ -122,14 +122,17 @@ 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 | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCompanyDataStatus @@ -162,7 +165,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.DataStatuses != nil { // handle response } @@ -177,14 +179,17 @@ func main() { | `request` | [operations.GetCompanyDataStatusRequest](../../pkg/models/operations/getcompanydatastatusrequest.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.GetCompanyDataStatusResponse](../../pkg/models/operations/getcompanydatastatusresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPullOperation @@ -218,7 +223,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PullOperation != nil { // handle response } @@ -233,14 +237,17 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ListPullOperations @@ -272,11 +279,11 @@ func main() { OrderBy: syncforcommerceversion1.String("-modifiedDate"), Page: syncforcommerceversion1.Int(1), PageSize: syncforcommerceversion1.Int(100), + Query: syncforcommerceversion1.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.PullOperations != nil { // handle response } @@ -291,11 +298,13 @@ 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 | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/sync/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/sync/README.md index 2c16e475c..4b3fd207e 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/sync/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/sync/README.md @@ -42,7 +42,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.SyncSummary != nil { // handle response } @@ -57,14 +56,17 @@ func main() { | `request` | [operations.GetSyncStatusRequest](../../pkg/models/operations/getsyncstatusrequest.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.GetSyncStatusResponse](../../pkg/models/operations/getsyncstatusresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## RequestSync @@ -101,7 +103,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.SyncSummary != nil { // handle response } @@ -116,14 +117,17 @@ func main() { | `request` | [operations.RequestSyncRequest](../../pkg/models/operations/requestsyncrequest.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.RequestSyncResponse](../../pkg/models/operations/requestsyncresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## RequestSyncForDateRange @@ -162,7 +166,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.SyncSummary != nil { // handle response } @@ -177,11 +180,13 @@ func main() { | `request` | [operations.RequestSyncForDateRangeRequest](../../pkg/models/operations/requestsyncfordaterangerequest.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.RequestSyncForDateRangeResponse](../../pkg/models/operations/requestsyncfordaterangeresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/docs/sdks/syncflowpreferences/README.md b/previous-versions/sync-for-commerce-version-1/docs/sdks/syncflowpreferences/README.md index c2d06fd0b..9b1e01e85 100644 --- a/previous-versions/sync-for-commerce-version-1/docs/sdks/syncflowpreferences/README.md +++ b/previous-versions/sync-for-commerce-version-1/docs/sdks/syncflowpreferences/README.md @@ -44,7 +44,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -59,14 +58,17 @@ func main() { | `request` | [operations.GetConfigTextSyncFlowRequest](../../pkg/models/operations/getconfigtextsyncflowrequest.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.GetConfigTextSyncFlowResponse](../../pkg/models/operations/getconfigtextsyncflowresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------- | ----------------------- | ----------------------- | | sdkerrors.ErrorMessage | 401,402,403,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetSyncFlowURL @@ -94,13 +96,12 @@ func main() { ctx := context.Background() res, err := s.SyncFlowPreferences.GetSyncFlowURL(ctx, operations.GetSyncFlowURLRequest{ - AccountingKey: "string", - CommerceKey: "string", + AccountingKey: "", + CommerceKey: "", }) if err != nil { log.Fatal(err) } - if res.SyncFlowURL != nil { // handle response } @@ -115,14 +116,17 @@ func main() { | `request` | [operations.GetSyncFlowURLRequest](../../pkg/models/operations/getsyncflowurlrequest.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.GetSyncFlowURLResponse](../../pkg/models/operations/getsyncflowurlresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetVisibleAccounts @@ -156,7 +160,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.VisibleAccounts != nil { // handle response } @@ -171,14 +174,17 @@ func main() { | `request` | [operations.GetVisibleAccountsRequest](../../pkg/models/operations/getvisibleaccountsrequest.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.GetVisibleAccountsResponse](../../pkg/models/operations/getvisibleaccountsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdateConfigTextSyncFlow @@ -206,15 +212,11 @@ func main() { ctx := context.Background() res, err := s.SyncFlowPreferences.UpdateConfigTextSyncFlow(ctx, operations.UpdateConfigTextSyncFlowRequest{ - RequestBody: map[string]shared.Localization{ - "key": shared.Localization{}, - }, Locale: shared.LocaleEnUs, }) if err != nil { log.Fatal(err) } - if res.LocalizationInfo != nil { // handle response } @@ -229,14 +231,17 @@ func main() { | `request` | [operations.UpdateConfigTextSyncFlowRequest](../../pkg/models/operations/updateconfigtextsyncflowrequest.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.UpdateConfigTextSyncFlowResponse](../../pkg/models/operations/updateconfigtextsyncflowresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdateVisibleAccountsSyncFlow @@ -264,17 +269,11 @@ func main() { ctx := context.Background() res, err := s.SyncFlowPreferences.UpdateVisibleAccountsSyncFlow(ctx, operations.UpdateVisibleAccountsSyncFlowRequest{ - VisibleAccounts: &shared.VisibleAccounts{ - VisibleAccounts: []string{ - "string", - }, - }, PlatformKey: "gbol", }) if err != nil { log.Fatal(err) } - if res.VisibleAccounts != nil { // handle response } @@ -289,11 +288,13 @@ func main() { | `request` | [operations.UpdateVisibleAccountsSyncFlowRequest](../../pkg/models/operations/updatevisibleaccountssyncflowrequest.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.UpdateVisibleAccountsSyncFlowResponse](../../pkg/models/operations/updatevisibleaccountssyncflowresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 400-600 | */* | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/previous-versions/sync-for-commerce-version-1/go.mod b/previous-versions/sync-for-commerce-version-1/go.mod index dfdb66510..09a779918 100644 --- a/previous-versions/sync-for-commerce-version-1/go.mod +++ b/previous-versions/sync-for-commerce-version-1/go.mod @@ -1,10 +1,8 @@ module github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1 -go 1.14 +go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.0 github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 - github.com/mitchellh/mapstructure v1.5.0 - github.com/spyzhov/ajson v0.8.0 ) diff --git a/previous-versions/sync-for-commerce-version-1/go.sum b/previous-versions/sync-for-commerce-version-1/go.sum index ae03a472a..f95577939 100644 --- a/previous-versions/sync-for-commerce-version-1/go.sum +++ b/previous-versions/sync-for-commerce-version-1/go.sum @@ -2,7 +2,3 @@ github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+M github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/spyzhov/ajson v0.8.0 h1:sFXyMbi4Y/BKjrsfkUZHSjA2JM1184enheSjjoT/zCc= -github.com/spyzhov/ajson v0.8.0/go.mod h1:63V+CGM6f1Bu/p4nLIN8885ojBdt88TbLoSFzyqMuVA= diff --git a/previous-versions/sync-for-commerce-version-1/integrations.go b/previous-versions/sync-for-commerce-version-1/integrations.go index 4aa110be0..2151a3e8b 100644 --- a/previous-versions/sync-for-commerce-version-1/integrations.go +++ b/previous-versions/sync-for-commerce-version-1/integrations.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 syncforcommerceversion1 @@ -6,13 +6,16 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" - "strings" + "net/url" ) // Integrations - View useful information about codat's integrations. @@ -29,9 +32,17 @@ func newIntegrations(sdkConfig sdkConfiguration) *Integrations { // GetIntegrationBranding - Get branding for an integration // Retrieve Integration branding assets. func (s *Integrations) GetIntegrationBranding(ctx context.Context, request operations.GetIntegrationBrandingRequest, opts ...operations.Option) (*operations.GetIntegrationBrandingResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-integration-branding", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -39,28 +50,43 @@ func (s *Integrations) GetIntegrationBranding(ctx context.Context, request opera return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/config/integrations/{platformKey}/branding", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/config/integrations/{platformKey}/branding", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -68,46 +94,109 @@ func (s *Integrations) GetIntegrationBranding(ctx context.Context, request opera }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.GetIntegrationBrandingResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Branding if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -115,7 +204,12 @@ func (s *Integrations) GetIntegrationBranding(ctx context.Context, request opera res.Branding = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -131,30 +225,62 @@ func (s *Integrations) GetIntegrationBranding(ctx context.Context, request opera fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListIntegrations - List integrations // Retrieve a list of available integrations support by datatype and state of release. func (s *Integrations) ListIntegrations(ctx context.Context, request operations.ListIntegrationsRequest, opts ...operations.Option) (*operations.ListIntegrationsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-integrations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -162,29 +288,47 @@ func (s *Integrations) ListIntegrations(ctx context.Context, request operations. return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/config/integrations" + opURL, err := url.JoinPath(baseURL, "/config/integrations") + 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", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -192,46 +336,109 @@ func (s *Integrations) ListIntegrations(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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + 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 + } + } + } res := &operations.ListIntegrationsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Integrations if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -239,7 +446,12 @@ func (s *Integrations) ListIntegrations(ctx context.Context, request operations. res.Integrations = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -255,20 +467,44 @@ func (s *Integrations) ListIntegrations(ctx context.Context, request operations. fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/internal/hooks/hooks.go b/previous-versions/sync-for-commerce-version-1/internal/hooks/hooks.go new file mode 100644 index 000000000..8ea491aeb --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/internal/hooks/hooks.go @@ -0,0 +1,144 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package hooks + +import ( + "context" + "errors" + "net/http" +) + +type FailEarly struct { + Cause error +} + +var _ error = (*FailEarly)(nil) + +func (f *FailEarly) Error() string { + return f.Cause.Error() +} + +// HTTPClient provides an interface for supplying the SDK with a custom HTTP client +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +type HookContext struct { + Context context.Context + OperationID string + OAuth2Scopes []string + SecuritySource func(context.Context) (interface{}, error) +} + +type BeforeRequestContext struct { + HookContext +} + +type AfterSuccessContext struct { + HookContext +} + +type AfterErrorContext struct { + HookContext +} + +// sdkInitHook is called when the SDK is initializing. The hook can modify and return a new baseURL and HTTP client to be used by the SDK. +type sdkInitHook interface { + SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) +} + +// beforeRequestHook is called before the SDK sends a request. The hook can modify the request before it is sent or return an error to stop the request from being sent. +type beforeRequestHook interface { + BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) +} + +// afterSuccessHook is called after the SDK receives a response. The hook can modify the response before it is handled or return an error to stop the response from being handled. +type afterSuccessHook interface { + AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) +} + +// afterErrorHook is called after the SDK encounters an error, or a non-successful response. The hook can modify the response if available otherwise modify the error. +// All afterErrorHook hooks are called and returning an error won't stop the other hooks from being called. But if you want to stop the other hooks from being called, you can return a FailEarly error wrapping your error. +type afterErrorHook interface { + AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) +} + +type Hooks struct { + sdkInitHooks []sdkInitHook + beforeRequestHook []beforeRequestHook + afterSuccessHook []afterSuccessHook + afterErrorHook []afterErrorHook +} + +func New() *Hooks { + h := &Hooks{ + sdkInitHooks: []sdkInitHook{}, + beforeRequestHook: []beforeRequestHook{}, + afterSuccessHook: []afterSuccessHook{}, + afterErrorHook: []afterErrorHook{}, + } + + initHooks(h) + + return h +} + +// registerSDKInitHook registers a hook to be used by the SDK for the initialization event. +func (h *Hooks) registerSDKInitHook(hook sdkInitHook) { + h.sdkInitHooks = append(h.sdkInitHooks, hook) +} + +// registerBeforeRequestHook registers a hook to be used by the SDK for the before request event. +func (h *Hooks) registerBeforeRequestHook(hook beforeRequestHook) { + h.beforeRequestHook = append(h.beforeRequestHook, hook) +} + +// registerAfterSuccessHook registers a hook to be used by the SDK for the after success event. +func (h *Hooks) registerAfterSuccessHook(hook afterSuccessHook) { + h.afterSuccessHook = append(h.afterSuccessHook, hook) +} + +// registerAfterErrorHook registers a hook to be used by the SDK for the after error event. +func (h *Hooks) registerAfterErrorHook(hook afterErrorHook) { + h.afterErrorHook = append(h.afterErrorHook, hook) +} + +func (h *Hooks) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) { + for _, hook := range h.sdkInitHooks { + baseURL, client = hook.SDKInit(baseURL, client) + } + return baseURL, client +} + +func (h *Hooks) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) { + for _, hook := range h.beforeRequestHook { + var err error + req, err = hook.BeforeRequest(hookCtx, req) + if err != nil { + return req, err + } + } + return req, nil +} + +func (h *Hooks) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) { + for _, hook := range h.afterSuccessHook { + var err error + res, err = hook.AfterSuccess(hookCtx, res) + if err != nil { + return res, err + } + } + return res, nil +} + +func (h *Hooks) AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) { + for _, hook := range h.afterErrorHook { + res, err = hook.AfterError(hookCtx, res, err) + var fe *FailEarly + if errors.As(err, &fe) { + return nil, fe.Cause + } + } + return res, err +} diff --git a/previous-versions/sync-for-commerce-version-1/internal/hooks/registration.go b/previous-versions/sync-for-commerce-version-1/internal/hooks/registration.go new file mode 100644 index 000000000..fa131be81 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/internal/hooks/registration.go @@ -0,0 +1,18 @@ +package hooks + +/* + * This file is only ever generated once on the first generation and then is free to be modified. + * Any hooks you wish to add should be registered in the initHooks function. Feel free to define + * your hooks in this file or in separate files in the hooks package. + * + * Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance. + */ + +func initHooks(h *Hooks) { + // exampleHook := &ExampleHook{} + + // h.registerSDKInitHook(exampleHook) + // h.registerBeforeRequestHook(exampleHook) + // h.registerAfterErrorHook(exampleHook) + // h.registerAfterSuccessHook(exampleHook) +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingaccount.go index cc3adadff..f8d5f382c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingaccount.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcreditnote.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcreditnote.go index d848e8b17..54a5000a4 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcreditnote.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcreditnote.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcustomer.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcustomer.go index 8b7931d9c..a0364c392 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcustomer.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingcustomer.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingdirectincome.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingdirectincome.go index 44be544a8..66dcf50ed 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingdirectincome.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingdirectincome.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountinginvoice.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountinginvoice.go index 0cec05346..7b81ab9ce 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountinginvoice.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountinginvoice.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingjournalentry.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingjournalentry.go index 2d01fc659..d9d4e9eaf 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingjournalentry.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingjournalentry.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingpayment.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingpayment.go index b16ecf3e9..c4b4033f0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingpayment.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createaccountingpayment.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createcompany.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createcompany.go index bbc331e81..69d082e80 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createcompany.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createconnection.go index d348566aa..bbc51a438 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/createconnection.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deletecompany.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deletecompany.go index 4fe14e7e9..e23526cf3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deletecompany.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deleteconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deleteconnection.go index 6e5d2d358..c6574cf51 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/deleteconnection.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingaccount.go index 3dedeae6a..d48618e68 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingaccount.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingbankaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingbankaccount.go index dc7b1b5e2..3cc7693d6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingbankaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingbankaccount.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingcompanyinfo.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingcompanyinfo.go index 7ce03099e..e7d9110fc 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingcompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getaccountingcompanyinfo.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecompanyinfo.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecompanyinfo.go index 6d8a580fb..e0582e988 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecompanyinfo.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecustomer.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecustomer.go index 84067670e..13db749e3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecustomer.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercecustomer.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercelocation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercelocation.go index 949826bea..05d487566 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercelocation.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercelocation.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceorder.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceorder.go index 72ad955f3..c04b137f0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceorder.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceorder.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepayment.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepayment.go index 50ac442fb..7c4ade748 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepayment.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepayment.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepaymentmethod.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepaymentmethod.go index 2c5d370a9..dc7ed0bd9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepaymentmethod.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercepaymentmethod.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceproduct.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceproduct.go index bdac99d0f..737160120 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceproduct.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommerceproduct.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercetransaction.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercetransaction.go index 67b50b225..122bd3f23 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercetransaction.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcommercetransaction.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompany.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompany.go index a58e0c7c7..c8d58273e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompany.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanydatastatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanydatastatus.go index c091e64e7..79cbd8ae2 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanydatastatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanydatastatus.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 *GetCompanyDataStatusRequest) GetCompanyID() string { return o.CompanyID } +// GetCompanyDataStatusDataStatuses - OK +type GetCompanyDataStatusDataStatuses 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 *GetCompanyDataStatusDataStatuses) GetAccountTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.AccountTransactions +} + +func (o *GetCompanyDataStatusDataStatuses) GetBalanceSheet() *shared.DataStatus { + if o == nil { + return nil + } + return o.BalanceSheet +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankAccounts +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankTransactions +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankingAccountBalances() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccountBalances +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankingAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccounts +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankingTransactionCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactionCategories +} + +func (o *GetCompanyDataStatusDataStatuses) GetBankingTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactions +} + +func (o *GetCompanyDataStatusDataStatuses) GetBillCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillCreditNotes +} + +func (o *GetCompanyDataStatusDataStatuses) GetBillPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillPayments +} + +func (o *GetCompanyDataStatusDataStatuses) GetBills() *shared.DataStatus { + if o == nil { + return nil + } + return o.Bills +} + +func (o *GetCompanyDataStatusDataStatuses) GetCashFlowStatement() *shared.DataStatus { + if o == nil { + return nil + } + return o.CashFlowStatement +} + +func (o *GetCompanyDataStatusDataStatuses) GetChartOfAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ChartOfAccounts +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceCompanyInfo() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCompanyInfo +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCustomers +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceDisputes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceDisputes +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceLocations() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceLocations +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceOrders +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommercePaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePaymentMethods +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommercePayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePayments +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceProductCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProductCategories +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceProducts() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProducts +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceTaxComponents() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTaxComponents +} + +func (o *GetCompanyDataStatusDataStatuses) GetCommerceTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTransactions +} + +func (o *GetCompanyDataStatusDataStatuses) GetCompany() *shared.DataStatus { + if o == nil { + return nil + } + return o.Company +} + +func (o *GetCompanyDataStatusDataStatuses) GetCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CreditNotes +} + +func (o *GetCompanyDataStatusDataStatuses) GetCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Customers +} + +func (o *GetCompanyDataStatusDataStatuses) GetDirectCosts() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectCosts +} + +func (o *GetCompanyDataStatusDataStatuses) GetDirectIncomes() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectIncomes +} + +func (o *GetCompanyDataStatusDataStatuses) GetInvoices() *shared.DataStatus { + if o == nil { + return nil + } + return o.Invoices +} + +func (o *GetCompanyDataStatusDataStatuses) GetItemReceipts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ItemReceipts +} + +func (o *GetCompanyDataStatusDataStatuses) GetItems() *shared.DataStatus { + if o == nil { + return nil + } + return o.Items +} + +func (o *GetCompanyDataStatusDataStatuses) GetJournalEntries() *shared.DataStatus { + if o == nil { + return nil + } + return o.JournalEntries +} + +func (o *GetCompanyDataStatusDataStatuses) GetJournals() *shared.DataStatus { + if o == nil { + return nil + } + return o.Journals +} + +func (o *GetCompanyDataStatusDataStatuses) GetPaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.PaymentMethods +} + +func (o *GetCompanyDataStatusDataStatuses) GetPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.Payments +} + +func (o *GetCompanyDataStatusDataStatuses) GetProfitAndLoss() *shared.DataStatus { + if o == nil { + return nil + } + return o.ProfitAndLoss +} + +func (o *GetCompanyDataStatusDataStatuses) GetPurchaseOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.PurchaseOrders +} + +func (o *GetCompanyDataStatusDataStatuses) GetSalesOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.SalesOrders +} + +func (o *GetCompanyDataStatusDataStatuses) GetSuppliers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Suppliers +} + +func (o *GetCompanyDataStatusDataStatuses) GetTaxRates() *shared.DataStatus { + if o == nil { + return nil + } + return o.TaxRates +} + +func (o *GetCompanyDataStatusDataStatuses) GetTrackingCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.TrackingCategories +} + +func (o *GetCompanyDataStatusDataStatuses) GetTransfers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Transfers +} + type GetCompanyDataStatusResponse struct { // HTTP response content type for this operation ContentType string // OK - DataStatuses map[string]shared.DataStatus + DataStatuses *GetCompanyDataStatusDataStatuses // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing @@ -37,7 +428,7 @@ func (o *GetCompanyDataStatusResponse) GetContentType() string { return o.ContentType } -func (o *GetCompanyDataStatusResponse) GetDataStatuses() map[string]shared.DataStatus { +func (o *GetCompanyDataStatusResponse) GetDataStatuses() *GetCompanyDataStatusDataStatuses { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanypushhistory.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanypushhistory.go index 0db2eeb1a..7d54264d6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanypushhistory.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getcompanypushhistory.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfigtextsyncflow.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfigtextsyncflow.go index d023bd50e..1c1c30831 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfigtextsyncflow.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfigtextsyncflow.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfiguration.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfiguration.go index c54bf0e2e..15bc38406 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfiguration.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconfiguration.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconnection.go index 708d14ae7..22aee1bdd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getconnection.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getintegrationbranding.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getintegrationbranding.go index b7e8faa8c..77d67db34 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getintegrationbranding.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getintegrationbranding.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,7 +8,7 @@ import ( ) type GetIntegrationBrandingRequest struct { - // A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. + // A unique 4-letter key to represent a platform in each integration. PlatformKey string `pathParam:"style=simple,explode=false,name=platformKey"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpulloperation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpulloperation.go index 916c19cfe..0e7c1f4b7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpulloperation.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpushoperation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpushoperation.go index b28d7b866..778c8c9b6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getpushoperation.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncflowurl.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncflowurl.go index 38f11bc0a..4bde2d5ac 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncflowurl.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncflowurl.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncstatus.go index 6c635bc6e..2a116d06c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncstatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getsyncstatus.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getvisibleaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getvisibleaccounts.go index 875cd389a..5611fd796 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getvisibleaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/getvisibleaccounts.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 @@ -10,7 +10,7 @@ import ( type GetVisibleAccountsRequest struct { // Unique identifier for your client in Codat. ClientID string `pathParam:"style=simple,explode=false,name=clientId"` - // A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. + // A unique 4-letter key to represent a platform in each integration. PlatformKey string `pathParam:"style=simple,explode=false,name=platformKey"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingaccounts.go index f90106b4e..efb01d36c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingaccounts.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingbankaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingbankaccounts.go index 5484beee8..f066538a8 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingbankaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listaccountingbankaccounts.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercecustomers.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercecustomers.go index a0a5a7420..8d9dec224 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercecustomers.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercecustomers.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercelocations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercelocations.go index 5ecdc56ec..604124045 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercelocations.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercelocations.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceorders.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceorders.go index c6c916af2..d9f247f75 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceorders.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceorders.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepaymentmethods.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepaymentmethods.go index 2fb33370b..f14f33e1a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepaymentmethods.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepaymentmethods.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepayments.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepayments.go index 6350acc57..bc21465e5 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepayments.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercepayments.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceproducts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceproducts.go index 47b5aec81..d9d75c922 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceproducts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommerceproducts.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercetransactions.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercetransactions.go index 698b7dcac..1a2cc70ec 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercetransactions.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcommercetransactions.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcompanies.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcompanies.go index 2b101fd05..b90dd4484 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listcompanies.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listconnections.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listconnections.go index fcc945029..b47ccfe6f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listconnections.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listintegrations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listintegrations.go index 9deb15085..56fd4ebc3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listintegrations.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listintegrations.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listpulloperations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listpulloperations.go index 203ff38fb..e19dba11d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/listpulloperations.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/options.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/options.go index 30031a918..070dddf91 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/options.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanydata.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanydata.go index f89bbc965..2dc13174e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanydata.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanydata.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanyinfo.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanyinfo.go index 7cb2789ac..0c1ebc90e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshcompanyinfo.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshdatatype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshdatatype.go index cf7dfa437..bdc595909 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/refreshdatatype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsync.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsync.go index 620c1f70e..ce1f3734a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsync.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsync.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsyncfordaterange.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsyncfordaterange.go index df070af1c..e22c0733b 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsyncfordaterange.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/requestsyncfordaterange.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/setconfiguration.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/setconfiguration.go index e9381d810..5db2e7660 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/setconfiguration.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/setconfiguration.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/unlinkconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/unlinkconnection.go index 9ea6270c7..2718f719f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/unlinkconnection.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatecompany.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatecompany.go index 99f3c503c..ba1c22141 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatecompany.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconfigtextsyncflow.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconfigtextsyncflow.go index 608e56f0d..ca2449b4f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconfigtextsyncflow.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconfigtextsyncflow.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconnection.go index 88805146d..8023dbffd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconnection.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updateconnection.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/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatevisibleaccountssyncflow.go b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatevisibleaccountssyncflow.go index b6dbe4f22..9c4a5be16 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatevisibleaccountssyncflow.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/operations/updatevisibleaccountssyncflow.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 @@ -9,7 +9,7 @@ import ( type UpdateVisibleAccountsSyncFlowRequest struct { VisibleAccounts *shared.VisibleAccounts `request:"mediaType=application/json"` - // A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. + // A unique 4-letter key to represent a platform in each integration. PlatformKey string `pathParam:"style=simple,explode=false,name=platformKey"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/errormessage.go b/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/errormessage.go index ca0e5ca9f..368f9b782 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/errormessage.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/errormessage.go @@ -1,9 +1,10 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors import ( "encoding/json" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" ) // ErrorMessage - Your API request was not properly authorized. @@ -20,6 +21,8 @@ type ErrorMessage struct { Service *string `json:"service,omitempty"` // The HTTP status code returned by the error. StatusCode *int64 `json:"statusCode,omitempty"` + // A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. + Validation *shared.ErrorValidation `json:"validation,omitempty"` } var _ error = &ErrorMessage{} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/sdkerror.go b/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/sdkerror.go index 5c1affd31..7d63b9813 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors/sdkerror.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountbalance.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountbalance.go index 4b1bcfb25..aa2119b1c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountbalance.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountbalance.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 @@ -15,7 +15,7 @@ type AccountBalance struct { // Funds that are not yet available in the balance Pending *decimal.Big `decimal:"number" json:"pending,omitempty"` // Funds reserved as holdings - Reserved interface{} `json:"reserved,omitempty"` + Reserved any `json:"reserved,omitempty"` } func (a AccountBalance) MarshalJSON() ([]byte, error) { @@ -50,7 +50,7 @@ func (o *AccountBalance) GetPending() *decimal.Big { return o.Pending } -func (o *AccountBalance) GetReserved() interface{} { +func (o *AccountBalance) GetReserved() any { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccount.go index e13601174..ff124c65a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccount.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 @@ -145,7 +145,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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccounts.go index 4228fd0da..065f82b9f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaccounts.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaddresstype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaddresstype.go index c98699efe..a0c620b32 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingaddresstype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccount.go index c671e224e..82ba928af 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccount.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 BankAccountType) ToPointer() *BankAccountType { return &e } - func (e *BankAccountType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -55,11 +54,11 @@ func (e *BankAccountType) UnmarshalJSON(data []byte) error { // 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 platform. +// * 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 AccountingBankAccount struct { - // Name of the bank account in the accounting platform. + // Name of the bank account in the accounting software. AccountName *string `json:"accountName,omitempty"` // Account number for the bank account. // @@ -87,7 +86,7 @@ type AccountingBankAccount struct { 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 platform. + // 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"` @@ -105,9 +104,11 @@ type AccountingBankAccount struct { // 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 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"` } @@ -227,6 +228,13 @@ func (o *AccountingBankAccount) GetSourceModifiedDate() *string { 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 diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccounts.go index 242c643d3..335aaee95 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingbankaccounts.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcompanydataset.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcompanydataset.go index 770580bbe..833cdf980 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcompanydataset.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcompanydataset.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 @@ -75,7 +75,7 @@ func (o *AccountingAddress) GetType() AccountingAddressType { type Phone struct { // A phone number. - Number *string `json:"number"` + Number *string `json:"number,omitempty"` // The type of phone number Type PhoneNumberType `json:"type"` } @@ -106,7 +106,6 @@ const ( func (e AccountingCompanyDatasetType) ToPointer() *AccountingCompanyDatasetType { return &e } - func (e *AccountingCompanyDatasetType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -153,13 +152,13 @@ func (o *Weblink) GetURL() *string { // // > **Company information or companies?** // > -// > Company profile is standard information that is held in the accounting platform about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. +// > Company profile is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. type AccountingCompanyDataset struct { - // Identifier or reference for the company in the accounting platform. + // Identifier or reference for the company in the accounting software. AccountingPlatformRef *string `json:"accountingPlatformRef,omitempty"` // An array of Addresses. Addresses []AccountingAddress `json:"addresses,omitempty"` - // Currency set in the accounting platform of the linked company. Used by the currency rate. + // Currency set in the accounting software of the linked company. Used by the currency rate. BaseCurrency *string `json:"baseCurrency,omitempty"` // Registered legal name of the linked company. CompanyLegalName *string `json:"companyLegalName,omitempty"` @@ -235,7 +234,7 @@ type AccountingCompanyDataset struct { SourceUrls map[string]string `json:"sourceUrls,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"` // Company tax number. TaxNumber *string `json:"taxNumber,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateaccountresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateaccountresponse.go index 31ad652b3..d2627f9fd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateaccountresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateaccountresponse.go @@ -1,7 +1,283 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +import ( + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/ericlagergren/decimal" +) + +type AccountingCreateAccountResponseMetadata struct { + // Indicates whether the record has been deleted in the third-party system this record originated from. + IsDeleted *bool `json:"isDeleted,omitempty"` +} + +func (o *AccountingCreateAccountResponseMetadata) GetIsDeleted() *bool { + if o == nil { + return nil + } + return o.IsDeleted +} + +// AccountingCreateAccountResponseValidDataTypeLinks - When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. +// +// For example, `validDatatypeLinks` might indicate the following references: +// +// - Which tax rates are valid to use on the line item of a bill. +// - Which items can be used when creating an invoice. +// +// You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. +// +// ## `validDatatypeLinks` example +// +// The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. +// +// ```json validDatatypeLinks for an account +// +// { +// "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", +// "nominalCode": "090", +// "name": "Business Bank Account", +// #... +// "validDatatypeLinks": [ +// { +// "property": "Id", +// "links": [ +// "Payment.AccountRef.Id", +// "BillPayment.AccountRef.Id", +// "DirectIncome.LineItems.AccountRef.Id", +// "DirectCost.LineItems.AccountRef.Id" +// ] +// } +// ] +// } +// +// ``` +// +// ## Support for `validDatatypeLinks` +// +// Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. +// +// If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. +type AccountingCreateAccountResponseValidDataTypeLinks struct { + // Supported `dataTypes` that the record can be linked to. + Links []string `json:"links,omitempty"` + // The property from the account that can be linked. + Property *string `json:"property,omitempty"` +} + +func (o *AccountingCreateAccountResponseValidDataTypeLinks) GetLinks() []string { + if o == nil { + return nil + } + return o.Links +} + +func (o *AccountingCreateAccountResponseValidDataTypeLinks) GetProperty() *string { + if o == nil { + return nil + } + return o.Property +} + +// AccountingCreateAccountResponseAccountingAccount - > **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. +// +// View the coverage for accounts in the Data coverage explorer. +// +// ## Overview +// +// Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. +// +// The categories for an account include: +// * Asset +// * Expense +// * Income +// * Liability +// * Equity. +// +// The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. +// +// At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. +// +// To determine the list of allowed categories for a specific integration, you can: +// - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/accounting-api#/operations/get-create-chartOfAccounts-model). +// - Refer to the integration's own documentation. +// +// > **Accounts with no category** +// > +// > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. +// > +// > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateAccountResponseAccountingAccount struct { + // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + // + // ## Unknown currencies + // + // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a 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"` + // Current balance in the account. + CurrentBalance *decimal.Big `decimal:"number" json:"currentBalance,omitempty"` + // Description for the account. + Description *string `json:"description,omitempty"` + // Full category of the account. + // + // For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. + FullyQualifiedCategory *string `json:"fullyQualifiedCategory,omitempty"` + // Full name of the account, for example: + // - `Cash On Hand` + // - `Rents Held In Trust` + // - `Fixed Asset` + FullyQualifiedName *string `json:"fullyQualifiedName,omitempty"` + // Identifier for the account, unique for the company. + ID *string `json:"id,omitempty"` + // Confirms whether the account is a bank account or not. + IsBankAccount *bool `json:"isBankAccount,omitempty"` + Metadata *AccountingCreateAccountResponseMetadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Name of the account. + Name *string `json:"name,omitempty"` + // 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. + NominalCode *string `json:"nominalCode,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Status of the account + 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 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"` + // 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](/accounting-api#/schemas/ValidDataTypeLinks). + ValidDatatypeLinks []AccountingCreateAccountResponseValidDataTypeLinks `json:"validDatatypeLinks,omitempty"` +} + +func (a AccountingCreateAccountResponseAccountingAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateAccountResponseAccountingAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetCurrentBalance() *decimal.Big { + if o == nil { + return nil + } + return o.CurrentBalance +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetFullyQualifiedCategory() *string { + if o == nil { + return nil + } + return o.FullyQualifiedCategory +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetFullyQualifiedName() *string { + if o == nil { + return nil + } + return o.FullyQualifiedName +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetIsBankAccount() *bool { + if o == nil { + return nil + } + return o.IsBankAccount +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetMetadata() *AccountingCreateAccountResponseMetadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetNominalCode() *string { + if o == nil { + return nil + } + return o.NominalCode +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetStatus() *AccountStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetType() *AccountType { + if o == nil { + return nil + } + return o.Type +} + +func (o *AccountingCreateAccountResponseAccountingAccount) GetValidDatatypeLinks() []AccountingCreateAccountResponseValidDataTypeLinks { + if o == nil { + return nil + } + return o.ValidDatatypeLinks +} + type AccountingCreateAccountResponse struct { // Contains a single entry that communicates which record has changed and the manner in which it changed. Changes []PushOperationChange `json:"changes,omitempty"` @@ -26,39 +302,11 @@ type AccountingCreateAccountResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - // - // View the coverage for accounts in the Data coverage explorer. - // - // ## Overview - // - // Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - // - // The categories for an account include: - // * Asset - // * Expense - // * Income - // * Liability - // * Equity. - // - // The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - // - // At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - // - // To determine the list of allowed categories for a specific integration, you can: - // - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/accounting-api#/operations/get-create-chartOfAccounts-model). - // - Refer to the integration's own documentation. - // - // > **Accounts with no category** - // > - // > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. - // > - // > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - Data *AccountingAccount `json:"data,omitempty"` + CompletedOnUtc *string `json:"completedOnUtc,omitempty"` + Data *AccountingCreateAccountResponseAccountingAccount `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -119,7 +367,7 @@ func (o *AccountingCreateAccountResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateAccountResponse) GetData() *AccountingAccount { +func (o *AccountingCreateAccountResponse) GetData() *AccountingCreateAccountResponseAccountingAccount { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecreditnoteresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecreditnoteresponse.go index acf983975..1843e13ad 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecreditnoteresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecreditnoteresponse.go @@ -1,7 +1,325 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +import ( + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// AccountingCreateCreditNoteResponseAccountingCreditNote - > View the coverage for credit notes in the Data coverage explorer. +// +// ## Overview +// +// Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. +// +// In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/accounting-api#/schemas/Customer) accounts receivable. +// +// It contains details of: +// * The amount of credit remaining and its status. +// * Payment allocations against the payments type, in this case an invoice. +// * Which customers the credit notes have been issued to. +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateCreditNoteResponseAccountingCreditNote struct { + // Additional tax amount applied to credit note. + AdditionalTaxAmount *decimal.Big `decimal:"number" json:"additionalTaxAmount,omitempty"` + // Percentage rate of any additional tax applied to the credit note. + AdditionalTaxPercentage *decimal.Big `decimal:"number" json:"additionalTaxPercentage,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. + AllocatedOnDate *string `json:"allocatedOnDate,omitempty"` + // Friendly reference for the credit note. + CreditNoteNumber *string `json:"creditNoteNumber,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"` + // 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"` + CustomerRef *AccountingCustomerRef `json:"customerRef,omitempty"` + // Percentage rate (from 0 to 100) of discounts applied to the credit note. + DiscountPercentage *decimal.Big `decimal:"number" json:"discountPercentage"` + // Identifier for the credit note, unique to the company in the accounting software. + 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. + IssueDate *string `json:"issueDate,omitempty"` + LineItems []CreditNoteLineItem `json:"lineItems,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. + Note *string `json:"note,omitempty"` + // An array of payment allocations. + PaymentAllocations []PaymentAllocationItems `json:"paymentAllocations,omitempty"` + // Unused balance of totalAmount originally raised. + RemainingCredit *decimal.Big `decimal:"number" json:"remainingCredit"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Current state of the credit note. + Status CreditNoteStatus `json:"status"` + // Value of the credit note, including discounts and excluding tax. + SubTotal *decimal.Big `decimal:"number" json:"subTotal"` + // 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"` + // Total amount of credit that has been applied to the customer's accounts receivable + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount"` + // Any discounts applied to the credit note amount. + TotalDiscount *decimal.Big `decimal:"number" json:"totalDiscount"` + // Any tax applied to the credit note amount. + TotalTaxAmount *decimal.Big `decimal:"number" json:"totalTaxAmount"` + WithholdingTax []WithholdingTaxItems `json:"withholdingTax,omitempty"` +} + +func (a AccountingCreateCreditNoteResponseAccountingCreditNote) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateCreditNoteResponseAccountingCreditNote) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetAdditionalTaxAmount() *decimal.Big { + if o == nil { + return nil + } + return o.AdditionalTaxAmount +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetAdditionalTaxPercentage() *decimal.Big { + if o == nil { + return nil + } + return o.AdditionalTaxPercentage +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetAllocatedOnDate() *string { + if o == nil { + return nil + } + return o.AllocatedOnDate +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetCreditNoteNumber() *string { + if o == nil { + return nil + } + return o.CreditNoteNumber +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetCustomerRef() *AccountingCustomerRef { + if o == nil { + return nil + } + return o.CustomerRef +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetDiscountPercentage() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.DiscountPercentage +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetIssueDate() *string { + if o == nil { + return nil + } + return o.IssueDate +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetLineItems() []CreditNoteLineItem { + if o == nil { + return nil + } + return o.LineItems +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetNote() *string { + if o == nil { + return nil + } + return o.Note +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetPaymentAllocations() []PaymentAllocationItems { + if o == nil { + return nil + } + return o.PaymentAllocations +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetRemainingCredit() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.RemainingCredit +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetStatus() CreditNoteStatus { + if o == nil { + return CreditNoteStatus("") + } + return o.Status +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetSubTotal() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.SubTotal +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetTotalAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalAmount +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetTotalDiscount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalDiscount +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetTotalTaxAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalTaxAmount +} + +func (o *AccountingCreateCreditNoteResponseAccountingCreditNote) GetWithholdingTax() []WithholdingTaxItems { + if o == nil { + return nil + } + return o.WithholdingTax +} + type AccountingCreateCreditNoteResponse struct { // Contains a single entry that communicates which record has changed and the manner in which it changed. Changes []PushOperationChange `json:"changes,omitempty"` @@ -26,23 +344,11 @@ type AccountingCreateCreditNoteResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > View the coverage for credit notes in the Data coverage explorer. - // - // ## Overview - // - // Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. - // - // In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/accounting-api#/schemas/Customer) accounts receivable. - // - // It contains details of: - // * The amount of credit remaining and its status. - // * Payment allocations against the payments type, in this case an invoice. - // * Which customers the credit notes have been issued to. - Data *AccountingCreditNote `json:"data,omitempty"` + CompletedOnUtc *string `json:"completedOnUtc,omitempty"` + Data *AccountingCreateCreditNoteResponseAccountingCreditNote `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -103,7 +409,7 @@ func (o *AccountingCreateCreditNoteResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateCreditNoteResponse) GetData() *AccountingCreditNote { +func (o *AccountingCreateCreditNoteResponse) GetData() *AccountingCreateCreditNoteResponseAccountingCreditNote { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecustomerresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecustomerresponse.go index 06ba8ad3d..a1cf0b4bd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecustomerresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatecustomerresponse.go @@ -1,7 +1,159 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +// AccountingCreateCustomerResponseAccountingCustomer - > View the coverage for customers in the Data coverage explorer. +// +// ## Overview +// +// A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). +// +// Customers' data links to accounts receivable [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice). +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateCustomerResponseAccountingCustomer struct { + // An array of Addresses. + Addresses []Items1 `json:"addresses,omitempty"` + // Name of the main contact for the identified customer. + ContactName *string `json:"contactName,omitempty"` + // An array of Contacts. + Contacts []Contact `json:"contacts,omitempty"` + // Name of the customer as recorded in the accounting system, typically the company name. + CustomerName *string `json:"customerName,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. + 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 software. + ID *string `json:"id,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Phone number the customer can be contacted by. + Phone *string `json:"phone,omitempty"` + // Company number. In the UK, this is typically the Companies House company registration number. + RegistrationNumber *string `json:"registrationNumber,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Status of customer. + 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 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"` +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetAddresses() []Items1 { + if o == nil { + return nil + } + return o.Addresses +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetContactName() *string { + if o == nil { + return nil + } + return o.ContactName +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetContacts() []Contact { + if o == nil { + return nil + } + return o.Contacts +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetCustomerName() *string { + if o == nil { + return nil + } + return o.CustomerName +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetDefaultCurrency() *string { + if o == nil { + return nil + } + return o.DefaultCurrency +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetEmailAddress() *string { + if o == nil { + return nil + } + return o.EmailAddress +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetPhone() *string { + if o == nil { + return nil + } + return o.Phone +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetRegistrationNumber() *string { + if o == nil { + return nil + } + return o.RegistrationNumber +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetStatus() CustomerStatus { + if o == nil { + return CustomerStatus("") + } + return o.Status +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateCustomerResponseAccountingCustomer) GetTaxNumber() *string { + if o == nil { + return nil + } + return o.TaxNumber +} + type AccountingCreateCustomerResponse struct { // Contains a single entry that communicates which record has changed and the manner in which it changed. Changes []PushOperationChange `json:"changes,omitempty"` @@ -26,19 +178,11 @@ type AccountingCreateCustomerResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > View the coverage for customers in the Data coverage explorer. - // - // ## Overview - // - // A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). - // - // Customers' data links to accounts receivable [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice). - // - Data *AccountingCustomer `json:"data,omitempty"` + CompletedOnUtc *string `json:"completedOnUtc,omitempty"` + Data *AccountingCreateCustomerResponseAccountingCustomer `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -99,7 +243,7 @@ func (o *AccountingCreateCustomerResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateCustomerResponse) GetData() *AccountingCustomer { +func (o *AccountingCreateCustomerResponse) GetData() *AccountingCreateCustomerResponseAccountingCustomer { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatedirectincomeresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatedirectincomeresponse.go index a80d8907e..bacccf376 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatedirectincomeresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatedirectincomeresponse.go @@ -1,12 +1,74 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -type AccountingCreateDirectIncomeResponse 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"` +import ( + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// AccountingCreateDirectIncomeResponseAccountingDirectIncome - > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. +// +// > View the coverage for direct incomes in the Data coverage explorer. +// +// ## Overview +// +// Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes. +// +// Direct incomes include: +// +// - Selling an item directly to a contact, and receiving payment at the point of the sale. +// - Refunding an item in cash to a contact. +// - Depositing money into a bank account. +// +// Direct incomes is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateDirectIncomeResponseAccountingDirectIncome struct { + ContactRef *ContactRef `json:"contactRef,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"` + // 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"` + // Identifier of the direct income, unique for the company. + 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: // // ``` @@ -26,27 +88,181 @@ type AccountingCreateDirectIncomeResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting platforms. + IssueDate string `json:"issueDate"` + // An array of line items. + LineItems []DirectIncomeLineItem `json:"lineItems"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. + Note *string `json:"note,omitempty"` + PaymentAllocations []PaymentAllocationItems `json:"paymentAllocations"` + // User-friendly reference for the direct income. + Reference *string `json:"reference,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // The total amount of the direct incomes, excluding any taxes. + SubTotal *decimal.Big `decimal:"number" json:"subTotal"` + // Supplemental data is additional data you can include in our standard data types. // - // > View the coverage for direct incomes in the Data coverage explorer. + // 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"` + // The total amount of tax on the direct incomes. + TaxAmount *decimal.Big `decimal:"number" json:"taxAmount"` + // The amount of the direct incomes, inclusive of tax. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount"` +} + +func (a AccountingCreateDirectIncomeResponseAccountingDirectIncome) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateDirectIncomeResponseAccountingDirectIncome) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetContactRef() *ContactRef { + if o == nil { + return nil + } + return o.ContactRef +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetCurrency() string { + if o == nil { + return "" + } + return o.Currency +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetIssueDate() string { + if o == nil { + return "" + } + return o.IssueDate +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetLineItems() []DirectIncomeLineItem { + if o == nil { + return []DirectIncomeLineItem{} + } + return o.LineItems +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetNote() *string { + if o == nil { + return nil + } + return o.Note +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetPaymentAllocations() []PaymentAllocationItems { + if o == nil { + return []PaymentAllocationItems{} + } + return o.PaymentAllocations +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetReference() *string { + if o == nil { + return nil + } + return o.Reference +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetSubTotal() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.SubTotal +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetTaxAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TaxAmount +} + +func (o *AccountingCreateDirectIncomeResponseAccountingDirectIncome) GetTotalAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalAmount +} + +type AccountingCreateDirectIncomeResponse 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: // - // ## Overview + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` // - // Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes. // - // Direct incomes include: // - // - Selling an item directly to a contact, and receiving payment at the point of the sale. - // - Refunding an item in cash to a contact. - // - Depositing money into a bank account. + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: // - // Direct incomes is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` // - Data *AccountingDirectIncome `json:"data,omitempty"` + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > 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 *AccountingCreateDirectIncomeResponseAccountingDirectIncome `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -107,7 +323,7 @@ func (o *AccountingCreateDirectIncomeResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateDirectIncomeResponse) GetData() *AccountingDirectIncome { +func (o *AccountingCreateDirectIncomeResponse) GetData() *AccountingCreateDirectIncomeResponseAccountingDirectIncome { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateinvoiceresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateinvoiceresponse.go index 8dfad8b23..85d2b1835 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateinvoiceresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreateinvoiceresponse.go @@ -1,12 +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 AccountingCreateInvoiceResponse 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"` +import ( + "encoding/json" + "fmt" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/ericlagergren/decimal" +) + +type AccountingCreateInvoiceResponseAllocation struct { // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // // ``` @@ -26,40 +29,589 @@ type AccountingCreateInvoiceResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > **Invoices or bills?** - // > - // > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. + AllocatedOnDate *string `json:"allocatedOnDate,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"` + // 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"` + // The total amount that has been allocated. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` +} + +func (a AccountingCreateInvoiceResponseAllocation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateInvoiceResponseAllocation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateInvoiceResponseAllocation) GetAllocatedOnDate() *string { + if o == nil { + return nil + } + return o.AllocatedOnDate +} + +func (o *AccountingCreateInvoiceResponseAllocation) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingCreateInvoiceResponseAllocation) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AccountingCreateInvoiceResponseAllocation) GetTotalAmount() *decimal.Big { + if o == nil { + return nil + } + return o.TotalAmount +} + +type AccountingCreateInvoiceResponseAccountingPaymentAllocation struct { + Allocation AccountingCreateInvoiceResponseAllocation `json:"allocation"` + Payment PaymentAllocationPayment `json:"payment"` +} + +func (o *AccountingCreateInvoiceResponseAccountingPaymentAllocation) GetAllocation() AccountingCreateInvoiceResponseAllocation { + if o == nil { + return AccountingCreateInvoiceResponseAllocation{} + } + return o.Allocation +} + +func (o *AccountingCreateInvoiceResponseAccountingPaymentAllocation) GetPayment() PaymentAllocationPayment { + if o == nil { + return PaymentAllocationPayment{} + } + return o.Payment +} + +// AccountingCreateInvoiceResponseDataType - The underlying data type associated to the reference `id`. +type AccountingCreateInvoiceResponseDataType string + +const ( + AccountingCreateInvoiceResponseDataTypeSalesOrders AccountingCreateInvoiceResponseDataType = "salesOrders" +) + +func (e AccountingCreateInvoiceResponseDataType) ToPointer() *AccountingCreateInvoiceResponseDataType { + return &e +} +func (e *AccountingCreateInvoiceResponseDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "salesOrders": + *e = AccountingCreateInvoiceResponseDataType(v) + return nil + default: + return fmt.Errorf("invalid value for AccountingCreateInvoiceResponseDataType: %v", v) + } +} + +type AccountingCreateInvoiceResponseSalesOrderReference struct { + // The underlying data type associated to the reference `id`. + DataType *AccountingCreateInvoiceResponseDataType `json:"dataType,omitempty"` + // Unique identifier to a record in `dataType`. + ID *string `json:"id,omitempty"` +} + +func (o *AccountingCreateInvoiceResponseSalesOrderReference) GetDataType() *AccountingCreateInvoiceResponseDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *AccountingCreateInvoiceResponseSalesOrderReference) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type AccountingCreateInvoiceResponseWithholdingTax struct { + // Amount of tax withheld. + Amount *decimal.Big `decimal:"number" json:"amount"` + // Name assigned to withheld tax. + Name string `json:"name"` +} + +func (a AccountingCreateInvoiceResponseWithholdingTax) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateInvoiceResponseWithholdingTax) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateInvoiceResponseWithholdingTax) GetAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.Amount +} + +func (o *AccountingCreateInvoiceResponseWithholdingTax) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +// AccountingCreateInvoiceResponseAccountingInvoice - > **Invoices or bills?** +// > +// > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. +// > +// > See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills. +// +// View the coverage for invoices in the Data coverage explorer. +// +// ## Overview +// +// An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer). +// +// In Codat, an invoice contains details of: +// +// - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. +// - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. +// - Who the invoice has been raised to; the _customer_. +// - The breakdown of what the invoice is for; the _line items_. +// - Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. +// +// > **Invoice PDF downloads** +// > +// > You can download a PDF version of an invoice for supported integrations. +// > +// > The filename will be invoice-{number}.pdf. +// +// > **Referencing an invoice in Sage 50 and ClearBooks** +// > +// > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateInvoiceResponseAccountingInvoice struct { + // Additional tax amount applied to invoice. + AdditionalTaxAmount *decimal.Big `decimal:"number" json:"additionalTaxAmount,omitempty"` + // Percentage rate of any additional tax applied to the invoice. + AdditionalTaxPercentage *decimal.Big `decimal:"number" json:"additionalTaxPercentage,omitempty"` + // Amount outstanding on the invoice. + AmountDue *decimal.Big `decimal:"number" json:"amountDue"` + // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + // + // ## Unknown currencies + // + // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a 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"` + // 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"` + CustomerRef *AccountingCustomerRef `json:"customerRef,omitempty"` + // Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. + DiscountPercentage *decimal.Big `decimal:"number" json:"discountPercentage,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 // > - // > See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills. + // > Not all dates from Codat will contain information about time zones. + // > 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,omitempty"` + // Identifier for the invoice, unique to the company in the accounting software. + ID *string `json:"id,omitempty"` + // Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. + InvoiceNumber *string `json:"invoiceNumber,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: // - // View the coverage for invoices in the Data coverage explorer. + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` // - // ## Overview // - // An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer). // - // In Codat, an invoice contains details of: + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: // - // - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - // - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - // - Who the invoice has been raised to; the _customer_. - // - The breakdown of what the invoice is for; the _line items_. - // - Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` // - // > **Invoice PDF downloads** + // > Time zones // > - // > You can download a PDF version of an invoice for supported integrations. + // > Not all dates from Codat will contain information about time zones. + // > 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"` + // An array of line items. + LineItems []InvoiceLineItem `json:"lineItems,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. + Note *string `json:"note,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 // > - // > The filename will be invoice-{number}.pdf. + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + PaidOnDate *string `json:"paidOnDate,omitempty"` + // An array of payment allocations. + PaymentAllocations []AccountingCreateInvoiceResponseAccountingPaymentAllocation `json:"paymentAllocations,omitempty"` + // List of references to related Sales orders. + SalesOrderRefs []AccountingCreateInvoiceResponseSalesOrderReference `json:"salesOrderRefs,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Current state of the invoice: + // + // - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. + // - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it (amountDue == totalAmount). + // - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount (0 < amountDue < totalAmount). + // - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid (amountDue == 0). + // - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. + Status InvoiceStatus `json:"status"` + // Total amount of the invoice excluding any taxes. + SubTotal *decimal.Big `decimal:"number" json:"subTotal,omitempty"` + // Supplemental data is additional data you can include in our standard data types. // - // > **Referencing an invoice in Sage 50 and ClearBooks** + // 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"` + // Amount of the invoice, inclusive of tax. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount"` + // Numerical value of discounts applied to the invoice. + TotalDiscount *decimal.Big `decimal:"number" json:"totalDiscount,omitempty"` + // Amount of tax on the invoice. + TotalTaxAmount *decimal.Big `decimal:"number" json:"totalTaxAmount"` + WithholdingTax []AccountingCreateInvoiceResponseWithholdingTax `json:"withholdingTax,omitempty"` +} + +func (a AccountingCreateInvoiceResponseAccountingInvoice) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreateInvoiceResponseAccountingInvoice) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetAdditionalTaxAmount() *decimal.Big { + if o == nil { + return nil + } + return o.AdditionalTaxAmount +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetAdditionalTaxPercentage() *decimal.Big { + if o == nil { + return nil + } + return o.AdditionalTaxPercentage +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetAmountDue() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.AmountDue +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetCustomerRef() *AccountingCustomerRef { + if o == nil { + return nil + } + return o.CustomerRef +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetDiscountPercentage() *decimal.Big { + if o == nil { + return nil + } + return o.DiscountPercentage +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetDueDate() *string { + if o == nil { + return nil + } + return o.DueDate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetInvoiceNumber() *string { + if o == nil { + return nil + } + return o.InvoiceNumber +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetIssueDate() string { + if o == nil { + return "" + } + return o.IssueDate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetLineItems() []InvoiceLineItem { + if o == nil { + return nil + } + return o.LineItems +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetNote() *string { + if o == nil { + return nil + } + return o.Note +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetPaidOnDate() *string { + if o == nil { + return nil + } + return o.PaidOnDate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetPaymentAllocations() []AccountingCreateInvoiceResponseAccountingPaymentAllocation { + if o == nil { + return nil + } + return o.PaymentAllocations +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetSalesOrderRefs() []AccountingCreateInvoiceResponseSalesOrderReference { + if o == nil { + return nil + } + return o.SalesOrderRefs +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetStatus() InvoiceStatus { + if o == nil { + return InvoiceStatus("") + } + return o.Status +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetSubTotal() *decimal.Big { + if o == nil { + return nil + } + return o.SubTotal +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetTotalAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalAmount +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetTotalDiscount() *decimal.Big { + if o == nil { + return nil + } + return o.TotalDiscount +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetTotalTaxAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.TotalTaxAmount +} + +func (o *AccountingCreateInvoiceResponseAccountingInvoice) GetWithholdingTax() []AccountingCreateInvoiceResponseWithholdingTax { + if o == nil { + return nil + } + return o.WithholdingTax +} + +type AccountingCreateInvoiceResponse 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 // > - // > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. - Data *AccountingInvoice `json:"data,omitempty"` + // > Not all dates from Codat will contain information about time zones. + // > 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 *AccountingCreateInvoiceResponseAccountingInvoice `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -120,7 +672,7 @@ func (o *AccountingCreateInvoiceResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateInvoiceResponse) GetData() *AccountingInvoice { +func (o *AccountingCreateInvoiceResponse) GetData() *AccountingCreateInvoiceResponseAccountingInvoice { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatejournalentryresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatejournalentryresponse.go index f4578ce04..a62df99ea 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatejournalentryresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatejournalentryresponse.go @@ -1,12 +1,54 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -type AccountingCreateJournalEntryResponse 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"` +// AccountingCreateJournalEntryResponseJournalReference - Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). +type AccountingCreateJournalEntryResponseJournalReference struct { + // GUID of the underlying journal. + ID string `json:"id"` + // Name of journal + Name *string `json:"name,omitempty"` +} + +func (o *AccountingCreateJournalEntryResponseJournalReference) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AccountingCreateJournalEntryResponseJournalReference) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +// AccountingCreateJournalEntryResponseAccountingJournalEntry - > **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/accounting-api#/schemas/Journal) data type +// +// > View the coverage for journal entries in the Data coverage explorer. +// +// ## Overview +// +// A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/accounting-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. +// +// A journal entry line item is a single transaction line on the journal entry. For example: +// +// - When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. +// - When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. +// +// In Codat a journal entry contains details of: +// +// - The date on which the entry was created and posted. +// - Itemised lines, including amounts and currency. +// - A reference to the associated accounts. +// - A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. +// +// > **Pushing journal entries** +// > Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreateJournalEntryResponseAccountingJournalEntry struct { // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // // ``` @@ -26,33 +68,179 @@ type AccountingCreateJournalEntryResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/accounting-api#/schemas/Journal) data type + CreatedOn *string `json:"createdOn,omitempty"` + // Optional description of the journal entry. + Description *string `json:"description,omitempty"` + // Unique identifier of the journal entry for the company in the accounting software. + ID *string `json:"id,omitempty"` + // An array of journal lines. + JournalLines []JournalLine `json:"journalLines,omitempty"` + // Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). + JournalRef *AccountingCreateJournalEntryResponseJournalReference `json:"journalRef,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,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: // - // > View the coverage for journal entries in the Data coverage explorer. + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: // - // ## Overview + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + PostedOn *string `json:"postedOn,omitempty"` + // Links a journal entry to the underlying record that created it. + RecordRef *JournalEntryRecordRef `json:"recordRef,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,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"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + UpdatedOn *string `json:"updatedOn,omitempty"` +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetCreatedOn() *string { + if o == nil { + return nil + } + return o.CreatedOn +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetJournalLines() []JournalLine { + if o == nil { + return nil + } + return o.JournalLines +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetJournalRef() *AccountingCreateJournalEntryResponseJournalReference { + if o == nil { + return nil + } + return o.JournalRef +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetPostedOn() *string { + if o == nil { + return nil + } + return o.PostedOn +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetRecordRef() *JournalEntryRecordRef { + if o == nil { + return nil + } + return o.RecordRef +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreateJournalEntryResponseAccountingJournalEntry) GetUpdatedOn() *string { + if o == nil { + return nil + } + return o.UpdatedOn +} + +type AccountingCreateJournalEntryResponse 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: // - // A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/accounting-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` // - // A journal entry line item is a single transaction line on the journal entry. For example: // - // - When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. - // - When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. // - // In Codat a journal entry contains details of: + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: // - // - The date on which the entry was created and posted. - // - Itemised lines, including amounts and currency. - // - A reference to the associated accounts. - // - A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` // - // > **Pushing journal entries** - // > Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. - Data *AccountingJournalEntry `json:"data,omitempty"` + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > 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 *AccountingCreateJournalEntryResponseAccountingJournalEntry `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -113,7 +301,7 @@ func (o *AccountingCreateJournalEntryResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreateJournalEntryResponse) GetData() *AccountingJournalEntry { +func (o *AccountingCreateJournalEntryResponse) GetData() *AccountingCreateJournalEntryResponseAccountingJournalEntry { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatepaymentresponse.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatepaymentresponse.go index a97ed2b21..02bef84db 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatepaymentresponse.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreatepaymentresponse.go @@ -1,12 +1,731 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -type AccountingCreatePaymentResponse 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"` +import ( + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// AccountingCreatePaymentResponseAccountingPayment - > **Payments or bill payments?** +// > +// > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/accounting-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/accounting-api#/schemas/Bill) and credit notes against bills. +// +// > View the coverage for payments in the Data coverage explorer. +// +// ## Overview +// +// Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote). +// +// A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: +// +// - A payment made against an invoice, like a credit card, cheque, or cash payment. +// - An allocation of a customer's credit note, either to an invoice or maybe a refund. +// - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. +// +// Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. +// +// In Codat, a payment contains details of: +// +// - When the payment was recorded in the accounting system. +// - How much it is for and in what currency that amount is in. +// - Who the payment was _paid by_ – the _customer_. +// - The payment method used. +// - The breakdown of the types of payments – the _line items_. +// +// Payments is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). +// +// ## Payment types +// +// ## Payment of an invoice +// +// A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: +// +// - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. +// - A **links** array containing one element with the following properties: +// - A **type** that indicates the type of **link**, in this case an `Invoice`. +// - An **id** that contains the ID of the invoice that was paid. +// - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. +// +// The **amount** field on the **line** equals the **totalAmount** on the payment. +// +// ## Payment of multiple invoices +// +// A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: +// +// - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). +// - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. +// +// Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. +// +// ## Payments and refunds on account +// +// A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: +// +// - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. +// - A **links** array containing one element with the following properties: +// - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. +// - The **id** containing the ID of the customer. +// - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. +// +// It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. +// +// ## Using a credit note to pay an invoice +// +// The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: +// +// - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. +// - A **links** array containing two elements: +// - The first **link** has: +// - A **type** that indicates the type of **link**, in this case an `Invoice`. +// - An **id** that contains the ID of the invoice that was paid. +// - The second **link** has: +// - A **type** that indicates the type of **link**, in this case a `CreditNote`. +// - An **id** that contains the ID of the credit note used by this payment. +// +// The **amount** field on the **line** equals the **totalAmount** on the payment. +// +// ## Refunding a credit note +// +// A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: +// +// - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. +// - A **links** array that contains one element with the following properties: +// - A **type** that indicates the type of **link**, in this case a `CreditNote`. +// - An **id** that contains the ID of the credit note that was refunded. +// +// The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. +// +// ## Refunding a payment +// +// If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: +// +// - One for the incoming over payment. +// - Another for the outgoing refund. +// +// The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: +// +// - An **amount** that indicates the amount that was refunded. This is always negative. +// - A **links** array that contains one element with the following properties: +// - A **type** that indicates the type of **link**, in this case a `Payment`. +// - An **id** that contains the ID of the payment that was refunded. +// +// The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. +// +// The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. +// +// For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: +// +// - One for £1,000 linked to the invoice that was paid. +// - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. +// +// The **line** linked to the payment has the following properties: +// +// - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. +// - A **links** array containing one element with the following properties: +// - A **type** that indicates the type of **link**, in this case a `Refund`. +// - An **id** that contains the ID of the payment that refunded this line. +// +// > **Support for linked payments** +// > +// > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. +// +// ## Foreign currencies +// +// There are two types of currency rate that are included in the payments data type: +// +// Payment currency rate: +// +// - Base currency of the accounts receivable account. +// - Foreign currency of the payment. +// +// Payment line link currency rate: +// +// - Base currency of the item the link represents. +// - Foreign currency of the payment. +// +// These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: +// +// - The base currency for the accounts receivable account. +// - The currency of the item. +// +// ```json title="Currency rate example" +// { +// "id": "123", +// "note": "", +// "totalAmount": 99.99, +// "currency": "GBP", +// "lines": [ +// { +// "amount": 99.99, +// "links": [ +// { +// "type": "Invoice", +// "id": "178", +// "amount": -50, +// "currencyRate": 1.9998 +// } +// ] +// } +// ] +// } +// ``` +// +// ## Example data +// +// > **Object properties** +// > +// > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). +// +// ## Simple examples +// +// ```json title="Payment for invoice" +// { +// "totalAmount": 1000, +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Allocation of credit note" +// { +// "totalAmount": 0, +// "lines": [ +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Payment of invoice and payment on account" +// { +// "totalAmount": 2000, +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "PaymentOnAccount", +// "id" : "y", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Refund of credit note" +// { +// "totalAmount": -1000, +// "lines": [ +// { +// "amount" : -1000, +// "links" : [ +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Refund on accounts receivable account" +// { +// "totalAmount": -1000, +// "lines": [ +// { +// "amount" : -1000, +// "links" : [ +// { +// "type" : "PaymentOnAccount", +// "id" : "y", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Linked refund on accounts receivable account" +// { +// "id" : "payment-001", +// "totalAmount": 1000, +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Refund", +// "id" : "refund-001", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// { +// "id" : "refund-001", +// "totalAmount": -1000, +// "lines": [ +// { +// "amount" : -1000, +// "links" : [ +// { +// "type" : "Payment", +// "id" : "payment-001", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Using a credit note and cash to pay an invoice" +// { +// "totalAmount": 250, +// "lines": [ +// { +// "amount": 0, +// "links": [ +// { +// "type": "Invoice", +// "id": "x", +// "amount": -750 +// }, +// { +// "type": "CreditNote", +// "id": "y", +// "amount": 750 +// } +// ] +// }, +// { +// "amount": 250, +// "links": [ +// { +// "type": "Invoice", +// "id": "x", +// "amount": -250 +// } +// ] +// } +// ] +// } +// ``` +// +// ## Complex examples +// +// ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" +// { +// "totalAmount": 1000, +// "lines": [ +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// } +// ] +// }, +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "z", +// "amount" : 1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" +// { +// "totalAmount": 2000, +// "lines": [ +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// } +// ] +// }, +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "z", +// "amount" : 1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "PaymentOnAccount", +// "id" : "customer-001", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Two credit notes pay two invoices with no allocation amount specified" +// { +// "totalAmount": 0, +// "lines": [ +// { +// "amount" : 0, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "w", +// "amount" : -1000 +// }, +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "z", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" +// { +// "totalAmount": 2000, +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "w", +// "amount" : -1000 +// }, +// { +// "type" : "Invoice", +// "id" : "x", +// "amount" : -1000 +// }, +// { +// "type" : "Invoice", +// "id" : "u", +// "amount" : -1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "y", +// "amount" : 1000 +// }, +// { +// "type" : "CreditNote", +// "id" : "z", +// "amount" : 1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Refund", +// "id" : "refund-001", +// "amount" : -1000 +// } +// ] +// } +// ] +// } +// { +// "id" : "refund-001", +// "totalAmount": -1000, +// "lines": [ +// { +// "amount" : -1000, +// "links" : [ +// { +// "type" : "Payment", +// "id" : "payment-001", +// "amount" : 1000 +// } +// ] +// } +// ] +// } +// ``` +// +// In this example, a payment on account is used to pay the same invoice in January and again in February. +// +// ```json title="January" +// { +// "id": "001", +// "totalAmount": 5000, +// "date" : "1901-01-01", +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "Invoice-x", +// "amount" : -1000 +// } +// ] +// }, +// { +// "amount" : 4000, +// "links" : [ +// { +// "type" : "PaymentOnAccount", +// "id" : "PaymentOnAccount-y", +// "amount" : -4000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="February" +// { +// "id": "001", +// "totalAmount": 5000, +// "date" : "1901-02-01", +// "lines": [ +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "Invoice-x", +// "amount" : -1000 +// } +// ] +// }, +// { +// "amount" : 1000, +// "links" : [ +// { +// "type" : "Invoice", +// "id" : "Invoice-y", +// "amount" : -1000 +// } +// ] +// }, +// { +// "amount" : 3000, +// "links" : [ +// { +// "type" : "PaymentOnAccount", +// "id" : "PaymentOnAccount-y", +// "amount" : -3000 +// } +// ] +// } +// ] +// } +// ``` +// +// +// +// ```json title="Two credit notes and some cash pay two invoices with no allocations specified" +// { +// "totalAmount": 500, +// "lines": [ +// { +// "amount": 500, +// "links": [{ +// "type": "Invoice", +// "id": "a", +// "amount": -1000 +// }, { +// "type": "Invoice", +// "id": "b", +// "amount": -1000 +// }, { +// "type": "CreditNote", +// "id": "y", +// "amount": 750 +// },{ +// "type": "CreditNote", +// "id": "z", +// "amount": 750 +// } +// ] +// } +// ] +// } +// ``` +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingCreatePaymentResponseAccountingPayment 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"` + // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + // + // ## Unknown currencies + // + // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a 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"` + // 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"` + CustomerRef *AccountingCustomerRef `json:"customerRef,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: // // ``` @@ -26,689 +745,173 @@ type AccountingCreatePaymentResponse 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. - CompletedOnUtc *string `json:"completedOnUtc,omitempty"` - // > **Payments or bill payments?** - // > - // > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/accounting-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/accounting-api#/schemas/Bill) and credit notes against bills. - // - // > View the coverage for payments in the Data coverage explorer. - // - // ## Overview - // - // Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote). - // - // A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - // - // - A payment made against an invoice, like a credit card, cheque, or cash payment. - // - An allocation of a customer's credit note, either to an invoice or maybe a refund. - // - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - // - // Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details. - // - // In Codat, a payment contains details of: - // - // - When the payment was recorded in the accounting system. - // - How much it is for and in what currency that amount is in. - // - Who the payment was _paid by_ – the _customer_. - // - The payment method used. - // - The breakdown of the types of payments – the _line items_. - // - // Payments is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). - // - // ## Payment types - // - // ## Payment of an invoice - // - // A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - // - // - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - // - A **links** array containing one element with the following properties: - // - A **type** that indicates the type of **link**, in this case an `Invoice`. - // - An **id** that contains the ID of the invoice that was paid. - // - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - // - // The **amount** field on the **line** equals the **totalAmount** on the payment. - // - // ## Payment of multiple invoices - // - // A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - // - // - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - // - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - // - // Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - // - // ## Payments and refunds on account - // - // A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - // - // - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - // - A **links** array containing one element with the following properties: - // - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - // - The **id** containing the ID of the customer. - // - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - // - // It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - // - // ## Using a credit note to pay an invoice - // - // The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - // - // - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - // - A **links** array containing two elements: - // - The first **link** has: - // - A **type** that indicates the type of **link**, in this case an `Invoice`. - // - An **id** that contains the ID of the invoice that was paid. - // - The second **link** has: - // - A **type** that indicates the type of **link**, in this case a `CreditNote`. - // - An **id** that contains the ID of the credit note used by this payment. - // - // The **amount** field on the **line** equals the **totalAmount** on the payment. - // - // ## Refunding a credit note - // - // A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - // - // - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - // - A **links** array that contains one element with the following properties: - // - A **type** that indicates the type of **link**, in this case a `CreditNote`. - // - An **id** that contains the ID of the credit note that was refunded. - // - // The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - // - // ## Refunding a payment - // - // If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - // - // - One for the incoming over payment. - // - Another for the outgoing refund. - // - // The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - // - // - An **amount** that indicates the amount that was refunded. This is always negative. - // - A **links** array that contains one element with the following properties: - // - A **type** that indicates the type of **link**, in this case a `Payment`. - // - An **id** that contains the ID of the payment that was refunded. - // - // The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - // - // The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - // - // For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - // - // - One for £1,000 linked to the invoice that was paid. - // - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - // - // The **line** linked to the payment has the following properties: - // - // - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - // - A **links** array containing one element with the following properties: - // - A **type** that indicates the type of **link**, in this case a `Refund`. - // - An **id** that contains the ID of the payment that refunded this line. - // - // > **Support for linked payments** - // > - // > Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - // - // ## Foreign currencies - // - // There are two types of currency rate that are included in the payments data type: - // - // Payment currency rate: - // - // - Base currency of the accounts receivable account. - // - Foreign currency of the payment. - // - // Payment line link currency rate: - // - // - Base currency of the item the link represents. - // - Foreign currency of the payment. - // - // These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: + Date string `json:"date"` + // Identifier for the payment, unique to the company in the accounting software. + ID *string `json:"id,omitempty"` + // An array of payment lines. + Lines []PaymentLine `json:"lines,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Any additional information associated with the payment. + Note *string `json:"note,omitempty"` + // The payment method the record is linked to in the accounting or commerce software. + PaymentMethodRef *PaymentMethodRef `json:"paymentMethodRef,omitempty"` + // Friendly reference for the payment. + Reference *string `json:"reference,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,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"` + // Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. + TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` +} + +func (a AccountingCreatePaymentResponseAccountingPayment) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingCreatePaymentResponseAccountingPayment) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetAccountRef() *AccountRef { + if o == nil { + return nil + } + return o.AccountRef +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetCustomerRef() *AccountingCustomerRef { + if o == nil { + return nil + } + return o.CustomerRef +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetDate() string { + if o == nil { + return "" + } + return o.Date +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetLines() []PaymentLine { + if o == nil { + return nil + } + return o.Lines +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetNote() *string { + if o == nil { + return nil + } + return o.Note +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetPaymentMethodRef() *PaymentMethodRef { + if o == nil { + return nil + } + return o.PaymentMethodRef +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetReference() *string { + if o == nil { + return nil + } + return o.Reference +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +func (o *AccountingCreatePaymentResponseAccountingPayment) GetTotalAmount() *decimal.Big { + if o == nil { + return nil + } + return o.TotalAmount +} + +type AccountingCreatePaymentResponse 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: // - // - The base currency for the accounts receivable account. - // - The currency of the item. + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` // - // ```json title="Currency rate example" - // { - // "id": "123", - // "note": "", - // "totalAmount": 99.99, - // "currency": "GBP", - // "lines": [ - // { - // "amount": 99.99, - // "links": [ - // { - // "type": "Invoice", - // "id": "178", - // "amount": -50, - // "currencyRate": 1.9998 - // } - // ] - // } - // ] - // } - // ``` // // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: // - // ## Example data + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` // - // > **Object properties** + // > Time zones // > - // > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - // - // ## Simple examples - // - // ```json title="Payment for invoice" - // { - // "totalAmount": 1000, - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Allocation of credit note" - // { - // "totalAmount": 0, - // "lines": [ - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Payment of invoice and payment on account" - // { - // "totalAmount": 2000, - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "PaymentOnAccount", - // "id" : "y", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Refund of credit note" - // { - // "totalAmount": -1000, - // "lines": [ - // { - // "amount" : -1000, - // "links" : [ - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Refund on accounts receivable account" - // { - // "totalAmount": -1000, - // "lines": [ - // { - // "amount" : -1000, - // "links" : [ - // { - // "type" : "PaymentOnAccount", - // "id" : "y", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Linked refund on accounts receivable account" - // { - // "id" : "payment-001", - // "totalAmount": 1000, - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Refund", - // "id" : "refund-001", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // { - // "id" : "refund-001", - // "totalAmount": -1000, - // "lines": [ - // { - // "amount" : -1000, - // "links" : [ - // { - // "type" : "Payment", - // "id" : "payment-001", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Using a credit note and cash to pay an invoice" - // { - // "totalAmount": 250, - // "lines": [ - // { - // "amount": 0, - // "links": [ - // { - // "type": "Invoice", - // "id": "x", - // "amount": -750 - // }, - // { - // "type": "CreditNote", - // "id": "y", - // "amount": 750 - // } - // ] - // }, - // { - // "amount": 250, - // "links": [ - // { - // "type": "Invoice", - // "id": "x", - // "amount": -250 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ## Complex examples - // - // ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" - // { - // "totalAmount": 1000, - // "lines": [ - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // } - // ] - // }, - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "z", - // "amount" : 1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" - // { - // "totalAmount": 2000, - // "lines": [ - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // } - // ] - // }, - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "z", - // "amount" : 1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "PaymentOnAccount", - // "id" : "customer-001", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Two credit notes pay two invoices with no allocation amount specified" - // { - // "totalAmount": 0, - // "lines": [ - // { - // "amount" : 0, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "w", - // "amount" : -1000 - // }, - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "z", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" - // { - // "totalAmount": 2000, - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "w", - // "amount" : -1000 - // }, - // { - // "type" : "Invoice", - // "id" : "x", - // "amount" : -1000 - // }, - // { - // "type" : "Invoice", - // "id" : "u", - // "amount" : -1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "y", - // "amount" : 1000 - // }, - // { - // "type" : "CreditNote", - // "id" : "z", - // "amount" : 1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Refund", - // "id" : "refund-001", - // "amount" : -1000 - // } - // ] - // } - // ] - // } - // { - // "id" : "refund-001", - // "totalAmount": -1000, - // "lines": [ - // { - // "amount" : -1000, - // "links" : [ - // { - // "type" : "Payment", - // "id" : "payment-001", - // "amount" : 1000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // In this example, a payment on account is used to pay the same invoice in January and again in February. - // - // ```json title="January" - // { - // "id": "001", - // "totalAmount": 5000, - // "date" : "1901-01-01", - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "Invoice-x", - // "amount" : -1000 - // } - // ] - // }, - // { - // "amount" : 4000, - // "links" : [ - // { - // "type" : "PaymentOnAccount", - // "id" : "PaymentOnAccount-y", - // "amount" : -4000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="February" - // { - // "id": "001", - // "totalAmount": 5000, - // "date" : "1901-02-01", - // "lines": [ - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "Invoice-x", - // "amount" : -1000 - // } - // ] - // }, - // { - // "amount" : 1000, - // "links" : [ - // { - // "type" : "Invoice", - // "id" : "Invoice-y", - // "amount" : -1000 - // } - // ] - // }, - // { - // "amount" : 3000, - // "links" : [ - // { - // "type" : "PaymentOnAccount", - // "id" : "PaymentOnAccount-y", - // "amount" : -3000 - // } - // ] - // } - // ] - // } - // ``` - // - // - // - // ```json title="Two credit notes and some cash pay two invoices with no allocations specified" - // { - // "totalAmount": 500, - // "lines": [ - // { - // "amount": 500, - // "links": [{ - // "type": "Invoice", - // "id": "a", - // "amount": -1000 - // }, { - // "type": "Invoice", - // "id": "b", - // "amount": -1000 - // }, { - // "type": "CreditNote", - // "id": "y", - // "amount": 750 - // },{ - // "type": "CreditNote", - // "id": "z", - // "amount": 750 - // } - // ] - // } - // ] - // } - // ``` - Data *AccountingPayment `json:"data,omitempty"` + // > Not all dates from Codat will contain information about time zones. + // > 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 *AccountingCreatePaymentResponseAccountingPayment `json:"data,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` @@ -769,7 +972,7 @@ func (o *AccountingCreatePaymentResponse) GetCompletedOnUtc() *string { return o.CompletedOnUtc } -func (o *AccountingCreatePaymentResponse) GetData() *AccountingPayment { +func (o *AccountingCreatePaymentResponse) GetData() *AccountingCreatePaymentResponseAccountingPayment { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreditnote.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreditnote.go index 0e338c2fb..1871bac95 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreditnote.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcreditnote.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 @@ -60,9 +60,9 @@ type AccountingCreditNote 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 // @@ -85,12 +85,12 @@ type AccountingCreditNote 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"` CustomerRef *AccountingCustomerRef `json:"customerRef,omitempty"` // Percentage rate (from 0 to 100) of discounts applied to the credit note. DiscountPercentage *decimal.Big `decimal:"number" json:"discountPercentage"` - // Identifier for the credit note, unique to the company in the accounting platform. + // Identifier for the credit note, unique to the company in the accounting software. 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: // @@ -115,7 +115,7 @@ type AccountingCreditNote struct { LineItems []CreditNoteLineItem `json:"lineItems,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` - // Any additional information about the credit note. Where possible, Codat links to a data field in the accounting platform that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting platform to the customer. + // Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. Note *string `json:"note,omitempty"` // An array of payment allocations. PaymentAllocations []PaymentAllocationItems `json:"paymentAllocations,omitempty"` @@ -128,7 +128,7 @@ type AccountingCreditNote struct { SubTotal *decimal.Big `decimal:"number" json:"subTotal"` // 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"` // Total amount of credit that has been applied to the customer's accounts receivable TotalAmount *decimal.Big `decimal:"number" json:"totalAmount"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomer.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomer.go index 63043400e..dfb229eb3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomer.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomer.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 @@ -28,7 +28,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"` @@ -41,7 +41,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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomerref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomerref.go index cc74cca3c..4629e853d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomerref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingcustomerref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingdirectincome.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingdirectincome.go index 8e260acfa..45ebea5ac 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingdirectincome.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingdirectincome.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,29 +7,7 @@ import ( "github.com/ericlagergren/decimal" ) -// ContactRef - A customer or supplier associated with the direct income. -type ContactRef struct { - // Available Data types - DataType *DataType `json:"dataType,omitempty"` - // Unique identifier for a customer or supplier. - ID string `json:"id"` -} - -func (o *ContactRef) GetDataType() *DataType { - if o == nil { - return nil - } - return o.DataType -} - -func (o *ContactRef) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// AccountingDirectIncome - > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting platforms. +// AccountingDirectIncome - > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. // // > View the coverage for direct incomes in the Data coverage explorer. // @@ -45,7 +23,6 @@ func (o *ContactRef) GetID() string { // // Direct incomes is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction). type AccountingDirectIncome struct { - // A customer or supplier associated with the direct income. ContactRef *ContactRef `json:"contactRef,omitempty"` // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. // @@ -61,9 +38,9 @@ type AccountingDirectIncome 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 // @@ -86,7 +63,7 @@ type AccountingDirectIncome 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"` // Identifier of the direct income, unique for the company. ID *string `json:"id,omitempty"` @@ -124,7 +101,7 @@ type AccountingDirectIncome struct { SubTotal *decimal.Big `decimal:"number" json:"subTotal"` // 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"` // The total amount of tax on the direct incomes. TaxAmount *decimal.Big `decimal:"number" json:"taxAmount"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountinginvoice.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountinginvoice.go index d46983b4f..93b8c9bad 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountinginvoice.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountinginvoice.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/previous-versions/sync-for-commerce-version-1/pkg/utils" "github.com/ericlagergren/decimal" ) @@ -42,9 +44,9 @@ type AccountingInvoiceAllocation 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 // @@ -67,7 +69,7 @@ type AccountingInvoiceAllocation 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"` // The total amount that has been allocated. TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` @@ -131,14 +133,38 @@ func (o *AccountingPaymentAllocation) GetPayment() PaymentAllocationPayment { return o.Payment } +// AccountingInvoiceDataType - The underlying data type associated to the reference `id`. +type AccountingInvoiceDataType string + +const ( + AccountingInvoiceDataTypeSalesOrders AccountingInvoiceDataType = "salesOrders" +) + +func (e AccountingInvoiceDataType) ToPointer() *AccountingInvoiceDataType { + return &e +} +func (e *AccountingInvoiceDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "salesOrders": + *e = AccountingInvoiceDataType(v) + return nil + default: + return fmt.Errorf("invalid value for AccountingInvoiceDataType: %v", v) + } +} + type SalesOrderReference struct { - // Available Data types - DataType *DataType `json:"dataType,omitempty"` + // The underlying data type associated to the reference `id`. + DataType *AccountingInvoiceDataType `json:"dataType,omitempty"` // Unique identifier to a record in `dataType`. ID *string `json:"id,omitempty"` } -func (o *SalesOrderReference) GetDataType() *DataType { +func (o *SalesOrderReference) GetDataType() *AccountingInvoiceDataType { if o == nil { return nil } @@ -234,9 +260,9 @@ type AccountingInvoice 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 // @@ -259,7 +285,7 @@ type AccountingInvoice 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"` CustomerRef *AccountingCustomerRef `json:"customerRef,omitempty"` // Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. @@ -284,7 +310,7 @@ type AccountingInvoice 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. DueDate *string `json:"dueDate,omitempty"` - // Identifier for the invoice, unique to the company in the accounting platform. + // Identifier for the invoice, unique to the company in the accounting software. ID *string `json:"id,omitempty"` // Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. InvoiceNumber *string `json:"invoiceNumber,omitempty"` @@ -312,7 +338,7 @@ type AccountingInvoice struct { LineItems []InvoiceLineItem `json:"lineItems,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` - // Any additional information about the invoice. Where possible, Codat links to a data field in the accounting platform that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting platform to the customer. + // Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. Note *string `json:"note,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: // @@ -351,7 +377,7 @@ type AccountingInvoice struct { SubTotal *decimal.Big `decimal:"number" json:"subTotal,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"` // Amount of the invoice, inclusive of tax. TotalAmount *decimal.Big `decimal:"number" json:"totalAmount"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingjournalentry.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingjournalentry.go index faeaf170e..e05241ba5 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingjournalentry.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingjournalentry.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,30 +24,6 @@ func (o *JournalReference) GetName() *string { return o.Name } -// RecordReference - Links the current record to the underlying record or data type that created it. -// -// For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. -type RecordReference struct { - // Allowed name of the 'dataType'. - DataType *string `json:"dataType,omitempty"` - // 'id' of the underlying record or data type. - ID *string `json:"id,omitempty"` -} - -func (o *RecordReference) GetDataType() *string { - if o == nil { - return nil - } - return o.DataType -} - -func (o *RecordReference) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - // AccountingJournalEntry - > **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/accounting-api#/schemas/Journal) data type // // > View the coverage for journal entries in the Data coverage explorer. @@ -93,7 +69,7 @@ type AccountingJournalEntry struct { CreatedOn *string `json:"createdOn,omitempty"` // Optional description of the journal entry. Description *string `json:"description,omitempty"` - // Unique identifier of the journal entry for the company in the accounting platform. + // Unique identifier of the journal entry for the company in the accounting software. ID *string `json:"id,omitempty"` // An array of journal lines. JournalLines []JournalLine `json:"journalLines,omitempty"` @@ -121,14 +97,12 @@ type AccountingJournalEntry 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. PostedOn *string `json:"postedOn,omitempty"` - // Links the current record to the underlying record or data type that created it. - // - // For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - RecordRef *RecordReference `json:"recordRef,omitempty"` - SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Links a journal entry to the underlying record that created it. + RecordRef *JournalEntryRecordRef `json:"recordRef,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,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"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -208,7 +182,7 @@ func (o *AccountingJournalEntry) GetPostedOn() *string { return o.PostedOn } -func (o *AccountingJournalEntry) GetRecordRef() *RecordReference { +func (o *AccountingJournalEntry) GetRecordRef() *JournalEntryRecordRef { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingpayment.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingpayment.go index b5e6b6032..8a6790040 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingpayment.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountingpayment.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,7 @@ import ( // - An allocation of a customer's credit note, either to an invoice or maybe a refund. // - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. // -// Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details. +// Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. // // In Codat, a payment contains details of: // @@ -128,7 +128,7 @@ import ( // // > **Support for linked payments** // > -// > Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. +// > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. // // ## Foreign currencies // @@ -696,9 +696,9 @@ type AccountingPayment 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 // @@ -721,7 +721,7 @@ type AccountingPayment 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"` CustomerRef *AccountingCustomerRef `json:"customerRef,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: @@ -744,7 +744,7 @@ type AccountingPayment 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. Date string `json:"date"` - // Identifier for the payment, unique to the company in the accounting platform. + // Identifier for the payment, unique to the company in the accounting software. ID *string `json:"id,omitempty"` // An array of payment lines. Lines []PaymentLine `json:"lines,omitempty"` @@ -752,14 +752,14 @@ type AccountingPayment struct { ModifiedDate *string `json:"modifiedDate,omitempty"` // Any additional information associated with the payment. Note *string `json:"note,omitempty"` - // The payment method the record is linked to in the accounting or commerce platform. + // The payment method the record is linked to in the accounting or commerce software. PaymentMethodRef *PaymentMethodRef `json:"paymentMethodRef,omitempty"` // Friendly reference for the payment. Reference *string `json:"reference,omitempty"` SourceModifiedDate *string `json:"sourceModifiedDate,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"` // Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountoption.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountoption.go index cba9d8772..93dcf27de 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountoption.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountoption.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountprototype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountprototype.go index 3405a5e1a..724ea4f0c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountprototype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountref.go index a62aae1ef..49e13a2b9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountstatus.go index 17493901b..c86b01e74 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accountstatus.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accounttype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accounttype.go index 771c270b3..95bc921a7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/accounttype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/bankaccountstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/bankaccountstatus.go new file mode 100644 index 000000000..893fd2099 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/billedtotype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/billedtotype.go index f0e3fa18d..61826dad3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/billedtotype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/billedtotype.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 BilledToType) ToPointer() *BilledToType { return &e } - func (e *BilledToType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/branding.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/branding.go index 0590bac3d..670830d49 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/branding.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/branding.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingbutton.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingbutton.go index fc84e4b96..be78e3f7f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingbutton.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingbutton.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingimage.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingimage.go index 3db60dae4..5ed542c49 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingimage.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandingimage.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandinglogo.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandinglogo.go index 9aa8d6698..78b1535c0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandinglogo.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/brandinglogo.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceaddresstype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceaddresstype.go index f338f5ea7..7d4c0bf05 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceaddresstype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceaddresstype.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 CommerceAddressType) ToPointer() *CommerceAddressType { return &e } - func (e *CommerceAddressType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecompanyinfo.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecompanyinfo.go index 87ca5348e..f82b4e8c9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecompanyinfo.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecompanyinfo.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,7 @@ type CommerceCompanyInfo struct { // // There are only a very small number of edge cases where this currency code is returned by the Codat system. BaseCurrency *string `json:"baseCurrency,omitempty"` - // Identifier or reference for the company in the commerce platform + // Identifier or reference for the company in the commerce software CommercePlatformRef *string `json:"commercePlatformRef,omitempty"` // The full legal name of the company CompanyLegalName *string `json:"companyLegalName,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomer.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomer.go index 7cf76076f..ffc9356df 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomer.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomer.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomerref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomerref.go index 88f4eb694..0d6249192 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomerref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomerref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomers.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomers.go index 925f584b2..060cfb078 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomers.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercecustomers.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocation.go index 618eb9581..70fa43674 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocation.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocation.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocations.go index 3f86798b1..0b2b13ca6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocations.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercelocations.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorder.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorder.go index 01c17eda8..4bd46b7e3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorder.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorder.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 @@ -73,7 +73,7 @@ type CommerceOrder struct { SourceModifiedDate *string `json:"sourceModifiedDate,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"` // Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorders.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorders.go index e2c30c690..f5ba18c23 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorders.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceorders.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayment.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayment.go index 482025179..de579482d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayment.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayment.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 @@ -68,7 +68,7 @@ type CommercePayment struct { // A unique, persistent identifier for this record ID string `json:"id"` ModifiedDate *string `json:"modifiedDate,omitempty"` - // The payment method the record is linked to in the accounting or commerce platform. + // The payment method the record is linked to in the accounting or commerce software. PaymentMethodRef *PaymentMethodRef `json:"paymentMethodRef,omitempty"` // Service provider of the payment, if applicable. PaymentProvider *string `json:"paymentProvider,omitempty"` @@ -77,7 +77,7 @@ type CommercePayment struct { Status *PaymentStatus `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"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethod.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethod.go index edcd8d64e..e22d82701 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethod.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethod.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 Status) ToPointer() *Status { return &e } - func (e *Status) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethods.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethods.go index 66241e48d..7736a0382 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethods.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepaymentmethods.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayments.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayments.go index 46848f1b1..10ef816d7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayments.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercepayments.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproduct.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproduct.go index e37e71ae7..8ed10c38c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproduct.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproduct.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,7 @@ type CommerceProduct struct { Name *string `json:"name,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"` Variants []ProductVariant `json:"variants,omitempty"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproducts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproducts.go index be5c15333..87f2c7cfe 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproducts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commerceproducts.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransaction.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransaction.go index 5edbba0d7..f9bdbc258 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransaction.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransaction.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 @@ -70,11 +70,11 @@ type CommerceTransaction struct { // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. SourceCreatedDate *string `json:"sourceCreatedDate,omitempty"` SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` - // Non-standardised transaction type data from the commerce platform + // Non-standardised transaction type data from the commerce software SubType *string `json:"subType,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"` // The total transaction amount TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransactions.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransactions.go index 315fea2c1..0789c67e2 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransactions.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/commercetransactions.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/companies.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/companies.go index 5a5574be6..2776b0604 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/companies.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/company.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/company.go index 15ad56583..2e233a49b 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/company.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/company.go @@ -1,7 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +// 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-commerce-v1-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. // // Typically each company is one of your customers. @@ -57,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 { @@ -114,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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configaccount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configaccount.go index da198538e..3291e8ed6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configaccount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configaccount.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configuration.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configuration.go index 691a6c466..9d277d0f8 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/configuration.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/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 shared diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connection.go index d82caa74f..bd3a32865 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connection.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connection.go @@ -1,49 +1,7 @@ -// 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" -) - -// ConnectionSourceType - The type of platform of the connection. -type ConnectionSourceType string - -const ( - ConnectionSourceTypeAccounting ConnectionSourceType = "Accounting" - ConnectionSourceTypeBanking ConnectionSourceType = "Banking" - ConnectionSourceTypeCommerce ConnectionSourceType = "Commerce" - ConnectionSourceTypeOther ConnectionSourceType = "Other" - ConnectionSourceTypeUnknown ConnectionSourceType = "Unknown" -) - -func (e ConnectionSourceType) ToPointer() *ConnectionSourceType { - return &e -} - -func (e *ConnectionSourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Accounting": - fallthrough - case "Banking": - fallthrough - case "Commerce": - fallthrough - case "Other": - fallthrough - case "Unknown": - *e = ConnectionSourceType(v) - return nil - default: - return fmt.Errorf("invalid value for ConnectionSourceType: %v", v) - } -} - // Connection - A connection represents a [company's](https://docs.codat.io/sync-for-commerce-v1-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. // // A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: @@ -55,7 +13,7 @@ func (e *ConnectionSourceType) 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: // @@ -111,12 +69,12 @@ type Connection struct { // A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`. SourceID string `json:"sourceId"` // The type of platform of the connection. - SourceType ConnectionSourceType `json:"sourceType"` + SourceType SourceType `json:"sourceType"` // The current authorization status of the data connection. Status DataConnectionStatus `json:"status"` } -func (o *Connection) GetAdditionalProperties() interface{} { +func (o *Connection) GetAdditionalProperties() any { if o == nil { return nil } @@ -193,9 +151,9 @@ func (o *Connection) GetSourceID() string { return o.SourceID } -func (o *Connection) GetSourceType() ConnectionSourceType { +func (o *Connection) GetSourceType() SourceType { if o == nil { - return ConnectionSourceType("") + return SourceType("") } return o.SourceType } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connections.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connections.go index 24ae6e665..e20874757 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/connections.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contact.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contact.go index 39519a92d..dac326d74 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contact.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contactref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contactref.go new file mode 100644 index 000000000..cd1ca222f --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/contactref.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// ContactRefDataType - Allowed name of the 'dataType'. +type ContactRefDataType string + +const ( + ContactRefDataTypeCustomers ContactRefDataType = "customers" + ContactRefDataTypeSuppliers ContactRefDataType = "suppliers" +) + +func (e ContactRefDataType) ToPointer() *ContactRefDataType { + return &e +} +func (e *ContactRefDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "customers": + fallthrough + case "suppliers": + *e = ContactRefDataType(v) + return nil + default: + return fmt.Errorf("invalid value for ContactRefDataType: %v", v) + } +} + +type ContactRef struct { + // Allowed name of the 'dataType'. + DataType *ContactRefDataType `json:"dataType,omitempty"` + // Unique identifier for a customer or supplier. + ID string `json:"id"` +} + +func (o *ContactRef) GetDataType() *ContactRefDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *ContactRef) GetID() string { + if o == nil { + return "" + } + return o.ID +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/createcompany.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/createcompany.go index fdb1f712d..6902ba045 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/createcompany.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/createcompany.go @@ -1,10 +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 CreateCompany 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 []GroupReference `json:"groups,omitempty"` // Name of company being connected. Name string `json:"name"` } @@ -16,6 +30,13 @@ func (o *CreateCompany) GetDescription() *string { return o.Description } +func (o *CreateCompany) GetGroups() []GroupReference { + if o == nil { + return nil + } + return o.Groups +} + func (o *CreateCompany) GetName() string { if o == nil { return "" diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotelineitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotelineitem.go index ea084ab4e..b58de7d5c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotelineitem.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotelineitem.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 @@ -28,6 +28,30 @@ func (o *CreditNoteLineItemAccountingProjectReference) GetName() *string { return o.Name } +// CreditNoteLineItemRecordReference - Links the current record to the underlying record or data type that created it. +// +// For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. +type CreditNoteLineItemRecordReference struct { + // Allowed name of the 'dataType'. + DataType *string `json:"dataType,omitempty"` + // 'id' of the underlying record or data type. + ID *string `json:"id,omitempty"` +} + +func (o *CreditNoteLineItemRecordReference) GetDataType() *string { + if o == nil { + return nil + } + return o.DataType +} + +func (o *CreditNoteLineItemRecordReference) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + // CreditNoteLineItemTracking - Categories, and a project and customer, against which the item is tracked. type CreditNoteLineItemTracking struct { CategoryRefs []TrackingCategoryRefItems `json:"categoryRefs"` @@ -40,7 +64,7 @@ type CreditNoteLineItemTracking struct { // Links the current record to the underlying record or data type that created it. // // For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - RecordRef *RecordRef `json:"recordRef,omitempty"` + RecordRef *CreditNoteLineItemRecordReference `json:"recordRef,omitempty"` } func (o *CreditNoteLineItemTracking) GetCategoryRefs() []TrackingCategoryRefItems { @@ -78,7 +102,7 @@ func (o *CreditNoteLineItemTracking) GetProjectRef() *CreditNoteLineItemAccounti return o.ProjectRef } -func (o *CreditNoteLineItemTracking) GetRecordRef() *RecordRef { +func (o *CreditNoteLineItemTracking) GetRecordRef() *CreditNoteLineItemRecordReference { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotestatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotestatus.go index c38d43c80..c6c9026b1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotestatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/creditnotestatus.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 CreditNoteStatus) ToPointer() *CreditNoteStatus { return &e } - func (e *CreditNoteStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customer.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customer.go index 266e7e738..138bb67eb 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customer.go +++ b/previous-versions/sync-for-commerce-version-1/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 diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customerstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customerstatus.go index 1d5c0e8ef..d399ae91c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/customerstatus.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionerror.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionerror.go index 757486ba3..2bbff7093 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionerror.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionstatus.go index ec5254876..f7e281bc9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataconnectionstatus.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataset.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataset.go index 8f63c468b..4a71fa539 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataset.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/dataset.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,7 +7,7 @@ import ( "fmt" ) -// DataTypes - Available Data types +// DataTypes - Available data types type DataTypes string const ( @@ -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 { @@ -183,7 +182,7 @@ type Dataset struct { Completed *string `json:"completed,omitempty"` // Unique identifier for a company's data connection. ConnectionID string `json:"connectionId"` - // Available Data types + // Available data types DataType *DataTypes `json:"dataType,omitempty"` // URI to the dataset's logs. DatasetLogsURL *string `json:"datasetLogsUrl,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datasetstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datasetstatus.go index cf5cb01f4..07870a254 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datasetstatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datasetstatus.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 @@ -37,7 +37,6 @@ const ( func (e DatasetStatus) ToPointer() *DatasetStatus { return &e } - func (e *DatasetStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datastatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datastatus.go index b95863fdc..76f8293e1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datastatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datastatus.go @@ -1,12 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared // 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"` - // Available Data types + // The current status of the dataset. + CurrentStatus DatasetStatus `json:"currentStatus"` + // Available data types DataType DataType `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: // @@ -34,9 +34,9 @@ type DataStatus struct { LatestSyncID *string `json:"latestSyncId,omitempty"` } -func (o *DataStatus) GetCurrentStatus() string { +func (o *DataStatus) GetCurrentStatus() DatasetStatus { if o == nil { - return "" + return DatasetStatus("") } return o.CurrentStatus } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatype.go index 33d80c2cb..1d26b3108 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatype.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -7,7 +7,7 @@ import ( "fmt" ) -// DataType - Available Data types +// DataType - Available data types type DataType string const ( @@ -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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatypefeature.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatypefeature.go index 66c6ab9a2..fa35f659e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatypefeature.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/datatypefeature.go @@ -1,10 +1,10 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared // DataTypeFeature - Describes support for a given datatype and associated operations type DataTypeFeature struct { - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` SupportedFeatures []SupportedFeature `json:"supportedFeatures"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/daterange.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/daterange.go index 2c3850c3c..605887ff0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/daterange.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/daterange.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/directincomelineitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/directincomelineitem.go index 208c9816c..49ffe67fd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/directincomelineitem.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/directincomelineitem.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,9 +9,9 @@ import ( // ItemReference - Reference to the product, service type, or inventory item to which the direct cost is linked. type ItemReference struct { - // Unique identifier for the item in the accounting platform. + // Unique identifier for the item in the accounting software. ID string `json:"id"` - // Name of the item in the accounting platform. + // Name of the item in the accounting software. Name *string `json:"name,omitempty"` } @@ -33,9 +33,9 @@ func (o *ItemReference) GetName() *string { type TaxRateReference struct { // Applicable tax rate. EffectiveTaxRate *decimal.Big `decimal:"number" json:"effectiveTaxRate,omitempty"` - // Unique identifier for the tax rate in the accounting platform. + // Unique identifier for the tax rate in the accounting software. 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"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidation.go new file mode 100644 index 000000000..3f12091c8 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidation.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +// ErrorValidation - A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. +type ErrorValidation struct { + Errors []ErrorValidationItem `json:"errors,omitempty"` + Warnings []ErrorValidationItem `json:"warnings,omitempty"` +} + +func (o *ErrorValidation) GetErrors() []ErrorValidationItem { + if o == nil { + return nil + } + return o.Errors +} + +func (o *ErrorValidation) GetWarnings() []ErrorValidationItem { + if o == nil { + return nil + } + return o.Warnings +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidationitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidationitem.go new file mode 100644 index 000000000..b97f640eb --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/errorvalidationitem.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ErrorValidationItem struct { + // Unique identifier for a validation item. + ItemID *string `json:"itemId,omitempty"` + // A message outlining validation item's issue. + Message *string `json:"message,omitempty"` + // Name of validator. + ValidatorName *string `json:"validatorName,omitempty"` +} + +func (o *ErrorValidationItem) GetItemID() *string { + if o == nil { + return nil + } + return o.ItemID +} + +func (o *ErrorValidationItem) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *ErrorValidationItem) GetValidatorName() *string { + if o == nil { + return nil + } + return o.ValidatorName +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featurestate.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featurestate.go index 4422b5bc2..c1a65bb0e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featurestate.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featurestate.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 FeatureState) ToPointer() *FeatureState { return &e } - func (e *FeatureState) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featuretype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featuretype.go index c6e042e25..d6dd049da 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featuretype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/featuretype.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 @@ -26,7 +26,6 @@ const ( func (e FeatureType) ToPointer() *FeatureType { return &e } - func (e *FeatureType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/fees.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/fees.go index 2176ad6a5..a415adcb2 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/fees.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/fees.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/feessupplier.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/feessupplier.go index 16e0d9d89..66cd3155a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/feessupplier.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/feessupplier.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/grouping.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/grouping.go index 576d56659..5f4c467c1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/grouping.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/grouping.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupinglevels.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupinglevels.go index e50eb9ef4..d265196c5 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupinglevels.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupinglevels.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupingperiod.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupingperiod.go index 478b00211..e7102f6d8 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupingperiod.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/groupingperiod.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/halref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/halref.go index 06ee18c03..f7b86c830 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/halref.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/imagereference.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/imagereference.go index 18b3f2acf..4ce1bd5c4 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/imagereference.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/imagereference.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integration.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integration.go index 8c33e30d6..91d6b438b 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integration.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integration.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integrations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integrations.go index f220e4b30..674cff718 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integrations.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/integrations.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelevelselection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelevelselection.go index c43d0006e..91eb34c7c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelevelselection.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelevelselection.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelineitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelineitem.go index 037ba28f1..4902c0593 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelineitem.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelineitem.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 @@ -33,8 +33,6 @@ type InvoiceLineItem struct { // Categories, and a project and customer, against which the item is tracked. Tracking *Tracking `json:"tracking,omitempty"` // Reference to the tracking categories to which the line item is linked. - // - // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. TrackingCategoryRefs []TrackingCategoryRefItems `json:"trackingCategoryRefs,omitempty"` // Price of each unit of goods or services. UnitAmount *decimal.Big `decimal:"number" json:"unitAmount"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelinelevelselection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelinelevelselection.go index 398d6480f..dcd6f7ced 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelinelevelselection.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicelinelevelselection.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicestatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicestatus.go index 8cfe8e3ab..179d0595a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicestatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/invoicestatus.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 @@ -28,7 +28,6 @@ const ( func (e InvoiceStatus) ToPointer() *InvoiceStatus { return &e } - func (e *InvoiceStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/itemref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/itemref.go index d07b2a62d..f2d745fe0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/itemref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/itemref.go @@ -1,12 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared // ItemRef - Reference to the product, service type, or inventory item to which the direct cost is linked. type ItemRef struct { - // Unique identifier for the item in the accounting platform. + // Unique identifier for the item in the accounting software. ID string `json:"id"` - // Name of the item in the accounting platform. + // Name of the item in the accounting software. Name *string `json:"name,omitempty"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items.go index 0331ff490..50748468d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items1.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items1.go index f3b68996a..5669599f9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items1.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/items1.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalentryrecordref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalentryrecordref.go new file mode 100644 index 000000000..f6d9b9688 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalentryrecordref.go @@ -0,0 +1,84 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// JournalEntryRecordRefDataType - Name of underlying data type. +type JournalEntryRecordRefDataType string + +const ( + JournalEntryRecordRefDataTypeBankTransactions JournalEntryRecordRefDataType = "bankTransactions" + JournalEntryRecordRefDataTypeBillCreditNotes JournalEntryRecordRefDataType = "billCreditNotes" + JournalEntryRecordRefDataTypeBillPayments JournalEntryRecordRefDataType = "billPayments" + JournalEntryRecordRefDataTypeBills JournalEntryRecordRefDataType = "bills" + JournalEntryRecordRefDataTypeCreditNotes JournalEntryRecordRefDataType = "creditNotes" + JournalEntryRecordRefDataTypeDirectCosts JournalEntryRecordRefDataType = "directCosts" + JournalEntryRecordRefDataTypeDirectIncomes JournalEntryRecordRefDataType = "directIncomes" + JournalEntryRecordRefDataTypeInvoices JournalEntryRecordRefDataType = "invoices" + JournalEntryRecordRefDataTypeJournalEntries JournalEntryRecordRefDataType = "journalEntries" + JournalEntryRecordRefDataTypePayments JournalEntryRecordRefDataType = "payments" + JournalEntryRecordRefDataTypeTransfers JournalEntryRecordRefDataType = "transfers" +) + +func (e JournalEntryRecordRefDataType) ToPointer() *JournalEntryRecordRefDataType { + return &e +} +func (e *JournalEntryRecordRefDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "bankTransactions": + fallthrough + case "billCreditNotes": + fallthrough + case "billPayments": + fallthrough + case "bills": + fallthrough + case "creditNotes": + fallthrough + case "directCosts": + fallthrough + case "directIncomes": + fallthrough + case "invoices": + fallthrough + case "journalEntries": + fallthrough + case "payments": + fallthrough + case "transfers": + *e = JournalEntryRecordRefDataType(v) + return nil + default: + return fmt.Errorf("invalid value for JournalEntryRecordRefDataType: %v", v) + } +} + +// JournalEntryRecordRef - Links a journal entry to the underlying record that created it. +type JournalEntryRecordRef struct { + // Name of underlying data type. + DataType *JournalEntryRecordRefDataType `json:"dataType,omitempty"` + // 'id' of the underlying record or data type. + ID *string `json:"id,omitempty"` +} + +func (o *JournalEntryRecordRef) GetDataType() *JournalEntryRecordRefDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *JournalEntryRecordRef) GetID() *string { + if o == nil { + return nil + } + return o.ID +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalline.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalline.go index 755cb7e1e..33cbadd4e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalline.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/journalline.go @@ -1,18 +1,68 @@ -// 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/previous-versions/sync-for-commerce-version-1/pkg/utils" "github.com/ericlagergren/decimal" ) +// JournalLineDataType - Allowed name of the 'dataType'. +type JournalLineDataType string + +const ( + JournalLineDataTypeCustomers JournalLineDataType = "customers" + JournalLineDataTypeSuppliers JournalLineDataType = "suppliers" +) + +func (e JournalLineDataType) ToPointer() *JournalLineDataType { + return &e +} +func (e *JournalLineDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "customers": + fallthrough + case "suppliers": + *e = JournalLineDataType(v) + return nil + default: + return fmt.Errorf("invalid value for JournalLineDataType: %v", v) + } +} + +type ContactReference struct { + // Allowed name of the 'dataType'. + DataType *JournalLineDataType `json:"dataType,omitempty"` + // Unique identifier for a customer or supplier. + ID string `json:"id"` +} + +func (o *ContactReference) GetDataType() *JournalLineDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *ContactReference) GetID() string { + if o == nil { + return "" + } + return o.ID +} + // JournalLineTracking - List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) type JournalLineTracking struct { - RecordRefs []RecordRef `json:"recordRefs,omitempty"` + RecordRefs []TrackingRecordRef `json:"recordRefs,omitempty"` } -func (o *JournalLineTracking) GetRecordRefs() []RecordRef { +func (o *JournalLineTracking) GetRecordRefs() []TrackingRecordRef { if o == nil { return nil } @@ -21,7 +71,8 @@ func (o *JournalLineTracking) GetRecordRefs() []RecordRef { type JournalLine 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"` + AccountRef *AccountRef `json:"accountRef,omitempty"` + ContactRef *ContactReference `json:"contactRef,omitempty"` // Currency for the journal line item. Currency *string `json:"currency,omitempty"` // Description of the journal line item. @@ -50,6 +101,13 @@ func (o *JournalLine) GetAccountRef() *AccountRef { return o.AccountRef } +func (o *JournalLine) GetContactRef() *ContactReference { + if o == nil { + return nil + } + return o.ContactRef +} + func (o *JournalLine) GetCurrency() *string { if o == nil { return nil diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/links.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/links.go index df8dac300..9feb26261 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/links.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locale.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locale.go index c25bd7b29..276090eea 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locale.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locale.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 @@ -17,7 +17,6 @@ const ( func (e Locale) ToPointer() *Locale { return &e } - func (e *Locale) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/localization.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/localization.go index 0e9758352..335685b70 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/localization.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/localization.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locationref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locationref.go index 8fea0331f..b7f782559 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locationref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/locationref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/metadata.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/metadata.go index 85a209bbb..851caf39d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/metadata.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newpayments.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newpayments.go index ca79f2824..1b33cef88 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newpayments.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newpayments.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newtaxrates.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newtaxrates.go index f5d099530..41b3f07cb 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newtaxrates.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/newtaxrates.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/option.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/option.go index 8aab39542..7218ecb04 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/option.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/option.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderdiscountallocation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderdiscountallocation.go index ae160e56e..e0b49af31 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderdiscountallocation.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderdiscountallocation.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderlineitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderlineitem.go index 5804b6f1f..4e4ae0775 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderlineitem.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/orderlineitem.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationitems.go index 376346e3f..0177c0220 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationitems.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 @@ -42,9 +42,9 @@ type Allocation 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 // @@ -67,7 +67,7 @@ type Allocation 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"` // The total amount that has been allocated. TotalAmount *decimal.Big `decimal:"number" json:"totalAmount,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationpayment.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationpayment.go index 66f75cdb4..f7a5900e7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationpayment.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentallocationpayment.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,9 +24,9 @@ type PaymentAllocationPayment 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 // @@ -49,7 +49,7 @@ type PaymentAllocationPayment 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"` // Identifier of the allocated payment. ID *string `json:"id,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentline.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentline.go index 50efabd08..11a80bfd0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentline.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentline.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinelink.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinelink.go index 63982f78a..bd1e8fac3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinelink.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinelink.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,9 +18,9 @@ type PaymentLineLink 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 // @@ -43,7 +43,7 @@ type PaymentLineLink 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"` // Unique identifier of the transaction represented by the link. ID *string `json:"id,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinktype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinktype.go index 1149c6a11..6e35d51c9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinktype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentlinktype.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 @@ -36,7 +36,6 @@ const ( func (e PaymentLinkType) ToPointer() *PaymentLinkType { return &e } - func (e *PaymentLinkType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentmethodref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentmethodref.go index a1694da7f..beee5a811 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentmethodref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentmethodref.go @@ -1,8 +1,8 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -// PaymentMethodRef - The payment method the record is linked to in the accounting or commerce platform. +// PaymentMethodRef - The payment method the record is linked to in the accounting or commerce software. type PaymentMethodRef struct { // The unique identifier of the location being referenced. ID string `json:"id"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentref.go index 1df8988cd..d7ae14429 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/payments.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/payments.go index 6e3e9911e..9cb7fcffb 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/payments.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/payments.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentstatus.go index 726a47a47..4b8f3e952 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentstatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymentstatus.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 PaymentStatus) ToPointer() *PaymentStatus { return &e } - func (e *PaymentStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymenttype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymenttype.go index 8edccc260..18bd7c7a7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymenttype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/paymenttype.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 @@ -28,7 +28,6 @@ const ( func (e PaymentType) ToPointer() *PaymentType { return &e } - func (e *PaymentType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumberitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumberitems.go index bb977077d..32324de50 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumberitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumberitems.go @@ -1,10 +1,10 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type PhoneNumberItems struct { // A phone number. - Number *string `json:"number"` + Number *string `json:"number,omitempty"` // The type of phone number Type PhoneNumberType `json:"type"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumbertype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumbertype.go index 650172b3f..f9ed3f44c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/phonenumbertype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventory.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventory.go index 6618a2ebd..3714c15ce 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventory.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventory.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventorylocation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventorylocation.go index 3ca96e607..c07fc5f64 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventorylocation.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productinventorylocation.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productprice.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productprice.go index f5ce541ff..6d2a42987 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productprice.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productprice.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productref.go index 70f60eb92..f483a62c6 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariant.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariant.go index 71b964d41..b9f2d94d1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariant.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariant.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantref.go index 6ad5d1940..4bdb4d953 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantstatus.go index 9c2be05c1..bfedfa228 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantstatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/productvariantstatus.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 ProductVariantStatus) ToPointer() *ProductVariantStatus { return &e } - func (e *ProductVariantStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperation.go index 44b956d89..6ffb851ad 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperation.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperation.go @@ -1,103 +1,7 @@ -// 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" -) - -// PullOperationStatus - The current status of the pull operation. -type PullOperationStatus string - -const ( - PullOperationStatusInitial PullOperationStatus = "Initial" - PullOperationStatusQueued PullOperationStatus = "Queued" - PullOperationStatusFetching PullOperationStatus = "Fetching" - PullOperationStatusMapQueued PullOperationStatus = "MapQueued" - PullOperationStatusMapping PullOperationStatus = "Mapping" - PullOperationStatusComplete PullOperationStatus = "Complete" - PullOperationStatusFetchError PullOperationStatus = "FetchError" - PullOperationStatusMapError PullOperationStatus = "MapError" - PullOperationStatusInternalError PullOperationStatus = "InternalError" - PullOperationStatusProcessingQueued PullOperationStatus = "ProcessingQueued" - PullOperationStatusProcessing PullOperationStatus = "Processing" - PullOperationStatusProcessingError PullOperationStatus = "ProcessingError" - PullOperationStatusValidationQueued PullOperationStatus = "ValidationQueued" - PullOperationStatusValidating PullOperationStatus = "Validating" - PullOperationStatusValidationError PullOperationStatus = "ValidationError" - PullOperationStatusAuthError PullOperationStatus = "AuthError" - PullOperationStatusCancelled PullOperationStatus = "Cancelled" - PullOperationStatusRouting PullOperationStatus = "Routing" - PullOperationStatusRoutingError PullOperationStatus = "RoutingError" - PullOperationStatusNotSupported PullOperationStatus = "NotSupported" - PullOperationStatusRateLimitError PullOperationStatus = "RateLimitError" - PullOperationStatusPermissionsError PullOperationStatus = "PermissionsError" - PullOperationStatusPrerequisiteNotMet PullOperationStatus = "PrerequisiteNotMet" -) - -func (e PullOperationStatus) ToPointer() *PullOperationStatus { - return &e -} - -func (e *PullOperationStatus) 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 "Routing": - fallthrough - case "RoutingError": - fallthrough - case "NotSupported": - fallthrough - case "RateLimitError": - fallthrough - case "PermissionsError": - fallthrough - case "PrerequisiteNotMet": - *e = PullOperationStatus(v) - return nil - default: - return fmt.Errorf("invalid value for PullOperationStatus: %v", v) - } -} - // PullOperation - Information about a queued, in progress or completed pull operation. // *Formally called `dataset`* type PullOperation struct { @@ -127,7 +31,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 +61,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 PullOperationStatus `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 +137,9 @@ func (o *PullOperation) GetRequested() string { return o.Requested } -func (o *PullOperation) GetStatus() PullOperationStatus { +func (o *PullOperation) GetStatus() DatasetStatus { if o == nil { - return PullOperationStatus("") + return DatasetStatus("") } return o.Status } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperations.go index 36591729b..279571670 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pulloperations.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushchangetype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushchangetype.go index af522940e..d7a3d7a69 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushchangetype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperation.go index b54e8efbb..fdb1a3ceb 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperation.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -29,7 +29,7 @@ type PushOperation struct { CompletedOnUtc *string `json:"completedOnUtc,omitempty"` // Unique identifier for a company's data connection. DataConnectionKey string `json:"dataConnectionKey"` - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // A message about the error. ErrorMessage *string `json:"errorMessage,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationchange.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationchange.go index 500f01617..f7471e9a3 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationchange.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationref.go index 766073374..3e9ac25c0 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationref.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 PushOperationRef struct { - // Available Data types + // Available data types DataType *DataType `json:"dataType,omitempty"` // Unique identifier for a push operation. ID *string `json:"id,omitempty"` diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperations.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperations.go index 9d2ed7c86..23e30831d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperations.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationstatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationstatus.go index a795bac79..2f7070a10 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/pushoperationstatus.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/recordref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/recordref.go deleted file mode 100644 index 1331fed6c..000000000 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/recordref.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -// RecordRef - Links the current record to the underlying record or data type that created it. -// -// For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. -type RecordRef struct { - // Allowed name of the 'dataType'. - DataType *string `json:"dataType,omitempty"` - // 'id' of the underlying record or data type. - ID *string `json:"id,omitempty"` -} - -func (o *RecordRef) GetDataType() *string { - if o == nil { - return nil - } - return o.DataType -} - -func (o *RecordRef) GetID() *string { - if o == nil { - return nil - } - return o.ID -} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sales.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sales.go index 800239a82..92a6adcc4 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sales.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sales.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemadatatype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemadatatype.go index 19e3d610a..8d4d8cb8c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemadatatype.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -7,7 +7,7 @@ import ( "fmt" ) -// SchemaDataType - Available Data types +// SchemaDataType - Available data types type SchemaDataType string const ( @@ -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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemainvoicestatus.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemainvoicestatus.go index f5afd9987..417094bc2 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemainvoicestatus.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/schemainvoicestatus.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/security.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/security.go index 5d91435a8..e1f80d158 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/security.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicecharge.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicecharge.go index 412050755..c19daf02f 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicecharge.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicecharge.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,7 +7,7 @@ import ( "github.com/ericlagergren/decimal" ) -// ServiceChargeTaxComponentRef - Taxes rates reference object depending on the rates being available on source commerce package. +// ServiceChargeTaxComponentRef - Taxes rates reference object depending on the rates being available on source commerce software. type ServiceChargeTaxComponentRef struct { // The unique identitifer of the tax component being referenced. ID string `json:"id"` @@ -30,9 +30,9 @@ func (o *ServiceChargeTaxComponentRef) GetName() string { } type TaxComponentAllocation struct { - // Tax amount on order line sale as available from source commerce platform. + // Tax amount on order line sale as available from source commerce software. Rate *decimal.Big `decimal:"number" json:"rate,omitempty"` - // Taxes rates reference object depending on the rates being available on source commerce package. + // Taxes rates reference object depending on the rates being available on source commerce software. TaxComponentRef *ServiceChargeTaxComponentRef `json:"taxComponentRef,omitempty"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicechargetype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicechargetype.go index 7a3a240c3..377c3a681 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicechargetype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/servicechargetype.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 ServiceChargeType) ToPointer() *ServiceChargeType { return &e } - func (e *ServiceChargeType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sourcetype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sourcetype.go index c8b5f4e41..4fb3cf115 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sourcetype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/sourcetype.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 @@ -13,7 +13,9 @@ type SourceType string const ( SourceTypeAccounting SourceType = "Accounting" SourceTypeBanking SourceType = "Banking" + SourceTypeBankFeed SourceType = "BankFeed" SourceTypeCommerce SourceType = "Commerce" + SourceTypeExpense SourceType = "Expense" SourceTypeOther SourceType = "Other" SourceTypeUnknown SourceType = "Unknown" ) @@ -21,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 { @@ -32,8 +33,12 @@ func (e *SourceType) UnmarshalJSON(data []byte) error { fallthrough case "Banking": fallthrough + case "BankFeed": + fallthrough case "Commerce": fallthrough + case "Expense": + fallthrough case "Other": fallthrough case "Unknown": diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supplementaldata.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supplementaldata.go index edb51f9fc..8e62d3efc 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supplementaldata.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supportedfeature.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supportedfeature.go index ec1f375d1..0dbbafab7 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supportedfeature.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/supportedfeature.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncflowurl.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncflowurl.go index 8dc7df575..c56fc7571 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncflowurl.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncflowurl.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncrange.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncrange.go index bb5bdc472..795d82917 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncrange.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncrange.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncsummary.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncsummary.go index 598fddca3..e3070c93c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncsummary.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/syncsummary.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/synctolatestargs.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/synctolatestargs.go index f4cd43022..5e57b2877 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/synctolatestargs.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/synctolatestargs.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxeitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxeitems.go index 42b2f8e5e..7ee2e7b8a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxeitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxeitems.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,7 +7,7 @@ import ( "github.com/ericlagergren/decimal" ) -// TaxComponentRef - Taxes rates reference object depending on the rates being available on source commerce package. +// TaxComponentRef - Taxes rates reference object depending on the rates being available on source commerce software. type TaxComponentRef struct { // The unique identitifer of the tax component being referenced. ID string `json:"id"` @@ -30,9 +30,9 @@ func (o *TaxComponentRef) GetName() string { } type TaxeItems struct { - // Tax amount on order line sale as available from source commerce platform. + // Tax amount on order line sale as available from source commerce software. Rate *decimal.Big `decimal:"number" json:"rate,omitempty"` - // Taxes rates reference object depending on the rates being available on source commerce package. + // Taxes rates reference object depending on the rates being available on source commerce software. TaxComponentRef *TaxComponentRef `json:"taxComponentRef,omitempty"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateamount.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateamount.go index 1a29f8f67..fffad4c4c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateamount.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateamount.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxratemapping.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxratemapping.go index b85e2b4ad..4e6e74a4c 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxratemapping.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxratemapping.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateref.go index 54f73a95c..eb6a17c34 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/taxrateref.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 @@ -11,9 +11,9 @@ import ( type TaxRateRef struct { // Applicable tax rate. EffectiveTaxRate *decimal.Big `decimal:"number" json:"effectiveTaxRate,omitempty"` - // Unique identifier for the tax rate in the accounting platform. + // Unique identifier for the tax rate in the accounting software. 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"` } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/tracking.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/tracking.go index ac665933a..4ff5e18a1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/tracking.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/tracking.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,6 +23,30 @@ func (o *AccountingProjectReference) GetName() *string { return o.Name } +// RecordReference - Links the current record to the underlying record or data type that created it. +// +// For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. +type RecordReference struct { + // Allowed name of the 'dataType'. + DataType *string `json:"dataType,omitempty"` + // 'id' of the underlying record or data type. + ID *string `json:"id,omitempty"` +} + +func (o *RecordReference) GetDataType() *string { + if o == nil { + return nil + } + return o.DataType +} + +func (o *RecordReference) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + // Tracking - Categories, and a project and customer, against which the item is tracked. type Tracking struct { CategoryRefs []TrackingCategoryRefItems `json:"categoryRefs"` @@ -35,7 +59,7 @@ type Tracking struct { // Links the current record to the underlying record or data type that created it. // // For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - RecordRef *RecordRef `json:"recordRef,omitempty"` + RecordRef *RecordReference `json:"recordRef,omitempty"` } func (o *Tracking) GetCategoryRefs() []TrackingCategoryRefItems { @@ -73,7 +97,7 @@ func (o *Tracking) GetProjectRef() *AccountingProjectReference { return o.ProjectRef } -func (o *Tracking) GetRecordRef() *RecordRef { +func (o *Tracking) GetRecordRef() *RecordReference { if o == nil { return nil } diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingcategoryrefitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingcategoryrefitems.go index 224a4d92a..9667c8726 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingcategoryrefitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingcategoryrefitems.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingrecordref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingrecordref.go new file mode 100644 index 000000000..49495e34e --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/trackingrecordref.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// TrackingRecordRefDataType - Name of underlying data type. +type TrackingRecordRefDataType string + +const ( + TrackingRecordRefDataTypeCustomers TrackingRecordRefDataType = "customers" + TrackingRecordRefDataTypeSuppliers TrackingRecordRefDataType = "suppliers" + TrackingRecordRefDataTypeTrackingCategories TrackingRecordRefDataType = "trackingCategories" +) + +func (e TrackingRecordRefDataType) ToPointer() *TrackingRecordRefDataType { + return &e +} +func (e *TrackingRecordRefDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "customers": + fallthrough + case "suppliers": + fallthrough + case "trackingCategories": + *e = TrackingRecordRefDataType(v) + return nil + default: + return fmt.Errorf("invalid value for TrackingRecordRefDataType: %v", v) + } +} + +// TrackingRecordRef - Links to the customer or tracking category. +type TrackingRecordRef struct { + // Name of underlying data type. + DataType *TrackingRecordRefDataType `json:"dataType,omitempty"` + // 'id' of the underlying record or data type. + ID *string `json:"id,omitempty"` +} + +func (o *TrackingRecordRef) GetDataType() *TrackingRecordRefDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *TrackingRecordRef) GetID() *string { + if o == nil { + return nil + } + return o.ID +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourceref.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourceref.go index 5644a71b7..b06484265 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourceref.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourceref.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourcetype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourcetype.go index d46ae6678..25c652f95 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourcetype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactionsourcetype.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 TransactionSourceType) ToPointer() *TransactionSourceType { return &e } - func (e *TransactionSourceType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactiontype.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactiontype.go index f0a0c42bb..d95f9849d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactiontype.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/transactiontype.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 @@ -32,7 +32,6 @@ const ( func (e TransactionType) ToPointer() *TransactionType { return &e } - func (e *TransactionType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/updateconnection.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/updateconnection.go index b8a91e851..12daa4d1d 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/updateconnection.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/updateconnection.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validation.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validation.go index bb4ce0816..9788c88dd 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validation.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validationitem.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validationitem.go index 478e7bb7f..9993cc8f1 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/validationitem.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/visibleaccounts.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/visibleaccounts.go index 6a53e403c..725e14542 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/visibleaccounts.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/visibleaccounts.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/previous-versions/sync-for-commerce-version-1/pkg/models/shared/weblinkitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/weblinkitems.go index c38147150..599efac68 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/weblinkitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/weblinkitems.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 Type) ToPointer() *Type { return &e } - func (e *Type) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/withholdingtaxitems.go b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/withholdingtaxitems.go index c3168e69f..a4ad77646 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/models/shared/withholdingtaxitems.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/models/shared/withholdingtaxitems.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/previous-versions/sync-for-commerce-version-1/pkg/retry/config.go b/previous-versions/sync-for-commerce-version-1/pkg/retry/config.go new file mode 100644 index 000000000..c051b0a46 --- /dev/null +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/types/bigint.go b/previous-versions/sync-for-commerce-version-1/pkg/types/bigint.go index afd0cd2b8..9c6a086d5 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/types/bigint.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/types/date.go b/previous-versions/sync-for-commerce-version-1/pkg/types/date.go index c4648fa96..5b2782f21 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/types/date.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/types/datetime.go b/previous-versions/sync-for-commerce-version-1/pkg/types/datetime.go index 0529b2556..3eff332da 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/types/datetime.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/types/decimal.go b/previous-versions/sync-for-commerce-version-1/pkg/types/decimal.go index a42284b92..d8429bc6b 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/types/decimal.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/types/pointers.go b/previous-versions/sync-for-commerce-version-1/pkg/types/pointers.go index 4f15e99d4..35c439d26 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/types/pointers.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/utils/contenttype.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/contenttype.go index 8ed13e209..f6487e01e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/contenttype.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/utils/form.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/form.go index 56065d5ee..6619d7819 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/form.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/utils/headers.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/headers.go index 0837022e2..a07608bdc 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/headers.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -10,14 +10,34 @@ import ( "strings" ) -func PopulateHeaders(ctx context.Context, req *http.Request, headers interface{}) { - headerParamsStructType := reflect.TypeOf(headers) - headerParamsValType := reflect.ValueOf(headers) +func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, globals interface{}) { + globalsAlreadyPopulated := populateHeaders(headers, globals, req.Header, []string{}) + if globals != nil { + _ = populateHeaders(globals, nil, req.Header, globalsAlreadyPopulated) + } +} + +func populateHeaders(headers interface{}, globals interface{}, reqHeaders http.Header, skipFields []string) []string { + headerParamsStructType, headerParamsValType := dereferencePointers(reflect.TypeOf(headers), reflect.ValueOf(headers)) + + globalsAlreadyPopulated := []string{} for i := 0; i < headerParamsStructType.NumField(); i++ { fieldType := headerParamsStructType.Field(i) valType := headerParamsValType.Field(i) + if contains(skipFields, fieldType.Name) { + continue + } + + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, headerParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } + tag := parseParamTag(headerParamTagKey, fieldType, "simple", false) if tag == nil { continue @@ -25,9 +45,11 @@ func PopulateHeaders(ctx context.Context, req *http.Request, headers interface{} value := serializeHeader(fieldType.Type, valType, tag.Explode) if value != "" { - req.Header.Add(tag.ParamName, value) + reqHeaders.Add(tag.ParamName, value) } } + + return globalsAlreadyPopulated } func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) string { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/utils/json.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/json.go index 47dbd93b6..ac8de5d9a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/json.go +++ b/previous-versions/sync-for-commerce-version-1/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" { @@ -358,7 +387,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc return []byte(fmt.Sprintf(`"%s"`, tagValue)) default: if typ.Kind() == reflect.String { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) + return []byte(fmt.Sprintf("%q", tagValue)) } } @@ -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/previous-versions/sync-for-commerce-version-1/pkg/utils/pathparams.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/pathparams.go index 784eaff19..45475602e 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/pathparams.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -16,18 +16,40 @@ import ( "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/types" ) -func GenerateURL(ctx context.Context, serverURL, path string, pathParams interface{}, globals map[string]map[string]map[string]interface{}) (string, error) { +func GenerateURL(_ context.Context, serverURL, path string, pathParams interface{}, globals interface{}) (string, error) { uri := strings.TrimSuffix(serverURL, "/") + path - pathParamsStructType := reflect.TypeOf(pathParams) - pathParamsValType := reflect.ValueOf(pathParams) - parsedParameters := map[string]string{} + globalsAlreadyPopulated, err := populateParsedParameters(pathParams, globals, parsedParameters, []string{}) + if err != nil { + return "", err + } + + if globals != nil { + _, err = populateParsedParameters(globals, nil, parsedParameters, globalsAlreadyPopulated) + if err != nil { + return "", err + } + } + + // TODO should we handle the case where there are no matching path params? + return ReplaceParameters(uri, parsedParameters), nil +} + +func populateParsedParameters(pathParams interface{}, globals interface{}, parsedParameters map[string]string, skipFields []string) ([]string, error) { + pathParamsStructType, pathParamsValType := dereferencePointers(reflect.TypeOf(pathParams), reflect.ValueOf(pathParams)) + + globalsAlreadyPopulated := []string{} + for i := 0; i < pathParamsStructType.NumField(); i++ { fieldType := pathParamsStructType.Field(i) valType := pathParamsValType.Field(i) + if contains(skipFields, fieldType.Name) { + continue + } + requestTag := getRequestTag(fieldType) if requestTag != nil { continue @@ -38,12 +60,18 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa continue } - valType = populateFromGlobals(fieldType, valType, "pathParam", globals) + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, pathParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } if ppTag.Serialization != "" { vals, err := populateSerializedParams(ppTag, fieldType.Type, valType) if err != nil { - return "", err + return nil, err } for k, v := range vals { parsedParameters[k] = url.PathEscape(v) @@ -52,7 +80,7 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa // TODO: support other styles switch ppTag.Style { case "simple": - simpleParams := getSimplePathParams(ctx, ppTag.ParamName, fieldType.Type, valType, ppTag.Explode) + simpleParams := getSimplePathParams(ppTag.ParamName, fieldType.Type, valType, ppTag.Explode) for k, v := range simpleParams { parsedParameters[k] = v } @@ -60,11 +88,10 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa } } - // TODO should we handle the case where there are no matching path params? - return ReplaceParameters(uri, parsedParameters), nil + return globalsAlreadyPopulated, nil } -func getSimplePathParams(ctx context.Context, parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { +func getSimplePathParams(parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { pathParams := make(map[string]string) if isNil(objType, objValue) { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/utils/queryparams.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/queryparams.go index 0e94bcee4..00318396a 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/queryparams.go +++ b/previous-versions/sync-for-commerce-version-1/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,21 +6,55 @@ import ( "context" "encoding/json" "fmt" + "math/big" "net/http" "net/url" "reflect" + "time" + + "github.com/ericlagergren/decimal" + + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/types" ) -func PopulateQueryParams(ctx context.Context, req *http.Request, queryParams interface{}, globals map[string]map[string]map[string]interface{}) error { - queryParamsStructType := reflect.TypeOf(queryParams) - queryParamsValType := reflect.ValueOf(queryParams) +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{}) + if err != nil { + return err + } + + if globals != nil { + _, err = populateQueryParams(globals, nil, values, globalsAlreadyPopulated) + if err != nil { + return err + } + } + + req.URL.RawQuery = values.Encode() + + return nil +} + +func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) + + globalsAlreadyPopulated := []string{} + for i := 0; i < queryParamsStructType.NumField(); i++ { fieldType := queryParamsStructType.Field(i) valType := queryParamsValType.Field(i) + if contains(skipFields, fieldType.Name) { + continue + } + requestTag := getRequestTag(fieldType) if requestTag != nil { continue @@ -31,12 +65,18 @@ func PopulateQueryParams(ctx context.Context, req *http.Request, queryParams int continue } - valType = populateFromGlobals(fieldType, valType, "queryParam", globals) + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, queryParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } if qpTag.Serialization != "" { vals, err := populateSerializedParams(qpTag, fieldType.Type, valType) if err != nil { - return err + return nil, err } for k, v := range vals { values.Add(k, v) @@ -44,35 +84,33 @@ func PopulateQueryParams(ctx context.Context, req *http.Request, queryParams int } else { switch qpTag.Style { case "deepObject": - vals := populateDeepObjectParams(req, qpTag, fieldType.Type, valType) + vals := populateDeepObjectParams(qpTag, fieldType.Type, valType) for k, v := range vals { for _, vv := range v { values.Add(k, vv) } } case "form": - vals := populateFormParams(req, qpTag, fieldType.Type, valType, ",") + vals := populateFormParams(qpTag, fieldType.Type, valType, ",") for k, v := range vals { for _, vv := range v { values.Add(k, vv) } } case "pipeDelimited": - vals := populateFormParams(req, qpTag, fieldType.Type, valType, "|") + vals := populateFormParams(qpTag, fieldType.Type, valType, "|") for k, v := range vals { for _, vv := range v { values.Add(k, vv) } } default: - return fmt.Errorf("unsupported style: %s", qpTag.Style) + return nil, fmt.Errorf("unsupported style: %s", qpTag.Style) } } } - req.URL.RawQuery = values.Encode() - - return nil + return globalsAlreadyPopulated, nil } func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) (map[string]string, error) { @@ -98,64 +136,107 @@ func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue refl return values, nil } -func populateDeepObjectParams(req *http.Request, tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { +func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { values := url.Values{} if isNil(objType, objValue) { 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(req *http.Request, tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { +func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { qpTag := parseQueryParamTag(fieldType) if qpTag == nil { diff --git a/previous-versions/sync-for-commerce-version-1/pkg/utils/requestbody.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/requestbody.go index 950f39a31..000226ef9 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/requestbody.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -25,7 +25,20 @@ var ( urlEncodedEncodingRegex = regexp.MustCompile(`application\/x-www-form-urlencoded.*`) ) -func SerializeRequestBody(ctx context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { +func SerializeRequestBody(_ context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { + bodyReader, contentType, err := serializeRequestBody(request, nullable, optional, requestFieldName, serializationMethod, tag) + if err != nil { + return nil, "", fmt.Errorf("error serializing request body: %w", err) + } + + if bodyReader == nil && !optional { + return nil, "", fmt.Errorf("request body is required") + } + + return bodyReader, contentType, nil +} + +func serializeRequestBody(request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { requestStructType := reflect.TypeOf(request) requestValType := reflect.ValueOf(request) @@ -53,15 +66,16 @@ func SerializeRequestBody(ctx context.Context, request interface{}, nullable, op 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)) } } @@ -69,7 +83,7 @@ func SerializeRequestBody(ctx context.Context, request interface{}, nullable, op 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) { @@ -103,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) @@ -111,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: @@ -202,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) @@ -213,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") } @@ -229,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/previous-versions/sync-for-commerce-version-1/pkg/utils/retries.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/retries.go index ff39d0d84..44a4ea687 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/retries.go +++ b/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/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/previous-versions/sync-for-commerce-version-1/pkg/utils/security.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/security.go index fa5eff7df..19dfa6f46 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/security.go +++ b/previous-versions/sync-for-commerce-version-1/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 @@ -11,10 +11,6 @@ import ( "strings" ) -type HTTPClient interface { - Do(req *http.Request) (*http.Response, error) -} - const ( securityTagKey = "security" ) @@ -25,75 +21,27 @@ type securityTag struct { Name string Type string SubType string + Env string } -type securityConfig struct { - headers map[string]string - queryParams map[string]string -} - -type SecurityClient struct { - HTTPClient - security func(ctx context.Context) (interface{}, error) -} - -func newSecurityClient(client HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { - return &SecurityClient{ - HTTPClient: client, - security: security, +func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { + if securitySource == nil { + return nil } -} -func (c *SecurityClient) Do(req *http.Request) (*http.Response, error) { - securityCtx, err := c.security(req.Context()) + security, err := securitySource(ctx) if err != nil { - return nil, err + return err } - ctx := securityConfig{ - headers: make(map[string]string), - queryParams: make(map[string]string), - } - parseSecurityStruct(&ctx, securityCtx) - - for k, v := range ctx.headers { - req.Header.Set(k, v) - } - - queryParams := req.URL.Query() - - for k, v := range ctx.queryParams { - queryParams.Add(k, v) - } - - req.URL.RawQuery = queryParams.Encode() - - return c.HTTPClient.Do(req) -} - -func ConfigureSecurityClient(c HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { - return newSecurityClient(c, security) -} - -func trueReflectValue(val reflect.Value) reflect.Value { - kind := val.Type().Kind() - for kind == reflect.Interface || kind == reflect.Ptr { - innerVal := val.Elem() - if !innerVal.IsValid() { - break - } - val = innerVal - kind = val.Type().Kind() - } - return val -} + headers := make(map[string]string) + queryParams := make(map[string]string) -func parseSecurityStruct(c *securityConfig, security interface{}) { securityValType := trueReflectValue(reflect.ValueOf(security)) securityStructType := securityValType.Type() if isNil(securityStructType, securityValType) { - return + return nil } if securityStructType.Kind() == reflect.Ptr { @@ -118,25 +66,37 @@ func parseSecurityStruct(c *securityConfig, security interface{}) { secTag := parseSecurityTag(fieldType) if secTag != nil { if secTag.Option { - handleSecurityOption(c, valType.Interface()) + handleSecurityOption(headers, queryParams, valType.Interface()) } else if secTag.Scheme { // Special case for basic auth which could be a flattened struct if secTag.SubType == "basic" && kind != reflect.Struct { - parseSecurityScheme(c, secTag, security) + parseSecurityScheme(headers, queryParams, secTag, security) } else { - parseSecurityScheme(c, secTag, valType.Interface()) + parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) } } } } + + for key, value := range headers { + req.Header.Add(key, value) + } + + query := req.URL.Query() + for key, value := range queryParams { + query.Add(key, value) + } + req.URL.RawQuery = query.Encode() + + return nil } -func handleSecurityOption(c *securityConfig, option interface{}) error { +func handleSecurityOption(headers, queryParams map[string]string, option interface{}) { optionValType := trueReflectValue(reflect.ValueOf(option)) optionStructType := optionValType.Type() if isNil(optionStructType, optionValType) { - return nil + return } for i := 0; i < optionStructType.NumField(); i++ { @@ -145,14 +105,12 @@ func handleSecurityOption(c *securityConfig, option interface{}) error { secTag := parseSecurityTag(fieldType) if secTag != nil && secTag.Scheme { - parseSecurityScheme(c, secTag, valType.Interface()) + parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) } } - - return nil } -func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme interface{}) { +func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *securityTag, scheme interface{}) { schemeVal := trueReflectValue(reflect.ValueOf(scheme)) schemeType := schemeVal.Type() @@ -161,9 +119,14 @@ func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme } if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - handleBasicAuthScheme(client, 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++ { @@ -183,34 +146,37 @@ func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme return } - parseSecuritySchemeValue(client, schemeTag, secTag, valType.Interface()) + parseSecuritySchemeValue(headers, queryParams, schemeTag, secTag, valType.Interface()) } } else { - parseSecuritySchemeValue(client, schemeTag, schemeTag, schemeVal.Interface()) + parseSecuritySchemeValue(headers, queryParams, schemeTag, schemeTag, schemeVal.Interface()) } } -func parseSecuritySchemeValue(client *securityConfig, schemeTag *securityTag, secTag *securityTag, val interface{}) { +func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag *securityTag, secTag *securityTag, val interface{}) { switch schemeTag.Type { case "apiKey": switch schemeTag.SubType { case "header": - client.headers[secTag.Name] = valToString(val) + headers[secTag.Name] = valToString(val) case "query": - client.queryParams[secTag.Name] = valToString(val) + queryParams[secTag.Name] = valToString(val) case "cookie": - client.headers["Cookie"] = fmt.Sprintf("%s=%s", secTag.Name, valToString(val)) + headers["Cookie"] = fmt.Sprintf("%s=%s", secTag.Name, valToString(val)) default: panic("not supported") } case "openIdConnect": - client.headers[secTag.Name] = valToString(val) + headers[secTag.Name] = prefixBearer(valToString(val)) case "oauth2": - client.headers[secTag.Name] = valToString(val) + if schemeTag.SubType != "client_credentials" { + headers[secTag.Name] = prefixBearer(valToString(val)) + } case "http": switch schemeTag.SubType { case "bearer": - client.headers[secTag.Name] = prefixBearer(valToString(val)) + headers[secTag.Name] = prefixBearer(valToString(val)) + case "custom": default: panic("not supported") } @@ -227,7 +193,7 @@ func prefixBearer(authHeaderValue string) string { return fmt.Sprintf("Bearer %s", authHeaderValue) } -func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { +func handleBasicAuthScheme(headers map[string]string, scheme interface{}) { schemeStructType := reflect.TypeOf(scheme) schemeValType := reflect.ValueOf(scheme) @@ -237,6 +203,10 @@ func handleBasicAuthScheme(client *securityConfig, 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 @@ -250,7 +220,7 @@ func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { } } - client.headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))) + headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))) } func parseSecurityTag(field reflect.StructField) *securityTag { @@ -264,6 +234,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { name := "" securityType := "" securitySubType := "" + env := "" options := strings.Split(tag, ",") for _, optionConf := range options { @@ -283,6 +254,8 @@ func parseSecurityTag(field reflect.StructField) *securityTag { option = true case "scheme": scheme = true + case "env": + env = parts[1] } } @@ -294,5 +267,19 @@ func parseSecurityTag(field reflect.StructField) *securityTag { Name: name, Type: securityType, SubType: securitySubType, + Env: env, } } + +func trueReflectValue(val reflect.Value) reflect.Value { + kind := val.Type().Kind() + for kind == reflect.Interface || kind == reflect.Ptr { + innerVal := val.Elem() + if !innerVal.IsValid() { + break + } + val = innerVal + kind = val.Type().Kind() + } + return val +} diff --git a/previous-versions/sync-for-commerce-version-1/pkg/utils/utils.go b/previous-versions/sync-for-commerce-version-1/pkg/utils/utils.go index b4618bb35..adb2f7055 100644 --- a/previous-versions/sync-for-commerce-version-1/pkg/utils/utils.go +++ b/previous-versions/sync-for-commerce-version-1/pkg/utils/utils.go @@ -1,13 +1,15 @@ -// 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" "reflect" "regexp" + "strconv" "strings" "time" @@ -63,6 +65,35 @@ func Contains(slice []string, item string) bool { return false } +func MatchStatusCodes(expectedCodes []string, statusCode int) bool { + for _, codeStr := range expectedCodes { + code, err := strconv.Atoi(codeStr) + if err == nil { + if code == statusCode { + return true + } + continue + } + + codeRange, err := strconv.Atoi(string(codeStr[0])) + if err != nil { + continue + } + + if statusCode >= (codeRange*100) && statusCode < ((codeRange+1)*100) { + return true + } + } + + 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 == "" { @@ -134,23 +165,43 @@ func valToString(val interface{}) string { } } -func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, paramType string, globals map[string]map[string]map[string]interface{}) reflect.Value { - if globals != nil && fieldType.Type.Kind() == reflect.Ptr { - parameters, ok := globals["parameters"] - if ok { - paramsOfType, ok := parameters[paramType] - if ok { - globalVal, ok := paramsOfType[fieldType.Name] - if ok { - if reflect.TypeOf(globalVal).Kind() == fieldType.Type.Elem().Kind() && valType.IsNil() { - valType = reflect.ValueOf(&globalVal) - } - } - } +func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, paramType string, globals interface{}) (reflect.StructField, reflect.Value, bool) { + if globals == nil { + return fieldType, valType, false + } + + globalsStruct := reflect.TypeOf(globals) + globalsStructVal := reflect.ValueOf(globals) + + globalsField, found := globalsStruct.FieldByName(fieldType.Name) + if !found { + return fieldType, valType, false + } + + if fieldType.Type.Kind() != reflect.Ptr || !valType.IsNil() { + return fieldType, valType, true + } + + globalsVal := globalsStructVal.FieldByName(fieldType.Name) + + if !globalsVal.IsValid() { + return fieldType, valType, false + } + + switch paramType { + case queryParamTagKey: + qpTag := parseQueryParamTag(globalsField) + if qpTag == nil { + return fieldType, valType, false + } + default: + tag := parseParamTag(paramType, fieldType, "simple", false) + if tag == nil { + return fieldType, valType, false } } - return valType + return globalsField, globalsVal, true } func isNil(typ reflect.Type, val reflect.Value) bool { @@ -168,3 +219,12 @@ func isNil(typ reflect.Type, val reflect.Value) bool { return false } + +func contains(arr []string, str string) bool { + for _, a := range arr { + if a == str { + return true + } + } + return false +} diff --git a/previous-versions/sync-for-commerce-version-1/pushdata.go b/previous-versions/sync-for-commerce-version-1/pushdata.go index 7dcb2b966..f58f144f1 100644 --- a/previous-versions/sync-for-commerce-version-1/pushdata.go +++ b/previous-versions/sync-for-commerce-version-1/pushdata.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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -28,9 +31,17 @@ func newPushData(sdkConfig sdkConfiguration) *PushData { // GetOperation - Get push operation // Retrieve push operation. func (s *PushData) GetOperation(ctx context.Context, request operations.GetPushOperationRequest, opts ...operations.Option) (*operations.GetPushOperationResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-push-operation", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -38,28 +49,43 @@ func (s *PushData) GetOperation(ctx context.Context, request operations.GetPushO return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push/{pushOperationKey}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push/{pushOperationKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -67,46 +93,109 @@ func (s *PushData) GetOperation(ctx context.Context, request operations.GetPushO }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetPushOperationResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -114,7 +203,12 @@ func (s *PushData) GetOperation(ctx context.Context, request operations.GetPushO res.PushOperation = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -130,30 +224,62 @@ func (s *PushData) GetOperation(ctx context.Context, request operations.GetPushO fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ListOperations - List push operations // List push operation records. func (s *PushData) ListOperations(ctx context.Context, request operations.GetCompanyPushHistoryRequest, opts ...operations.Option) (*operations.GetCompanyPushHistoryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-company-push-history", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -161,32 +287,47 @@ func (s *PushData) ListOperations(ctx context.Context, request operations.GetCom return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -194,46 +335,109 @@ func (s *PushData) ListOperations(ctx context.Context, request operations.GetCom }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetCompanyPushHistoryResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -241,7 +445,12 @@ func (s *PushData) ListOperations(ctx context.Context, request operations.GetCom res.PushOperations = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -259,20 +468,44 @@ func (s *PushData) ListOperations(ctx context.Context, request operations.GetCom fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/refreshdata.go b/previous-versions/sync-for-commerce-version-1/refreshdata.go index 0d21f6cdc..a6eb5cf30 100644 --- a/previous-versions/sync-for-commerce-version-1/refreshdata.go +++ b/previous-versions/sync-for-commerce-version-1/refreshdata.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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -32,9 +35,17 @@ func newRefreshData(sdkConfig sdkConfiguration) *RefreshData { // // [Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`. func (s *RefreshData) All(ctx context.Context, request operations.RefreshCompanyDataRequest, opts ...operations.Option) (*operations.RefreshCompanyDataResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "refresh-company-data", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -42,28 +53,43 @@ func (s *RefreshData) All(ctx context.Context, request operations.RefreshCompany return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/all", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/all", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -71,42 +97,100 @@ func (s *RefreshData) All(ctx context.Context, request operations.RefreshCompany }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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) + } - contentType := httpRes.Header.Get("Content-Type") + 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.RefreshCompanyDataResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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 == 204: case httpRes.StatusCode == 401: @@ -123,22 +207,46 @@ func (s *RefreshData) All(ctx context.Context, request operations.RefreshCompany fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // ByDataType - Refresh data type @@ -146,9 +254,17 @@ func (s *RefreshData) All(ctx context.Context, request operations.RefreshCompany // // This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. func (s *RefreshData) ByDataType(ctx context.Context, request operations.RefreshDataTypeRequest, opts ...operations.Option) (*operations.RefreshDataTypeResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "refresh-data-type", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -156,32 +272,47 @@ func (s *RefreshData) ByDataType(ctx context.Context, request operations.Refresh return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/queue/{dataType}", request, nil) + 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) } - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + 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) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -189,46 +320,109 @@ func (s *RefreshData) ByDataType(ctx context.Context, request operations.Refresh }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.RefreshDataTypeResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -236,7 +430,12 @@ func (s *RefreshData) ByDataType(ctx context.Context, request operations.Refresh res.PullOperation = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -252,30 +451,62 @@ func (s *RefreshData) ByDataType(ctx context.Context, request operations.Refresh fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetCompanyDataStatus - Get data status // Get the state of each data type for a company func (s *RefreshData) GetCompanyDataStatus(ctx context.Context, request operations.GetCompanyDataStatusRequest, opts ...operations.Option) (*operations.GetCompanyDataStatusResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-company-data-status", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -283,28 +514,43 @@ func (s *RefreshData) GetCompanyDataStatus(ctx context.Context, request operatio return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/dataStatus", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/dataStatus", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -312,54 +558,122 @@ func (s *RefreshData) GetCompanyDataStatus(ctx context.Context, request operatio }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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) + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetCompanyDataStatusResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): - var out map[string]shared.DataStatus + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetCompanyDataStatusDataStatuses if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DataStatuses = out + res.DataStatuses = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -375,30 +689,62 @@ func (s *RefreshData) GetCompanyDataStatus(ctx context.Context, request operatio fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 // Retrieve information about a single dataset or pull operation. func (s *RefreshData) GetPullOperation(ctx context.Context, request operations.GetPullOperationRequest, opts ...operations.Option) (*operations.GetPullOperationResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-pull-operation", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -406,28 +752,43 @@ func (s *RefreshData) GetPullOperation(ctx context.Context, request operations.G return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/history/{datasetId}", request, nil) + 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) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -435,46 +796,109 @@ func (s *RefreshData) GetPullOperation(ctx context.Context, request operations.G }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.GetPullOperationResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -482,7 +906,12 @@ func (s *RefreshData) GetPullOperation(ctx context.Context, request operations.G res.PullOperation = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -498,30 +927,62 @@ func (s *RefreshData) GetPullOperation(ctx context.Context, request operations.G fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 // Gets the pull operation history (datasets) for a given company. func (s *RefreshData) ListPullOperations(ctx context.Context, request operations.ListPullOperationsRequest, opts ...operations.Option) (*operations.ListPullOperationsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-pull-operations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -529,32 +990,47 @@ func (s *RefreshData) ListPullOperations(ctx context.Context, request operations return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/history", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/history", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -562,46 +1038,109 @@ func (s *RefreshData) 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) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.ListPullOperationsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + 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 @@ -609,7 +1148,12 @@ func (s *RefreshData) ListPullOperations(ctx context.Context, request operations res.PullOperations = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -627,20 +1171,44 @@ func (s *RefreshData) ListPullOperations(ctx context.Context, request operations fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/sync.go b/previous-versions/sync-for-commerce-version-1/sync.go index 14a431224..da4bfdb3c 100644 --- a/previous-versions/sync-for-commerce-version-1/sync.go +++ b/previous-versions/sync-for-commerce-version-1/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 syncforcommerceversion1 @@ -6,9 +6,12 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" @@ -28,9 +31,17 @@ func newSync(sdkConfig sdkConfiguration) *Sync { // GetSyncStatus - Get status for a company's syncs // Check the sync history and sync status for a company. func (s *Sync) GetSyncStatus(ctx context.Context, request operations.GetSyncStatusRequest, opts ...operations.Option) (*operations.GetSyncStatusResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-sync-status", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -38,28 +49,43 @@ func (s *Sync) GetSyncStatus(ctx context.Context, request operations.GetSyncStat return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/sync/commerce/status", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/sync/commerce/status", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -67,46 +93,109 @@ func (s *Sync) GetSyncStatus(ctx context.Context, request operations.GetSyncStat }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.GetSyncStatusResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.SyncSummary if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -114,7 +203,12 @@ func (s *Sync) GetSyncStatus(ctx context.Context, request operations.GetSyncStat res.SyncSummary = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -130,31 +224,63 @@ func (s *Sync) GetSyncStatus(ctx context.Context, request operations.GetSyncStat fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // RequestSync - Sync new // Run a Commerce sync from the last successful sync up to the date provided (optional), otherwise UtcNow is used. // If there was no previously successful sync, the start date in the config is used. func (s *Sync) RequestSync(ctx context.Context, request operations.RequestSyncRequest, opts ...operations.Option) (*operations.RequestSyncResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "request-sync", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -162,35 +288,49 @@ func (s *Sync) RequestSync(ctx context.Context, request operations.RequestSyncRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/commerce/latest", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/commerce/latest", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "SyncToLatestArgs", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -198,46 +338,109 @@ func (s *Sync) RequestSync(ctx context.Context, request operations.RequestSyncRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.RequestSyncResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.SyncSummary if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -245,7 +448,12 @@ func (s *Sync) RequestSync(ctx context.Context, request operations.RequestSyncRe res.SyncSummary = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -263,30 +471,62 @@ func (s *Sync) RequestSync(ctx context.Context, request operations.RequestSyncRe fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // RequestSyncForDateRange - Sync range // Run a Commerce sync from the specified start date to the specified finish date in the request payload. func (s *Sync) RequestSyncForDateRange(ctx context.Context, request operations.RequestSyncForDateRangeRequest, opts ...operations.Option) (*operations.RequestSyncForDateRangeResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "request-sync-for-date-range", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -294,35 +534,49 @@ func (s *Sync) RequestSyncForDateRange(ctx context.Context, request operations.R return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/sync/commerce/historic", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/meta/companies/{companyId}/sync/commerce/historic", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "SyncRange", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -330,46 +584,109 @@ func (s *Sync) RequestSyncForDateRange(ctx context.Context, request operations.R }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.RequestSyncForDateRangeResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.SyncSummary if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -377,7 +694,12 @@ func (s *Sync) RequestSyncForDateRange(ctx context.Context, request operations.R res.SyncSummary = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -395,20 +717,44 @@ func (s *Sync) RequestSyncForDateRange(ctx context.Context, request operations.R fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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/previous-versions/sync-for-commerce-version-1/syncflowpreferences.go b/previous-versions/sync-for-commerce-version-1/syncflowpreferences.go index c321c179e..e7a5df2b7 100644 --- a/previous-versions/sync-for-commerce-version-1/syncflowpreferences.go +++ b/previous-versions/sync-for-commerce-version-1/syncflowpreferences.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 syncforcommerceversion1 @@ -6,13 +6,16 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/internal/hooks" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/operations" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/models/shared" + "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/retry" "github.com/codatio/client-sdk-go/previous-versions/sync-for-commerce-version-1/pkg/utils" "io" "net/http" - "strings" + "net/url" ) // SyncFlowPreferences - Configure preferences for any given Sync for Commerce company using sync flow. @@ -29,9 +32,17 @@ func newSyncFlowPreferences(sdkConfig sdkConfiguration) *SyncFlowPreferences { // GetConfigTextSyncFlow - Retrieve preferences for text fields on sync flow // To enable retrieval of preferences set for the text fields on Sync Flow. func (s *SyncFlowPreferences) GetConfigTextSyncFlow(ctx context.Context, request operations.GetConfigTextSyncFlowRequest, opts ...operations.Option) (*operations.GetConfigTextSyncFlowResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-config-text-sync-flow", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -39,29 +50,47 @@ func (s *SyncFlowPreferences) GetConfigTextSyncFlow(ctx context.Context, request return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/sync/commerce/config/ui/text" + opURL, err := url.JoinPath(baseURL, "/sync/commerce/config/ui/text") + 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", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -69,46 +98,109 @@ func (s *SyncFlowPreferences) GetConfigTextSyncFlow(ctx context.Context, request }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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", "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.GetConfigTextSyncFlowResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out map[string]shared.Localization if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -116,7 +208,12 @@ func (s *SyncFlowPreferences) GetConfigTextSyncFlow(ctx context.Context, request res.LocalizationInfo = out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -130,30 +227,62 @@ func (s *SyncFlowPreferences) GetConfigTextSyncFlow(ctx context.Context, request fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetSyncFlowURL - Retrieve sync flow url // Get a URL for Sync Flow including a one time passcode. func (s *SyncFlowPreferences) GetSyncFlowURL(ctx context.Context, request operations.GetSyncFlowURLRequest, opts ...operations.Option) (*operations.GetSyncFlowURLResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-sync-flow-url", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -161,32 +290,47 @@ func (s *SyncFlowPreferences) GetSyncFlowURL(ctx context.Context, request operat return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/config/sync/commerce/{commerceKey}/{accountingKey}/start", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/config/sync/commerce/{commerceKey}/{accountingKey}/start", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -194,46 +338,109 @@ func (s *SyncFlowPreferences) GetSyncFlowURL(ctx context.Context, request operat }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, 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.GetSyncFlowURLResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.SyncFlowURL if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -241,7 +448,12 @@ func (s *SyncFlowPreferences) GetSyncFlowURL(ctx context.Context, request operat res.SyncFlowURL = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -259,30 +471,62 @@ func (s *SyncFlowPreferences) GetSyncFlowURL(ctx context.Context, request operat fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // GetVisibleAccounts - List visible accounts // Enable retrieval for accounts which are visible on sync flow. func (s *SyncFlowPreferences) GetVisibleAccounts(ctx context.Context, request operations.GetVisibleAccountsRequest, opts ...operations.Option) (*operations.GetVisibleAccountsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-visible-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -290,28 +534,43 @@ func (s *SyncFlowPreferences) GetVisibleAccounts(ctx context.Context, request op return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/clients/{clientId}/config/ui/accounts/platform/{platformKey}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/clients/{clientId}/config/ui/accounts/platform/{platformKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -319,46 +578,109 @@ func (s *SyncFlowPreferences) GetVisibleAccounts(ctx context.Context, request op }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + }) - contentType := httpRes.Header.Get("Content-Type") + 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.GetVisibleAccountsResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.VisibleAccounts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -366,7 +688,12 @@ func (s *SyncFlowPreferences) GetVisibleAccounts(ctx context.Context, request op res.VisibleAccounts = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -382,30 +709,62 @@ func (s *SyncFlowPreferences) GetVisibleAccounts(ctx context.Context, request op fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // UpdateConfigTextSyncFlow - Update preferences for text fields on sync flow // To enable update of preferences set for the text fields on sync flow. func (s *SyncFlowPreferences) UpdateConfigTextSyncFlow(ctx context.Context, request operations.UpdateConfigTextSyncFlowRequest, opts ...operations.Option) (*operations.UpdateConfigTextSyncFlowResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-config-text-sync-flow", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -413,36 +772,53 @@ func (s *SyncFlowPreferences) UpdateConfigTextSyncFlow(ctx context.Context, requ return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/sync/commerce/config/ui/text" + opURL, err := url.JoinPath(baseURL, "/sync/commerce/config/ui/text") + 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, fmt.Errorf("error serializing request body: %w", err) + 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", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", 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("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) } - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -450,46 +826,109 @@ func (s *SyncFlowPreferences) UpdateConfigTextSyncFlow(ctx context.Context, requ }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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") + } - contentType := httpRes.Header.Get("Content-Type") + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + 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 + } + } + } res := &operations.UpdateConfigTextSyncFlowResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out map[string]shared.Localization if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -497,7 +936,12 @@ func (s *SyncFlowPreferences) UpdateConfigTextSyncFlow(ctx context.Context, requ res.LocalizationInfo = out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -513,30 +957,62 @@ func (s *SyncFlowPreferences) UpdateConfigTextSyncFlow(ctx context.Context, requ fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + } // UpdateVisibleAccountsSyncFlow - Update the visible accounts on sync flow // To enable update of accounts visible preferences set on Sync Flow. func (s *SyncFlowPreferences) UpdateVisibleAccountsSyncFlow(ctx context.Context, request operations.UpdateVisibleAccountsSyncFlowRequest, opts ...operations.Option) (*operations.UpdateVisibleAccountsSyncFlowResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-visible-accounts-sync-flow", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -544,35 +1020,49 @@ func (s *SyncFlowPreferences) UpdateVisibleAccountsSyncFlow(ctx context.Context, return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/sync/commerce/config/ui/accounts/platform/{platformKey}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/sync/commerce/config/ui/accounts/platform/{platformKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "VisibleAccounts", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + 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("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + 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{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -580,46 +1070,109 @@ func (s *SyncFlowPreferences) UpdateVisibleAccountsSyncFlow(ctx context.Context, }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - return client.Do(req) - }) - if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) - } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") - } + 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 + } - contentType := httpRes.Header.Get("Content-Type") + 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.UpdateVisibleAccountsSyncFlowResponse{ StatusCode: httpRes.StatusCode, - ContentType: contentType, + 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(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.VisibleAccounts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -627,7 +1180,12 @@ func (s *SyncFlowPreferences) UpdateVisibleAccountsSyncFlow(ctx context.Context, res.VisibleAccounts = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 @@ -645,20 +1203,44 @@ func (s *SyncFlowPreferences) UpdateVisibleAccountsSyncFlow(ctx context.Context, fallthrough case httpRes.StatusCode == 503: switch { - case utils.MatchContentType(contentType, `application/json`): + 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: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + 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 + }