diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 7aa98eb51..280a29b44 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -105,6 +105,13 @@ sources: tags: - latest - main + sync-for-payroll-source: + sourceNamespace: sync-for-payroll-source + sourceRevisionDigest: sha256:06a5cf91b89eebfab357e63b3043fd5f934c41604e6dc79bbd1ec65dec2004d9 + sourceBlobDigest: sha256:367f56c8bbc3e5f79b13390764a0e77ad2d9d25ca3e515c1c62b19fe459d927c + tags: + - latest + - main targets: accounting-library: source: accounting-source @@ -181,6 +188,11 @@ targets: sourceNamespace: sync-for-payables-version-1-source sourceRevisionDigest: sha256:3f82aa5d9dbae963c7fee29089ff1a0513b8db9892a196607d500d08f18dd7d5 sourceBlobDigest: sha256:e1fb1fe0af40cf137b8b320fd75e913c83e54e0a2bb2e80a5af69e0bce409e71 + sync-for-payroll-library: + source: sync-for-payroll-source + sourceNamespace: sync-for-payroll-source + sourceRevisionDigest: sha256:06a5cf91b89eebfab357e63b3043fd5f934c41604e6dc79bbd1ec65dec2004d9 + sourceBlobDigest: sha256:367f56c8bbc3e5f79b13390764a0e77ad2d9d25ca3e515c1c62b19fe459d927c workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -263,6 +275,8 @@ workflow: sync-for-payroll-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payroll.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source targets: accounting-library: target: go diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index be1c84d44..e8780cce0 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -79,6 +79,8 @@ sources: sync-for-payroll-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payroll.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source targets: accounting-library: target: go diff --git a/sync-for-payroll/.speakeasy/gen.lock b/sync-for-payroll/.speakeasy/gen.lock index b1ae0e125..9da491619 100755 --- a/sync-for-payroll/.speakeasy/gen.lock +++ b/sync-for-payroll/.speakeasy/gen.lock @@ -1,321 +1,2141 @@ lockVersion: 2.0.0 id: b0b7f8e1-2c76-4ec3-bd8e-bf083590b2ea management: - docChecksum: a15261c2e04a7bd37f34fe39f6ce446f + docChecksum: 22a4832a4016a6a47dabc9945d7e8f2b docVersion: 3.0.0 - speakeasyVersion: internal - generationVersion: 2.253.0 - releaseVersion: 1.3.0 - configChecksum: e8b214400edb9497d9ecb65dee205bb9 + speakeasyVersion: 1.396.9 + generationVersion: 2.415.7 + releaseVersion: 1.4.0 + configChecksum: d28c59b5c91242e7d58373f11d382cfb repoURL: https://github.com/codatio/client-sdk-go.git repoSubDirectory: sync-for-payroll installationURL: https://github.com/codatio/client-sdk-go/sync-for-payroll published: true features: go: - constsAndDefaults: 0.1.3 - core: 3.3.2 + 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.6 - globalServerURLs: 2.82.1 + globalSecurity: 2.82.10 + globalSecurityCallbacks: 0.1.0 + globalServerURLs: 2.82.2 inputOutputModels: 2.83.0 - nameOverrides: 2.81.1 - retries: 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 + webhooks: 1.0.0 generatedFiles: - - companies.go - - connections.go - - accounts.go - - journalentries.go - - journals.go - - managedata.go - - companyinfo.go - - trackingcategories.go - - codatsyncpayroll.go - - go.mod - - go.sum - - pkg/models/sdkerrors/sdkerror.go - - pkg/types/bigint.go - - pkg/types/date.go - - pkg/types/datetime.go - - pkg/types/decimal.go - - pkg/types/pointers.go - - pkg/utils/contenttype.go - - pkg/utils/form.go - - pkg/utils/headers.go - - pkg/utils/json.go - - pkg/utils/pathparams.go - - pkg/utils/queryparams.go - - pkg/utils/requestbody.go - - pkg/utils/retries.go - - pkg/utils/security.go - - pkg/utils/utils.go + - .gitattributes + - /pkg/models/operations/createaccount.go - /pkg/models/operations/createcompany.go - - /pkg/models/operations/deletecompany.go - - /pkg/models/operations/getcompany.go - - /pkg/models/operations/listcompanies.go - - /pkg/models/operations/updatecompany.go - /pkg/models/operations/createconnection.go + - /pkg/models/operations/createjournal.go + - /pkg/models/operations/createjournalentry.go + - /pkg/models/operations/deletecompany.go - /pkg/models/operations/deleteconnection.go - - /pkg/models/operations/getconnection.go - - /pkg/models/operations/listconnections.go - - /pkg/models/operations/unlinkconnection.go - - /pkg/models/operations/createaccount.go + - /pkg/models/operations/deletejournalentry.go - /pkg/models/operations/getaccount.go + - /pkg/models/operations/getaccountingprofile.go + - /pkg/models/operations/getcompany.go + - /pkg/models/operations/getconnection.go - /pkg/models/operations/getcreateaccountsmodel.go - - /pkg/models/operations/listaccounts.go - - /pkg/models/operations/createjournalentry.go - - /pkg/models/operations/deletejournalentry.go - - /pkg/models/operations/getjournalentry.go - /pkg/models/operations/getcreatejournalentrymodel.go - - /pkg/models/operations/listjournalentries.go - - /pkg/models/operations/createjournal.go - - /pkg/models/operations/getjournal.go - /pkg/models/operations/getcreatejournalmodel.go - - /pkg/models/operations/listjournals.go - /pkg/models/operations/getdatastatus.go + - /pkg/models/operations/getjournal.go + - /pkg/models/operations/getjournalentry.go - /pkg/models/operations/getpulloperation.go - /pkg/models/operations/getpushoperation.go - - /pkg/models/operations/listpushoperations.go + - /pkg/models/operations/gettrackingcategory.go + - /pkg/models/operations/listaccounts.go + - /pkg/models/operations/listcompanies.go + - /pkg/models/operations/listconnections.go + - /pkg/models/operations/listjournalentries.go + - /pkg/models/operations/listjournals.go - /pkg/models/operations/listpulloperations.go + - /pkg/models/operations/listpushoperations.go + - /pkg/models/operations/listtrackingcategories.go - /pkg/models/operations/refreshalldatatypes.go - /pkg/models/operations/refreshdatatype.go - - /pkg/models/operations/getaccountingprofile.go - - /pkg/models/operations/gettrackingcategory.go - - /pkg/models/operations/listtrackingcategories.go + - /pkg/models/operations/unlinkconnection.go + - /pkg/models/operations/updatecompany.go + - /pkg/models/sdkerrors/errormessage.go + - /pkg/models/shared/account.go + - /pkg/models/shared/accountingaddresstype.go + - /pkg/models/shared/accountprototype.go + - /pkg/models/shared/accountref.go + - /pkg/models/shared/accounts.go + - /pkg/models/shared/accountstatus.go + - /pkg/models/shared/accounttype.go + - /pkg/models/shared/address.go + - /pkg/models/shared/clientratelimitreachedwebhook.go + - /pkg/models/shared/clientratelimitreachedwebhookdata.go + - /pkg/models/shared/clientratelimitresetwebhook.go + - /pkg/models/shared/clientratelimitresetwebhookdata.go + - /pkg/models/shared/clientratelimitwebhook.go + - /pkg/models/shared/clientratelimitwebhookpayload.go + - /pkg/models/shared/companies.go - /pkg/models/shared/company.go + - /pkg/models/shared/companyinfo.go + - /pkg/models/shared/companyrequestbody.go - /pkg/models/shared/connection.go - - /pkg/models/shared/dataconnectionstatus.go + - /pkg/models/shared/connections.go + - /pkg/models/shared/createaccountresponse.go + - /pkg/models/shared/createjournalentryresponse.go + - /pkg/models/shared/createjournalresponse.go - /pkg/models/shared/dataconnectionerror.go + - /pkg/models/shared/dataconnectionstatus.go + - /pkg/models/shared/datastatus.go + - /pkg/models/shared/datatype.go - /pkg/models/shared/errorvalidation.go - /pkg/models/shared/errorvalidationitem.go - - /pkg/models/shared/companyrequestbody.go - - /pkg/models/shared/items.go - - /pkg/models/shared/companies.go - - /pkg/models/shared/links.go - /pkg/models/shared/halref.go - - /pkg/models/shared/connections.go - - /pkg/models/shared/createaccountresponse.go - - /pkg/models/shared/validation.go - - /pkg/models/shared/validationitem.go - - /pkg/models/shared/pushoperationstatus.go - - /pkg/models/shared/datatype.go - - /pkg/models/shared/accounttype.go - - /pkg/models/shared/supplementaldata.go - - /pkg/models/shared/accountstatus.go - - /pkg/models/shared/pushoperationchange.go - - /pkg/models/shared/pushchangetype.go - - /pkg/models/shared/pushoperationref.go - - /pkg/models/shared/accountprototype.go - - /pkg/models/shared/account.go - - /pkg/models/shared/pushoption.go - - /pkg/models/shared/pushvalidationinfo.go - - /pkg/models/shared/pushfieldvalidation.go - - /pkg/models/shared/pushoptiontype.go - - /pkg/models/shared/pushoptionproperty.go - - /pkg/models/shared/pushoptionchoice.go - - /pkg/models/shared/accounts.go - - /pkg/models/shared/createjournalentryresponse.go + - /pkg/models/shared/journal.go + - /pkg/models/shared/journalentries.go + - /pkg/models/shared/journalentry.go - /pkg/models/shared/journalentryrecordref.go - - /pkg/models/shared/metadata.go - - /pkg/models/shared/journalref.go - /pkg/models/shared/journalline.go - - /pkg/models/shared/trackingrecordref.go - - /pkg/models/shared/accountref.go - - /pkg/models/shared/journalentry.go - - /pkg/models/shared/pushoperation.go - - /pkg/models/shared/journalentries.go - - /pkg/models/shared/createjournalresponse.go - - /pkg/models/shared/journalstatus.go - /pkg/models/shared/journalprototype.go - - /pkg/models/shared/journal.go + - /pkg/models/shared/journalref.go - /pkg/models/shared/journals.go - - /pkg/models/shared/datastatus.go + - /pkg/models/shared/journalstatus.go + - /pkg/models/shared/links.go + - /pkg/models/shared/metadata.go + - /pkg/models/shared/phonenumber.go + - /pkg/models/shared/phonenumbertype.go + - /pkg/models/shared/propertiestatus.go - /pkg/models/shared/pulloperation.go - - /pkg/models/shared/pushoperations.go - /pkg/models/shared/pulloperations.go + - /pkg/models/shared/pushchangetype.go + - /pkg/models/shared/pushfieldvalidation.go + - /pkg/models/shared/pushoperation.go + - /pkg/models/shared/pushoperationchange.go + - /pkg/models/shared/pushoperationref.go + - /pkg/models/shared/pushoperations.go + - /pkg/models/shared/pushoperationstatus.go + - /pkg/models/shared/pushoption.go + - /pkg/models/shared/pushoptionchoice.go + - /pkg/models/shared/pushoptionproperty.go + - /pkg/models/shared/pushoptiontype.go + - /pkg/models/shared/pushvalidationinfo.go - /pkg/models/shared/schemadatatype.go - - /pkg/models/shared/companyinfo.go - - /pkg/models/shared/weblink.go - - /pkg/models/shared/phonenumber.go - - /pkg/models/shared/phonenumbertype.go - - /pkg/models/shared/address.go - - /pkg/models/shared/accountingaddresstype.go - - /pkg/models/shared/trackingcategorytree.go + - /pkg/models/shared/security.go - /pkg/models/shared/status.go + - /pkg/models/shared/supplementaldata.go - /pkg/models/shared/trackingcategories.go - /pkg/models/shared/trackingcategory.go - - /pkg/models/shared/security.go - - /pkg/models/shared/clientratelimitreachedwebhook.go - - /pkg/models/shared/clientratelimitreachedwebhookdata.go - - /pkg/models/shared/clientratelimitresetwebhook.go - - /pkg/models/shared/clientratelimitresetwebhookdata.go - - /pkg/models/sdkerrors/errormessage.go + - /pkg/models/shared/trackingcategorytree.go + - /pkg/models/shared/trackingrecordref.go + - /pkg/models/shared/validation.go + - /pkg/models/shared/validationitem.go + - /pkg/models/shared/weblink.go - /pkg/models/webhooks/clientratelimitreached.go - /pkg/models/webhooks/clientratelimitreset.go + - CONTRIBUTING.md + - USAGE.md + - accounts.go + - codatsyncpayroll.go + - companies.go + - companyinfo.go + - connections.go + - docs/pkg/models/operations/createaccountrequest.md + - docs/pkg/models/operations/createaccountresponse.md - docs/pkg/models/operations/createcompanyresponse.md - - docs/pkg/models/operations/deletecompanyrequest.md - - docs/pkg/models/operations/deletecompanyresponse.md - - docs/pkg/models/operations/getcompanyrequest.md - - docs/pkg/models/operations/getcompanyresponse.md - - docs/pkg/models/operations/listcompaniesrequest.md - - docs/pkg/models/operations/listcompaniesresponse.md - - docs/pkg/models/operations/updatecompanyrequest.md - - docs/pkg/models/operations/updatecompanyresponse.md - - docs/pkg/models/operations/createconnectionrequestbody.md - docs/pkg/models/operations/createconnectionrequest.md + - docs/pkg/models/operations/createconnectionrequestbody.md - docs/pkg/models/operations/createconnectionresponse.md + - docs/pkg/models/operations/createjournalentryrequest.md + - docs/pkg/models/operations/createjournalentryresponse.md + - docs/pkg/models/operations/createjournalrequest.md + - docs/pkg/models/operations/createjournalresponse.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/getconnectionrequest.md - - docs/pkg/models/operations/getconnectionresponse.md - - docs/pkg/models/operations/listconnectionsrequest.md - - docs/pkg/models/operations/listconnectionsresponse.md - - docs/pkg/models/operations/unlinkconnectionupdateconnection.md - - docs/pkg/models/operations/unlinkconnectionrequest.md - - docs/pkg/models/operations/unlinkconnectionresponse.md - - docs/pkg/models/operations/createaccountrequest.md - - docs/pkg/models/operations/createaccountresponse.md + - docs/pkg/models/operations/deletejournalentryrequest.md + - docs/pkg/models/operations/deletejournalentryresponse.md + - docs/pkg/models/operations/getaccountingprofilerequest.md + - docs/pkg/models/operations/getaccountingprofileresponse.md - docs/pkg/models/operations/getaccountrequest.md - docs/pkg/models/operations/getaccountresponse.md + - docs/pkg/models/operations/getcompanyrequest.md + - docs/pkg/models/operations/getcompanyresponse.md + - docs/pkg/models/operations/getconnectionrequest.md + - docs/pkg/models/operations/getconnectionresponse.md - docs/pkg/models/operations/getcreateaccountsmodelrequest.md - docs/pkg/models/operations/getcreateaccountsmodelresponse.md - - docs/pkg/models/operations/listaccountsrequest.md - - docs/pkg/models/operations/listaccountsresponse.md - - docs/pkg/models/operations/createjournalentryrequest.md - - docs/pkg/models/operations/createjournalentryresponse.md - - docs/pkg/models/operations/deletejournalentryrequest.md - - docs/pkg/models/operations/deletejournalentryresponse.md - - docs/pkg/models/operations/getjournalentryrequest.md - - docs/pkg/models/operations/getjournalentryresponse.md - docs/pkg/models/operations/getcreatejournalentrymodelrequest.md - docs/pkg/models/operations/getcreatejournalentrymodelresponse.md - - docs/pkg/models/operations/listjournalentriesrequest.md - - docs/pkg/models/operations/listjournalentriesresponse.md - - docs/pkg/models/operations/createjournalrequest.md - - docs/pkg/models/operations/createjournalresponse.md - - docs/pkg/models/operations/getjournalrequest.md - - docs/pkg/models/operations/getjournalresponse.md - docs/pkg/models/operations/getcreatejournalmodelrequest.md - docs/pkg/models/operations/getcreatejournalmodelresponse.md - - docs/pkg/models/operations/listjournalsrequest.md - - docs/pkg/models/operations/listjournalsresponse.md + - docs/pkg/models/operations/getdatastatusdatastatuses.md - docs/pkg/models/operations/getdatastatusrequest.md - docs/pkg/models/operations/getdatastatusresponse.md + - docs/pkg/models/operations/getjournalentryrequest.md + - docs/pkg/models/operations/getjournalentryresponse.md + - docs/pkg/models/operations/getjournalrequest.md + - docs/pkg/models/operations/getjournalresponse.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/listpushoperationsrequest.md - - docs/pkg/models/operations/listpushoperationsresponse.md + - docs/pkg/models/operations/gettrackingcategoryrequest.md + - docs/pkg/models/operations/gettrackingcategoryresponse.md + - docs/pkg/models/operations/listaccountsrequest.md + - docs/pkg/models/operations/listaccountsresponse.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/listjournalentriesrequest.md + - docs/pkg/models/operations/listjournalentriesresponse.md + - docs/pkg/models/operations/listjournalsrequest.md + - docs/pkg/models/operations/listjournalsresponse.md - docs/pkg/models/operations/listpulloperationsrequest.md - docs/pkg/models/operations/listpulloperationsresponse.md + - docs/pkg/models/operations/listpushoperationsrequest.md + - docs/pkg/models/operations/listpushoperationsresponse.md + - docs/pkg/models/operations/listtrackingcategoriesrequest.md + - docs/pkg/models/operations/listtrackingcategoriesresponse.md + - docs/pkg/models/operations/option.md - docs/pkg/models/operations/refreshalldatatypesrequest.md - docs/pkg/models/operations/refreshalldatatypesresponse.md - docs/pkg/models/operations/refreshdatatyperequest.md - docs/pkg/models/operations/refreshdatatyperesponse.md - - docs/pkg/models/operations/getaccountingprofilerequest.md - - docs/pkg/models/operations/getaccountingprofileresponse.md - - docs/pkg/models/operations/gettrackingcategoryrequest.md - - docs/pkg/models/operations/gettrackingcategoryresponse.md - - docs/pkg/models/operations/listtrackingcategoriesrequest.md - - docs/pkg/models/operations/listtrackingcategoriesresponse.md - - docs/pkg/models/shared/groupreference.md + - docs/pkg/models/operations/unlinkconnectionrequest.md + - docs/pkg/models/operations/unlinkconnectionresponse.md + - docs/pkg/models/operations/unlinkconnectionupdateconnection.md + - docs/pkg/models/operations/updatecompanyrequest.md + - docs/pkg/models/operations/updatecompanyresponse.md + - docs/pkg/models/sdkerrors/errormessage.md + - docs/pkg/models/shared/account.md + - docs/pkg/models/shared/accountingaccount.md + - docs/pkg/models/shared/accountingaddresstype.md + - docs/pkg/models/shared/accountingjournal.md + - docs/pkg/models/shared/accountingjournalentry.md + - docs/pkg/models/shared/accountmetadata.md + - docs/pkg/models/shared/accountprototype.md + - docs/pkg/models/shared/accountref.md + - docs/pkg/models/shared/accounts.md + - docs/pkg/models/shared/accountstatus.md + - docs/pkg/models/shared/accounttype.md + - docs/pkg/models/shared/accountvaliddatatypelinks.md + - docs/pkg/models/shared/address.md + - docs/pkg/models/shared/clientratelimitreachedwebhook.md + - docs/pkg/models/shared/clientratelimitreachedwebhookdata.md + - docs/pkg/models/shared/clientratelimitresetwebhook.md + - docs/pkg/models/shared/clientratelimitresetwebhookdata.md + - docs/pkg/models/shared/clientratelimitwebhook.md + - docs/pkg/models/shared/clientratelimitwebhookpayload.md + - docs/pkg/models/shared/companies.md - docs/pkg/models/shared/company.md - - docs/pkg/models/shared/sourcetype.md - - docs/pkg/models/shared/connection.md - - docs/pkg/models/shared/dataconnectionstatus.md - - docs/pkg/models/shared/dataconnectionerror.md - - docs/pkg/models/shared/errorvalidation.md - - docs/pkg/models/shared/errorvalidationitem.md + - docs/pkg/models/shared/companyinfo.md - docs/pkg/models/shared/companyrequestbody.md - - docs/pkg/models/shared/items.md - - docs/pkg/models/shared/companies.md - - docs/pkg/models/shared/links.md - - docs/pkg/models/shared/halref.md + - docs/pkg/models/shared/connection.md - docs/pkg/models/shared/connections.md + - docs/pkg/models/shared/contactreference.md + - docs/pkg/models/shared/createaccountresponse.md - docs/pkg/models/shared/createaccountresponsemetadata.md - docs/pkg/models/shared/createaccountresponsevaliddatatypelinks.md - - docs/pkg/models/shared/accountingaccount.md - - docs/pkg/models/shared/createaccountresponse.md - - docs/pkg/models/shared/validation.md - - docs/pkg/models/shared/validationitem.md - - docs/pkg/models/shared/pushoperationstatus.md - - docs/pkg/models/shared/datatype.md - - docs/pkg/models/shared/accounttype.md - - docs/pkg/models/shared/supplementaldata.md - - docs/pkg/models/shared/accountstatus.md - - docs/pkg/models/shared/pushoperationchange.md - - docs/pkg/models/shared/pushchangetype.md - - docs/pkg/models/shared/pushoperationref.md - - docs/pkg/models/shared/validdatatypelinks.md - - docs/pkg/models/shared/accountprototype.md - - docs/pkg/models/shared/accountmetadata.md - - docs/pkg/models/shared/accountvaliddatatypelinks.md - - docs/pkg/models/shared/account.md - - docs/pkg/models/shared/pushoption.md - - docs/pkg/models/shared/pushvalidationinfo.md - - docs/pkg/models/shared/pushfieldvalidation.md - - docs/pkg/models/shared/pushoptiontype.md - - docs/pkg/models/shared/pushoptionproperty.md - - docs/pkg/models/shared/pushoptionchoice.md - - docs/pkg/models/shared/accounts.md - - docs/pkg/models/shared/accountingjournalentry.md - docs/pkg/models/shared/createjournalentryresponse.md - - docs/pkg/models/shared/journalentryrecordrefdatatype.md + - docs/pkg/models/shared/createjournalresponse.md + - docs/pkg/models/shared/dataconnectionerror.md + - docs/pkg/models/shared/dataconnectionstatus.md + - docs/pkg/models/shared/datasetstatus.md + - docs/pkg/models/shared/datastatus.md + - docs/pkg/models/shared/datatype.md + - docs/pkg/models/shared/datatypes.md + - docs/pkg/models/shared/errorstatus.md + - docs/pkg/models/shared/errorvalidation.md + - docs/pkg/models/shared/errorvalidationitem.md + - docs/pkg/models/shared/groupreference.md + - docs/pkg/models/shared/halref.md + - docs/pkg/models/shared/journal.md + - docs/pkg/models/shared/journalentries.md + - docs/pkg/models/shared/journalentry.md - docs/pkg/models/shared/journalentryrecordref.md - - docs/pkg/models/shared/metadata.md - - docs/pkg/models/shared/journalref.md - - docs/pkg/models/shared/tracking.md + - docs/pkg/models/shared/journalentryrecordrefdatatype.md - docs/pkg/models/shared/journalline.md - - docs/pkg/models/shared/trackingrecordrefdatatype.md - - docs/pkg/models/shared/trackingrecordref.md - - docs/pkg/models/shared/accountref.md - - docs/pkg/models/shared/journalentry.md - - docs/pkg/models/shared/pushoperation.md - - docs/pkg/models/shared/journalentries.md - - docs/pkg/models/shared/accountingjournal.md - - docs/pkg/models/shared/createjournalresponse.md - - docs/pkg/models/shared/journalstatus.md + - docs/pkg/models/shared/journallinedatatype.md - docs/pkg/models/shared/journalprototype.md - - docs/pkg/models/shared/journal.md + - docs/pkg/models/shared/journalref.md - docs/pkg/models/shared/journals.md - - docs/pkg/models/shared/datatypes.md - - docs/pkg/models/shared/datastatus.md - - docs/pkg/models/shared/pulloperationstatus.md + - docs/pkg/models/shared/journalstatus.md + - docs/pkg/models/shared/links.md + - docs/pkg/models/shared/metadata.md + - docs/pkg/models/shared/phonenumber.md + - docs/pkg/models/shared/phonenumbertype.md + - docs/pkg/models/shared/propertiestatus.md - docs/pkg/models/shared/pulloperation.md - - docs/pkg/models/shared/pushoperations.md - docs/pkg/models/shared/pulloperations.md + - docs/pkg/models/shared/pushchangetype.md + - docs/pkg/models/shared/pushfieldvalidation.md + - docs/pkg/models/shared/pushoperation.md + - docs/pkg/models/shared/pushoperationchange.md + - docs/pkg/models/shared/pushoperationref.md + - docs/pkg/models/shared/pushoperations.md + - docs/pkg/models/shared/pushoperationstatus.md + - docs/pkg/models/shared/pushoption.md + - docs/pkg/models/shared/pushoptionchoice.md + - docs/pkg/models/shared/pushoptionproperty.md + - docs/pkg/models/shared/pushoptiontype.md + - docs/pkg/models/shared/pushvalidationinfo.md - docs/pkg/models/shared/schemadatatype.md - - docs/pkg/models/shared/companyinfo.md - - docs/pkg/models/shared/type.md - - docs/pkg/models/shared/weblink.md - - docs/pkg/models/shared/phonenumber.md - - docs/pkg/models/shared/phonenumbertype.md - - docs/pkg/models/shared/address.md - - docs/pkg/models/shared/accountingaddresstype.md - - docs/pkg/models/shared/trackingcategorytree.md + - docs/pkg/models/shared/security.md + - docs/pkg/models/shared/sourcetype.md - docs/pkg/models/shared/status.md + - docs/pkg/models/shared/supplementaldata.md + - docs/pkg/models/shared/tags.md + - docs/pkg/models/shared/tracking.md - docs/pkg/models/shared/trackingcategories.md - docs/pkg/models/shared/trackingcategory.md - - docs/pkg/models/shared/security.md - - docs/pkg/models/shared/clientratelimitreachedwebhook.md - - docs/pkg/models/shared/clientratelimitreachedwebhookdata.md - - docs/pkg/models/shared/clientratelimitresetwebhook.md - - docs/pkg/models/shared/clientratelimitresetwebhookdata.md - - docs/pkg/models/sdkerrors/errormessage.md + - docs/pkg/models/shared/trackingcategorytree.md + - docs/pkg/models/shared/trackingrecordref.md + - docs/pkg/models/shared/trackingrecordrefdatatype.md + - docs/pkg/models/shared/type.md + - docs/pkg/models/shared/validation.md + - docs/pkg/models/shared/validationitem.md + - docs/pkg/models/shared/validdatatypelinks.md + - docs/pkg/models/shared/weblink.md - docs/pkg/models/webhooks/clientratelimitreachedresponse.md + - docs/pkg/models/webhooks/clientratelimitreachedresponse1.md - docs/pkg/models/webhooks/clientratelimitresetresponse.md + - docs/pkg/models/webhooks/clientratelimitresetresponse1.md + - docs/sdks/accounts/README.md - docs/sdks/codatsyncpayroll/README.md - - docs/pkg/models/operations/option.md - docs/sdks/companies/README.md + - docs/sdks/companyinfo/README.md - docs/sdks/connections/README.md - - docs/sdks/accounts/README.md - docs/sdks/journalentries/README.md - docs/sdks/journals/README.md - docs/sdks/managedata/README.md - - docs/sdks/companyinfo/README.md - docs/sdks/trackingcategories/README.md - - USAGE.md + - go.mod + - internal/hooks/hooks.go + - journalentries.go + - journals.go + - managedata.go - pkg/models/operations/options.go - - .gitattributes + - 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 + - trackingcategories.go +examples: + create-company: + With no description: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + With a description: + requestBody: + application/json: {"description": "Technology services, including web and app design and development", "groups": [], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "Technology services, including web and app design and development", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + With a group: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [{"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"}], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + Malformed query: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Bank of Dave"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + delete-company: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-company: + Simple company: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "My First Company", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + With groups: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "My First Company", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-companies: + "": + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"}], "totalResults": 1} + "400": {} + One company: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/3fa85f64-5717-4562-b3fc-2c963f66afa6/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "My Test Company make testing software", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "lastSync": "2022-01-01T12:30:00.000Z", "name": "My Test Company", "redirect": "https://link.codat.io/company/3fa85f64-5717-4562-b3fc-2c963f66afa6"}], "totalResults": 1} + List of Companies: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Joe Bloggs", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/d1568dde-adf6-11ed-afa1-0242ac120002/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "Technology services, including web and app design and development", "id": "d1568dde-adf6-11ed-afa1-0242ac120002", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/d1568dde-adf6-11ed-afa1-0242ac120002"}, {"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "a70bc148-dc21-46b2-a257-d9c58ac15cbb", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/096db70b-78de-4ff0-aa98-299cb5fe17a0/connections/a70bc148-dc21-46b2-a257-d9c58ac15cbb/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "A new digital agency with a passion for creating amazing digital experiences", "id": "096db70b-78de-4ff0-aa98-299cb5fe17a0", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Godata", "redirect": "https://link.codat.io/company/096db70b-78de-4ff0-aa98-299cb5fe17a0"}], "totalResults": 2} + Malformed query: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + update-company: + Update name: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "New Name"} + responses: + "200": + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"} + "401": {} + Update description: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Additional documents required", "groups": [], "name": "Same name"} + responses: + "200": + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Bank of Dave"} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + delete-connection: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-connections: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "totalResults": 1} + "400": {} + Connections: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "string"}, "next": {"href": "string"}, "previous": {"href": "string"}, "self": {"href": "string"}}, "pageNumber": 0, "pageSize": 0, "results": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "totalResults": 0} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + unlink-connection: + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + requestBody: + application/json: {"status": "Unlinked"} + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-account: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "USD", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Current", "fullyQualifiedName": "Cash On Hand", "name": "Accounts Receivable", "nominalCode": "610", "status": "Active", "type": "Asset"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-account: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + accountId: "7110701885" + 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: "13d946f0-c5d5-42bc-b092-97ece17923ab" + 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: "7110701885" + 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: "EILBDVJVNUAGVKRQ" + 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: "7110701885" + 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: "EILBDVJVNUAGVKRQ" + 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: "7110701885" + 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: "13d946f0-c5d5-42bc-b092-97ece17923ab" + 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: "EILBDVJVNUAGVKRQ" + 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: "EILBDVJVNUAGVKRQ" + 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: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + 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: "7110701885" + 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: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + 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: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + 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: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + 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: "EILBDVJVNUAGVKRQ" + 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: "13d946f0-c5d5-42bc-b092-97ece17923ab" + 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: "13d946f0-c5d5-42bc-b092-97ece17923ab" + 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: "EILBDVJVNUAGVKRQ" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-create-accounts-model: + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Name"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Asset.Assets.Cash", "required": false, "type": "String", "value": "Asset.Assets.Cash"}, {"displayName": "Asset.Assets.Bank", "required": false, "type": "String", "value": "Asset.Assets.Bank"}, {"displayName": "Asset.Assets.PaymentServices", "required": false, "type": "String", "value": "Asset.Assets.PaymentServices"}, {"displayName": "Asset.Assets.AccountsReceivable", "required": false, "type": "String", "value": "Asset.Assets.AccountsReceivable"}, {"displayName": "Liability.EquityAndLiabilities.AccountsPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccountsPayable"}, {"displayName": "Asset.Assets.VAT", "required": false, "type": "String", "value": "Asset.Assets.VAT"}, {"displayName": "Liability.EquityAndLiabilities.EmployeesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.EmployeesPayable"}, {"displayName": "Asset.Assets.PrepaidExpenses", "required": false, "type": "String", "value": "Asset.Assets.PrepaidExpenses"}, {"displayName": "Liability.EquityAndLiabilities.AccruedExpenses", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccruedExpenses"}, {"displayName": "Liability.EquityAndLiabilities.IncomeTaxesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.IncomeTaxesPayable"}, {"displayName": "Asset.Assets.FixedAssets", "required": false, "type": "String", "value": "Asset.Assets.FixedAssets"}, {"displayName": "Asset.Assets.OtherAssets", "required": false, "type": "String", "value": "Asset.Assets.OtherAssets"}, {"displayName": "Asset.Assets.AccumulatedDeprecation", "required": false, "type": "String", "value": "Asset.Assets.AccumulatedDeprecation"}, {"displayName": "Asset.Assets.Inventory", "required": false, "type": "String", "value": "Asset.Assets.Inventory"}, {"displayName": "Equity.EquityAndLiabilities.CapitalStock", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.CapitalStock"}, {"displayName": "Equity.EquityAndLiabilities.RetainedEarnings", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.RetainedEarnings"}, {"displayName": "Liability.EquityAndLiabilities.LongTermDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.LongTermDebt"}, {"displayName": "Liability.EquityAndLiabilities.CurrentPortionOfDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.CurrentPortionOfDebt"}, {"displayName": "Unknown.EquityAndLiabilities.Intercompany", "required": false, "type": "String", "value": "Unknown.EquityAndLiabilities.Intercompany"}, {"displayName": "Unknown.General.General", "required": false, "type": "String", "value": "Unknown.General.General"}, {"displayName": "Income.NetIncome.Revenue", "required": false, "type": "String", "value": "Income.NetIncome.Revenue"}, {"displayName": "Expense.NetIncome.CostOfGoods", "required": false, "type": "String", "value": "Expense.NetIncome.CostOfGoods"}, {"displayName": "Expense.NetIncome.OtherCosts", "required": false, "type": "String", "value": "Expense.NetIncome.OtherCosts"}, {"displayName": "Expense.NetIncome.SalesGeneralAdministrativeExpenses", "required": false, "type": "String", "value": "Expense.NetIncome.SalesGeneralAdministrativeExpenses"}, {"displayName": "Expense.NetIncome.DeprecationCosts", "required": false, "type": "String", "value": "Expense.NetIncome.DeprecationCosts"}, {"displayName": "Expense.NetIncome.ResearchAndDevelopment", "required": false, "type": "String", "value": "Expense.NetIncome.ResearchAndDevelopment"}, {"displayName": "Expense.NetIncome.EmployeeCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmployeeCosts"}, {"displayName": "Expense.NetIncome.EmploymentCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmploymentCosts"}, {"displayName": "Expense.ExceptionalIncome.ExceptionalCosts", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.ExceptionalCosts"}, {"displayName": "Income.ExceptionalIncome.ExceptionalIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.ExceptionalIncome"}, {"displayName": "Expense.ExceptionalIncome.IncomeTaxes", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.IncomeTaxes"}, {"displayName": "Income.ExceptionalIncome.InterestIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.InterestIncome"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "FullyQualifiedCategory"}], "warnings": []}}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Pending", "required": false, "type": "String", "value": "Pending"}, {"displayName": "Unknown", "required": false, "type": "String", "value": "Unknown"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Status"}], "warnings": []}}}, "required": true, "type": "Object"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Name"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Asset.Assets.Cash", "required": false, "type": "String", "value": "Asset.Assets.Cash"}, {"displayName": "Asset.Assets.Bank", "required": false, "type": "String", "value": "Asset.Assets.Bank"}, {"displayName": "Asset.Assets.PaymentServices", "required": false, "type": "String", "value": "Asset.Assets.PaymentServices"}, {"displayName": "Asset.Assets.AccountsReceivable", "required": false, "type": "String", "value": "Asset.Assets.AccountsReceivable"}, {"displayName": "Liability.EquityAndLiabilities.AccountsPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccountsPayable"}, {"displayName": "Asset.Assets.VAT", "required": false, "type": "String", "value": "Asset.Assets.VAT"}, {"displayName": "Liability.EquityAndLiabilities.EmployeesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.EmployeesPayable"}, {"displayName": "Asset.Assets.PrepaidExpenses", "required": false, "type": "String", "value": "Asset.Assets.PrepaidExpenses"}, {"displayName": "Liability.EquityAndLiabilities.AccruedExpenses", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccruedExpenses"}, {"displayName": "Liability.EquityAndLiabilities.IncomeTaxesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.IncomeTaxesPayable"}, {"displayName": "Asset.Assets.FixedAssets", "required": false, "type": "String", "value": "Asset.Assets.FixedAssets"}, {"displayName": "Asset.Assets.OtherAssets", "required": false, "type": "String", "value": "Asset.Assets.OtherAssets"}, {"displayName": "Asset.Assets.AccumulatedDeprecation", "required": false, "type": "String", "value": "Asset.Assets.AccumulatedDeprecation"}, {"displayName": "Asset.Assets.Inventory", "required": false, "type": "String", "value": "Asset.Assets.Inventory"}, {"displayName": "Equity.EquityAndLiabilities.CapitalStock", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.CapitalStock"}, {"displayName": "Equity.EquityAndLiabilities.RetainedEarnings", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.RetainedEarnings"}, {"displayName": "Liability.EquityAndLiabilities.LongTermDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.LongTermDebt"}, {"displayName": "Liability.EquityAndLiabilities.CurrentPortionOfDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.CurrentPortionOfDebt"}, {"displayName": "Unknown.EquityAndLiabilities.Intercompany", "required": false, "type": "String", "value": "Unknown.EquityAndLiabilities.Intercompany"}, {"displayName": "Unknown.General.General", "required": false, "type": "String", "value": "Unknown.General.General"}, {"displayName": "Income.NetIncome.Revenue", "required": false, "type": "String", "value": "Income.NetIncome.Revenue"}, {"displayName": "Expense.NetIncome.CostOfGoods", "required": false, "type": "String", "value": "Expense.NetIncome.CostOfGoods"}, {"displayName": "Expense.NetIncome.OtherCosts", "required": false, "type": "String", "value": "Expense.NetIncome.OtherCosts"}, {"displayName": "Expense.NetIncome.SalesGeneralAdministrativeExpenses", "required": false, "type": "String", "value": "Expense.NetIncome.SalesGeneralAdministrativeExpenses"}, {"displayName": "Expense.NetIncome.DeprecationCosts", "required": false, "type": "String", "value": "Expense.NetIncome.DeprecationCosts"}, {"displayName": "Expense.NetIncome.ResearchAndDevelopment", "required": false, "type": "String", "value": "Expense.NetIncome.ResearchAndDevelopment"}, {"displayName": "Expense.NetIncome.EmployeeCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmployeeCosts"}, {"displayName": "Expense.NetIncome.EmploymentCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmploymentCosts"}, {"displayName": "Expense.ExceptionalIncome.ExceptionalCosts", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.ExceptionalCosts"}, {"displayName": "Income.ExceptionalIncome.ExceptionalIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.ExceptionalIncome"}, {"displayName": "Expense.ExceptionalIncome.IncomeTaxes", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.IncomeTaxes"}, {"displayName": "Income.ExceptionalIncome.InterestIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.InterestIncome"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "FullyQualifiedCategory"}], "warnings": []}}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Pending", "required": false, "type": "String", "value": "Pending"}, {"displayName": "Unknown", "required": false, "type": "String", "value": "Unknown"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Status"}], "warnings": []}}}, "required": true, "type": "Object"} + MYOB AccountRight and Essentials: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "If alphanumeric is supported, must be between 1 and 10 characters. Otherwise format is x-xxxx", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 60 characters", "field": "Name"}]}}, "description": {"description": "Description of the account", "displayName": "Description", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 255 characters", "field": "Description"}]}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Bank", "required": false, "type": "String", "value": "Asset.Bank"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.AccountReceivable"}, {"displayName": "Other Current Asset", "required": false, "type": "String", "value": "Asset.OtherCurrentAsset"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.FixedAsset"}, {"displayName": "Other Asset", "required": false, "type": "String", "value": "Asset.OtherAsset"}, {"displayName": "Cash", "required": false, "type": "String", "value": "Asset.CashAndBank"}, {"displayName": "Equipment Machinery", "required": false, "type": "String", "value": "Asset.Property Plant and Equipment"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.CreditCard"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.AccountsPayable"}, {"displayName": "Other Current Liability", "required": false, "type": "String", "value": "Liability.OtherCurrentLiability"}, {"displayName": "Long Term Liability", "required": false, "type": "String", "value": "Liability.LongTermLiability"}, {"displayName": "Other Liability", "required": false, "type": "String", "value": "Liability.OtherLiability"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Owner's Equity"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "OtherIncome"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense"}, {"displayName": "Sales Marketing", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "General Administrative", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "General Administrative", "required": false, "type": "String", "value": "Expense.Overhead"}, {"displayName": "Repairs Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Other Expense", "required": false, "type": "String", "value": "OtherExpense"}, {"displayName": "Cost of Sales", "required": false, "type": "String", "value": "CostOfSales"}, {"displayName": "Other", "required": false, "type": "String", "value": "Cost Of Goods Sold.Cost of Sales"}], "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Archived", "required": false, "type": "String", "value": "Archived"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 7 characters.", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 31 characters.", "field": "Name"}]}}, "description": {"description": "Description of the account", "displayName": "Description", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 200 characters.", "field": "Description"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "If not set, will default to the base currency of the QuickBooks Desktop company", "field": "Currency"}], "warnings": [{"details": "The currency must match the base currency of the QuickBooks Desktop company unless the FullyQualifiedCategory is 'Asset.AccountsReceivable','Liability.AccountsPayable' or 'Liability.CreditCard'", "field": "Currency"}, {"details": "Must be a three letter ISO code that matches an existing active currency in the QuickBooks Desktop company", "field": "Currency"}, {"details": "Can only be set if the Quickbooks Desktop company has Multicurrency enabled.", "field": "Currency"}]}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Account Receivable", "required": false, "type": "String", "value": "Asset.AccountsReceivable"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.FixedAsset"}, {"displayName": "Other Current Asset", "required": false, "type": "String", "value": "Asset.OtherCurrentAsset"}, {"displayName": "Other Asset", "required": false, "type": "String", "value": "Asset.OtherAsset"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income.Income"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "Income.OtherIncome"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.AccountsPayable"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.CreditCard"}, {"displayName": "Long Term Liability", "required": false, "type": "String", "value": "Liability.LongTermLiability"}, {"displayName": "Other Current Liability", "required": false, "type": "String", "value": "Liability.OtherCurrentLiability"}, {"displayName": "Cost Of Goods Sold", "required": false, "type": "String", "value": "Liability.CostOfGoodsSold"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity.Equity"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "Other Expense", "required": false, "type": "String", "value": "Expense.OtherExpense"}], "required": true, "type": "String"}, "currentBalance": {"description": "The current balance in the account", "displayName": "Current Balance", "required": false, "type": "Number"}}, "required": true, "type": "Object"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "If included must have a length between 1 and 7 characters", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 100 characters", "field": "Name"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "When not specified company base currency will be used", "field": "Currency"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Cash On Hand", "required": false, "type": "String", "value": "Asset.Bank.CashOnHand"}, {"displayName": "Checking", "required": false, "type": "String", "value": "Asset.Bank.Checking"}, {"displayName": "Money Market", "required": false, "type": "String", "value": "Asset.Bank.MoneyMarket"}, {"displayName": "Rents Held In Trust", "required": false, "type": "String", "value": "Asset.Bank.RentsHeldInTrust"}, {"displayName": "Savings", "required": false, "type": "String", "value": "Asset.Bank.Savings"}, {"displayName": "Trust Accounts", "required": false, "type": "String", "value": "Asset.Bank.TrustAccounts"}, {"displayName": "Cash And Cash Equivalents", "required": false, "type": "String", "value": "Asset.Bank.CashAndCashEquivalents"}, {"displayName": "Other Earmarked Bank Accounts", "required": false, "type": "String", "value": "Asset.Bank.OtherEarmarkedBankAccounts"}, {"displayName": "Allowance For Bad Debts", "required": false, "type": "String", "value": "Asset.Other Current Asset.AllowanceForBadDebts"}, {"displayName": "Development Costs", "required": false, "type": "String", "value": "Asset.Other Current Asset.DevelopmentCosts"}, {"displayName": "Employee Cash Advances", "required": false, "type": "String", "value": "Asset.Other Current Asset.EmployeeCashAdvances"}, {"displayName": "Other Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherCurrentAssets"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Other Current Asset.Inventory"}, {"displayName": "Investment Mortgage Real Estate Loans", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_MortgageRealEstateLoans"}, {"displayName": "Investment Other", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_Other"}, {"displayName": "Investment Tax Exempt Securities", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_TaxExemptSecurities"}, {"displayName": "Investment US Government Obligations", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_USGovernmentObligations"}, {"displayName": "Loans To Officers", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOfficers"}, {"displayName": "Loans To Others", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOthers"}, {"displayName": "Loans To Stockholders", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToStockholders"}, {"displayName": "Prepaid Expenses", "required": false, "type": "String", "value": "Asset.Other Current Asset.PrepaidExpenses"}, {"displayName": "Retainage", "required": false, "type": "String", "value": "Asset.Other Current Asset.Retainage"}, {"displayName": "Undeposited Funds", "required": false, "type": "String", "value": "Asset.Other Current Asset.UndepositedFunds"}, {"displayName": "Assets Available For Sale", "required": false, "type": "String", "value": "Asset.Other Current Asset.AssetsAvailableForSale"}, {"displayName": "Balance With Govt Authorities", "required": false, "type": "String", "value": "Asset.Other Current Asset.BalWithGovtAuthorities"}, {"displayName": "Called Up Share Capital Not Paid", "required": false, "type": "String", "value": "Asset.Other Current Asset.CalledUpShareCapitalNotPaid"}, {"displayName": "Expenditure Authorisations And Letters Of Credit", "required": false, "type": "String", "value": "Asset.Other Current Asset.ExpenditureAuthorisationsAndLettersOfCredit"}, {"displayName": "Global Tax Deferred", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxDeferred"}, {"displayName": "Global Tax Refund", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxRefund"}, {"displayName": "Internal Transfers", "required": false, "type": "String", "value": "Asset.Other Current Asset.InternalTransfers"}, {"displayName": "Other Consumables", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherConsumables"}, {"displayName": "Provisions Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.ProvisionsCurrentAssets"}, {"displayName": "Short Term Investments In Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermInvestmentsInRelatedParties"}, {"displayName": "Short Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Trade And Other Receivables", "required": false, "type": "String", "value": "Asset.Other Current Asset.TradeAndOtherReceivables"}, {"displayName": "Accumulated Depletion", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepletion"}, {"displayName": "Accumulated Depreciation", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepreciation"}, {"displayName": "Depletable Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.DepletableAssets"}, {"displayName": "Fixed Asset Computers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetComputers"}, {"displayName": "Fixed Asset Copiers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetCopiers"}, {"displayName": "Fixed Asset Furniture", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetFurniture"}, {"displayName": "Fixed Asset Phone", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhone"}, {"displayName": "Fixed Asset Photo Video", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhotoVideo"}, {"displayName": "Fixed Asset Software", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetSoftware"}, {"displayName": "Fixed Asset Other Tools Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetOtherToolsEquipment"}, {"displayName": "Furniture And Fixtures", "required": false, "type": "String", "value": "Asset.Fixed Asset.FurnitureAndFixtures"}, {"displayName": "Land", "required": false, "type": "String", "value": "Asset.Fixed Asset.Land"}, {"displayName": "Leasehold Improvements", "required": false, "type": "String", "value": "Asset.Fixed Asset.LeaseholdImprovements"}, {"displayName": "Other Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.OtherFixedAssets"}, {"displayName": "Accumulated Amortization", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedAmortization"}, {"displayName": "Buildings", "required": false, "type": "String", "value": "Asset.Fixed Asset.Buildings"}, {"displayName": "Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssets"}, {"displayName": "Machinery And Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.MachineryAndEquipment"}, {"displayName": "Vehicles", "required": false, "type": "String", "value": "Asset.Fixed Asset.Vehicles"}, {"displayName": "Assets In Course Of Construction", "required": false, "type": "String", "value": "Asset.Fixed Asset.AssetsInCourseOfConstruction"}, {"displayName": "Capital Wip", "required": false, "type": "String", "value": "Asset.Fixed Asset.CapitalWip"}, {"displayName": "Cumulative Depreciation On Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.CumulativeDepreciationOnIntangibleAssets"}, {"displayName": "Intangible Assets Under Development", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssetsUnderDevelopment"}, {"displayName": "Land Asset", "required": false, "type": "String", "value": "Asset.Fixed Asset.LandAsset"}, {"displayName": "Non Current Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.NonCurrentAssets"}, {"displayName": "Participating Interests", "required": false, "type": "String", "value": "Asset.Fixed Asset.ParticipatingInterests"}, {"displayName": "Provisions Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.ProvisionsFixedAssets"}, {"displayName": "Lease Buyout", "required": false, "type": "String", "value": "Asset.Other Asset.LeaseBuyout"}, {"displayName": "Other Long Term Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermAssets"}, {"displayName": "Security Deposits", "required": false, "type": "String", "value": "Asset.Other Asset.SecurityDeposits"}, {"displayName": "Accumulated Amortization Of Other Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AccumulatedAmortizationOfOtherAssets"}, {"displayName": "Goodwill", "required": false, "type": "String", "value": "Asset.Other Asset.Goodwill"}, {"displayName": "Licenses", "required": false, "type": "String", "value": "Asset.Other Asset.Licenses"}, {"displayName": "Organizational Costs", "required": false, "type": "String", "value": "Asset.Other Asset.OrganizationalCosts"}, {"displayName": "Assets Held For Sale", "required": false, "type": "String", "value": "Asset.Other Asset.AssetsHeldForSale"}, {"displayName": "Available For Sale Financial Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AvailableForSaleFinancialAssets"}, {"displayName": "Deferred Tax", "required": false, "type": "String", "value": "Asset.Other Asset.DeferredTax"}, {"displayName": "Investments", "required": false, "type": "String", "value": "Asset.Other Asset.Investments"}, {"displayName": "Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermInvestments"}, {"displayName": "Long Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Other Intangible Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherIntangibleAssets"}, {"displayName": "Other Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermInvestments"}, {"displayName": "Other Long Term Loans And Advances", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermLoansAndAdvances"}, {"displayName": "Prepayments And Accrued Income", "required": false, "type": "String", "value": "Asset.Other Asset.PrepaymentsAndAccruedIncome"}, {"displayName": "Provisions Non-Current Assets", "required": false, "type": "String", "value": "Asset.Other Asset.ProvisionsNonCurrentAssets"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.Accounts Receivable.AccountsReceivable"}, {"displayName": "Advertising/Promotional", "required": false, "type": "String", "value": "Expense.Expense.AdvertisingPromotional"}, {"displayName": "Bad Debts", "required": false, "type": "String", "value": "Expense.Expense.BadDebts"}, {"displayName": "Bank Charges", "required": false, "type": "String", "value": "Expense.Expense.BankCharges"}, {"displayName": "Charitable Contributions", "required": false, "type": "String", "value": "Expense.Expense.CharitableContributions"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Entertainment", "required": false, "type": "String", "value": "Expense.Expense.Entertainment"}, {"displayName": "Entertainment Meals", "required": false, "type": "String", "value": "Expense.Expense.EntertainmentMeals"}, {"displayName": "Equipment Rental", "required": false, "type": "String", "value": "Expense.Expense.EquipmentRental"}, {"displayName": "Finance Costs", "required": false, "type": "String", "value": "Expense.Expense.FinanceCosts"}, {"displayName": "Global Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.GlobalTaxExpense"}, {"displayName": "Insurance", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "Interest Paid", "required": false, "type": "String", "value": "Expense.Expense.InterestPaid"}, {"displayName": "Legal And Professional Fees", "required": false, "type": "String", "value": "Expense.Expense.LegalProfessionalFees"}, {"displayName": "Office Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeExpenses"}, {"displayName": "Office/General Administrative Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeGeneralAdministrativeExpenses"}, {"displayName": "Other Business Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherBusinessExpenses"}, {"displayName": "Other Miscellaneous Service Cost", "required": false, "type": "String", "value": "Expense.Expense.OtherMiscellaneousServiceCost"}, {"displayName": "Promotional Meals", "required": false, "type": "String", "value": "Expense.Expense.PromotionalMeals"}, {"displayName": "Rent Or Lease Of Buildings", "required": false, "type": "String", "value": "Expense.Expense.RentOrLeaseOfBuildings"}, {"displayName": "Repair And Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Shipping, Freight And Delivery", "required": false, "type": "String", "value": "Expense.Expense.ShippingFreightDelivery"}, {"displayName": "Supplies And Materials", "required": false, "type": "String", "value": "Expense.Expense.SuppliesMaterials"}, {"displayName": "Travel", "required": false, "type": "String", "value": "Expense.Expense.Travel"}, {"displayName": "Travel Meals", "required": false, "type": "String", "value": "Expense.Expense.TravelMeals"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Auto", "required": false, "type": "String", "value": "Expense.Expense.Auto"}, {"displayName": "Cost Of Labor", "required": false, "type": "String", "value": "Expense.Expense.CostOfLabor"}, {"displayName": "Dues And Subscriptions", "required": false, "type": "String", "value": "Expense.Expense.DuesSubscriptions"}, {"displayName": "Payroll Expenses", "required": false, "type": "String", "value": "Expense.Expense.PayrollExpenses"}, {"displayName": "Taxes Paid", "required": false, "type": "String", "value": "Expense.Expense.TaxesPaid"}, {"displayName": "Unapplied Cash Bill Payment Expense", "required": false, "type": "String", "value": "Expense.Expense.UnappliedCashBillPaymentExpense"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Amortization Expense", "required": false, "type": "String", "value": "Expense.Expense.AmortizationExpense"}, {"displayName": "Appropriations To Depreciation", "required": false, "type": "String", "value": "Expense.Expense.AppropriationsToDepreciation"}, {"displayName": "Borrowing Cost", "required": false, "type": "String", "value": "Expense.Expense.BorrowingCost"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Distribution Costs", "required": false, "type": "String", "value": "Expense.Expense.DistributionCosts"}, {"displayName": "External Services", "required": false, "type": "String", "value": "Expense.Expense.ExternalServices"}, {"displayName": "Extraordinary Charges", "required": false, "type": "String", "value": "Expense.Expense.ExtraordinaryCharges"}, {"displayName": "Income Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.IncomeTaxExpense"}, {"displayName": "Loss On Discontinued Operations Net Of Tax", "required": false, "type": "String", "value": "Expense.Expense.LossOnDiscontinuedOperationsNetOfTax"}, {"displayName": "Management Compensation", "required": false, "type": "String", "value": "Expense.Expense.ManagementCompensation"}, {"displayName": "Other Current Operating Charges", "required": false, "type": "String", "value": "Expense.Expense.OtherCurrentOperatingCharges"}, {"displayName": "Other External Services", "required": false, "type": "String", "value": "Expense.Expense.OtherExternalServices"}, {"displayName": "Other Rental Costs", "required": false, "type": "String", "value": "Expense.Expense.OtherRentalCosts"}, {"displayName": "Other Selling Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherSellingExpenses"}, {"displayName": "Project Studies Surveys Assessments", "required": false, "type": "String", "value": "Expense.Expense.ProjectStudiesSurveysAssessments"}, {"displayName": "Purchases Rebates", "required": false, "type": "String", "value": "Expense.Expense.PurchasesRebates"}, {"displayName": "Shipping And Delivery Expense", "required": false, "type": "String", "value": "Expense.Expense.ShippingAndDeliveryExpense"}, {"displayName": "Staff Costs", "required": false, "type": "String", "value": "Expense.Expense.StaffCosts"}, {"displayName": "Sundry", "required": false, "type": "String", "value": "Expense.Expense.Sundry"}, {"displayName": "Travel Expenses General And Admin Expenses", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesGeneralAndAdminExpenses"}, {"displayName": "Travel Expenses Selling Expense", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesSellingExpense"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Expense.Other Expense.Depreciation"}, {"displayName": "Exchange Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.ExchangeGainOrLoss"}, {"displayName": "Other Miscellaneous Expense", "required": false, "type": "String", "value": "Expense.Other Expense.OtherMiscellaneousExpense"}, {"displayName": "Penalties And Settlements", "required": false, "type": "String", "value": "Expense.Other Expense.PenaltiesSettlements"}, {"displayName": "Amortization", "required": false, "type": "String", "value": "Expense.Other Expense.Amortization"}, {"displayName": "Gas And Fuel", "required": false, "type": "String", "value": "Expense.Other Expense.GasAndFuel"}, {"displayName": "Home Office", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOffice"}, {"displayName": "Home Owner Rental Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOwnerRentalInsurance"}, {"displayName": "Other Home Office Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherHomeOfficeExpenses"}, {"displayName": "Mortgage Interest", "required": false, "type": "String", "value": "Expense.Other Expense.MortgageInterest"}, {"displayName": "Rent And Lease", "required": false, "type": "String", "value": "Expense.Other Expense.RentAndLease"}, {"displayName": "Repairs And Maintenance", "required": false, "type": "String", "value": "Expense.Other Expense.RepairsAndMaintenance"}, {"displayName": "Parking And Tolls", "required": false, "type": "String", "value": "Expense.Other Expense.ParkingAndTolls"}, {"displayName": "Vehicle", "required": false, "type": "String", "value": "Expense.Other Expense.Vehicle"}, {"displayName": "Vehicle Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleInsurance"}, {"displayName": "Vehicle Lease", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLease"}, {"displayName": "Vehicle Loan Interest", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoanInterest"}, {"displayName": "Vehicle Loan", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoan"}, {"displayName": "Vehicle Registration", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRegistration"}, {"displayName": "Vehicle Repairs", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRepairs"}, {"displayName": "Other Vehicle Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherVehicleExpenses"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Other Expense.Utilities"}, {"displayName": "Wash And Road Services", "required": false, "type": "String", "value": "Expense.Other Expense.WashAndRoadServices"}, {"displayName": "Deferred Tax Expense", "required": false, "type": "String", "value": "Expense.Other Expense.DeferredTaxExpense"}, {"displayName": "Depletion", "required": false, "type": "String", "value": "Expense.Other Expense.Depletion"}, {"displayName": "Exceptional Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExceptionalItems"}, {"displayName": "Extraordinary Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExtraordinaryItems"}, {"displayName": "Income Tax Other Expense", "required": false, "type": "String", "value": "Expense.Other Expense.IncomeTaxOtherExpense"}, {"displayName": "Mat Credit", "required": false, "type": "String", "value": "Expense.Other Expense.MatCredit"}, {"displayName": "Prior Period Items", "required": false, "type": "String", "value": "Expense.Other Expense.PriorPeriodItems"}, {"displayName": "Tax Roundoff Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.TaxRoundoffGainOrLoss"}, {"displayName": "Equipment Rental - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.EquipmentRentalCos"}, {"displayName": "Other Costs Of Sales - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.OtherCostsOfServiceCos"}, {"displayName": "Shipping, Freight And Delivery - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.ShippingFreightDeliveryCos"}, {"displayName": "Supplies And Materials - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.SuppliesMaterialsCogs"}, {"displayName": "Cost Of Labor - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfLaborCos"}, {"displayName": "Cost Of Sales", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfSales"}, {"displayName": "Freight And Delivery Cost", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.FreightAndDeliveryCost"}, {"displayName": "Non Profit Income", "required": false, "type": "String", "value": "Income.Income.NonProfitIncome"}, {"displayName": "Other Primary Income", "required": false, "type": "String", "value": "Income.Income.OtherPrimaryIncome"}, {"displayName": "Sales Of ProductIncome", "required": false, "type": "String", "value": "Income.Income.SalesOfProductIncome"}, {"displayName": "Service Fee Income", "required": false, "type": "String", "value": "Income.Income.ServiceFeeIncome"}, {"displayName": "Discounts Refunds Given", "required": false, "type": "String", "value": "Income.Income.DiscountsRefundsGiven"}, {"displayName": "Unapplied Cash Payment Income", "required": false, "type": "String", "value": "Income.Income.UnappliedCashPaymentIncome"}, {"displayName": "Cash Receipt Income", "required": false, "type": "String", "value": "Income.Income.CashReceiptIncome"}, {"displayName": "Operating Grants", "required": false, "type": "String", "value": "Income.Income.OperatingGrants"}, {"displayName": "Other Current Operating Income", "required": false, "type": "String", "value": "Income.Income.OtherCurrentOperatingIncome"}, {"displayName": "Own Work Capitalized", "required": false, "type": "String", "value": "Income.Income.OwnWorkCapitalized"}, {"displayName": "Revenue General", "required": false, "type": "String", "value": "Income.Income.RevenueGeneral"}, {"displayName": "Sales Retail", "required": false, "type": "String", "value": "Income.Income.SalesRetail"}, {"displayName": "Sales Wholesale", "required": false, "type": "String", "value": "Income.Income.SalesWholesale"}, {"displayName": "Savings By Tax Scheme", "required": false, "type": "String", "value": "Income.Income.SavingsByTaxScheme"}, {"displayName": "Dividend Income", "required": false, "type": "String", "value": "Income.Other Income.DividendIncome"}, {"displayName": "Interest Earned", "required": false, "type": "String", "value": "Income.Other Income.InterestEarned"}, {"displayName": "Other Investment Income", "required": false, "type": "String", "value": "Income.Other Income.OtherInvestmentIncome"}, {"displayName": "Other Miscellaneous Income", "required": false, "type": "String", "value": "Income.Other Income.OtherMiscellaneousIncome"}, {"displayName": "Tax Exempt Interest", "required": false, "type": "String", "value": "Income.Other Income.TaxExemptInterest"}, {"displayName": "Gain Loss On Sale Of Fixed Assets", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfFixedAssets"}, {"displayName": "Gain Loss On Sale Of Investments", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfInvestments"}, {"displayName": "Loss On Disposal Of Assets", "required": false, "type": "String", "value": "Income.Other Income.LossOnDisposalOfAssets"}, {"displayName": "Other Operating Income", "required": false, "type": "String", "value": "Income.Other Income.OtherOperatingIncome"}, {"displayName": "Unrealised Loss On Securities Net Of Tax", "required": false, "type": "String", "value": "Income.Other Income.UnrealisedLossOnSecuritiesNetOfTax"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.Accounts Payable.AccountsPayable"}, {"displayName": "Outstanding Dues Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesMicroSmallEnterprise"}, {"displayName": "Outstanding Dues Other Than Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesOtherThanMicroSmallEnterprise"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.Credit Card.CreditCard"}, {"displayName": "Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.NotesPayable"}, {"displayName": "Other Long Term Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermLiabilities"}, {"displayName": "Shareholder Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.ShareholderNotesPayable"}, {"displayName": "Accruals And Deferred Income", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccrualsAndDeferredIncome"}, {"displayName": "Accrued Long Lerm Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedLongLermLiabilities"}, {"displayName": "Accrued Vacation Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedVacationPayable"}, {"displayName": "Bank Loans", "required": false, "type": "String", "value": "Liability.Long Term Liability.BankLoans"}, {"displayName": "Debts Related To Participating Interests", "required": false, "type": "String", "value": "Liability.Long Term Liability.DebtsRelatedToParticipatingInterests"}, {"displayName": "Deferred Tax Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.DeferredTaxLiabilities"}, {"displayName": "Government And Other Public Authorities", "required": false, "type": "String", "value": "Liability.Long Term Liability.GovernmentAndOtherPublicAuthorities"}, {"displayName": "Group And Associates", "required": false, "type": "String", "value": "Liability.Long Term Liability.GroupAndAssociates"}, {"displayName": "Liabilities Related To Assets Held For Sale", "required": false, "type": "String", "value": "Liability.Long Term Liability.LiabilitiesRelatedToAssetsHeldForSale"}, {"displayName": "Long Term Borrowings", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermBorrowings"}, {"displayName": "Long Term Debit", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermDebit"}, {"displayName": "Long Term Employee Benefit Obligations", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermEmployeeBenefitObligations"}, {"displayName": "Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Long Term Liability.ObligationsUnderFinanceLeases"}, {"displayName": "Other Long Term Provisions", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermProvisions"}, {"displayName": "Provision For Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionForLiabilities"}, {"displayName": "Provisions Non Current Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionsNonCurrentLiabilities"}, {"displayName": "Staff And Related Long Term Liability Accounts", "required": false, "type": "String", "value": "Liability.Long Term Liability.StaffAndRelatedLongTermLiabilityAccounts"}, {"displayName": "Direct Deposit Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DirectDepositPayable"}, {"displayName": "Line Of Credit", "required": false, "type": "String", "value": "Liability.Other Current Liability.LineOfCredit"}, {"displayName": "Loan Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.LoanPayable"}, {"displayName": "Global Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxPayable"}, {"displayName": "Global Tax Suspense", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxSuspense"}, {"displayName": "Other Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.OtherCurrentLiabilities"}, {"displayName": "Payroll Clearing", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollClearing"}, {"displayName": "Payroll Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollTaxPayable"}, {"displayName": "Prepaid Expenses Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PrepaidExpensesPayable"}, {"displayName": "Rents In Trust Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.RentsInTrustLiability"}, {"displayName": "Trust Accounts Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.TrustAccountsLiabilities"}, {"displayName": "Federal Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.FederalIncomeTaxPayable"}, {"displayName": "Insurance Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.InsurancePayable"}, {"displayName": "Sales Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.SalesTaxPayable"}, {"displayName": "State Local Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.StateLocalIncomeTaxPayable"}, {"displayName": "Accrued Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.AccruedLiabilities"}, {"displayName": "Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentLiabilities"}, {"displayName": "Current Portion EmployeeBenefits Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionEmployeeBenefitsObligations"}, {"displayName": "Current Portion Of Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionOfObligationsUnderFinanceLeases"}, {"displayName": "Current Tax Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentTaxLiability"}, {"displayName": "Dividends Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DividendsPayable"}, {"displayName": "Duties And Taxes", "required": false, "type": "String", "value": "Liability.Other Current Liability.DutiesAndTaxes"}, {"displayName": "Interest Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.InterestPayables"}, {"displayName": "Provision For Warranty Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionForWarrantyObligations"}, {"displayName": "Provisions Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionsCurrentLiabilities"}, {"displayName": "Short Term Borrowings", "required": false, "type": "String", "value": "Liability.Other Current Liability.ShortTermBorrowings"}, {"displayName": "Social Security Agencies", "required": false, "type": "String", "value": "Liability.Other Current Liability.SocialSecurityAgencies"}, {"displayName": "Staff And Related Liability Accounts", "required": false, "type": "String", "value": "Liability.Other Current Liability.StaffAndRelatedLiabilityAccounts"}, {"displayName": "Sundry Debtors And Creditors", "required": false, "type": "String", "value": "Liability.Other Current Liability.SundryDebtorsAndCreditors"}, {"displayName": "Trade And Other Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.TradeAndOtherPayables"}, {"displayName": "Opening Balance Equity", "required": false, "type": "String", "value": "Equity.Equity.OpeningBalanceEquity"}, {"displayName": "Partners Equity", "required": false, "type": "String", "value": "Equity.Equity.PartnersEquity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Accumulated Adjustment", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedAdjustment"}, {"displayName": "Owners Equity", "required": false, "type": "String", "value": "Equity.Equity.OwnersEquity"}, {"displayName": "Paid In Capital Or Surplus", "required": false, "type": "String", "value": "Equity.Equity.PaidInCapitalOrSurplus"}, {"displayName": "Partner Contributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerContributions"}, {"displayName": "Partner Distributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerDistributions"}, {"displayName": "Preferred Stock", "required": false, "type": "String", "value": "Equity.Equity.PreferredStock"}, {"displayName": "Common Stock", "required": false, "type": "String", "value": "Equity.Equity.CommonStock"}, {"displayName": "Treasury Stock", "required": false, "type": "String", "value": "Equity.Equity.TreasuryStock"}, {"displayName": "Estimated Taxes", "required": false, "type": "String", "value": "Equity.Equity.EstimatedTaxes"}, {"displayName": "Healthcare", "required": false, "type": "String", "value": "Equity.Equity.Healthcare"}, {"displayName": "Personal Income", "required": false, "type": "String", "value": "Equity.Equity.PersonalIncome"}, {"displayName": "Personal Expense", "required": false, "type": "String", "value": "Equity.Equity.PersonalExpense"}, {"displayName": "Accumulated Other Comprehensive Income", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedOtherComprehensiveIncome"}, {"displayName": "Called Up Share Capital", "required": false, "type": "String", "value": "Equity.Equity.CalledUpShareCapital"}, {"displayName": "Capital Reserves", "required": false, "type": "String", "value": "Equity.Equity.CapitalReserves"}, {"displayName": "Dividend Disbursed", "required": false, "type": "String", "value": "Equity.Equity.DividendDisbursed"}, {"displayName": "Equity In Earnings Of Subsiduaries", "required": false, "type": "String", "value": "Equity.Equity.EquityInEarningsOfSubsiduaries"}, {"displayName": "Investment Grants", "required": false, "type": "String", "value": "Equity.Equity.InvestmentGrants"}, {"displayName": "Money Received Against Share Warrants", "required": false, "type": "String", "value": "Equity.Equity.MoneyReceivedAgainstShareWarrants"}, {"displayName": "Other Free Reserves", "required": false, "type": "String", "value": "Equity.Equity.OtherFreeReserves"}, {"displayName": "Share Application Money Pending Allotment", "required": false, "type": "String", "value": "Equity.Equity.ShareApplicationMoneyPendingAllotment"}, {"displayName": "Share Capital", "required": false, "type": "String", "value": "Equity.Equity.ShareCapital"}, {"displayName": "Funds", "required": false, "type": "String", "value": "Equity.Equity.Funds"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "If included must have a length between 1 and 7 characters", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 100 characters", "field": "Name"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "When not specified company base currency will be used", "field": "Currency"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Cash On Hand", "required": false, "type": "String", "value": "Asset.Bank.CashOnHand"}, {"displayName": "Checking", "required": false, "type": "String", "value": "Asset.Bank.Checking"}, {"displayName": "Money Market", "required": false, "type": "String", "value": "Asset.Bank.MoneyMarket"}, {"displayName": "Rents Held In Trust", "required": false, "type": "String", "value": "Asset.Bank.RentsHeldInTrust"}, {"displayName": "Savings", "required": false, "type": "String", "value": "Asset.Bank.Savings"}, {"displayName": "Trust Accounts", "required": false, "type": "String", "value": "Asset.Bank.TrustAccounts"}, {"displayName": "Cash And Cash Equivalents", "required": false, "type": "String", "value": "Asset.Bank.CashAndCashEquivalents"}, {"displayName": "Other Earmarked Bank Accounts", "required": false, "type": "String", "value": "Asset.Bank.OtherEarmarkedBankAccounts"}, {"displayName": "Allowance For Bad Debts", "required": false, "type": "String", "value": "Asset.Other Current Asset.AllowanceForBadDebts"}, {"displayName": "Development Costs", "required": false, "type": "String", "value": "Asset.Other Current Asset.DevelopmentCosts"}, {"displayName": "Employee Cash Advances", "required": false, "type": "String", "value": "Asset.Other Current Asset.EmployeeCashAdvances"}, {"displayName": "Other Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherCurrentAssets"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Other Current Asset.Inventory"}, {"displayName": "Investment Mortgage Real Estate Loans", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_MortgageRealEstateLoans"}, {"displayName": "Investment Other", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_Other"}, {"displayName": "Investment Tax Exempt Securities", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_TaxExemptSecurities"}, {"displayName": "Investment US Government Obligations", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_USGovernmentObligations"}, {"displayName": "Loans To Officers", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOfficers"}, {"displayName": "Loans To Others", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOthers"}, {"displayName": "Loans To Stockholders", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToStockholders"}, {"displayName": "Prepaid Expenses", "required": false, "type": "String", "value": "Asset.Other Current Asset.PrepaidExpenses"}, {"displayName": "Retainage", "required": false, "type": "String", "value": "Asset.Other Current Asset.Retainage"}, {"displayName": "Undeposited Funds", "required": false, "type": "String", "value": "Asset.Other Current Asset.UndepositedFunds"}, {"displayName": "Assets Available For Sale", "required": false, "type": "String", "value": "Asset.Other Current Asset.AssetsAvailableForSale"}, {"displayName": "Balance With Govt Authorities", "required": false, "type": "String", "value": "Asset.Other Current Asset.BalWithGovtAuthorities"}, {"displayName": "Called Up Share Capital Not Paid", "required": false, "type": "String", "value": "Asset.Other Current Asset.CalledUpShareCapitalNotPaid"}, {"displayName": "Expenditure Authorisations And Letters Of Credit", "required": false, "type": "String", "value": "Asset.Other Current Asset.ExpenditureAuthorisationsAndLettersOfCredit"}, {"displayName": "Global Tax Deferred", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxDeferred"}, {"displayName": "Global Tax Refund", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxRefund"}, {"displayName": "Internal Transfers", "required": false, "type": "String", "value": "Asset.Other Current Asset.InternalTransfers"}, {"displayName": "Other Consumables", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherConsumables"}, {"displayName": "Provisions Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.ProvisionsCurrentAssets"}, {"displayName": "Short Term Investments In Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermInvestmentsInRelatedParties"}, {"displayName": "Short Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Trade And Other Receivables", "required": false, "type": "String", "value": "Asset.Other Current Asset.TradeAndOtherReceivables"}, {"displayName": "Accumulated Depletion", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepletion"}, {"displayName": "Accumulated Depreciation", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepreciation"}, {"displayName": "Depletable Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.DepletableAssets"}, {"displayName": "Fixed Asset Computers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetComputers"}, {"displayName": "Fixed Asset Copiers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetCopiers"}, {"displayName": "Fixed Asset Furniture", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetFurniture"}, {"displayName": "Fixed Asset Phone", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhone"}, {"displayName": "Fixed Asset Photo Video", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhotoVideo"}, {"displayName": "Fixed Asset Software", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetSoftware"}, {"displayName": "Fixed Asset Other Tools Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetOtherToolsEquipment"}, {"displayName": "Furniture And Fixtures", "required": false, "type": "String", "value": "Asset.Fixed Asset.FurnitureAndFixtures"}, {"displayName": "Land", "required": false, "type": "String", "value": "Asset.Fixed Asset.Land"}, {"displayName": "Leasehold Improvements", "required": false, "type": "String", "value": "Asset.Fixed Asset.LeaseholdImprovements"}, {"displayName": "Other Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.OtherFixedAssets"}, {"displayName": "Accumulated Amortization", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedAmortization"}, {"displayName": "Buildings", "required": false, "type": "String", "value": "Asset.Fixed Asset.Buildings"}, {"displayName": "Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssets"}, {"displayName": "Machinery And Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.MachineryAndEquipment"}, {"displayName": "Vehicles", "required": false, "type": "String", "value": "Asset.Fixed Asset.Vehicles"}, {"displayName": "Assets In Course Of Construction", "required": false, "type": "String", "value": "Asset.Fixed Asset.AssetsInCourseOfConstruction"}, {"displayName": "Capital Wip", "required": false, "type": "String", "value": "Asset.Fixed Asset.CapitalWip"}, {"displayName": "Cumulative Depreciation On Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.CumulativeDepreciationOnIntangibleAssets"}, {"displayName": "Intangible Assets Under Development", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssetsUnderDevelopment"}, {"displayName": "Land Asset", "required": false, "type": "String", "value": "Asset.Fixed Asset.LandAsset"}, {"displayName": "Non Current Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.NonCurrentAssets"}, {"displayName": "Participating Interests", "required": false, "type": "String", "value": "Asset.Fixed Asset.ParticipatingInterests"}, {"displayName": "Provisions Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.ProvisionsFixedAssets"}, {"displayName": "Lease Buyout", "required": false, "type": "String", "value": "Asset.Other Asset.LeaseBuyout"}, {"displayName": "Other Long Term Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermAssets"}, {"displayName": "Security Deposits", "required": false, "type": "String", "value": "Asset.Other Asset.SecurityDeposits"}, {"displayName": "Accumulated Amortization Of Other Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AccumulatedAmortizationOfOtherAssets"}, {"displayName": "Goodwill", "required": false, "type": "String", "value": "Asset.Other Asset.Goodwill"}, {"displayName": "Licenses", "required": false, "type": "String", "value": "Asset.Other Asset.Licenses"}, {"displayName": "Organizational Costs", "required": false, "type": "String", "value": "Asset.Other Asset.OrganizationalCosts"}, {"displayName": "Assets Held For Sale", "required": false, "type": "String", "value": "Asset.Other Asset.AssetsHeldForSale"}, {"displayName": "Available For Sale Financial Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AvailableForSaleFinancialAssets"}, {"displayName": "Deferred Tax", "required": false, "type": "String", "value": "Asset.Other Asset.DeferredTax"}, {"displayName": "Investments", "required": false, "type": "String", "value": "Asset.Other Asset.Investments"}, {"displayName": "Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermInvestments"}, {"displayName": "Long Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Other Intangible Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherIntangibleAssets"}, {"displayName": "Other Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermInvestments"}, {"displayName": "Other Long Term Loans And Advances", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermLoansAndAdvances"}, {"displayName": "Prepayments And Accrued Income", "required": false, "type": "String", "value": "Asset.Other Asset.PrepaymentsAndAccruedIncome"}, {"displayName": "Provisions Non-Current Assets", "required": false, "type": "String", "value": "Asset.Other Asset.ProvisionsNonCurrentAssets"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.Accounts Receivable.AccountsReceivable"}, {"displayName": "Advertising/Promotional", "required": false, "type": "String", "value": "Expense.Expense.AdvertisingPromotional"}, {"displayName": "Bad Debts", "required": false, "type": "String", "value": "Expense.Expense.BadDebts"}, {"displayName": "Bank Charges", "required": false, "type": "String", "value": "Expense.Expense.BankCharges"}, {"displayName": "Charitable Contributions", "required": false, "type": "String", "value": "Expense.Expense.CharitableContributions"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Entertainment", "required": false, "type": "String", "value": "Expense.Expense.Entertainment"}, {"displayName": "Entertainment Meals", "required": false, "type": "String", "value": "Expense.Expense.EntertainmentMeals"}, {"displayName": "Equipment Rental", "required": false, "type": "String", "value": "Expense.Expense.EquipmentRental"}, {"displayName": "Finance Costs", "required": false, "type": "String", "value": "Expense.Expense.FinanceCosts"}, {"displayName": "Global Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.GlobalTaxExpense"}, {"displayName": "Insurance", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "Interest Paid", "required": false, "type": "String", "value": "Expense.Expense.InterestPaid"}, {"displayName": "Legal And Professional Fees", "required": false, "type": "String", "value": "Expense.Expense.LegalProfessionalFees"}, {"displayName": "Office Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeExpenses"}, {"displayName": "Office/General Administrative Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeGeneralAdministrativeExpenses"}, {"displayName": "Other Business Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherBusinessExpenses"}, {"displayName": "Other Miscellaneous Service Cost", "required": false, "type": "String", "value": "Expense.Expense.OtherMiscellaneousServiceCost"}, {"displayName": "Promotional Meals", "required": false, "type": "String", "value": "Expense.Expense.PromotionalMeals"}, {"displayName": "Rent Or Lease Of Buildings", "required": false, "type": "String", "value": "Expense.Expense.RentOrLeaseOfBuildings"}, {"displayName": "Repair And Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Shipping, Freight And Delivery", "required": false, "type": "String", "value": "Expense.Expense.ShippingFreightDelivery"}, {"displayName": "Supplies And Materials", "required": false, "type": "String", "value": "Expense.Expense.SuppliesMaterials"}, {"displayName": "Travel", "required": false, "type": "String", "value": "Expense.Expense.Travel"}, {"displayName": "Travel Meals", "required": false, "type": "String", "value": "Expense.Expense.TravelMeals"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Auto", "required": false, "type": "String", "value": "Expense.Expense.Auto"}, {"displayName": "Cost Of Labor", "required": false, "type": "String", "value": "Expense.Expense.CostOfLabor"}, {"displayName": "Dues And Subscriptions", "required": false, "type": "String", "value": "Expense.Expense.DuesSubscriptions"}, {"displayName": "Payroll Expenses", "required": false, "type": "String", "value": "Expense.Expense.PayrollExpenses"}, {"displayName": "Taxes Paid", "required": false, "type": "String", "value": "Expense.Expense.TaxesPaid"}, {"displayName": "Unapplied Cash Bill Payment Expense", "required": false, "type": "String", "value": "Expense.Expense.UnappliedCashBillPaymentExpense"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Amortization Expense", "required": false, "type": "String", "value": "Expense.Expense.AmortizationExpense"}, {"displayName": "Appropriations To Depreciation", "required": false, "type": "String", "value": "Expense.Expense.AppropriationsToDepreciation"}, {"displayName": "Borrowing Cost", "required": false, "type": "String", "value": "Expense.Expense.BorrowingCost"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Distribution Costs", "required": false, "type": "String", "value": "Expense.Expense.DistributionCosts"}, {"displayName": "External Services", "required": false, "type": "String", "value": "Expense.Expense.ExternalServices"}, {"displayName": "Extraordinary Charges", "required": false, "type": "String", "value": "Expense.Expense.ExtraordinaryCharges"}, {"displayName": "Income Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.IncomeTaxExpense"}, {"displayName": "Loss On Discontinued Operations Net Of Tax", "required": false, "type": "String", "value": "Expense.Expense.LossOnDiscontinuedOperationsNetOfTax"}, {"displayName": "Management Compensation", "required": false, "type": "String", "value": "Expense.Expense.ManagementCompensation"}, {"displayName": "Other Current Operating Charges", "required": false, "type": "String", "value": "Expense.Expense.OtherCurrentOperatingCharges"}, {"displayName": "Other External Services", "required": false, "type": "String", "value": "Expense.Expense.OtherExternalServices"}, {"displayName": "Other Rental Costs", "required": false, "type": "String", "value": "Expense.Expense.OtherRentalCosts"}, {"displayName": "Other Selling Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherSellingExpenses"}, {"displayName": "Project Studies Surveys Assessments", "required": false, "type": "String", "value": "Expense.Expense.ProjectStudiesSurveysAssessments"}, {"displayName": "Purchases Rebates", "required": false, "type": "String", "value": "Expense.Expense.PurchasesRebates"}, {"displayName": "Shipping And Delivery Expense", "required": false, "type": "String", "value": "Expense.Expense.ShippingAndDeliveryExpense"}, {"displayName": "Staff Costs", "required": false, "type": "String", "value": "Expense.Expense.StaffCosts"}, {"displayName": "Sundry", "required": false, "type": "String", "value": "Expense.Expense.Sundry"}, {"displayName": "Travel Expenses General And Admin Expenses", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesGeneralAndAdminExpenses"}, {"displayName": "Travel Expenses Selling Expense", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesSellingExpense"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Expense.Other Expense.Depreciation"}, {"displayName": "Exchange Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.ExchangeGainOrLoss"}, {"displayName": "Other Miscellaneous Expense", "required": false, "type": "String", "value": "Expense.Other Expense.OtherMiscellaneousExpense"}, {"displayName": "Penalties And Settlements", "required": false, "type": "String", "value": "Expense.Other Expense.PenaltiesSettlements"}, {"displayName": "Amortization", "required": false, "type": "String", "value": "Expense.Other Expense.Amortization"}, {"displayName": "Gas And Fuel", "required": false, "type": "String", "value": "Expense.Other Expense.GasAndFuel"}, {"displayName": "Home Office", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOffice"}, {"displayName": "Home Owner Rental Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOwnerRentalInsurance"}, {"displayName": "Other Home Office Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherHomeOfficeExpenses"}, {"displayName": "Mortgage Interest", "required": false, "type": "String", "value": "Expense.Other Expense.MortgageInterest"}, {"displayName": "Rent And Lease", "required": false, "type": "String", "value": "Expense.Other Expense.RentAndLease"}, {"displayName": "Repairs And Maintenance", "required": false, "type": "String", "value": "Expense.Other Expense.RepairsAndMaintenance"}, {"displayName": "Parking And Tolls", "required": false, "type": "String", "value": "Expense.Other Expense.ParkingAndTolls"}, {"displayName": "Vehicle", "required": false, "type": "String", "value": "Expense.Other Expense.Vehicle"}, {"displayName": "Vehicle Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleInsurance"}, {"displayName": "Vehicle Lease", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLease"}, {"displayName": "Vehicle Loan Interest", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoanInterest"}, {"displayName": "Vehicle Loan", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoan"}, {"displayName": "Vehicle Registration", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRegistration"}, {"displayName": "Vehicle Repairs", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRepairs"}, {"displayName": "Other Vehicle Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherVehicleExpenses"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Other Expense.Utilities"}, {"displayName": "Wash And Road Services", "required": false, "type": "String", "value": "Expense.Other Expense.WashAndRoadServices"}, {"displayName": "Deferred Tax Expense", "required": false, "type": "String", "value": "Expense.Other Expense.DeferredTaxExpense"}, {"displayName": "Depletion", "required": false, "type": "String", "value": "Expense.Other Expense.Depletion"}, {"displayName": "Exceptional Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExceptionalItems"}, {"displayName": "Extraordinary Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExtraordinaryItems"}, {"displayName": "Income Tax Other Expense", "required": false, "type": "String", "value": "Expense.Other Expense.IncomeTaxOtherExpense"}, {"displayName": "Mat Credit", "required": false, "type": "String", "value": "Expense.Other Expense.MatCredit"}, {"displayName": "Prior Period Items", "required": false, "type": "String", "value": "Expense.Other Expense.PriorPeriodItems"}, {"displayName": "Tax Roundoff Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.TaxRoundoffGainOrLoss"}, {"displayName": "Equipment Rental - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.EquipmentRentalCos"}, {"displayName": "Other Costs Of Sales - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.OtherCostsOfServiceCos"}, {"displayName": "Shipping, Freight And Delivery - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.ShippingFreightDeliveryCos"}, {"displayName": "Supplies And Materials - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.SuppliesMaterialsCogs"}, {"displayName": "Cost Of Labor - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfLaborCos"}, {"displayName": "Cost Of Sales", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfSales"}, {"displayName": "Freight And Delivery Cost", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.FreightAndDeliveryCost"}, {"displayName": "Non Profit Income", "required": false, "type": "String", "value": "Income.Income.NonProfitIncome"}, {"displayName": "Other Primary Income", "required": false, "type": "String", "value": "Income.Income.OtherPrimaryIncome"}, {"displayName": "Sales Of ProductIncome", "required": false, "type": "String", "value": "Income.Income.SalesOfProductIncome"}, {"displayName": "Service Fee Income", "required": false, "type": "String", "value": "Income.Income.ServiceFeeIncome"}, {"displayName": "Discounts Refunds Given", "required": false, "type": "String", "value": "Income.Income.DiscountsRefundsGiven"}, {"displayName": "Unapplied Cash Payment Income", "required": false, "type": "String", "value": "Income.Income.UnappliedCashPaymentIncome"}, {"displayName": "Cash Receipt Income", "required": false, "type": "String", "value": "Income.Income.CashReceiptIncome"}, {"displayName": "Operating Grants", "required": false, "type": "String", "value": "Income.Income.OperatingGrants"}, {"displayName": "Other Current Operating Income", "required": false, "type": "String", "value": "Income.Income.OtherCurrentOperatingIncome"}, {"displayName": "Own Work Capitalized", "required": false, "type": "String", "value": "Income.Income.OwnWorkCapitalized"}, {"displayName": "Revenue General", "required": false, "type": "String", "value": "Income.Income.RevenueGeneral"}, {"displayName": "Sales Retail", "required": false, "type": "String", "value": "Income.Income.SalesRetail"}, {"displayName": "Sales Wholesale", "required": false, "type": "String", "value": "Income.Income.SalesWholesale"}, {"displayName": "Savings By Tax Scheme", "required": false, "type": "String", "value": "Income.Income.SavingsByTaxScheme"}, {"displayName": "Dividend Income", "required": false, "type": "String", "value": "Income.Other Income.DividendIncome"}, {"displayName": "Interest Earned", "required": false, "type": "String", "value": "Income.Other Income.InterestEarned"}, {"displayName": "Other Investment Income", "required": false, "type": "String", "value": "Income.Other Income.OtherInvestmentIncome"}, {"displayName": "Other Miscellaneous Income", "required": false, "type": "String", "value": "Income.Other Income.OtherMiscellaneousIncome"}, {"displayName": "Tax Exempt Interest", "required": false, "type": "String", "value": "Income.Other Income.TaxExemptInterest"}, {"displayName": "Gain Loss On Sale Of Fixed Assets", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfFixedAssets"}, {"displayName": "Gain Loss On Sale Of Investments", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfInvestments"}, {"displayName": "Loss On Disposal Of Assets", "required": false, "type": "String", "value": "Income.Other Income.LossOnDisposalOfAssets"}, {"displayName": "Other Operating Income", "required": false, "type": "String", "value": "Income.Other Income.OtherOperatingIncome"}, {"displayName": "Unrealised Loss On Securities Net Of Tax", "required": false, "type": "String", "value": "Income.Other Income.UnrealisedLossOnSecuritiesNetOfTax"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.Accounts Payable.AccountsPayable"}, {"displayName": "Outstanding Dues Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesMicroSmallEnterprise"}, {"displayName": "Outstanding Dues Other Than Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesOtherThanMicroSmallEnterprise"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.Credit Card.CreditCard"}, {"displayName": "Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.NotesPayable"}, {"displayName": "Other Long Term Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermLiabilities"}, {"displayName": "Shareholder Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.ShareholderNotesPayable"}, {"displayName": "Accruals And Deferred Income", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccrualsAndDeferredIncome"}, {"displayName": "Accrued Long Lerm Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedLongLermLiabilities"}, {"displayName": "Accrued Vacation Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedVacationPayable"}, {"displayName": "Bank Loans", "required": false, "type": "String", "value": "Liability.Long Term Liability.BankLoans"}, {"displayName": "Debts Related To Participating Interests", "required": false, "type": "String", "value": "Liability.Long Term Liability.DebtsRelatedToParticipatingInterests"}, {"displayName": "Deferred Tax Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.DeferredTaxLiabilities"}, {"displayName": "Government And Other Public Authorities", "required": false, "type": "String", "value": "Liability.Long Term Liability.GovernmentAndOtherPublicAuthorities"}, {"displayName": "Group And Associates", "required": false, "type": "String", "value": "Liability.Long Term Liability.GroupAndAssociates"}, {"displayName": "Liabilities Related To Assets Held For Sale", "required": false, "type": "String", "value": "Liability.Long Term Liability.LiabilitiesRelatedToAssetsHeldForSale"}, {"displayName": "Long Term Borrowings", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermBorrowings"}, {"displayName": "Long Term Debit", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermDebit"}, {"displayName": "Long Term Employee Benefit Obligations", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermEmployeeBenefitObligations"}, {"displayName": "Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Long Term Liability.ObligationsUnderFinanceLeases"}, {"displayName": "Other Long Term Provisions", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermProvisions"}, {"displayName": "Provision For Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionForLiabilities"}, {"displayName": "Provisions Non Current Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionsNonCurrentLiabilities"}, {"displayName": "Staff And Related Long Term Liability Accounts", "required": false, "type": "String", "value": "Liability.Long Term Liability.StaffAndRelatedLongTermLiabilityAccounts"}, {"displayName": "Direct Deposit Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DirectDepositPayable"}, {"displayName": "Line Of Credit", "required": false, "type": "String", "value": "Liability.Other Current Liability.LineOfCredit"}, {"displayName": "Loan Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.LoanPayable"}, {"displayName": "Global Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxPayable"}, {"displayName": "Global Tax Suspense", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxSuspense"}, {"displayName": "Other Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.OtherCurrentLiabilities"}, {"displayName": "Payroll Clearing", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollClearing"}, {"displayName": "Payroll Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollTaxPayable"}, {"displayName": "Prepaid Expenses Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PrepaidExpensesPayable"}, {"displayName": "Rents In Trust Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.RentsInTrustLiability"}, {"displayName": "Trust Accounts Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.TrustAccountsLiabilities"}, {"displayName": "Federal Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.FederalIncomeTaxPayable"}, {"displayName": "Insurance Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.InsurancePayable"}, {"displayName": "Sales Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.SalesTaxPayable"}, {"displayName": "State Local Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.StateLocalIncomeTaxPayable"}, {"displayName": "Accrued Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.AccruedLiabilities"}, {"displayName": "Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentLiabilities"}, {"displayName": "Current Portion EmployeeBenefits Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionEmployeeBenefitsObligations"}, {"displayName": "Current Portion Of Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionOfObligationsUnderFinanceLeases"}, {"displayName": "Current Tax Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentTaxLiability"}, {"displayName": "Dividends Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DividendsPayable"}, {"displayName": "Duties And Taxes", "required": false, "type": "String", "value": "Liability.Other Current Liability.DutiesAndTaxes"}, {"displayName": "Interest Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.InterestPayables"}, {"displayName": "Provision For Warranty Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionForWarrantyObligations"}, {"displayName": "Provisions Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionsCurrentLiabilities"}, {"displayName": "Short Term Borrowings", "required": false, "type": "String", "value": "Liability.Other Current Liability.ShortTermBorrowings"}, {"displayName": "Social Security Agencies", "required": false, "type": "String", "value": "Liability.Other Current Liability.SocialSecurityAgencies"}, {"displayName": "Staff And Related Liability Accounts", "required": false, "type": "String", "value": "Liability.Other Current Liability.StaffAndRelatedLiabilityAccounts"}, {"displayName": "Sundry Debtors And Creditors", "required": false, "type": "String", "value": "Liability.Other Current Liability.SundryDebtorsAndCreditors"}, {"displayName": "Trade And Other Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.TradeAndOtherPayables"}, {"displayName": "Opening Balance Equity", "required": false, "type": "String", "value": "Equity.Equity.OpeningBalanceEquity"}, {"displayName": "Partners Equity", "required": false, "type": "String", "value": "Equity.Equity.PartnersEquity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Accumulated Adjustment", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedAdjustment"}, {"displayName": "Owners Equity", "required": false, "type": "String", "value": "Equity.Equity.OwnersEquity"}, {"displayName": "Paid In Capital Or Surplus", "required": false, "type": "String", "value": "Equity.Equity.PaidInCapitalOrSurplus"}, {"displayName": "Partner Contributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerContributions"}, {"displayName": "Partner Distributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerDistributions"}, {"displayName": "Preferred Stock", "required": false, "type": "String", "value": "Equity.Equity.PreferredStock"}, {"displayName": "Common Stock", "required": false, "type": "String", "value": "Equity.Equity.CommonStock"}, {"displayName": "Treasury Stock", "required": false, "type": "String", "value": "Equity.Equity.TreasuryStock"}, {"displayName": "Estimated Taxes", "required": false, "type": "String", "value": "Equity.Equity.EstimatedTaxes"}, {"displayName": "Healthcare", "required": false, "type": "String", "value": "Equity.Equity.Healthcare"}, {"displayName": "Personal Income", "required": false, "type": "String", "value": "Equity.Equity.PersonalIncome"}, {"displayName": "Personal Expense", "required": false, "type": "String", "value": "Equity.Equity.PersonalExpense"}, {"displayName": "Accumulated Other Comprehensive Income", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedOtherComprehensiveIncome"}, {"displayName": "Called Up Share Capital", "required": false, "type": "String", "value": "Equity.Equity.CalledUpShareCapital"}, {"displayName": "Capital Reserves", "required": false, "type": "String", "value": "Equity.Equity.CapitalReserves"}, {"displayName": "Dividend Disbursed", "required": false, "type": "String", "value": "Equity.Equity.DividendDisbursed"}, {"displayName": "Equity In Earnings Of Subsiduaries", "required": false, "type": "String", "value": "Equity.Equity.EquityInEarningsOfSubsiduaries"}, {"displayName": "Investment Grants", "required": false, "type": "String", "value": "Equity.Equity.InvestmentGrants"}, {"displayName": "Money Received Against Share Warrants", "required": false, "type": "String", "value": "Equity.Equity.MoneyReceivedAgainstShareWarrants"}, {"displayName": "Other Free Reserves", "required": false, "type": "String", "value": "Equity.Equity.OtherFreeReserves"}, {"displayName": "Share Application Money Pending Allotment", "required": false, "type": "String", "value": "Equity.Equity.ShareApplicationMoneyPendingAllotment"}, {"displayName": "Share Capital", "required": false, "type": "String", "value": "Equity.Equity.ShareCapital"}, {"displayName": "Funds", "required": false, "type": "String", "value": "Equity.Equity.Funds"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Should not be longer than 200 characters.", "field": "Name"}], "warnings": []}}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Should be a number between 1 and 99999999.", "field": "NominalCode"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Sales", "required": false, "type": "String", "value": "SALES"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "OTHER_INCOME"}, {"displayName": "Direct Expenses", "required": false, "type": "String", "value": "DIRECT_EXPENSES"}, {"displayName": "Overheads", "required": false, "type": "String", "value": "OVERHEADS"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "DEPRECIATION"}, {"displayName": "Current Assets", "required": false, "type": "String", "value": "CURRENT_ASSETS"}, {"displayName": "Fixed Assets", "required": false, "type": "String", "value": "FIXED_ASSETS"}, {"displayName": "Future Assets", "required": false, "type": "String", "value": "FUTURE_ASSETS"}, {"displayName": "Bank", "required": false, "type": "String", "value": "BANK"}, {"displayName": "Current Liability", "required": false, "type": "String", "value": "CURRENT_LIABILITY"}, {"displayName": "Future Liability", "required": false, "type": "String", "value": "FUTURE_LIABILITY"}, {"displayName": "Equity", "required": false, "type": "String", "value": "EQUITY"}, {"displayName": "Credit Card / Loan", "required": false, "type": "String", "value": "LINE_OF_CREDIT"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be unique within the entity.", "field": "NominalCode"}, {"details": "Must be at most 24 characters in length, although restrictions may vary between entities.", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Archived", "required": false, "type": "String", "value": "Archived"}], "required": true, "type": "String"}, "type": {"description": "The type, or base category, of the account", "displayName": "Account Type", "options": [{"displayName": "Asset", "required": false, "type": "String", "value": "Asset"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income"}, {"displayName": "Liability", "required": false, "type": "String", "value": "Liability"}], "required": true, "type": "String"}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "required": true, "type": "String", "validation": {"information": [{"details": "Any category that is part of the hierarchy of one of: 'Assets', 'Equity', 'Liabilities', 'Total Expenses' and 'Total Income' is permitted.", "field": "FullyQualifiedCategory"}], "warnings": []}}}, "required": true, "type": "Object"} + Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String"}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String"}, "description": {"description": "Description of the account", "displayName": "Description", "required": true, "type": "String"}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "required": true, "type": "String"}, "fullyQualifiedName": {"description": "The full name of the account e.g. Liability.Current.VAT or Income.Revenue.Sales", "displayName": "Fully Qualified Name", "required": true, "type": "String"}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": true, "type": "String"}, "currentBalance": {"description": "The current balance in the account", "displayName": "Current Balance", "required": true, "type": "Number"}, "type": {"description": "The type, or base category, of the account", "displayName": "Account Type", "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "required": true, "type": "String"}, "isBankAccount": {"description": "Confirms whether the nominal account represents a bank account or not", "displayName": "Is Bank Account?", "required": true, "type": "Boolean"}, "validDatatypeLinks": {"description": "Describes which fields on other data types are valid links to this account in the originating system", "displayName": "Valid Datatype Links", "required": true, "type": "Array"}, "metadata": {"description": "Miscellaneous data about the item", "displayName": "Metadata", "required": true, "type": "Object"}}, "required": true, "type": "Object"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "Identifier for the nominal account.", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 10 characters.", "field": "NominalCode"}]}}, "name": {"description": "Name of account as it appears in the chart of accounts or general ledger.", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Payments are enabled to this account if the name ends in .PaymentsEnabled.", "field": "Name"}], "warnings": []}}, "description": {"description": "Description for the nominal account.", "displayName": "Description", "required": false, "type": "String"}, "fullyQualifiedCategory": {"description": "Account type and category for nominal account.", "displayName": "Fully Qualified Category", "options": [{"displayName": "Current Asset", "required": false, "type": "String", "value": "Asset.Current"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.Fixed"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Inventory"}, {"displayName": "Non-current Asset", "required": false, "type": "String", "value": "Asset.NonCurrent"}, {"displayName": "Prepayment", "required": false, "type": "String", "value": "Asset.Prepayment"}, {"displayName": "Direct Costs", "required": false, "type": "String", "value": "Expense.DirectCosts"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "Overhead", "required": false, "type": "String", "value": "Expense.Overhead"}, {"displayName": "Superannuation", "required": false, "type": "String", "value": "Expense.Superannuation"}, {"displayName": "Wages", "required": false, "type": "String", "value": "Expense.Wages"}, {"displayName": "Sales", "required": false, "type": "String", "value": "Income.Sales"}, {"displayName": "Revenue", "required": false, "type": "String", "value": "Income.Revenue"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "Income.Other"}, {"displayName": "Current Liability", "required": false, "type": "String", "value": "Liability.Current"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Liability.Depreciation"}, {"displayName": "Liability", "required": false, "type": "String", "value": "Liability.Liability"}, {"displayName": "Non Current Liability", "required": false, "type": "String", "value": "Liability.NonCurrent"}, {"displayName": "Pay As You Go Liability", "required": false, "type": "String", "value": "Liability.PayAsYouGo"}, {"displayName": "Superannuation Liability", "required": false, "type": "String", "value": "Liability.Superannuation"}, {"displayName": "Wages Payable Liability", "required": false, "type": "String", "value": "Liability.WagesPayable"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity.Equity"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-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": "GBP", "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": "GBP", "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-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": "fe07241b-cdd8-49dc-bfa5-04e08333b1d5", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 415714} + "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} + delete-journal-entry: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + journalEntryId: "" + query: {} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-journal-entry: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2022-04-19T00:00:00", "id": "770c89bb-3d6a-449a-9243-739378b4cd7d", "journalLines": [{"accountRef": {"id": "ff8fdc4c-2aad-4ec1-9430-6bd201832eb3", "name": "Undeposited Funds"}, "currency": "GBP", "description": "", "netAmount": 32095.91, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "3a872b81-d1af-4d31-9bfa-a37280b8f68c", "name": "VAT"}, "currency": "GBP", "description": "Tax for direct income c31a3778-e3ea-4d01-9281-dd2f291c8cb8", "netAmount": -2917.81, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "72df89d2-512b-4455-af51-a6b563733842", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": -29178.09, "tracking": {"recordRefs": []}}], "journalRef": {"id": "90bb7784-083b-4bcb-a534-b30756cee65d", "name": "General Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "postedOn": "2022-04-19T00:00:00", "recordRef": {"dataType": "directIncomes", "id": "c31a3778-e3ea-4d01-9281-dd2f291c8cb8"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2018-12-31T00:00:00", "id": "START", "journalLines": [{"accountRef": {"id": "ac1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Retained Earnings"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -69723.14, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "aa1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Share Capital"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -20000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "8a1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Payable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -2329.42, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6e1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accumulated Depreciation"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 3499, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6c1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Equipment"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 5498, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6a1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Inventory"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 28547.16, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "641217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Receivable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 31638.4, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "641217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Receivable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 2870, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "621217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Petty Cash"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 20000, "tracking": {"recordRefs": []}}], "journalRef": {"id": "4caabc3e-3d64-ed11-8c34-000d3a870cba", "name": "DEFAULT"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:31Z", "postedOn": "2018-12-31T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2020-07-29T10:56:12Z", "updatedOn": "2022-10-23T00:00:00Z"} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2022-01-11T14:18:54", "id": "00002c0a-8061-4ad2-84fa-c879eea880a7", "journalLines": [{"accountRef": {"id": "e0217fbf-8963-4134-80ef-929d5de8612d", "name": "Kosten 13e maand"}, "currency": "EUR", "description": "1 transactions of type CARD_PAYMENT_FEE_REFUND", "netAmount": -6.94, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "0166c96b-adf2-4667-a755-87e67c741f41", "name": "Resultaat verkoop activa"}, "currency": "EUR", "description": "1 transactions of type CARD_PAYMENT_FEE_REFUND", "netAmount": 6.94, "tracking": {"recordRefs": []}}], "journalRef": {"id": "55ff34a3-0857-4202-b7ec-a399cfc26a4e", "name": "Memoriaal"}, "modifiedDate": "2022-10-26T13:37:10Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-01-11T14:18:54Z", "updatedOn": "2022-01-11T14:18:54"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2020-07-03T10:51:46", "id": "0008ef00-c5f8-4f97-bce9-5094b2f569dd", "journalLines": [{"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -9.1, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "6 service charges with 0.0% vat", "netAmount": -11.21, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "28.0 items with VatPercentage of 0.0", "netAmount": -308.61, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "febc52c4-a1ed-4000-b51a-76f9f525445d", "name": "Salary Control Account"}, "currency": "GBP", "description": "Gratuity", "netAmount": -25.87, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -47.14, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "19.0 items with VatPercentage of 20.0", "netAmount": -235.72, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "13.0 items with VatPercentage of 5.0", "netAmount": -182.06, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "febc52c4-a1ed-4000-b51a-76f9f525445d", "name": "Salary Control Account"}, "currency": "GBP", "description": "1.0 gift cards", "netAmount": -1, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "cf9572e7-8afa-4339-9113-af32a66d9df9", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": 820.71, "tracking": {"recordRefs": []}}], "journalRef": {"id": "ed5068ff-cb0e-4edd-9777-36ac94a5d6f0", "name": "Sales journal"}, "modifiedDate": "2022-10-26T13:35:45Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "invoices", "id": "0008ef00-c5f8-4f97-bce9-5094b2f569dd"}, "sourceModifiedDate": "2020-07-03T10:51:46Z", "updatedOn": "2020-07-03T10:51:46"} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "1987-10-01T00:00:00", "id": "24389149", "journalLines": [{"accountRef": {"id": "128611", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "Creative Writing Editorial", "netAmount": -222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": 0, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:38Z", "postedOn": "1987-10-01T00:00:00", "recordRef": {"dataType": "invoices", "id": "2596455"}, "sourceModifiedDate": "1987-10-01T00:00:00", "updatedOn": "1987-10-01T00:00:00"} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2021-03-26T10:31:05", "id": "112", "journalLines": [{"accountRef": {"id": "825", "name": "Codat Europe Bank"}, "currency": "GBP", "netAmount": -120, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "location-4"}, {"dataType": "suppliers", "id": "724"}]}}, {"accountRef": {"id": "111", "name": "Accounts Payable"}, "currency": "GBP", "netAmount": 120, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "location-4"}, {"dataType": "suppliers", "id": "724"}]}}], "modifiedDate": "2023-01-30T14:49:07Z", "postedOn": "2021-03-26T00:00:00", "recordRef": {"dataType": "billPayments", "id": "112"}, "sourceModifiedDate": "2021-03-26T10:31:06", "updatedOn": "2021-03-26T10:31:06"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2022-11-28T00:00:00", "id": "2453-1071526256", "journalLines": [{"accountRef": {"id": "40000-933270541", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 431.95, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "190000-933270541", "name": "Labor Income"}, "currency": "GBP", "description": "Foundation slab - prep and pouring", "netAmount": -167.5, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "100000-933270541", "name": "Sales Tax Payable"}, "currency": "GBP", "description": "CA sales tax, San Domingo County", "netAmount": -18.45, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Rough lumber", "netAmount": -48, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Trim lumber", "netAmount": -38, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Window", "netAmount": -50, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Flooring", "netAmount": -50, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Window", "netAmount": -60, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:11:56Z", "postedOn": "2022-11-28T00:00:00", "recordRef": {"dataType": "invoices", "id": "2453-1071526256"}, "sourceModifiedDate": "2023-12-16T05:04:21", "updatedOn": "2022-10-23T00:00:00Z"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2018-09-21T00:00:00", "id": "1", "journalLines": [{"accountRef": {"id": "61", "name": "Dave PP Current"}, "currency": "GBP", "description": "Opening Balance from Bank", "netAmount": 170.23, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "53", "name": "Retained profit balance forward account"}, "currency": "GBP", "description": "", "netAmount": -170.23, "tracking": {"recordRefs": []}}], "modifiedDate": "2023-01-18T11:03:25Z", "postedOn": "2018-09-21T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2018-12-17T14:56:20Z", "updatedOn": "2022-10-23T00:00:00Z"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2015-02-23T00:00:00", "id": "12", "journalLines": [{"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 250, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": -250, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:36:42Z", "postedOn": "2015-02-23T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2016-09-12T16:02:02Z", "updatedOn": "2022-10-23T00:00:00Z"} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2010-04-27T17:16:57", "description": "Opening Stock", "id": "88", "journalLines": [{"accountRef": {"id": "1001", "name": "Stock"}, "currency": "GBP", "description": "Opening Stock", "netAmount": -40710, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "5200", "name": "Opening Stock"}, "currency": "GBP", "description": "Opening Stock", "netAmount": 40710, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "postedOn": "2021-01-01T00:00:00", "recordRef": {"dataType": "journalEntries", "id": "88"}, "sourceModifiedDate": "2022-11-25T09:43:54", "updatedOn": "2022-10-23T00:00:00Z"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2017-05-08T11:08:39", "id": "b0489c4b33de11e797950a57719b2edb", "journalLines": [{"accountRef": {"id": "9a9931b4267a11e797950a57719b2edb", "name": "VAT on Sales - Holding Account"}, "currency": "GBP", "description": "Consulting services", "netAmount": 1440, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a994b92267a11e797950a57719b2edb", "name": "Sales Type A"}, "currency": "GBP", "description": "Consulting services", "netAmount": 7200, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a991c56267a11e797950a57719b2edb", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": -8640, "tracking": {"recordRefs": []}}], "modifiedDate": "2022-10-24T15:31:26Z", "postedOn": "2017-05-08T11:08:39", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2017-05-08T11:08:39Z", "updatedOn": "2017-05-08T11:08:39"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2021-04-22T10:44:27", "description": "Invoices - 1100: 2021/04/22 03:44:26:7042 Batch Summary Entry", "id": "262177", "journalLines": [{"accountRef": {"id": "176", "name": "Revenue - Services"}, "currency": "GBP", "description": "", "netAmount": -100, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "306", "name": "Sales Tax Payable"}, "currency": "GBP", "description": "", "netAmount": -20, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "2", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 120, "tracking": {"recordRefs": []}}], "journalRef": {"id": "1", "name": "Accounts Receivable Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:37Z", "postedOn": "2021-04-22T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2021-04-22T10:44:27", "updatedOn": "2021-04-22T10:44:27"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "200": + application/json: {"createdOn": "2023-02-17T21:07:12", "id": "033d79c7-565b-419a-9e1b-33ab58efcf3d", "journalLines": [{"accountRef": {"id": "e0faa299-ca0d-4b0a-9e32-0dfabdf9179a", "name": "Accounts Payable"}, "currency": "GBP", "description": "", "netAmount": -7267.2, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "46f9461e-788b-4906-8b74-d1ea17f6dc10", "name": "Consulting"}, "currency": "GBP", "description": "Half day training - Microsoft Office", "netAmount": 1800, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "f96c9458-d724-47bf-8f74-a9d5726465ce", "name": "General Expenses"}, "currency": "GBP", "description": "Desktop/network support via email & phone.Per month fixed fee for minimum 20 hours/month.", "netAmount": 4000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "cba6527d-f102-4538-b421-e483233e9d5a", "name": "Printing & Stationery"}, "currency": "GBP", "description": "Stationery charges", "netAmount": 256, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "b12f79b9-a082-4b8b-971e-d321292943c7", "name": "VAT"}, "currency": "GBP", "description": "", "netAmount": 1211.2, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:37:09Z", "postedOn": "2021-11-19T00:00:00", "recordRef": {"dataType": "bills", "id": "3945273c-cc04-479f-a4b5-1e3dc7a55ed1"}, "sourceModifiedDate": "2023-02-17T21:07:12", "updatedOn": "2022-10-23T00:00:00Z"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalEntryId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-create-journalEntry-model: + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"journalRef": {"description": "Reference to the journal in which this journal entry was created", "displayName": "Journal Reference", "required": true, "type": "Object", "validation": {"information": [{"details": "Only General type Journals are allowed", "field": "JournalRef"}], "warnings": []}}, "postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime"}, "description": {"description": "An optional top level description for the journal entry", "displayName": "Description", "required": false, "type": "String"}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array", "validation": {"information": [], "warnings": [{"details": "Must contain 2 journal lines", "field": "JournalLines"}]}}}, "required": true, "type": "Object"} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"description": {"description": "An optional top level description for the journal entry", "displayName": "Description", "required": false, "type": "String"}, "postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": false, "type": "DateTime", "validation": {"information": [{"details": "Defaults to today's date if not specified", "field": "PostedOn"}], "warnings": []}}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array"}}, "required": true, "type": "Object"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": false, "type": "DateTime"}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array"}}, "required": true, "type": "Object"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime"}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array", "validation": {"information": [{"details": "There must be at least two lines", "field": "JournalLines"}], "warnings": []}}}, "required": true, "type": "Object", "validation": {"information": [], "warnings": [{"details": "To push a JournalEntry to a French Company in QuickBooks Online, an active JournalCode with type 'Others' or 'Autres' must exist inside the Company"}]}} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime"}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array", "validation": {"information": [{"details": "There must be at least two lines", "field": "JournalLines"}], "warnings": []}}}, "required": true, "type": "Object", "validation": {"information": [], "warnings": [{"details": "To push a JournalEntry to a French Company in QuickBooks Online, an active JournalCode with type 'Others' or 'Autres' must exist inside the Company"}]}} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"createdOn": {"description": "Date on which the journal was created in Sage50.", "displayName": "Created On", "required": false, "type": "DateTime", "validation": {"information": [{"details": "if empty then Sage 50 will auto generate a created on date", "field": "createdOn"}], "warnings": []}}, "updatedOn": {"description": "Date on which the journal was last updated in Sage50.", "displayName": "Updated On", "required": true, "type": "DateTime", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "updatedOn"}]}}, "description": {"description": "Optional description of the journal entry.", "displayName": "Description", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "description"}]}}, "modifiedDate": {"description": "Date on which the record was last updated via pushes.", "displayName": "Source Modified Date", "required": true, "type": "DateTime", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "modifiedDate"}]}}, "sourceModifiedDate": {"description": "Date on which the record was last changed in Sage50.", "displayName": "Source Modified Date", "required": true, "type": "DateTime", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "sourceModifiedDate"}]}}, "recordRef": {"description": "Links a journal entry to the underlying record that created it.", "displayName": "Record Reference", "required": false, "type": "Object"}, "dataType": {"description": "Data type of the underlying record that created the journal entry.", "displayName": "Data Type", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "dataType"}]}}, "journalRef": {"description": "Links journal entries to the relevant journal", "displayName": "Journal Reference", "required": false, "type": "Object"}, "id": {"description": "The reference journal id", "displayName": "Id", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "id"}]}}, "name": {"description": "The reference journal name", "displayName": "Name", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Is not supported and therefore will be ignored", "field": "name"}]}}, "journalLines": {"description": "Journal line items of the journal entry.", "displayName": "Journal Lines", "required": true, "type": "Array"}}, "required": true, "type": "Object", "validation": {"information": [{"details": "Pushing to Sage 50 2015 (v21) or below is not supported. To enable push, please upgrade to at least Sage 50 2016 (v22) and re-sync the company."}], "warnings": []}} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime"}, "journalRef": {"description": "Reference to the journal in which this journal entry was created", "displayName": "Journal Reference", "required": true, "type": "Object"}, "description": {"description": "An optional top level description for the journal entry", "displayName": "Description", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be no greater than 512 characters", "field": "Description"}]}}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array", "validation": {"information": [], "warnings": [{"details": "There must be at least two lines", "field": "JournalLines"}]}}}, "required": true, "type": "Object"} + Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"description": {"description": "An optional top level description for the journal entry", "displayName": "Description", "required": true, "type": "String"}, "postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime"}, "createdOn": {"description": "The date the entry was created in the originating system", "displayName": "Created On", "required": true, "type": "DateTime"}, "updatedOn": {"description": "The date in which the journal was last updated in the originating system", "displayName": "Updated On", "required": true, "type": "DateTime"}, "journalRef": {"description": "Reference to the journal in which this journal entry was created", "displayName": "Journal Reference", "required": true, "type": "Object"}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array"}, "recordRef": {"description": "Reference to the record for which this journal entry was created", "displayName": "Record Reference", "required": true, "type": "Object"}, "metadata": {"description": "Miscellaneous data about the item", "displayName": "Metadata", "required": true, "type": "Object"}}, "required": true, "type": "Object"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "JournalEntry", "properties": {"postedOn": {"description": "The date the entry was posted in the originating system", "displayName": "Posted On", "required": true, "type": "DateTime", "validation": {"information": [{"details": "If no date is specified, it will default to today's date.", "field": "PostedOn"}], "warnings": []}}, "journalLines": {"description": "A collection of detail lines that represent the transactions associated in this entry", "displayName": "Journal Lines", "required": true, "type": "Array", "validation": {"information": [{"details": "At least 2 must be provided.", "field": "JournalLines"}], "warnings": []}}}, "required": true, "type": "Object"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-journal-entries: + "": + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2022-04-19T00:00:00", "id": "770c89bb-3d6a-449a-9243-739378b4cd7d", "journalLines": [{"accountRef": {"id": "ff8fdc4c-2aad-4ec1-9430-6bd201832eb3", "name": "Undeposited Funds"}, "currency": "GBP", "description": "", "netAmount": 32095.91, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "3a872b81-d1af-4d31-9bfa-a37280b8f68c", "name": "VAT"}, "currency": "GBP", "description": "Tax for direct income c31a3778-e3ea-4d01-9281-dd2f291c8cb8", "netAmount": -2917.81, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "72df89d2-512b-4455-af51-a6b563733842", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": -29178.09, "tracking": {"recordRefs": []}}], "journalRef": {"id": "90bb7784-083b-4bcb-a534-b30756cee65d", "name": "General Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "postedOn": "2022-04-19T00:00:00", "recordRef": {"dataType": "directIncomes", "id": "c31a3778-e3ea-4d01-9281-dd2f291c8cb8"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2022-04-19T00:00:00", "id": "9f96606f-6846-40c6-b423-9b1753458e75", "journalLines": [{"accountRef": {"id": "ff8fdc4c-2aad-4ec1-9430-6bd201832eb3", "name": "Undeposited Funds"}, "currency": "GBP", "description": "", "netAmount": 188.33, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "3a872b81-d1af-4d31-9bfa-a37280b8f68c", "name": "VAT"}, "currency": "GBP", "description": "Tax for direct income 38e8c917-0afc-4583-8ffe-1b53ad601197", "netAmount": -17.12, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "72df89d2-512b-4455-af51-a6b563733842", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": -171.21, "tracking": {"recordRefs": []}}], "journalRef": {"id": "90bb7784-083b-4bcb-a534-b30756cee65d", "name": "General Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "postedOn": "2022-04-19T00:00:00", "recordRef": {"dataType": "directIncomes", "id": "38e8c917-0afc-4583-8ffe-1b53ad601197"}, "sourceModifiedDate": "2022-10-23T00:00:00Z", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 1862} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2018-12-31T00:00:00", "id": "START", "journalLines": [{"accountRef": {"id": "ac1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Retained Earnings"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -69723.14, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "aa1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Share Capital"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -20000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "8a1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Payable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": -2329.42, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6e1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accumulated Depreciation"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 3499, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6c1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Equipment"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 5498, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "6a1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Inventory"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 28547.16, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "641217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Receivable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 31638.4, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "641217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Accounts Receivable"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 2870, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "621217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Petty Cash"}, "currency": "GBP", "description": "Opening Entry", "netAmount": 20000, "tracking": {"recordRefs": []}}], "journalRef": {"id": "4caabc3e-3d64-ed11-8c34-000d3a870cba", "name": "DEFAULT"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:31Z", "postedOn": "2018-12-31T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2020-07-29T10:56:12Z", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2019-01-01T00:00:00", "id": "01-2019", "journalLines": [{"accountRef": {"id": "5e1217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Checking account"}, "currency": "GBP", "description": "January 2019", "netAmount": -2000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "401217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Salaries Expense"}, "currency": "GBP", "description": "January 2019", "netAmount": 1000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "341217b3-89d1-ea11-bbaa-000d3a2b9185", "name": "Rent Expense"}, "currency": "GBP", "description": "January 2019", "netAmount": 1000, "tracking": {"recordRefs": []}}], "journalRef": {"id": "4caabc3e-3d64-ed11-8c34-000d3a870cba", "name": "DEFAULT"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:31Z", "postedOn": "2019-01-01T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2020-07-29T10:56:12Z", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 825} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2022-01-11T14:18:54", "id": "00002c0a-8061-4ad2-84fa-c879eea880a7", "journalLines": [{"accountRef": {"id": "e0217fbf-8963-4134-80ef-929d5de8612d", "name": "Kosten 13e maand"}, "currency": "EUR", "description": "1 transactions of type CARD_PAYMENT_FEE_REFUND", "netAmount": -6.94, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "0166c96b-adf2-4667-a755-87e67c741f41", "name": "Resultaat verkoop activa"}, "currency": "EUR", "description": "1 transactions of type CARD_PAYMENT_FEE_REFUND", "netAmount": 6.94, "tracking": {"recordRefs": []}}], "journalRef": {"id": "55ff34a3-0857-4202-b7ec-a399cfc26a4e", "name": "Memoriaal"}, "modifiedDate": "2022-10-26T13:37:10Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-01-11T14:18:54Z", "updatedOn": "2022-01-11T14:18:54"}, {"createdOn": "2020-04-22T13:56:46", "id": "000154f0-e83a-4012-96a3-7db0b036b96b", "journalLines": [{"accountRef": {"id": "0741cc89-e33a-4358-bcbd-3acb07b005dc", "name": "Nominal Card"}, "currency": "EUR", "description": "Refunds with payment type of Cash", "netAmount": -144.36, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "ef2fde36-4416-4bc5-b239-315b2929348c", "name": "Debiteuren"}, "currency": "EUR", "description": "Refunds with payment type of Cash", "netAmount": 144.36, "tracking": {"recordRefs": []}}], "journalRef": {"id": "151313ae-55b1-4ba0-b32a-e2ef6a8ce52a", "name": "Nominal Card"}, "modifiedDate": "2022-10-26T13:37:08Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2020-04-22T13:56:46Z", "updatedOn": "2020-04-22T13:56:46"}], "totalResults": 35972} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2020-07-03T10:51:46", "id": "0008ef00-c5f8-4f97-bce9-5094b2f569dd", "journalLines": [{"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -9.1, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "6 service charges with 0.0% vat", "netAmount": -11.21, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "28.0 items with VatPercentage of 0.0", "netAmount": -308.61, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "febc52c4-a1ed-4000-b51a-76f9f525445d", "name": "Salary Control Account"}, "currency": "GBP", "description": "Gratuity", "netAmount": -25.87, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -47.14, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "19.0 items with VatPercentage of 20.0", "netAmount": -235.72, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "43acd218-6a95-445f-994c-660273e0ced9", "name": "Sales"}, "currency": "GBP", "description": "13.0 items with VatPercentage of 5.0", "netAmount": -182.06, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "febc52c4-a1ed-4000-b51a-76f9f525445d", "name": "Salary Control Account"}, "currency": "GBP", "description": "1.0 gift cards", "netAmount": -1, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "cf9572e7-8afa-4339-9113-af32a66d9df9", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": 820.71, "tracking": {"recordRefs": []}}], "journalRef": {"id": "ed5068ff-cb0e-4edd-9777-36ac94a5d6f0", "name": "Sales journal"}, "modifiedDate": "2022-10-26T13:35:45Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "invoices", "id": "0008ef00-c5f8-4f97-bce9-5094b2f569dd"}, "sourceModifiedDate": "2020-07-03T10:51:46Z", "updatedOn": "2020-07-03T10:51:46"}, {"createdOn": "2021-07-30T18:02:23", "id": "001a8d63-2d5b-4b00-b17f-894108b6ce81", "journalLines": [{"accountRef": {"id": "cf9572e7-8afa-4339-9113-af32a66d9df9", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": 1038.01, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "cc0ab812-d89a-452b-88a8-61666a0f0211", "name": "Accruals"}, "currency": "GBP", "description": "1.0 gift cards", "netAmount": -1, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -19.29, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "45ae4323-c93b-48b1-8393-db54254e4e6c", "name": "VAT To Pay"}, "currency": "GBP", "netAmount": -60.82, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "ba7d27d1-72cf-411b-8ef3-55ca4b13dac3", "name": "Sundry Non-Operating Expenses"}, "currency": "GBP", "description": "15.0 items with VatPercentage of 0.0", "netAmount": -248.28, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "8f27a6b8-101d-4613-a059-2b462fb01b2f", "name": "anna_test_prod"}, "currency": "GBP", "description": "Gratuity", "netAmount": -8.97, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "ba7d27d1-72cf-411b-8ef3-55ca4b13dac3", "name": "Sundry Non-Operating Expenses"}, "currency": "GBP", "description": "28.0 items with VatPercentage of 5.0", "netAmount": -385.7, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "ba7d27d1-72cf-411b-8ef3-55ca4b13dac3", "name": "Sundry Non-Operating Expenses"}, "currency": "GBP", "description": "2 service charges with 0.0% vat", "netAmount": -9.85, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "ba7d27d1-72cf-411b-8ef3-55ca4b13dac3", "name": "Sundry Non-Operating Expenses"}, "currency": "GBP", "description": "27.0 items with VatPercentage of 20.0", "netAmount": -304.1, "tracking": {"recordRefs": []}}], "journalRef": {"id": "ed5068ff-cb0e-4edd-9777-36ac94a5d6f0", "name": "Sales journal"}, "modifiedDate": "2022-10-26T13:35:45Z", "postedOn": "2022-10-23T00:00:00Z", "recordRef": {"dataType": "invoices", "id": "001a8d63-2d5b-4b00-b17f-894108b6ce81"}, "sourceModifiedDate": "2021-07-30T18:02:23Z", "updatedOn": "2021-07-30T18:02:23"}], "totalResults": 6785} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "1987-10-01T00:00:00", "id": "24389149", "journalLines": [{"accountRef": {"id": "128611", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "Creative Writing Editorial", "netAmount": -222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": 0, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:38Z", "postedOn": "1987-10-01T00:00:00", "recordRef": {"dataType": "invoices", "id": "2596455"}, "sourceModifiedDate": "1987-10-01T00:00:00", "updatedOn": "1987-10-01T00:00:00"}, {"createdOn": "1987-10-01T00:00:00", "id": "24389396", "journalLines": [{"accountRef": {"id": "128611", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": -222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "Creative Writing Editorial", "netAmount": 222.88, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "128613", "name": "Sales"}, "currency": "GBP", "description": "", "netAmount": 0, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:38Z", "postedOn": "1987-10-01T00:00:00", "recordRef": {"dataType": "invoices", "id": "2596455"}, "sourceModifiedDate": "1987-10-01T00:00:00", "updatedOn": "1987-10-01T00:00:00"}], "totalResults": 734} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2021-03-26T10:31:05", "id": "112", "journalLines": [{"accountRef": {"id": "825", "name": "Codat Europe Bank"}, "currency": "GBP", "netAmount": -120, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "location-4"}, {"dataType": "suppliers", "id": "724"}]}}, {"accountRef": {"id": "111", "name": "Accounts Payable"}, "currency": "GBP", "netAmount": 120, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "location-4"}, {"dataType": "suppliers", "id": "724"}]}}], "modifiedDate": "2023-01-30T14:49:07Z", "postedOn": "2021-03-26T00:00:00", "recordRef": {"dataType": "billPayments", "id": "112"}, "sourceModifiedDate": "2021-03-26T10:31:06", "updatedOn": "2021-03-26T10:31:06"}, {"createdOn": "2021-03-26T10:02:18", "id": "7", "journalLines": [{"accountRef": {"id": "111", "name": "Accounts Payable"}, "currency": "GBP", "netAmount": -144, "tracking": {"recordRefs": [{"dataType": "suppliers", "id": "724"}]}}, {"accountRef": {"id": "716", "name": "Inventory In Transit"}, "currency": "GBP", "netAmount": 120, "tracking": {"recordRefs": [{"dataType": "trackingCategories", "id": "location-4"}]}}, {"accountRef": {"id": "211", "name": "VAT on Purchases"}, "currency": "GBP", "description": "VAT", "netAmount": 24, "tracking": {"recordRefs": [{"dataType": "suppliers", "id": "713"}]}}], "modifiedDate": "2023-01-30T14:49:07Z", "postedOn": "2021-03-26T00:00:00", "recordRef": {"dataType": "bills", "id": "7"}, "sourceModifiedDate": "2022-07-05T13:38:10", "updatedOn": "2022-07-05T13:38:10"}], "totalResults": 11} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2022-11-28T00:00:00", "id": "2453-1071526256", "journalLines": [{"accountRef": {"id": "40000-933270541", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 431.95, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "190000-933270541", "name": "Labor Income"}, "currency": "GBP", "description": "Foundation slab - prep and pouring", "netAmount": -167.5, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "100000-933270541", "name": "Sales Tax Payable"}, "currency": "GBP", "description": "CA sales tax, San Domingo County", "netAmount": -18.45, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Rough lumber", "netAmount": -48, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Trim lumber", "netAmount": -38, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Window", "netAmount": -50, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Flooring", "netAmount": -50, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Window", "netAmount": -60, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:11:56Z", "postedOn": "2022-11-28T00:00:00", "recordRef": {"dataType": "invoices", "id": "2453-1071526256"}, "sourceModifiedDate": "2023-12-16T05:04:21", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2022-11-30T00:00:00", "id": "469E-1071530054", "journalLines": [{"accountRef": {"id": "40000-933270541", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 14488.64, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "190000-933270541", "name": "Labor Income"}, "currency": "GBP", "description": "Installation labor", "netAmount": -45.5, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Install drywall", "netAmount": -1320, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Electrical work", "netAmount": -1650, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Metal Work", "netAmount": -660, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Install insulation", "netAmount": -1100, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Plumbing", "netAmount": -1650, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Painting", "netAmount": -2420, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1C0000-933270542", "name": "Subcontracted Labor Income"}, "currency": "GBP", "description": "Install carpeting", "netAmount": -3300, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Custom Bay Window", "netAmount": -1925, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "1A0000-933270542", "name": "Materials Income"}, "currency": "GBP", "description": "Window", "netAmount": -115.5, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "190000-933270541", "name": "Labor Income"}, "currency": "GBP", "description": "Equipment Rental", "netAmount": -700, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "70000-933270541", "name": "Retainage Receivable"}, "currency": "GBP", "description": "10% retainage to be billed after job is complete and approved.", "netAmount": 555.5, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "100000-933270541", "name": "Sales Tax Payable"}, "currency": "GBP", "description": "CA sales tax, San Tomas County", "netAmount": -158.14, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:11:56Z", "postedOn": "2022-11-30T00:00:00", "recordRef": {"dataType": "invoices", "id": "469E-1071530054"}, "sourceModifiedDate": "2023-12-16T05:05:41", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 140} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2018-09-21T00:00:00", "id": "1", "journalLines": [{"accountRef": {"id": "61", "name": "Dave PP Current"}, "currency": "GBP", "description": "Opening Balance from Bank", "netAmount": 170.23, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "53", "name": "Retained profit balance forward account"}, "currency": "GBP", "description": "", "netAmount": -170.23, "tracking": {"recordRefs": []}}], "modifiedDate": "2023-01-18T11:03:25Z", "postedOn": "2018-09-21T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2018-12-17T14:56:20Z", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2018-09-21T00:00:00", "id": "15", "journalLines": [{"accountRef": {"id": "61", "name": "Dave PP Current"}, "currency": "GBP", "description": "Payment to Google", "netAmount": -1.59, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "37", "name": "Computer equipment accumulated depreciation brought forward"}, "currency": "GBP", "description": "Payment to Google", "netAmount": 1.59, "tracking": {"recordRefs": []}}], "modifiedDate": "2023-01-18T11:03:25Z", "postedOn": "2018-09-21T00:00:00", "recordRef": {"dataType": "directCosts", "id": "PUR-15"}, "sourceModifiedDate": "2018-12-17T14:56:44Z", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 9405} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2015-02-23T00:00:00", "id": "12", "journalLines": [{"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": 250, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Guest Book", "netAmount": -250, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:36:42Z", "postedOn": "2015-02-23T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2016-09-12T16:02:02Z", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2015-02-23T00:00:00", "id": "13", "journalLines": [{"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Name Badges", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Name Badges", "netAmount": 0, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "65", "name": "Stock Asset"}, "currency": "GBP", "description": "Opening stock for Name Badges", "netAmount": 7500, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "55", "name": "Opening Balance Equity"}, "currency": "GBP", "description": "Opening stock for Name Badges", "netAmount": -7500, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:36:42Z", "postedOn": "2015-02-23T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2016-09-12T16:02:04Z", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 9190} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2010-04-27T17:16:57", "description": "Opening Stock", "id": "88", "journalLines": [{"accountRef": {"id": "1001", "name": "Stock"}, "currency": "GBP", "description": "Opening Stock", "netAmount": -40710, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "5200", "name": "Opening Stock"}, "currency": "GBP", "description": "Opening Stock", "netAmount": 40710, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "postedOn": "2021-01-01T00:00:00", "recordRef": {"dataType": "journalEntries", "id": "88"}, "sourceModifiedDate": "2022-11-25T09:43:54", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2010-04-27T17:16:57", "description": "Goods", "id": "92", "journalLines": [{"accountRef": {"id": "2100", "name": "Creditors Control Account"}, "currency": "GBP", "description": "Goods/Services - Goods", "netAmount": -5875, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "5000", "name": "Materials Purchased"}, "currency": "GBP", "description": "Goods/Services - Goods", "netAmount": 5000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "2201", "name": "Purchase Tax Control Account"}, "currency": "GBP", "description": "Goods/Services - Goods", "netAmount": 875, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "postedOn": "2021-01-01T00:00:00", "recordRef": {"dataType": "bills", "id": "92"}, "sourceModifiedDate": "2022-11-25T09:43:54", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 1119} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2017-05-08T11:08:39", "id": "b0489c4b33de11e797950a57719b2edb", "journalLines": [{"accountRef": {"id": "9a9931b4267a11e797950a57719b2edb", "name": "VAT on Sales - Holding Account"}, "currency": "GBP", "description": "Consulting services", "netAmount": 1440, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a994b92267a11e797950a57719b2edb", "name": "Sales Type A"}, "currency": "GBP", "description": "Consulting services", "netAmount": 7200, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a991c56267a11e797950a57719b2edb", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": -8640, "tracking": {"recordRefs": []}}], "modifiedDate": "2022-10-24T15:31:26Z", "postedOn": "2017-05-08T11:08:39", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2017-05-08T11:08:39Z", "updatedOn": "2017-05-08T11:08:39"}, {"createdOn": "2017-05-08T11:09:09", "id": "c23efa4233de11e797950a57719b2edb", "journalLines": [{"accountRef": {"id": "9a991c56267a11e797950a57719b2edb", "name": "Trade Debtors"}, "currency": "GBP", "netAmount": 1080, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a9931b4267a11e797950a57719b2edb", "name": "VAT on Sales - Holding Account"}, "currency": "GBP", "description": "Consulting services", "netAmount": -180, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "9a994b92267a11e797950a57719b2edb", "name": "Sales Type A"}, "currency": "GBP", "description": "Consulting services", "netAmount": -900, "tracking": {"recordRefs": []}}], "modifiedDate": "2022-10-24T15:31:26Z", "postedOn": "2017-05-08T11:09:09", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2017-05-08T11:09:09Z", "updatedOn": "2017-05-08T11:09:09"}], "totalResults": 24386} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2021-04-22T10:44:27", "description": "Invoices - 1100: 2021/04/22 03:44:26:7042 Batch Summary Entry", "id": "262177", "journalLines": [{"accountRef": {"id": "176", "name": "Revenue - Services"}, "currency": "GBP", "description": "", "netAmount": -100, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "306", "name": "Sales Tax Payable"}, "currency": "GBP", "description": "", "netAmount": -20, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "2", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": 120, "tracking": {"recordRefs": []}}], "journalRef": {"id": "1", "name": "Accounts Receivable Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:37Z", "postedOn": "2021-04-22T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2021-04-22T10:44:27", "updatedOn": "2021-04-22T10:44:27"}, {"createdOn": "2021-04-22T11:01:11", "description": "Receipts(Bank-501_CHK) - 1100: April 2021 Batch Summary Entry", "id": "262179", "journalLines": [{"accountRef": {"id": "2", "name": "Accounts Receivable"}, "currency": "GBP", "description": "", "netAmount": -120, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "353", "name": "Current Account"}, "currency": "GBP", "description": "", "netAmount": 120, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "353", "name": "Current Account"}, "currency": "GBP", "description": "", "netAmount": 150, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "179", "name": "Revenue - Other"}, "currency": "GBP", "description": "", "netAmount": -150, "tracking": {"recordRefs": []}}], "journalRef": {"id": "7", "name": "Cash Receipts Journal"}, "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:37Z", "postedOn": "2021-04-30T00:00:00", "recordRef": {"dataType": "transfers"}, "sourceModifiedDate": "2022-04-19T13:38:45", "updatedOn": "2022-04-19T13:38:45"}], "totalResults": 21} + 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/journalEntries?page=1&pageSize=2"}, "next": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/journalEntries?page=2&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/journalEntries"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2023-02-17T21:07:12", "id": "033d79c7-565b-419a-9e1b-33ab58efcf3d", "journalLines": [{"accountRef": {"id": "e0faa299-ca0d-4b0a-9e32-0dfabdf9179a", "name": "Accounts Payable"}, "currency": "GBP", "description": "", "netAmount": -7267.2, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "46f9461e-788b-4906-8b74-d1ea17f6dc10", "name": "Consulting"}, "currency": "GBP", "description": "Half day training - Microsoft Office", "netAmount": 1800, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "f96c9458-d724-47bf-8f74-a9d5726465ce", "name": "General Expenses"}, "currency": "GBP", "description": "Desktop/network support via email & phone.Per month fixed fee for minimum 20 hours/month.", "netAmount": 4000, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "cba6527d-f102-4538-b421-e483233e9d5a", "name": "Printing & Stationery"}, "currency": "GBP", "description": "Stationery charges", "netAmount": 256, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "b12f79b9-a082-4b8b-971e-d321292943c7", "name": "VAT"}, "currency": "GBP", "description": "", "netAmount": 1211.2, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:37:09Z", "postedOn": "2021-11-19T00:00:00", "recordRef": {"dataType": "bills", "id": "3945273c-cc04-479f-a4b5-1e3dc7a55ed1"}, "sourceModifiedDate": "2023-02-17T21:07:12", "updatedOn": "2022-10-23T00:00:00Z"}, {"createdOn": "2023-02-17T21:07:23", "id": "98ac5060-c9ed-4359-bcd5-711e649e7899", "journalLines": [{"accountRef": {"id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", "name": "Business Bank Account"}, "currency": "GBP", "description": "", "netAmount": -7267.2, "tracking": {"recordRefs": []}}, {"accountRef": {"id": "e0faa299-ca0d-4b0a-9e32-0dfabdf9179a", "name": "Accounts Payable"}, "currency": "GBP", "description": "", "netAmount": 7267.2, "tracking": {"recordRefs": []}}], "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:37:09Z", "postedOn": "2021-12-20T00:00:00", "recordRef": {"dataType": "billPayments", "id": "74004690-82a1-4810-aaca-6ce575af94b4"}, "sourceModifiedDate": "2023-02-17T21:07:23", "updatedOn": "2022-10-23T00:00:00Z"}], "totalResults": 290} + 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-journal: + 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"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-journal: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "200": + application/json: {"createdOn": "2021-12-11T13:04:02", "hasChildren": true, "id": "90bb7784-083b-4bcb-a534-b30756cee65d", "journalCode": "GJ", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "name": "General Journal", "sourceModifiedDate": "2022-07-15T20:19:02", "status": "Active", "type": "General Journal"} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "200": + application/json: {"createdOn": "2022-10-23T00:00:00Z", "hasChildren": true, "id": "211317b3-89d1-ea11-bbaa-000d3a2b9185", "journalCode": "ASSETS", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "name": "ASSETS", "sourceModifiedDate": "2023-02-02T10:26:25Z", "status": "Active", "type": "Assets"} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "200": + application/json: {"createdOn": "2019-11-05T14:44:51", "hasChildren": false, "id": "aae31284-e23d-456b-9957-fbf4bcef6c19", "journalCode": "21", "modifiedDate": "2022-10-26T13:31:58Z", "name": "12345678", "sourceModifiedDate": "2020-01-24T11:41:25Z", "status": "Active", "type": "Bank"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "200": + application/json: {"createdOn": "2021-04-26T16:44:47", "hasChildren": false, "id": "05b9febe-34b3-4836-8277-002294b233a9", "journalCode": "25", "modifiedDate": "2022-10-26T13:33:08Z", "name": "annaBankAccount1", "sourceModifiedDate": "2021-04-26T16:44:47Z", "status": "Active", "type": "Bank"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "200": + application/json: {"createdOn": "2022-01-17T10:44:23", "hasChildren": false, "id": "207", "journalCode": "AJPT", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:30Z", "name": "A Journal Push Test", "sourceModifiedDate": "2022-01-17T10:44:23", "status": "Active", "type": ""} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + journalId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-create-journal-model: + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "Journal", "properties": {"name": {"description": "The name of the journal", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be no greater than 40 characters", "field": "Name"}]}}, "journalCode": {"description": "The number or code for the journal", "displayName": "Journal Number", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be no greater than 16 characters", "field": "JournalCode"}]}}, "status": {"description": "The status of the journal", "displayName": "Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Archived", "required": false, "type": "String", "value": "Archived"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"displayName": "Journal", "properties": {"journalCode": {"description": "The number or code for the journal", "displayName": "Journal Number", "required": true, "type": "String"}, "name": {"description": "The name of the journal", "displayName": "Name", "required": true, "type": "String"}, "type": {"description": "The type of journal", "displayName": "Type", "required": true, "type": "String"}, "parentId": {"description": "Identifier for the parent journal - empty if journal is the parent", "displayName": "Parent Id", "required": true, "type": "String"}, "hasChildren": {"description": "If a journal has children, the journal is parent of those children journals", "displayName": "Has Children", "required": true, "type": "Boolean"}, "createdOn": {"description": "The date the journal was created in the originating system", "displayName": "Created On", "required": true, "type": "DateTime"}, "status": {"description": "The status of the journal", "displayName": "Status", "required": true, "type": "String"}, "metadata": {"description": "Miscellaneous data about the item", "displayName": "Metadata", "required": true, "type": "Object"}}, "required": true, "type": "Object"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-journals: + "": + 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/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2021-12-11T13:04:02", "hasChildren": true, "id": "90bb7784-083b-4bcb-a534-b30756cee65d", "journalCode": "GJ", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "name": "General Journal", "sourceModifiedDate": "2022-07-15T20:19:02", "status": "Active", "type": "General Journal"}, {"createdOn": "2021-12-11T13:04:02", "hasChildren": false, "id": "07b94827-c0a5-4cc7-ba58-3f9efec3b4b3", "journalCode": "PAY", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:18Z", "name": "Payroll Journal", "parentId": "90bb7784-083b-4bcb-a534-b30756cee65d", "sourceModifiedDate": "2022-07-24T14:17:02", "status": "Active", "type": "Payroll Journal"}], "totalResults": 4} + 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/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2022-10-23T00:00:00Z", "hasChildren": true, "id": "211317b3-89d1-ea11-bbaa-000d3a2b9185", "journalCode": "ASSETS", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "name": "ASSETS", "sourceModifiedDate": "2023-02-02T10:26:25Z", "status": "Active", "type": "Assets"}, {"createdOn": "2022-06-15T10:03:59", "hasChildren": false, "id": "9a94ef78-92ec-ec11-82f9-000d3a8746a9", "journalCode": "BNKDEPOSIT-BNKD", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:10Z", "name": "BNKD", "parentId": "af7d7e6b-e5c8-ec11-8e7e-000d3a86e04a", "sourceModifiedDate": "2022-06-15T22:45:30Z", "status": "Active", "type": "Bank Deposits"}], "totalResults": 46} + 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/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2019-11-05T14:44:51", "hasChildren": false, "id": "aae31284-e23d-456b-9957-fbf4bcef6c19", "journalCode": "21", "modifiedDate": "2022-10-26T13:31:58Z", "name": "12345678", "sourceModifiedDate": "2020-01-24T11:41:25Z", "status": "Active", "type": "Bank"}, {"createdOn": "2019-11-22T13:35:57", "hasChildren": false, "id": "74677165-1bd3-49b4-87d0-32d974674f86", "journalCode": "23", "modifiedDate": "2022-10-26T13:31:58Z", "name": "Abraham's Billion Dollar stuff", "sourceModifiedDate": "2019-11-22T13:35:57Z", "status": "Active", "type": "Bank"}], "totalResults": 47} + 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/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2021-04-26T16:44:47", "hasChildren": false, "id": "05b9febe-34b3-4836-8277-002294b233a9", "journalCode": "25", "modifiedDate": "2022-10-26T13:33:08Z", "name": "annaBankAccount1", "sourceModifiedDate": "2021-04-26T16:44:47Z", "status": "Active", "type": "Bank"}, {"createdOn": "2021-05-18T10:24:18", "hasChildren": false, "id": "b9c3d6a6-4ce2-4714-9ff6-fb15892300f7", "journalCode": "31", "modifiedDate": "2022-10-26T13:33:08Z", "name": "annaBankAccount10", "sourceModifiedDate": "2021-05-18T10:24:18Z", "status": "Active", "type": "Bank"}], "totalResults": 21} + 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/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/journals"}}, "pageNumber": 1, "pageSize": 2, "results": [{"createdOn": "2022-01-17T10:44:23", "hasChildren": false, "id": "207", "journalCode": "AJPT", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:30Z", "name": "A Journal Push Test", "sourceModifiedDate": "2022-01-17T10:44:23", "status": "Active", "type": ""}, {"createdOn": "2022-01-18T15:39:07", "hasChildren": false, "id": "223", "journalCode": "AJPT2", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:31:30Z", "name": "A Journal Push Test 2", "sourceModifiedDate": "2022-01-18T15:39:07", "status": "Active", "type": ""}], "totalResults": 1211} + 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-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} + get-push-operation: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + pushOperationKey: "2a6486f4-00c4-40bd-900d-b29c15ad0581" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-push-operations: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [], "totalResults": 1} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + list-pull-operations: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5", "completed": "2022-10-23T00:00:00Z", "connectionId": "51baa045-4836-4317-a42e-3542e991e581", "dataType": "invoices", "id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b", "isCompleted": false, "isErrored": false, "progress": 10, "requested": "2022-11-14T11:18:37.2798351Z", "status": "Initial", "statusDescription": "Paused until 2022-10-23T00:00:00.000Z"}], "totalResults": 1} + "400": {} + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history?page=1&pageSize=2"}, "next": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history?page=2&pageSize=2"}, "self": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history"}}, "pageNumber": 0, "pageSize": 0, "results": [{"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5", "completed": "2022-10-23T00:00:00Z", "connectionId": "51baa045-4836-4317-a42e-3542e991e581", "dataType": "invoices", "id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b", "isCompleted": false, "isErrored": false, "progress": 10, "requested": "2022-11-14T11:18:37.2798351Z", "status": "Initial", "statusDescription": "Paused until 2022-10-23T00:00:00.000Z"}], "totalResults": 0} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + refresh-all-data-types: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + refresh-data-type: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + dataType: "invoices" + query: {} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-accounting-profile: + 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} + get-tracking-category: + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "9e1dea89-1e34-ed11-97e8-000d3a872db9", "modifiedDate": "2023-03-27T14:21:18Z", "name": "A-000-A-Hundreds", "parentId": "d1391864-77cf-eb11-9f0a-0022481b404b", "sourceModifiedDate": "2022-09-14T11:19:28Z", "status": "Active", "subCategories": []} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "5389667", "modifiedDate": "2023-03-24T16:07:24Z", "name": "ABCustomCategory", "parentId": "4370491", "sourceModifiedDate": "2021-05-19T11:09:40", "status": "Active", "subCategories": []} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "CostEstimateType-AVGCOST", "modifiedDate": "2023-01-30T14:46:52Z", "name": "Average Cost", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "subCategories": []} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": true, "id": "80000008-1734278594", "modifiedDate": "2023-04-26T09:12:46Z", "name": "ClassWithSub", "sourceModifiedDate": "2024-12-15T16:03:14", "status": "Active"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "CLASS_5100000000000014491", "modifiedDate": "2023-04-26T09:35:57Z", "name": "A", "parentId": "CLASSES", "sourceModifiedDate": "2022-03-07T08:28:32Z", "status": "Active", "subCategories": []} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "department_10", "modifiedDate": "2023-03-30T14:42:37Z", "name": "", "parentId": "DEPARTMENTS", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active", "subCategories": []} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "department_0", "modifiedDate": "2022-07-27T17:41:22Z", "name": "BallparkContracting", "sourceModifiedDate": "2022-03-22T15:33:21", "status": "Active", "subCategories": []} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "WAREHOUSE-2", "modifiedDate": "2023-04-04T16:32:02Z", "name": "200", "parentId": "WAREHOUSE", "sourceModifiedDate": "2020-04-26T05:26:46", "status": "Active", "subCategories": []} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "dba3d4da-f9ed-4eee-8e0b-452d11fdb1fa", "modifiedDate": "2023-03-15T20:37:11Z", "name": "Eastside", "parentId": "9d8ad8f6-0d0f-41e0-8851-ef47e8b54ae6", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "subCategories": []} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "200": + application/json: {"hasChildren": false, "id": "104957000000000323-104957000001510028", "modifiedDate": "2022-10-03T08:40:39Z", "name": "Down", "parentId": "104957000000000323", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "subCategories": []} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + trackingCategoryId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-tracking-categories: + "": + 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": [{"hasChildren": true, "id": "string", "modifiedDate": "2022-10-23T00:00:00Z", "name": "string", "parentId": "string", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"}], "totalResults": 1} + "400": {} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "9e1dea89-1e34-ed11-97e8-000d3a872db9", "modifiedDate": "2023-03-27T14:21:18Z", "name": "A-000-A-Hundreds", "parentId": "d1391864-77cf-eb11-9f0a-0022481b404b", "sourceModifiedDate": "2022-09-14T11:19:28Z", "status": "Active"}, {"hasChildren": false, "id": "ffc4c780-77cf-eb11-9f0a-0022481b404b", "modifiedDate": "2023-03-27T14:21:18Z", "name": "A-100-A-100 Name", "parentId": "d1391864-77cf-eb11-9f0a-0022481b404b", "sourceModifiedDate": "2021-06-17T14:25:28Z", "status": "Active"}], "totalResults": 36} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "5389667", "modifiedDate": "2023-03-24T16:07:24Z", "name": "ABCustomCategory", "parentId": "4370491", "sourceModifiedDate": "2021-05-19T11:09:40", "status": "Active"}, {"hasChildren": false, "id": "4370499", "modifiedDate": "2023-03-24T16:07:24Z", "name": "Accident Insurance", "parentId": "4370496", "sourceModifiedDate": "2021-07-26T09:42:18", "status": "Active"}], "totalResults": 82} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "CostEstimateType-AVGCOST", "modifiedDate": "2023-01-30T14:46:52Z", "name": "Average Cost", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"hasChildren": false, "id": "classification-1", "modifiedDate": "2023-01-30T14:46:52Z", "name": "Class 1", "sourceModifiedDate": "2022-11-17T11:47:34", "status": "Active"}], "totalResults": 18} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": true, "id": "80000008-1734278594", "modifiedDate": "2023-04-26T09:12:46Z", "name": "ClassWithSub", "sourceModifiedDate": "2024-12-15T16:03:14", "status": "Active"}, {"hasChildren": false, "id": "8000000A-1734278615", "modifiedDate": "2023-04-26T09:12:46Z", "name": "Incative", "sourceModifiedDate": "2024-12-15T16:09:02", "status": "Active"}], "totalResults": 6} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "CLASS_5100000000000014491", "modifiedDate": "2023-04-26T09:35:57Z", "name": "A", "parentId": "CLASSES", "sourceModifiedDate": "2022-03-07T08:28:32Z", "status": "Active"}, {"hasChildren": false, "id": "CLASS_200200000000000009374", "modifiedDate": "2023-04-26T09:35:57Z", "name": "Australia (deleted)", "parentId": "CLASSES", "sourceModifiedDate": "2016-11-04T09:28:00Z", "status": "Archived"}], "totalResults": 23} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "__DEPARTMENTS/3", "modifiedDate": "2022-10-14T09:35:52Z", "name": "Accounts", "parentId": "__DEPARTMENTS", "sourceModifiedDate": "2020-02-28T14:23:46Z", "status": "Active"}, {"hasChildren": false, "id": "__DEPARTMENTS/4", "modifiedDate": "2022-10-14T09:35:52Z", "name": "Admin", "parentId": "__DEPARTMENTS", "sourceModifiedDate": "2020-02-28T14:23:46Z", "status": "Active"}], "totalResults": 24} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "department_10", "modifiedDate": "2023-03-30T14:42:37Z", "name": "", "parentId": "DEPARTMENTS", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active"}, {"hasChildren": false, "id": "department_100", "modifiedDate": "2023-03-30T14:42:37Z", "name": "", "parentId": "DEPARTMENTS", "sourceModifiedDate": "2022-11-25T09:43:54", "status": "Active"}], "totalResults": 1022} + 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/f4aae110-ca17-4cd4-8aaa-a3136b1cf0b1/data/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/f4aae110-ca17-4cd4-8aaa-a3136b1cf0b1/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/f4aae110-ca17-4cd4-8aaa-a3136b1cf0b1/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "department_0", "modifiedDate": "2022-07-27T17:41:22Z", "name": "BallparkContracting", "sourceModifiedDate": "2022-03-22T15:33:21", "status": "Active"}, {"hasChildren": true, "id": "department_1", "modifiedDate": "2022-07-27T17:41:22Z", "name": "BaseMountainConstruction", "sourceModifiedDate": "2021-06-23T15:33:21", "status": "Active"}], "totalResults": 15} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "WAREHOUSE-2", "modifiedDate": "2023-04-04T16:32:02Z", "name": "200", "parentId": "WAREHOUSE", "sourceModifiedDate": "2020-04-26T05:26:46", "status": "Active"}, {"hasChildren": false, "id": "WAREHOUSE-3", "modifiedDate": "2023-04-04T16:32:02Z", "name": "300", "parentId": "WAREHOUSE", "sourceModifiedDate": "2021-08-10T13:41:01", "status": "Active"}], "totalResults": 757} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "dba3d4da-f9ed-4eee-8e0b-452d11fdb1fa", "modifiedDate": "2023-03-15T20:37:11Z", "name": "Eastside", "parentId": "9d8ad8f6-0d0f-41e0-8851-ef47e8b54ae6", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"hasChildren": false, "id": "34b9b859-07a9-451a-b4d3-effc9946634a", "modifiedDate": "2023-03-15T20:37:11Z", "name": "North", "parentId": "9d8ad8f6-0d0f-41e0-8851-ef47e8b54ae6", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 5} + 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/trackingCategories?page=1&pageSize=2"}, "next": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/trackingCategories?page=2&pageSize=2"}, "self": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/trackingCategories"}}, "pageNumber": 1, "pageSize": 2, "results": [{"hasChildren": false, "id": "104957000000000323-104957000001510028", "modifiedDate": "2022-10-03T08:40:39Z", "name": "Down", "parentId": "104957000000000323", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}, {"hasChildren": false, "id": "104957000000000323-104957000001510024", "modifiedDate": "2022-10-03T08:40:39Z", "name": "East", "parentId": "104957000000000323", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"}], "totalResults": 11} + 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} diff --git a/sync-for-payroll/.speakeasy/gen.yaml b/sync-for-payroll/.speakeasy/gen.yaml index 54309815a..895d7dc75 100644 --- a/sync-for-payroll/.speakeasy/gen.yaml +++ b/sync-for-payroll/.speakeasy/gen.yaml @@ -7,9 +7,13 @@ generation: nameResolutionDec2023: false parameterOrderingFeb2024: false requestResponseComponentNamesFeb2024: false + auth: + oAuth2ClientCredentialsEnabled: false telemetryEnabled: true go: - version: 1.3.0 + version: 1.4.0 + additionalDependencies: {} + allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true flattenGlobalSecurity: false imports: @@ -22,5 +26,7 @@ go: webhooks: pkg/models/webhooks inputModelSuffix: input maxMethodParams: 0 + methodArguments: require-security-and-request outputModelSuffix: output packageName: github.com/codatio/client-sdk-go/sync-for-payroll + responseFormat: envelope diff --git a/sync-for-payroll/CONTRIBUTING.md b/sync-for-payroll/CONTRIBUTING.md new file mode 100644 index 000000000..d585717fc --- /dev/null +++ b/sync-for-payroll/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/sync-for-payroll/README.md b/sync-for-payroll/README.md index fa26b88f9..1342775e7 100644 --- a/sync-for-payroll/README.md +++ b/sync-for-payroll/README.md @@ -4,9 +4,51 @@ Push payroll to accounting platforms. + +## Summary + +Sync for Payroll: The API for Sync for Payroll. + +Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting software and to support its reconciliation. + +[Explore product](https://docs.codat.io/payroll/overview) | [See OpenAPI spec](https://github.com/codatio/oas) + +--- + + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Accounts | Get, create, and update Accounts. | +| Journal entries | Get, create, and update Journal entries. | +| Journals | Get, create, and update Journals. | +| Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. | +| Company info | View company profile from the source platform. | +| Manage data | Control how data is retrieved from an integration. | + + + + +## Table of Contents + +* [SDK Installation](#sdk-installation) +* [SDK Example Usage](#sdk-example-usage) +* [Available Resources and Operations](#available-resources-and-operations) +* [Retries](#retries) +* [Error Handling](#error-handling) +* [Server Selection](#server-selection) +* [Custom HTTP Client](#custom-http-client) +* [Authentication](#authentication) +* [Special Types](#special-types) + + ## SDK Installation +To add the SDK as a dependency to your project: ```bash go get github.com/codatio/client-sdk-go/sync-for-payroll ``` @@ -38,12 +80,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -55,6 +101,17 @@ func main() { ## Available Resources and Operations +
+Available methods + +### [Accounts](docs/sdks/accounts/README.md) + +* [Create](docs/sdks/accounts/README.md#create) - Create account +* [Get](docs/sdks/accounts/README.md#get) - Get account +* [GetCreateModel](docs/sdks/accounts/README.md#getcreatemodel) - Get create account model +* [List](docs/sdks/accounts/README.md#list) - List accounts + + ### [Companies](docs/sdks/companies/README.md) * [Create](docs/sdks/companies/README.md#create) - Create company @@ -63,6 +120,10 @@ func main() { * [List](docs/sdks/companies/README.md#list) - List companies * [Update](docs/sdks/companies/README.md#update) - Update company +### [CompanyInfo](docs/sdks/companyinfo/README.md) + +* [GetAccountingProfile](docs/sdks/companyinfo/README.md#getaccountingprofile) - Get company accounting profile + ### [Connections](docs/sdks/connections/README.md) * [Create](docs/sdks/connections/README.md#create) - Create connection @@ -71,13 +132,6 @@ func main() { * [List](docs/sdks/connections/README.md#list) - List connections * [Unlink](docs/sdks/connections/README.md#unlink) - Unlink connection -### [Accounts](docs/sdks/accounts/README.md) - -* [Create](docs/sdks/accounts/README.md#create) - Create account -* [Get](docs/sdks/accounts/README.md#get) - Get account -* [GetCreateModel](docs/sdks/accounts/README.md#getcreatemodel) - Get create account model -* [List](docs/sdks/accounts/README.md#list) - List accounts - ### [JournalEntries](docs/sdks/journalentries/README.md) * [Create](docs/sdks/journalentries/README.md#create) - Create journal entry @@ -103,14 +157,12 @@ func main() { * [RefreshAllDataTypes](docs/sdks/managedata/README.md#refreshalldatatypes) - Refresh all data * [RefreshDataType](docs/sdks/managedata/README.md#refreshdatatype) - Refresh data type -### [CompanyInfo](docs/sdks/companyinfo/README.md) - -* [GetAccountingProfile](docs/sdks/companyinfo/README.md#getaccountingprofile) - Get company accounting profile - ### [TrackingCategories](docs/sdks/trackingcategories/README.md) * [Get](docs/sdks/trackingcategories/README.md#get) - Get tracking categories * [List](docs/sdks/trackingcategories/README.md#list) - List tracking categories + +
@@ -128,7 +180,7 @@ func main() { Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. -To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call by using the `WithRetries` option: +To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option: ```go package main @@ -136,7 +188,7 @@ import ( "context" syncforpayroll "github.com/codatio/client-sdk-go/sync-for-payroll" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" - "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "log" "pkg/models/operations" ) @@ -151,11 +203,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }, operations.WithRetries( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -166,7 +223,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -182,16 +238,16 @@ import ( "context" syncforpayroll "github.com/codatio/client-sdk-go/sync-for-payroll" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" - "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "log" ) func main() { s := syncforpayroll.New( syncforpayroll.WithRetryConfig( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -207,12 +263,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -255,7 +315,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { @@ -310,12 +375,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -348,12 +417,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -423,12 +496,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } diff --git a/sync-for-payroll/RELEASES.md b/sync-for-payroll/RELEASES.md index 051e4d0df..eb2899006 100644 --- a/sync-for-payroll/RELEASES.md +++ b/sync-for-payroll/RELEASES.md @@ -48,4 +48,14 @@ Based on: ### Generated - [go v1.3.0] sync-for-payroll ### Releases -- [Go v1.3.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payroll/v1.3.0 - sync-for-payroll \ No newline at end of file +- [Go v1.3.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payroll/v1.3.0 - sync-for-payroll + +## 2024-09-14 10:29:06 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.396.9 (2.415.7) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v1.4.0] sync-for-payroll +### Releases +- [Go v1.4.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-payroll/v1.4.0 - sync-for-payroll \ No newline at end of file diff --git a/sync-for-payroll/USAGE.md b/sync-for-payroll/USAGE.md index e82eb14c7..31cffe317 100644 --- a/sync-for-payroll/USAGE.md +++ b/sync-for-payroll/USAGE.md @@ -19,12 +19,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } diff --git a/sync-for-payroll/accounts.go b/sync-for-payroll/accounts.go index 04addc87b..98fea6db0 100644 --- a/sync-for-payroll/accounts.go +++ b/sync-for-payroll/accounts.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// Accounts +// Accounts - Get, create, and update Accounts. type Accounts struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newAccounts(sdkConfig sdkConfiguration) *Accounts { // // 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 *Accounts) Create(ctx context.Context, request operations.CreateAccountRequest, opts ...operations.Option) (*operations.CreateAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-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 *Accounts) Create(ctx context.Context, request operations.CreateAccountR 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 + } + + 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,53 +111,109 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.CreateAccountResponse{ 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.CreateAccountResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -140,7 +221,12 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR res.CreateAccountResponse = &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 @@ -158,22 +244,46 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR 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 + } // Get account @@ -185,9 +295,17 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest, opts ...operations.Option) (*operations.GetAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -195,28 +313,43 @@ func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest 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, @@ -224,53 +357,109 @@ func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetAccountResponse{ 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.Account if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -278,7 +467,12 @@ func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest res.Account = &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 @@ -296,22 +490,46 @@ func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest 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 + } // GetCreateModel - Get create account model @@ -325,9 +543,17 @@ func (s *Accounts) Get(ctx context.Context, request operations.GetAccountRequest // // 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 *Accounts) GetCreateModel(ctx context.Context, request operations.GetCreateAccountsModelRequest, opts ...operations.Option) (*operations.GetCreateAccountsModelResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-create-accounts-model", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -335,28 +561,43 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - 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, @@ -364,53 +605,109 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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.GetCreateAccountsModelResponse{ 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.PushOption if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -418,7 +715,12 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre res.PushOption = &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 @@ -434,22 +736,46 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre 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 + } // List accounts @@ -459,9 +785,17 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *Accounts) List(ctx context.Context, request operations.ListAccountsRequest, opts ...operations.Option) (*operations.ListAccountsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -469,32 +803,47 @@ func (s *Accounts) List(ctx context.Context, request operations.ListAccountsRequ 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, @@ -502,53 +851,109 @@ func (s *Accounts) List(ctx context.Context, request operations.ListAccountsRequ }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.ListAccountsResponse{ 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.Accounts if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -556,7 +961,12 @@ func (s *Accounts) List(ctx context.Context, request operations.ListAccountsRequ res.Accounts = &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 @@ -576,20 +986,44 @@ func (s *Accounts) List(ctx context.Context, request operations.ListAccountsRequ 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/sync-for-payroll/codatsyncpayroll.go b/sync-for-payroll/codatsyncpayroll.go index 276cb2f8b..79d8d12bd 100644 --- a/sync-for-payroll/codatsyncpayroll.go +++ b/sync-for-payroll/codatsyncpayroll.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 syncforpayroll import ( "context" "fmt" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/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) { @@ -64,40 +70,42 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // CodatSyncPayroll - Sync for Payroll: The API for Sync for Payroll. // -// Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting platforms and to support its reconciliation. +// Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting software and to support its reconciliation. // // [Explore product](https://docs.codat.io/payroll/overview) | [See OpenAPI spec](https://github.com/codatio/oas) // // --- // +// // ## Endpoints // -// | Endpoints | Description | -// |:---------------------|:-----------------------------------------------------------------------------------------------------------| -// | Companies | Create and manage your SMB users' companies. | -// | Connections | Create new and manage existing data connections for a company. | -// | Accounts | Get, create, and update Accounts. | -// | Journal entries | Get, create, and update Journal entries. | -// | Journals | Get, create, and update Journals. | -// | Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. | -// | Company info | View company profile from the source platform. | -// | Manage data | Control how data is retrieved from an integration. | +// | Endpoints | Description | +// | :- |:- | +// | Companies | Create and manage your SMB users' companies. | +// | Connections | Create new and manage existing data connections for a company. | +// | Accounts | Get, create, and update Accounts. | +// | Journal entries | Get, create, and update Journal entries. | +// | Journals | Get, create, and update Journals. | +// | Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. | +// | Company info | View company profile from the source platform. | +// | Manage data | Control how data is retrieved from an integration. | +// type CodatSyncPayroll struct { - // Create and manage your Codat companies. + // Create and manage your SMB users' companies. Companies *Companies - // Manage your companies' data connections. + // Create new and manage existing data connections for a company. Connections *Connections - // Accounts + // Get, create, and update Accounts. Accounts *Accounts - // Journal entries + // Get, create, and update Journal entries. JournalEntries *JournalEntries - // Journals + // Get, create, and update Journals. Journals *Journals - // Asynchronously retrieve data from an integration to refresh data in Codat. + // Control how data is retrieved from an integration. ManageData *ManageData - // View company information fetched from the source platform. + // View company profile from the source platform. CompanyInfo *CompanyInfo - // Tracking categories + // Get, create, and update Tracking Categories for additional categorization of payroll components. TrackingCategories *TrackingCategories sdkConfiguration sdkConfiguration @@ -137,20 +145,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 *CodatSyncPayroll) { - 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 *CodatSyncPayroll) { - sdk.sdkConfiguration.Security = withSecurity(security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) } } @@ -163,21 +165,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 *CodatSyncPayroll) { sdk.sdkConfiguration.RetryConfig = &retryConfig } } +// WithTimeout Optional request timeout applied to each operation +func WithTimeout(timeout time.Duration) SDKOption { + return func(sdk *CodatSyncPayroll) { + sdk.sdkConfiguration.Timeout = &timeout + } +} + // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *CodatSyncPayroll { sdk := &CodatSyncPayroll{ sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "3.0.0", - SDKVersion: "1.3.0", - GenVersion: "2.253.0", - UserAgent: "speakeasy-sdk/go 1.3.0 2.253.0 3.0.0 github.com/codatio/client-sdk-go/sync-for-payroll", + SDKVersion: "1.4.0", + GenVersion: "2.415.7", + UserAgent: "speakeasy-sdk/go 1.4.0 2.415.7 3.0.0 github.com/codatio/client-sdk-go/sync-for-payroll", + Hooks: hooks.New(), }, } for _, opt := range opts { @@ -185,15 +195,15 @@ func New(opts ...SDKOption) *CodatSyncPayroll { } // 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.Companies = newCompanies(sdk.sdkConfiguration) diff --git a/sync-for-payroll/companies.go b/sync-for-payroll/companies.go index 97f422bb1..7b81c2bdf 100644 --- a/sync-for-payroll/companies.go +++ b/sync-for-payroll/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 syncforpayroll @@ -6,16 +6,19 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" - "strings" + "net/url" ) -// Companies - Create and manage your Codat companies. +// Companies - Create and manage your SMB users' companies. type Companies struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newCompanies(sdkConfig sdkConfiguration) *Companies { // // If forbidden characters (see `name` pattern) are present in the request, a company will be created with the forbidden characters removed. For example, `Company (Codat[1])` with be created as `Company Codat1`. func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBody, 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 { @@ -44,32 +55,49 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/companies" + opURL, err := url.JoinPath(baseURL, "/companies") + 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, @@ -77,53 +105,109 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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 @@ -131,7 +215,12 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo 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 @@ -147,22 +236,46 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo 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 + } // Delete a company @@ -171,9 +284,17 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo // A [company](https://docs.codat.io/sync-for-payroll-api#/schemas/Company) represents a business sharing access to their data. // Each company can have multiple [connections](https://docs.codat.io/sync-for-payroll-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) Delete(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 { @@ -181,28 +302,43 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -210,49 +346,100 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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: @@ -269,22 +456,46 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany 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 + } // Get company @@ -293,9 +504,17 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany // A [company](https://docs.codat.io/sync-for-payroll-api#/schemas/Company) represents a business sharing access to their data. // Each company can have multiple [connections](https://docs.codat.io/sync-for-payroll-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) Get(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 { @@ -303,28 +522,43 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -332,53 +566,109 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -386,7 +676,12 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques 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 @@ -402,22 +697,46 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques 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 + } // List companies @@ -426,9 +745,17 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques // A [company](https://docs.codat.io/sync-for-payroll-api#/schemas/Company) represents a business sharing access to their data. // Each company can have multiple [connections](https://docs.codat.io/sync-for-payroll-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) List(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 { @@ -436,29 +763,47 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/companies" + opURL, err := url.JoinPath(baseURL, "/companies") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + 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, @@ -466,53 +811,109 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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 @@ -520,7 +921,12 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe 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 @@ -538,22 +944,46 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe 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 + } // Update company @@ -563,9 +993,17 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe // A [company](https://docs.codat.io/sync-for-payroll-api#/schemas/Company) represents a business sharing access to their data. // Each company can have multiple [connections](https://docs.codat.io/sync-for-payroll-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) Update(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 { @@ -573,35 +1011,49 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, "CompanyRequestBody", "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, @@ -609,53 +1061,109 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -663,7 +1171,12 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany 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 @@ -679,20 +1192,44 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany 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/sync-for-payroll/companyinfo.go b/sync-for-payroll/companyinfo.go index 6c39f8156..2ad40f364 100644 --- a/sync-for-payroll/companyinfo.go +++ b/sync-for-payroll/companyinfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// CompanyInfo - View company information fetched from the source platform. +// CompanyInfo - View company profile from the source platform. type CompanyInfo struct { sdkConfiguration sdkConfiguration } @@ -28,9 +31,17 @@ func newCompanyInfo(sdkConfig sdkConfiguration) *CompanyInfo { // GetAccountingProfile - Get company accounting profile // Gets the latest basic info for a company. func (s *CompanyInfo) GetAccountingProfile(ctx context.Context, request operations.GetAccountingProfileRequest, opts ...operations.Option) (*operations.GetAccountingProfileResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-accounting-profile", + 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 *CompanyInfo) GetAccountingProfile(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}/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,53 +93,109 @@ func (s *CompanyInfo) GetAccountingProfile(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) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetAccountingProfileResponse{ 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.CompanyInfo if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -121,7 +203,12 @@ func (s *CompanyInfo) GetAccountingProfile(ctx context.Context, request operatio res.CompanyInfo = &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 @@ -139,20 +226,44 @@ func (s *CompanyInfo) GetAccountingProfile(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 + } diff --git a/sync-for-payroll/connections.go b/sync-for-payroll/connections.go index 2e1709c05..ebf42517f 100644 --- a/sync-for-payroll/connections.go +++ b/sync-for-payroll/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 syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// Connections - Manage your companies' data connections. +// Connections - Create new and manage existing data connections for a company. type Connections struct { sdkConfiguration sdkConfiguration } @@ -30,9 +33,17 @@ func newConnections(sdkConfig sdkConfiguration) *Connections { // // Use the [List Integrations](https://docs.codat.io/sync-for-payroll-api#/operations/list-integrations) endpoint to access valid platform keys. func (s *Connections) Create(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 { @@ -40,35 +51,49 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/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 } - 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, @@ -76,53 +101,109 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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 @@ -130,7 +211,12 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne 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 @@ -146,31 +232,63 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne 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 + } // Delete connection // Revoke and remove a connection from a company. // This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company. func (s *Connections) Delete(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 { @@ -178,28 +296,43 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -207,49 +340,100 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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: @@ -266,30 +450,62 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne 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 + } // 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) Get(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 { @@ -297,28 +513,43 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -326,53 +557,109 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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 @@ -380,7 +667,12 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR 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 @@ -396,30 +688,62 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR 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 + } // List connections // List the connections for a company. func (s *Connections) List(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 { @@ -427,32 +751,47 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/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, @@ -460,53 +799,109 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -514,7 +909,12 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio 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 @@ -532,30 +932,62 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio 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 { @@ -563,35 +995,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, "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) - 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, @@ -599,53 +1045,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) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -653,7 +1155,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 @@ -669,20 +1176,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/sync-for-payroll/docs/pkg/models/operations/createcompanyresponse.md b/sync-for-payroll/docs/pkg/models/operations/createcompanyresponse.md index 795f1c5b4..134636626 100644 --- a/sync-for-payroll/docs/pkg/models/operations/createcompanyresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/createcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"id":"ee2eb431-c0fa-4dc9-93fa-d29781c12bcd","integrationId":"bf083d72-62c7-493e-aec9-81b4dbba7e2c","integrationKey":"dfxm","sourceId":"bdd831ce-eebd-4896-89a7-20e5ee8989ee","platformName":"Basiq","linkUrl":"https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start","status":"Linked","lastSync":"2022-10-27T10:22:43.6464237Z","created":"2022-10-27T09:53:29Z","sourceType":"Banking"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/createconnectionresponse.md b/sync-for-payroll/docs/pkg/models/operations/createconnectionresponse.md index 570c12006..8967db127 100644 --- a/sync-for-payroll/docs/pkg/models/operations/createconnectionresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/createconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 +| 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/sync-for-payroll/docs/pkg/models/operations/getaccountingprofileresponse.md b/sync-for-payroll/docs/pkg/models/operations/getaccountingprofileresponse.md index 44a4cc249..d314ad034 100644 --- a/sync-for-payroll/docs/pkg/models/operations/getaccountingprofileresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/getaccountingprofileresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `CompanyInfo` | [*shared.CompanyInfo](../../../pkg/models/shared/companyinfo.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 +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `CompanyInfo` | [*shared.CompanyInfo](../../../pkg/models/shared/companyinfo.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/sync-for-payroll/docs/pkg/models/operations/getcompanyresponse.md b/sync-for-payroll/docs/pkg/models/operations/getcompanyresponse.md index d2fd90472..8bc3efda8 100644 --- a/sync-for-payroll/docs/pkg/models/operations/getcompanyresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/getcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"id":"ee2eb431-c0fa-4dc9-93fa-d29781c12bcd","integrationId":"bf083d72-62c7-493e-aec9-81b4dbba7e2c","integrationKey":"dfxm","sourceId":"bdd831ce-eebd-4896-89a7-20e5ee8989ee","platformName":"Basiq","linkUrl":"https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start","status":"Linked","lastSync":"2022-10-27T10:22:43.6464237Z","created":"2022-10-27T09:53:29Z","sourceType":"Banking"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/getconnectionresponse.md b/sync-for-payroll/docs/pkg/models/operations/getconnectionresponse.md index cec1bdb6e..30b35ef1b 100644 --- a/sync-for-payroll/docs/pkg/models/operations/getconnectionresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/getconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 +| 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/sync-for-payroll/docs/pkg/models/operations/getdatastatusdatastatuses.md b/sync-for-payroll/docs/pkg/models/operations/getdatastatusdatastatuses.md new file mode 100644 index 000000000..9b20b4637 --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/operations/getdatastatusdatastatuses.md @@ -0,0 +1,52 @@ +# GetDataStatusDataStatuses + +OK + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BalanceSheet` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingAccountBalances` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingTransactionCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BillCreditNotes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BillPayments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Bills` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CashFlowStatement` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ChartOfAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceCompanyInfo` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceCustomers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceDisputes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceLocations` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommercePaymentMethods` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommercePayments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceProductCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceProducts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceTaxComponents` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Company` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CreditNotes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Customers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `DirectCosts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `DirectIncomes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Invoices` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ItemReceipts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Items` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `JournalEntries` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Journals` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `PaymentMethods` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Payments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ProfitAndLoss` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `PurchaseOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `SalesOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Suppliers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `TaxRates` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `TrackingCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Transfers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/getdatastatusresponse.md b/sync-for-payroll/docs/pkg/models/operations/getdatastatusresponse.md index 28fc68ffa..9416981a4 100644 --- a/sync-for-payroll/docs/pkg/models/operations/getdatastatusresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/getdatastatusresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `DataStatuses` | map[string][shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `DataStatuses` | [*operations.GetDataStatusDataStatuses](../../../pkg/models/operations/getdatastatusdatastatuses.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/getpulloperationresponse.md b/sync-for-payroll/docs/pkg/models/operations/getpulloperationresponse.md index be4d31b85..7568d1fbb 100644 --- a/sync-for-payroll/docs/pkg/models/operations/getpulloperationresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/getpulloperationresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 +| 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/sync-for-payroll/docs/pkg/models/operations/listaccountsrequest.md b/sync-for-payroll/docs/pkg/models/operations/listaccountsrequest.md index 24abb38e7..f72631aea 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listaccountsrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listaccountsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listaccountsresponse.md b/sync-for-payroll/docs/pkg/models/operations/listaccountsresponse.md index 67b5c3173..e9fb7e35f 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listaccountsresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listaccountsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Accounts` | [*shared.Accounts](../../../pkg/models/shared/accounts.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Accounts` | [*shared.Accounts](../../../pkg/models/shared/accounts.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/sync-for-payroll/docs/pkg/models/operations/listcompaniesrequest.md b/sync-for-payroll/docs/pkg/models/operations/listcompaniesrequest.md index ee176cc37..cccb983e3 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listcompaniesrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listcompaniesrequest.md @@ -8,4 +8,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listcompaniesresponse.md b/sync-for-payroll/docs/pkg/models/operations/listcompaniesresponse.md index 41065cae0..5131f71f8 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listcompaniesresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listcompaniesresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Companies` | [*shared.Companies](../../../pkg/models/shared/companies.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Companies` | [*shared.Companies](../../../pkg/models/shared/companies.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/sync-for-payroll/docs/pkg/models/operations/listconnectionsrequest.md b/sync-for-payroll/docs/pkg/models/operations/listconnectionsrequest.md index df5ebd3fc..c28099519 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listconnectionsrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listconnectionsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listconnectionsresponse.md b/sync-for-payroll/docs/pkg/models/operations/listconnectionsresponse.md index 27c58c5a4..44339a983 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listconnectionsresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listconnectionsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Connections` | [*shared.Connections](../../../pkg/models/shared/connections.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Connections` | [*shared.Connections](../../../pkg/models/shared/connections.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/sync-for-payroll/docs/pkg/models/operations/listjournalentriesrequest.md b/sync-for-payroll/docs/pkg/models/operations/listjournalentriesrequest.md index 367c13031..11e1bc7fc 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listjournalentriesrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listjournalentriesrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listjournalentriesresponse.md b/sync-for-payroll/docs/pkg/models/operations/listjournalentriesresponse.md index d57f51073..a73169bfa 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listjournalentriesresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listjournalentriesresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `JournalEntries` | [*shared.JournalEntries](../../../pkg/models/shared/journalentries.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `JournalEntries` | [*shared.JournalEntries](../../../pkg/models/shared/journalentries.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/sync-for-payroll/docs/pkg/models/operations/listjournalsrequest.md b/sync-for-payroll/docs/pkg/models/operations/listjournalsrequest.md index c5585c7cc..3e71a295e 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listjournalsrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listjournalsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listjournalsresponse.md b/sync-for-payroll/docs/pkg/models/operations/listjournalsresponse.md index bc0846125..abbf75fcd 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listjournalsresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listjournalsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `Journals` | [*shared.Journals](../../../pkg/models/shared/journals.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `Journals` | [*shared.Journals](../../../pkg/models/shared/journals.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/sync-for-payroll/docs/pkg/models/operations/listpulloperationsrequest.md b/sync-for-payroll/docs/pkg/models/operations/listpulloperationsrequest.md index 6c5f80bfc..bfea8f9b6 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listpulloperationsrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listpulloperationsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listpulloperationsresponse.md b/sync-for-payroll/docs/pkg/models/operations/listpulloperationsresponse.md index 92e76c190..0aceb5994 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listpulloperationsresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listpulloperationsresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/operations/listpushoperationsrequest.md b/sync-for-payroll/docs/pkg/models/operations/listpushoperationsrequest.md index bfd4ea0f6..faba95832 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listpushoperationsrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listpushoperationsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listpushoperationsresponse.md b/sync-for-payroll/docs/pkg/models/operations/listpushoperationsresponse.md index 8fb7cc067..4d78df3cb 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listpushoperationsresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listpushoperationsresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesrequest.md b/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesrequest.md index c2183d78d..8942fd270 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesrequest.md +++ b/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesresponse.md b/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesresponse.md index 00264386c..826b75b93 100644 --- a/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/listtrackingcategoriesresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `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 | | -| `TrackingCategories` | [*shared.TrackingCategories](../../../pkg/models/shared/trackingcategories.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | | +| `TrackingCategories` | [*shared.TrackingCategories](../../../pkg/models/shared/trackingcategories.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"
}
}
} | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/operations/option.md b/sync-for-payroll/docs/pkg/models/operations/option.md index 9167702bf..35d8a1e2a 100644 --- a/sync-for-payroll/docs/pkg/models/operations/option.md +++ b/sync-for-payroll/docs/pkg/models/operations/option.md @@ -24,9 +24,9 @@ operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{ WithRetries allows customizing the default retry configuration. Only usable with methods that mention they support retries. ```go -operations.WithRetries(utils.RetryConfig{ +operations.WithRetries(retry.Config{ Strategy: "backoff", - Backoff: utils.BackoffStrategy{ + Backoff: retry.BackoffStrategy{ InitialInterval: 500 * time.Millisecond, MaxInterval: 60 * time.Second, Exponent: 1.5, diff --git a/sync-for-payroll/docs/pkg/models/operations/refreshdatatyperesponse.md b/sync-for-payroll/docs/pkg/models/operations/refreshdatatyperesponse.md index 8072edeee..baddccc06 100644 --- a/sync-for-payroll/docs/pkg/models/operations/refreshdatatyperesponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/refreshdatatyperesponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 +| 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/sync-for-payroll/docs/pkg/models/operations/unlinkconnectionresponse.md b/sync-for-payroll/docs/pkg/models/operations/unlinkconnectionresponse.md index cc9abe4fb..e407eadee 100644 --- a/sync-for-payroll/docs/pkg/models/operations/unlinkconnectionresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/unlinkconnectionresponse.md @@ -3,9 +3,9 @@ ## Fields -| 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 +| 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/sync-for-payroll/docs/pkg/models/operations/updatecompanyresponse.md b/sync-for-payroll/docs/pkg/models/operations/updatecompanyresponse.md index 39e3766ff..30b2e9856 100644 --- a/sync-for-payroll/docs/pkg/models/operations/updatecompanyresponse.md +++ b/sync-for-payroll/docs/pkg/models/operations/updatecompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"id":"ee2eb431-c0fa-4dc9-93fa-d29781c12bcd","integrationId":"bf083d72-62c7-493e-aec9-81b4dbba7e2c","integrationKey":"dfxm","sourceId":"bdd831ce-eebd-4896-89a7-20e5ee8989ee","platformName":"Basiq","linkUrl":"https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start","status":"Linked","lastSync":"2022-10-27T10:22:43.6464237Z","created":"2022-10-27T09:53:29Z","sourceType":"Banking"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/account.md b/sync-for-payroll/docs/pkg/models/shared/account.md index 3eaf17d19..e15492b89 100644 --- a/sync-for-payroll/docs/pkg/models/shared/account.md +++ b/sync-for-payroll/docs/pkg/models/shared/account.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.AccountValidDataTypeLinks](../../../pkg/models/shared/accountvaliddatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/sync-for-payroll-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/accountingaccount.md b/sync-for-payroll/docs/pkg/models/shared/accountingaccount.md index c8d60be1a..abf602fa4 100644 --- a/sync-for-payroll/docs/pkg/models/shared/accountingaccount.md +++ b/sync-for-payroll/docs/pkg/models/shared/accountingaccount.md @@ -49,6 +49,6 @@ To determine the list of allowed categories for a specific integration, you can: | `NominalCode` | **string* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [*shared.AccountStatus](../../../pkg/models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the account | Active | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

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

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `Type` | [*shared.AccountType](../../../pkg/models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | | `ValidDatatypeLinks` | [][shared.CreateAccountResponseValidDataTypeLinks](../../../pkg/models/shared/createaccountresponsevaliddatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/sync-for-payroll-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/accountingjournal.md b/sync-for-payroll/docs/pkg/models/shared/accountingjournal.md index d232cc53e..ae184ef7c 100644 --- a/sync-for-payroll/docs/pkg/models/shared/accountingjournal.md +++ b/sync-for-payroll/docs/pkg/models/shared/accountingjournal.md @@ -21,7 +21,7 @@ Multiple journals or subjournals are used in the following Codat integrations: - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) -> When pushing journal entries to an accounting platform that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. +> When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. > :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. diff --git a/sync-for-payroll/docs/pkg/models/shared/accountingjournalentry.md b/sync-for-payroll/docs/pkg/models/shared/accountingjournalentry.md index 0d2c4dcc2..7578d2ed9 100644 --- a/sync-for-payroll/docs/pkg/models/shared/accountingjournalentry.md +++ b/sync-for-payroll/docs/pkg/models/shared/accountingjournalentry.md @@ -32,7 +32,7 @@ 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.JournalRef](../../../pkg/models/shared/journalref.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | @@ -40,5 +40,5 @@ In Codat a journal entry contains details of: | `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 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/sync-for-payroll/docs/pkg/models/shared/accountprototype.md b/sync-for-payroll/docs/pkg/models/shared/accountprototype.md index 087a8fa02..9a943bef9 100644 --- a/sync-for-payroll/docs/pkg/models/shared/accountprototype.md +++ b/sync-for-payroll/docs/pkg/models/shared/accountprototype.md @@ -14,6 +14,6 @@ | `Name` | **string* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | | `NominalCode` | **string* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | | `Status` | [*shared.AccountStatus](../../../pkg/models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the account | Active | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

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

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `Type` | [*shared.AccountType](../../../pkg/models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | | `ValidDatatypeLinks` | [][shared.ValidDataTypeLinks](../../../pkg/models/shared/validdatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/sync-for-payroll-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/accounts.md b/sync-for-payroll/docs/pkg/models/shared/accounts.md index 1fdff0230..3cd5d4687 100644 --- a/sync-for-payroll/docs/pkg/models/shared/accounts.md +++ b/sync-for-payroll/docs/pkg/models/shared/accounts.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | -| `Results` | [][shared.Account](../../../pkg/models/shared/account.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.Account](../../../pkg/models/shared/account.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/clientratelimitreachedwebhook.md b/sync-for-payroll/docs/pkg/models/shared/clientratelimitreachedwebhook.md index 90223a07a..9d358404f 100644 --- a/sync-for-payroll/docs/pkg/models/shared/clientratelimitreachedwebhook.md +++ b/sync-for-payroll/docs/pkg/models/shared/clientratelimitreachedwebhook.md @@ -5,12 +5,12 @@ Webhook request body for a client that has reached their rate limit. ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `AlertID` | **string* | :heavy_minus_sign: | Unique identifier of the webhook event. | -| `ClientID` | **string* | :heavy_minus_sign: | Unique identifier for your client in Codat. | -| `ClientName` | **string* | :heavy_minus_sign: | Name of your client in Codat. | -| `Data` | [*shared.ClientRateLimitReachedWebhookData](../../../pkg/models/shared/clientratelimitreachedwebhookdata.md) | :heavy_minus_sign: | N/A | -| `Message` | **string* | :heavy_minus_sign: | A human readable message about the webhook. | -| `RuleID` | **string* | :heavy_minus_sign: | Unique identifier for the rule. | -| `RuleType` | **string* | :heavy_minus_sign: | The type of rule. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AlertID` | **string* | :heavy_minus_sign: | Unique identifier of the webhook event. | +| `ClientID` | **string* | :heavy_minus_sign: | Unique identifier for your client in Codat. | +| `ClientName` | **string* | :heavy_minus_sign: | Name of your client in Codat. | +| `Data` | [*shared.ClientRateLimitReachedWebhookData](../../../pkg/models/shared/clientratelimitreachedwebhookdata.md) | :heavy_minus_sign: | N/A | +| `Message` | **string* | :heavy_minus_sign: | A human-readable message about the webhook. | +| ~~`RuleID`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | +| `RuleType` | **string* | :heavy_minus_sign: | The type of rule. | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhook.md b/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhook.md index 07a4bdf32..8223885e3 100644 --- a/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhook.md +++ b/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhook.md @@ -5,12 +5,12 @@ Webhook request body for a client that has had their rate limit reset. ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `AlertID` | **string* | :heavy_minus_sign: | Unique identifier of the webhook event. | -| `ClientID` | **string* | :heavy_minus_sign: | Unique identifier for your client in Codat. | -| `ClientName` | **string* | :heavy_minus_sign: | Name of your client in Codat. | -| `Data` | [*shared.ClientRateLimitResetWebhookData](../../../pkg/models/shared/clientratelimitresetwebhookdata.md) | :heavy_minus_sign: | N/A | -| `Message` | **string* | :heavy_minus_sign: | A human readable message about the webhook. | -| `RuleID` | **string* | :heavy_minus_sign: | Unique identifier for the rule. | -| `RuleType` | **string* | :heavy_minus_sign: | The type of rule. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AlertID` | **string* | :heavy_minus_sign: | Unique identifier of the webhook event. | +| `ClientID` | **string* | :heavy_minus_sign: | Unique identifier for your client in Codat. | +| `ClientName` | **string* | :heavy_minus_sign: | Name of your client in Codat. | +| `Data` | [*shared.ClientRateLimitResetWebhookData](../../../pkg/models/shared/clientratelimitresetwebhookdata.md) | :heavy_minus_sign: | N/A | +| `Message` | **string* | :heavy_minus_sign: | A human-readable message about the webhook. | +| ~~`RuleID`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | +| `RuleType` | **string* | :heavy_minus_sign: | The type of rule. | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhookdata.md b/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhookdata.md index b06f48df7..f5af03570 100644 --- a/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhookdata.md +++ b/sync-for-payroll/docs/pkg/models/shared/clientratelimitresetwebhookdata.md @@ -7,5 +7,5 @@ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `DailyQuota` | **int64* | :heavy_minus_sign: | The number of available requests per day. | | | `ExpiresUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `QuotaRemaining` | **int64* | :heavy_minus_sign: | Total number of request remaining for your client. | | +| `QuotaRemaining` | **int64* | :heavy_minus_sign: | Total number of requests remaining for your client. | | | `ResetReason` | **string* | :heavy_minus_sign: | The reason for your rate limit quota being reset. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/clientratelimitwebhook.md b/sync-for-payroll/docs/pkg/models/shared/clientratelimitwebhook.md new file mode 100644 index 000000000..99c7948dd --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/shared/clientratelimitwebhook.md @@ -0,0 +1,11 @@ +# ClientRateLimitWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `EventType` | **string* | :heavy_minus_sign: | The type of event. | client.rateLimit.reset | +| `GeneratedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

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

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `QuotaRemaining` | **int64* | :heavy_minus_sign: | Total number of requests remaining for your client. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/companies.md b/sync-for-payroll/docs/pkg/models/shared/companies.md index 156a1bbad..320f6c913 100644 --- a/sync-for-payroll/docs/pkg/models/shared/companies.md +++ b/sync-for-payroll/docs/pkg/models/shared/companies.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/shared/company.md b/sync-for-payroll/docs/pkg/models/shared/company.md index eb6bae838..eea50f3e5 100644 --- a/sync-for-payroll/docs/pkg/models/shared/company.md +++ b/sync-for-payroll/docs/pkg/models/shared/company.md @@ -15,9 +15,8 @@ When you create a company, you can specify a `name` and we will automatically ge | `CreatedByUserName` | **string* | :heavy_minus_sign: | Name of user that created the company in Codat. | | | `DataConnections` | [][shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | N/A | | | `Description` | **string* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | -| `Groups` | [][shared.GroupReference](../../../pkg/models/shared/groupreference.md) | :heavy_minus_sign: | An array of groups the company has been assigned to. | | | `ID` | *string* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `LastSync` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

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

`platformKeys` name used when creating the company. | Xero | -| `Redirect` | *string* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | \ No newline at end of file +| `Redirect` | *string* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | +| `Tags` | [*shared.Tags](../../../pkg/models/shared/tags.md) | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/companyinfo.md b/sync-for-payroll/docs/pkg/models/shared/companyinfo.md index 703555d6c..aeb3fffb6 100644 --- a/sync-for-payroll/docs/pkg/models/shared/companyinfo.md +++ b/sync-for-payroll/docs/pkg/models/shared/companyinfo.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.Address](../../../pkg/models/shared/address.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.PhoneNumber](../../../pkg/models/shared/phonenumber.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/sync-for-payroll/docs/pkg/models/shared/companyrequestbody.md b/sync-for-payroll/docs/pkg/models/shared/companyrequestbody.md index ce44d69ac..0b7b5533c 100644 --- a/sync-for-payroll/docs/pkg/models/shared/companyrequestbody.md +++ b/sync-for-payroll/docs/pkg/models/shared/companyrequestbody.md @@ -6,5 +6,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `Description` | **string* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | -| `Groups` | [][shared.Items](../../../pkg/models/shared/items.md) | :heavy_minus_sign: | Reference to the groups that the company is assigned to. | | +| `Groups` | [][shared.GroupReference](../../../pkg/models/shared/groupreference.md) | :heavy_minus_sign: | Reference to the groups that the company is assigned to. | | | `Name` | *string* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/connection.md b/sync-for-payroll/docs/pkg/models/shared/connection.md index 6f2a27263..dc445ab6f 100644 --- a/sync-for-payroll/docs/pkg/models/shared/connection.md +++ b/sync-for-payroll/docs/pkg/models/shared/connection.md @@ -16,7 +16,7 @@ Before you can use a data connection to pull or push data, the company must gran | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AdditionalProperties` | *interface{}* | :heavy_minus_sign: | N/A | | +| `AdditionalProperties` | *any* | :heavy_minus_sign: | N/A | | | `ConnectionInfo` | map[string]*string* | :heavy_minus_sign: | N/A | | | `Created` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `DataConnectionErrors` | [][shared.DataConnectionError](../../../pkg/models/shared/dataconnectionerror.md) | :heavy_minus_sign: | N/A | | diff --git a/sync-for-payroll/docs/pkg/models/shared/connections.md b/sync-for-payroll/docs/pkg/models/shared/connections.md index 7a7decfe8..4fe3ef571 100644 --- a/sync-for-payroll/docs/pkg/models/shared/connections.md +++ b/sync-for-payroll/docs/pkg/models/shared/connections.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/shared/contactreference.md b/sync-for-payroll/docs/pkg/models/shared/contactreference.md new file mode 100644 index 000000000..2bdc8bae1 --- /dev/null +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/createaccountresponse.md b/sync-for-payroll/docs/pkg/models/shared/createaccountresponse.md index 16e6d86ef..56f0dcd1d 100644 --- a/sync-for-payroll/docs/pkg/models/shared/createaccountresponse.md +++ b/sync-for-payroll/docs/pkg/models/shared/createaccountresponse.md @@ -10,7 +10,7 @@ | `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: | 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/sync-for-payroll/docs/pkg/models/shared/createjournalentryresponse.md b/sync-for-payroll/docs/pkg/models/shared/createjournalentryresponse.md index f30f5819b..e4cfaa398 100644 --- a/sync-for-payroll/docs/pkg/models/shared/createjournalentryresponse.md +++ b/sync-for-payroll/docs/pkg/models/shared/createjournalentryresponse.md @@ -10,7 +10,7 @@ | `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: | 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/sync-for-payroll/docs/pkg/models/shared/createjournalresponse.md b/sync-for-payroll/docs/pkg/models/shared/createjournalresponse.md index b5794c619..d8c21629e 100644 --- a/sync-for-payroll/docs/pkg/models/shared/createjournalresponse.md +++ b/sync-for-payroll/docs/pkg/models/shared/createjournalresponse.md @@ -10,7 +10,7 @@ | `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.AccountingJournal](../../../pkg/models/shared/accountingjournal.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/sync-for-payroll/docs/pkg/models/shared/dataconnectionerror.md b/sync-for-payroll/docs/pkg/models/shared/dataconnectionerror.md index 350df632c..1d234b89a 100644 --- a/sync-for-payroll/docs/pkg/models/shared/dataconnectionerror.md +++ b/sync-for-payroll/docs/pkg/models/shared/dataconnectionerror.md @@ -5,7 +5,9 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ErrorMessage` | **string* | :heavy_minus_sign: | A brief message about the error. | | +| `ErrorMessage` | **string* | :heavy_minus_sign: | A message about a error returned by Codat. | | | `ErroredOnUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

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

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



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

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

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

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `LatestSuccessfulSyncID` | **string* | :heavy_minus_sign: | Unique identifier for the most recent successful sync of data type. | 8220fc90-55b6-47bc-9417-48ac6ea93101 | | `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/sync-for-payroll/docs/pkg/models/shared/datatype.md b/sync-for-payroll/docs/pkg/models/shared/datatype.md index 550f76533..a44e87a38 100644 --- a/sync-for-payroll/docs/pkg/models/shared/datatype.md +++ b/sync-for-payroll/docs/pkg/models/shared/datatype.md @@ -1,6 +1,6 @@ # DataType -Available Data types +Available data types ## Values diff --git a/sync-for-payroll/docs/pkg/models/shared/datatypes.md b/sync-for-payroll/docs/pkg/models/shared/datatypes.md index 3aa7e83b1..61fa6bc31 100644 --- a/sync-for-payroll/docs/pkg/models/shared/datatypes.md +++ b/sync-for-payroll/docs/pkg/models/shared/datatypes.md @@ -1,6 +1,6 @@ # DataTypes -Available Data types +Available data types ## Values diff --git a/sync-for-payroll/docs/pkg/models/shared/errorstatus.md b/sync-for-payroll/docs/pkg/models/shared/errorstatus.md new file mode 100644 index 000000000..0164bbe93 --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/shared/errorstatus.md @@ -0,0 +1,11 @@ +# ErrorStatus + +The current status of a transient error. Null statuses indicate that the error is not transient. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `ErrorStatusActive` | Active | +| `ErrorStatusResolved` | Resolved | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/items.md b/sync-for-payroll/docs/pkg/models/shared/items.md deleted file mode 100644 index db633610b..000000000 --- a/sync-for-payroll/docs/pkg/models/shared/items.md +++ /dev/null @@ -1,8 +0,0 @@ -# Items - - -## 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/sync-for-payroll/docs/pkg/models/shared/journal.md b/sync-for-payroll/docs/pkg/models/shared/journal.md index 677d5f64c..c35c8ace6 100644 --- a/sync-for-payroll/docs/pkg/models/shared/journal.md +++ b/sync-for-payroll/docs/pkg/models/shared/journal.md @@ -21,7 +21,7 @@ Multiple journals or subjournals are used in the following Codat integrations: - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) -> When pushing journal entries to an accounting platform that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. +> When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. diff --git a/sync-for-payroll/docs/pkg/models/shared/journalentries.md b/sync-for-payroll/docs/pkg/models/shared/journalentries.md index 9e8636dbe..5692ef1ca 100644 --- a/sync-for-payroll/docs/pkg/models/shared/journalentries.md +++ b/sync-for-payroll/docs/pkg/models/shared/journalentries.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | -| `Results` | [][shared.JournalEntry](../../../pkg/models/shared/journalentry.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.JournalEntry](../../../pkg/models/shared/journalentry.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/journalentry.md b/sync-for-payroll/docs/pkg/models/shared/journalentry.md index 744fb25fc..c11b66902 100644 --- a/sync-for-payroll/docs/pkg/models/shared/journalentry.md +++ b/sync-for-payroll/docs/pkg/models/shared/journalentry.md @@ -30,7 +30,7 @@ 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.JournalRef](../../../pkg/models/shared/journalref.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | @@ -38,5 +38,5 @@ In Codat a journal entry contains details of: | `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 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/sync-for-payroll/docs/pkg/models/shared/journalline.md b/sync-for-payroll/docs/pkg/models/shared/journalline.md index 5a924a692..8909498a6 100644 --- a/sync-for-payroll/docs/pkg/models/shared/journalline.md +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/journallinedatatype.md b/sync-for-payroll/docs/pkg/models/shared/journallinedatatype.md new file mode 100644 index 000000000..32b204bed --- /dev/null +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/journals.md b/sync-for-payroll/docs/pkg/models/shared/journals.md index a6d4bc6fd..438089ec5 100644 --- a/sync-for-payroll/docs/pkg/models/shared/journals.md +++ b/sync-for-payroll/docs/pkg/models/shared/journals.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | -| `Results` | [][shared.Journal](../../../pkg/models/shared/journal.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.Journal](../../../pkg/models/shared/journal.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/phonenumber.md b/sync-for-payroll/docs/pkg/models/shared/phonenumber.md index 88c4ff1fc..4533beed7 100644 --- a/sync-for-payroll/docs/pkg/models/shared/phonenumber.md +++ b/sync-for-payroll/docs/pkg/models/shared/phonenumber.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/sync-for-payroll/docs/pkg/models/shared/propertiestatus.md b/sync-for-payroll/docs/pkg/models/shared/propertiestatus.md new file mode 100644 index 000000000..0985ebcfa --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/shared/propertiestatus.md @@ -0,0 +1,30 @@ +# PropertieStatus + +The current status of the dataset. + + +## Values + +| Name | Value | +| ----------------------------------- | ----------------------------------- | +| `PropertieStatusInitial` | Initial | +| `PropertieStatusQueued` | Queued | +| `PropertieStatusFetching` | Fetching | +| `PropertieStatusMapQueued` | MapQueued | +| `PropertieStatusMapping` | Mapping | +| `PropertieStatusComplete` | Complete | +| `PropertieStatusFetchError` | FetchError | +| `PropertieStatusMapError` | MapError | +| `PropertieStatusInternalError` | InternalError | +| `PropertieStatusProcessingQueued` | ProcessingQueued | +| `PropertieStatusProcessing` | Processing | +| `PropertieStatusProcessingError` | ProcessingError | +| `PropertieStatusValidationQueued` | ValidationQueued | +| `PropertieStatusValidating` | Validating | +| `PropertieStatusValidationError` | ValidationError | +| `PropertieStatusAuthError` | AuthError | +| `PropertieStatusCancelled` | Cancelled | +| `PropertieStatusNotSupported` | NotSupported | +| `PropertieStatusRateLimitError` | RateLimitError | +| `PropertieStatusPermissionsError` | PermissionsError | +| `PropertieStatusPrerequisiteNotMet` | PrerequisiteNotMet | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/pulloperation.md b/sync-for-payroll/docs/pkg/models/shared/pulloperation.md index 6b0aab84f..e2cf3dce8 100644 --- a/sync-for-payroll/docs/pkg/models/shared/pulloperation.md +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/pulloperations.md b/sync-for-payroll/docs/pkg/models/shared/pulloperations.md index aef942e81..f4e835f26 100644 --- a/sync-for-payroll/docs/pkg/models/shared/pulloperations.md +++ b/sync-for-payroll/docs/pkg/models/shared/pulloperations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/shared/pulloperationstatus.md b/sync-for-payroll/docs/pkg/models/shared/pulloperationstatus.md deleted file mode 100644 index ec9307c85..000000000 --- a/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/pushoperation.md b/sync-for-payroll/docs/pkg/models/shared/pushoperation.md index b8c816fba..c666911a8 100644 --- a/sync-for-payroll/docs/pkg/models/shared/pushoperation.md +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/pushoperationref.md b/sync-for-payroll/docs/pkg/models/shared/pushoperationref.md index 12980b5fd..f7aeaed0b 100644 --- a/sync-for-payroll/docs/pkg/models/shared/pushoperationref.md +++ b/sync-for-payroll/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/sync-for-payroll/docs/pkg/models/shared/pushoperations.md b/sync-for-payroll/docs/pkg/models/shared/pushoperations.md index fa709aebc..f036eee36 100644 --- a/sync-for-payroll/docs/pkg/models/shared/pushoperations.md +++ b/sync-for-payroll/docs/pkg/models/shared/pushoperations.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=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 +| 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/sync-for-payroll/docs/pkg/models/shared/schemadatatype.md b/sync-for-payroll/docs/pkg/models/shared/schemadatatype.md index d2910a0d3..e1d1293a4 100644 --- a/sync-for-payroll/docs/pkg/models/shared/schemadatatype.md +++ b/sync-for-payroll/docs/pkg/models/shared/schemadatatype.md @@ -1,6 +1,6 @@ # SchemaDataType -Available Data types +Available data types ## Values diff --git a/sync-for-payroll/docs/pkg/models/shared/supplementaldata.md b/sync-for-payroll/docs/pkg/models/shared/supplementaldata.md index 691487372..48a2c1fe3 100644 --- a/sync-for-payroll/docs/pkg/models/shared/supplementaldata.md +++ b/sync-for-payroll/docs/pkg/models/shared/supplementaldata.md @@ -2,11 +2,11 @@ Supplemental data is additional data you can include in our standard data types. -It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. +It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `Content` | map[string]map[string]*interface{}* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `Content` | map[string]map[string]*any* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/tags.md b/sync-for-payroll/docs/pkg/models/shared/tags.md new file mode 100644 index 000000000..6de993aa8 --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/shared/tags.md @@ -0,0 +1,9 @@ +# Tags + +A collection of user-defined key-value pairs that store custom metadata against the company. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/trackingcategories.md b/sync-for-payroll/docs/pkg/models/shared/trackingcategories.md index 4a34c51da..40e117638 100644 --- a/sync-for-payroll/docs/pkg/models/shared/trackingcategories.md +++ b/sync-for-payroll/docs/pkg/models/shared/trackingcategories.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Links` | [shared.Links](../../../pkg/models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} | -| `PageNumber` | *int64* | :heavy_check_mark: | Current page number. | | -| `PageSize` | *int64* | :heavy_check_mark: | Number of items to return in results array. | | -| `Results` | [][shared.TrackingCategory](../../../pkg/models/shared/trackingcategory.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.TrackingCategory](../../../pkg/models/shared/trackingcategory.md) | :heavy_minus_sign: | N/A | | +| `TotalResults` | *int64* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/shared/trackingcategory.md b/sync-for-payroll/docs/pkg/models/shared/trackingcategory.md index bcb121e92..1a9235288 100644 --- a/sync-for-payroll/docs/pkg/models/shared/trackingcategory.md +++ b/sync-for-payroll/docs/pkg/models/shared/trackingcategory.md @@ -4,7 +4,7 @@ Details of a category used for tracking transactions. > Language tip > -> Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting platforms. In Codat, we refer to these as tracking categories. +> Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting software. In Codat, we refer to these as tracking categories. View the coverage for tracking categories in the Data coverage explorer. diff --git a/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md b/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md new file mode 100644 index 000000000..b6367e569 --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md @@ -0,0 +1,10 @@ +# ClientRateLimitReachedResponse1 + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitresetresponse1.md b/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitresetresponse1.md new file mode 100644 index 000000000..5590e98f1 --- /dev/null +++ b/sync-for-payroll/docs/pkg/models/webhooks/clientratelimitresetresponse1.md @@ -0,0 +1,10 @@ +# ClientRateLimitResetResponse1 + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-payroll/docs/sdks/accounts/README.md b/sync-for-payroll/docs/sdks/accounts/README.md index 31878be33..7ec205e82 100644 --- a/sync-for-payroll/docs/sdks/accounts/README.md +++ b/sync-for-payroll/docs/sdks/accounts/README.md @@ -3,7 +3,7 @@ ## Overview -Accounts +Get, create, and update Accounts. ### Available Operations @@ -34,6 +34,7 @@ import( "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" syncforpayroll "github.com/codatio/client-sdk-go/sync-for-payroll" "context" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/types" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "log" ) @@ -47,13 +48,23 @@ func main() { ctx := context.Background() res, err := s.Accounts.Create(ctx, operations.CreateAccountRequest{ + AccountPrototype: &shared.AccountPrototype{ + Currency: syncforpayroll.String("USD"), + CurrentBalance: types.MustNewDecimalFromString("0"), + Description: syncforpayroll.String("Invoices the business has issued but has not yet collected payment on."), + FullyQualifiedCategory: syncforpayroll.String("Asset.Current"), + FullyQualifiedName: syncforpayroll.String("Cash On Hand"), + Name: syncforpayroll.String("Accounts Receivable"), + NominalCode: syncforpayroll.String("610"), + Status: shared.AccountStatusActive.ToPointer(), + Type: shared.AccountTypeAsset.ToPointer(), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.CreateAccountResponse != nil { // handle response } @@ -68,15 +79,18 @@ func main() { | `request` | [operations.CreateAccountRequest](../../pkg/models/operations/createaccountrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateAccountResponse](../../pkg/models/operations/createaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get account* endpoint returns a single account for a given `accountId`. @@ -116,7 +130,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Account != nil { // handle response } @@ -131,15 +144,18 @@ func main() { | `request` | [operations.GetAccountRequest](../../pkg/models/operations/getaccountrequest.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.GetAccountResponse](../../pkg/models/operations/getaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCreateModel The *Get create account model* endpoint returns the expected data for the request payload when creating an [account](https://docs.codat.io/sync-for-payroll-api#/schemas/Account) for a given company and integration. @@ -181,7 +197,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PushOption != nil { // handle response } @@ -196,15 +211,18 @@ func main() { | `request` | [operations.GetCreateAccountsModelRequest](../../pkg/models/operations/getcreateaccountsmodelrequest.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.GetCreateAccountsModelResponse](../../pkg/models/operations/getcreateaccountsmodelresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/sync-for-payroll-api#/schemas/Account) for a given company's connection. @@ -239,11 +257,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Accounts != nil { // handle response } @@ -258,10 +276,12 @@ func main() { | `request` | [operations.ListAccountsRequest](../../pkg/models/operations/listaccountsrequest.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.ListAccountsResponse](../../pkg/models/operations/listaccountsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/codatsyncpayroll/README.md b/sync-for-payroll/docs/sdks/codatsyncpayroll/README.md index 8afd84f5f..acb66c6fb 100644 --- a/sync-for-payroll/docs/sdks/codatsyncpayroll/README.md +++ b/sync-for-payroll/docs/sdks/codatsyncpayroll/README.md @@ -1,28 +1,26 @@ # CodatSyncPayroll SDK - ## Overview Sync for Payroll: The API for Sync for Payroll. -Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting platforms and to support its reconciliation. +Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting software and to support its reconciliation. [Explore product](https://docs.codat.io/payroll/overview) | [See OpenAPI spec](https://github.com/codatio/oas) --- + ## Endpoints -| Endpoints | Description | -|:---------------------|:-----------------------------------------------------------------------------------------------------------| -| Companies | Create and manage your SMB users' companies. | -| Connections | Create new and manage existing data connections for a company. | -| Accounts | Get, create, and update Accounts. | -| Journal entries | Get, create, and update Journal entries. | -| Journals | Get, create, and update Journals. | -| Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. | -| Company info | View company profile from the source platform. | -| Manage data | Control how data is retrieved from an integration. | - -### Available Operations - +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Accounts | Get, create, and update Accounts. | +| Journal entries | Get, create, and update Journal entries. | +| Journals | Get, create, and update Journals. | +| Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. | +| Company info | View company profile from the source platform. | +| Manage data | Control how data is retrieved from an integration. | + \ No newline at end of file diff --git a/sync-for-payroll/docs/sdks/companies/README.md b/sync-for-payroll/docs/sdks/companies/README.md index cdc537bd1..5f1458eb1 100644 --- a/sync-for-payroll/docs/sdks/companies/README.md +++ b/sync-for-payroll/docs/sdks/companies/README.md @@ -3,7 +3,7 @@ ## Overview -Create and manage your Codat companies. +Create and manage your SMB users' companies. ### Available Operations @@ -44,12 +44,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforpayroll.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -64,15 +68,18 @@ func main() { | `request` | [shared.CompanyRequestBody](../../pkg/models/shared/companyrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateCompanyResponse](../../pkg/models/operations/createcompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Delete The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-payroll-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-payroll-api#/schemas/Connection) and any cached data. This operation is irreversible. @@ -92,7 +99,6 @@ import( "context" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "log" - "net/http" ) func main() { @@ -109,8 +115,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -124,15 +129,18 @@ func main() { | `request` | [operations.DeleteCompanyRequest](../../pkg/models/operations/deletecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.DeleteCompanyResponse](../../pkg/models/operations/deletecompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get company* endpoint returns a single company for a given `companyId`. @@ -168,7 +176,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Company != nil { // handle response } @@ -183,15 +190,18 @@ func main() { | `request` | [operations.GetCompanyRequest](../../pkg/models/operations/getcompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetCompanyResponse](../../pkg/models/operations/getcompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List companies* endpoint returns a list of [companies] associated to your instances. @@ -224,11 +234,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Companies != nil { // handle response } @@ -243,15 +253,18 @@ func main() { | `request` | [operations.ListCompaniesRequest](../../pkg/models/operations/listcompaniesrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListCompaniesResponse](../../pkg/models/operations/listcompaniesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Update Use the *Update company* endpoint to update both the name and description of the company. @@ -282,12 +295,20 @@ func main() { ctx := context.Background() res, err := s.Companies.Update(ctx, operations.UpdateCompanyRequest{ + CompanyRequestBody: &shared.CompanyRequestBody{ + Description: syncforpayroll.String("Requested early access to the new financing scheme."), + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforpayroll.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 } @@ -302,10 +323,12 @@ func main() { | `request` | [operations.UpdateCompanyRequest](../../pkg/models/operations/updatecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateCompanyResponse](../../pkg/models/operations/updatecompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/companyinfo/README.md b/sync-for-payroll/docs/sdks/companyinfo/README.md index 5fa55066e..5b8f6c677 100644 --- a/sync-for-payroll/docs/sdks/companyinfo/README.md +++ b/sync-for-payroll/docs/sdks/companyinfo/README.md @@ -3,7 +3,7 @@ ## Overview -View company information fetched from the source platform. +View company profile from the source platform. ### Available Operations @@ -40,7 +40,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.CompanyInfo != nil { // handle response } @@ -55,10 +54,12 @@ func main() { | `request` | [operations.GetAccountingProfileRequest](../../pkg/models/operations/getaccountingprofilerequest.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.GetAccountingProfileResponse](../../pkg/models/operations/getaccountingprofileresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/connections/README.md b/sync-for-payroll/docs/sdks/connections/README.md index 37574b025..3c4ec135b 100644 --- a/sync-for-payroll/docs/sdks/connections/README.md +++ b/sync-for-payroll/docs/sdks/connections/README.md @@ -3,7 +3,7 @@ ## Overview -Manage your companies' data connections. +Create new and manage existing data connections for a company. ### Available Operations @@ -41,12 +41,14 @@ func main() { ctx := context.Background() res, err := s.Connections.Create(ctx, operations.CreateConnectionRequest{ + RequestBody: &operations.CreateConnectionRequestBody{ + PlatformKey: syncforpayroll.String("gbol"), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -61,15 +63,18 @@ func main() { | `request` | [operations.CreateConnectionRequest](../../pkg/models/operations/createconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateConnectionResponse](../../pkg/models/operations/createconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Delete Revoke and remove a connection from a company. @@ -86,7 +91,6 @@ import( "context" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "log" - "net/http" ) func main() { @@ -104,8 +108,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -119,15 +122,18 @@ func main() { | `request` | [operations.DeleteConnectionRequest](../../pkg/models/operations/deleteconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.DeleteConnectionResponse](../../pkg/models/operations/deleteconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. @@ -160,7 +166,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -175,15 +180,18 @@ func main() { | `request` | [operations.GetConnectionRequest](../../pkg/models/operations/getconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetConnectionResponse](../../pkg/models/operations/getconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List List the connections for a company. @@ -214,11 +222,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Connections != nil { // handle response } @@ -233,15 +241,18 @@ func main() { | `request` | [operations.ListConnectionsRequest](../../pkg/models/operations/listconnectionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListConnectionsResponse](../../pkg/models/operations/listconnectionsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Unlink This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data. @@ -268,13 +279,15 @@ func main() { ctx := context.Background() res, err := s.Connections.Unlink(ctx, operations.UnlinkConnectionRequest{ + RequestBody: &operations.UnlinkConnectionUpdateConnection{ + Status: shared.DataConnectionStatusUnlinked.ToPointer(), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.Connection != nil { // handle response } @@ -289,10 +302,12 @@ func main() { | `request` | [operations.UnlinkConnectionRequest](../../pkg/models/operations/unlinkconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UnlinkConnectionResponse](../../pkg/models/operations/unlinkconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/journalentries/README.md b/sync-for-payroll/docs/sdks/journalentries/README.md index eca3e3faa..95a4a106e 100644 --- a/sync-for-payroll/docs/sdks/journalentries/README.md +++ b/sync-for-payroll/docs/sdks/journalentries/README.md @@ -3,7 +3,7 @@ ## Overview -Journal entries +Get, create, and update Journal entries. ### Available Operations @@ -35,6 +35,7 @@ import( "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" syncforpayroll "github.com/codatio/client-sdk-go/sync-for-payroll" "context" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/types" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "log" ) @@ -48,13 +49,66 @@ func main() { ctx := context.Background() res, err := s.JournalEntries.Create(ctx, operations.CreateJournalEntryRequest{ + JournalEntry: &shared.JournalEntry{ + CreatedOn: syncforpayroll.String("2023-02-22T19:49:16.052Z"), + Description: syncforpayroll.String("record level description"), + JournalLines: []shared.JournalLine{ + shared.JournalLine{ + AccountRef: &shared.AccountRef{ + ID: syncforpayroll.String("80000019-1671793811"), + Name: syncforpayroll.String("Office Supplies"), + }, + Currency: syncforpayroll.String("USD"), + Description: syncforpayroll.String("journalLines.description debit"), + NetAmount: types.MustNewDecimalFromString("23.02"), + Tracking: &shared.Tracking{ + RecordRefs: []shared.TrackingRecordRef{ + shared.TrackingRecordRef{ + DataType: shared.TrackingRecordRefDataTypeCustomers.ToPointer(), + ID: syncforpayroll.String("80000001-1674553252"), + }, + }, + }, + }, + shared.JournalLine{ + AccountRef: &shared.AccountRef{ + ID: syncforpayroll.String("8000001E-1671793811"), + Name: syncforpayroll.String("Utilities"), + }, + Currency: syncforpayroll.String("USD"), + Description: syncforpayroll.String("journalLines.description credit"), + NetAmount: types.MustNewDecimalFromString("-23.02"), + Tracking: &shared.Tracking{ + RecordRefs: []shared.TrackingRecordRef{ + shared.TrackingRecordRef{ + DataType: shared.TrackingRecordRefDataTypeTrackingCategories.ToPointer(), + ID: syncforpayroll.String("80000002-1674553271"), + }, + }, + }, + }, + }, + JournalRef: &shared.JournalRef{ + ID: "12", + }, + Metadata: &shared.Metadata{ + IsDeleted: syncforpayroll.Bool(true), + }, + ModifiedDate: syncforpayroll.String("2022-10-23T00:00:00Z"), + PostedOn: syncforpayroll.String("2023-02-23T19:49:16.052Z"), + RecordRef: &shared.JournalEntryRecordRef{ + DataType: shared.JournalEntryRecordRefDataTypeBills.ToPointer(), + ID: syncforpayroll.String("80000002-6722155312"), + }, + SourceModifiedDate: syncforpayroll.String("2022-10-23T00:00:00Z"), + UpdatedOn: syncforpayroll.String("2023-02-21T19:49:16.052Z"), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if err != nil { log.Fatal(err) } - if res.CreateJournalEntryResponse != nil { // handle response } @@ -69,24 +123,27 @@ func main() { | `request` | [operations.CreateJournalEntryRequest](../../pkg/models/operations/createjournalentryrequest.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.CreateJournalEntryResponse](../../pkg/models/operations/createjournalentryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Delete > **Use with caution** > ->Because journal entries underpin every transaction in an accounting platform, deleting a journal entry can affect every transaction for a given company. +>Because journal entries underpin every transaction in an accounting software, deleting a journal entry can affect every transaction for a given company. > > **Before you proceed, make sure you understand the implications of deleting journal entries from an accounting perspective.** -The *Delete journal entry* endpoint allows you to delete a specified journal entry from an accounting platform. +The *Delete journal entry* endpoint allows you to delete a specified journal entry from an accounting software. [Journal entries](https://docs.codat.io/sync-for-payroll-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. @@ -96,15 +153,15 @@ The *Delete journal entry* endpoint allows you to delete a specified journal ent 1. [Push operation webhook](https://docs.codat.io/introduction/webhooks/core-rules-types#push-operation-status-has-changed) (advised), 2. [Push operation status endpoint](https://docs.codat.io/sync-for-payroll-api#/operations/get-push-operation). - A `Success` status indicates that the journal entry object was deleted from the accounting platform. -3. (Optional) Check that the journal entry was deleted from the accounting platform. + A `Success` status indicates that the journal entry object was deleted from the accounting software. +3. (Optional) Check that the journal entry was deleted from the accounting software. ### Effect on related objects -Be aware that deleting a journal entry from an accounting platform might cause related objects to be modified. For example, if you delete the journal entry for a paid invoice in QuickBooks Online, the invoice is deleted but the payment against that invoice is not. The payment is converted to a payment on account. +Be aware that deleting a journal entry from an accounting software might cause related objects to be modified. For example, if you delete the journal entry for a paid invoice in QuickBooks Online, the invoice is deleted but the payment against that invoice is not. The payment is converted to a payment on account. ## Integration specifics -Integrations that support soft delete do not permanently delete the object in the accounting platform. +Integrations that support soft delete do not permanently delete the object in the accounting software. | Integration | Soft Deleted | |-------------|--------------| @@ -135,12 +192,11 @@ func main() { res, err := s.JournalEntries.Delete(ctx, operations.DeleteJournalEntryRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", - JournalEntryID: "string", + JournalEntryID: "", }) if err != nil { log.Fatal(err) } - if res.PushOperation != nil { // handle response } @@ -155,15 +211,18 @@ func main() { | `request` | [operations.DeleteJournalEntryRequest](../../pkg/models/operations/deletejournalentryrequest.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.DeleteJournalEntryResponse](../../pkg/models/operations/deletejournalentryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get journal entry* endpoint returns a single journal entry for a given `journalEntryId`. @@ -198,12 +257,11 @@ func main() { ctx := context.Background() res, err := s.JournalEntries.Get(ctx, operations.GetJournalEntryRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - JournalEntryID: "string", + JournalEntryID: "", }) if err != nil { log.Fatal(err) } - if res.JournalEntry != nil { // handle response } @@ -218,15 +276,18 @@ func main() { | `request` | [operations.GetJournalEntryRequest](../../pkg/models/operations/getjournalentryrequest.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.GetJournalEntryResponse](../../pkg/models/operations/getjournalentryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCreateModel The *Get create journal entry model* endpoint returns the expected data for the request payload when creating a [journal entry](https://docs.codat.io/sync-for-payroll-api#/schemas/JournalEntry) for a given company and integration. @@ -268,7 +329,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PushOption != nil { // handle response } @@ -283,15 +343,18 @@ func main() { | `request` | [operations.GetCreateJournalEntryModelRequest](../../pkg/models/operations/getcreatejournalentrymodelrequest.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.GetCreateJournalEntryModelResponse](../../pkg/models/operations/getcreatejournalentrymodelresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List journal entries* endpoint returns a list of [journal entries](https://docs.codat.io/sync-for-payroll-api#/schemas/JournalEntry) for a given company's connection. @@ -327,11 +390,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.JournalEntries != nil { // handle response } @@ -346,10 +409,12 @@ func main() { | `request` | [operations.ListJournalEntriesRequest](../../pkg/models/operations/listjournalentriesrequest.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.ListJournalEntriesResponse](../../pkg/models/operations/listjournalentriesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/journals/README.md b/sync-for-payroll/docs/sdks/journals/README.md index 02fd90423..10b0a4cfe 100644 --- a/sync-for-payroll/docs/sdks/journals/README.md +++ b/sync-for-payroll/docs/sdks/journals/README.md @@ -3,7 +3,7 @@ ## Overview -Journals +Get, create, and update Journals. ### Available Operations @@ -49,11 +49,13 @@ func main() { res, err := s.Journals.Create(ctx, operations.CreateJournalRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", + JournalPrototype: &shared.JournalPrototype{ + CreatedOn: syncforpayroll.String("2022-10-23T00:00:00Z"), + }, }) if err != nil { log.Fatal(err) } - if res.CreateJournalResponse != nil { // handle response } @@ -68,15 +70,18 @@ func main() { | `request` | [operations.CreateJournalRequest](../../pkg/models/operations/createjournalrequest.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.CreateJournalResponse](../../pkg/models/operations/createjournalresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get journal* endpoint returns a single journal for a given `journalId`. @@ -111,12 +116,11 @@ func main() { ctx := context.Background() res, err := s.Journals.Get(ctx, operations.GetJournalRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - JournalID: "string", + JournalID: "", }) if err != nil { log.Fatal(err) } - if res.Journal != nil { // handle response } @@ -131,15 +135,18 @@ func main() { | `request` | [operations.GetJournalRequest](../../pkg/models/operations/getjournalrequest.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.GetJournalResponse](../../pkg/models/operations/getjournalresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCreateModel The *Get create journal model* endpoint returns the expected data for the request payload when creating a [journal](https://docs.codat.io/sync-for-payroll-api#/schemas/Journal) for a given company and integration. @@ -181,7 +188,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PushOption != nil { // handle response } @@ -196,15 +202,18 @@ func main() { | `request` | [operations.GetCreateJournalModelRequest](../../pkg/models/operations/getcreatejournalmodelrequest.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.GetCreateJournalModelResponse](../../pkg/models/operations/getcreatejournalmodelresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List journals* endpoint returns a list of [journals](https://docs.codat.io/sync-for-payroll-api#/schemas/Journal) for a given company's connection. @@ -240,11 +249,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.Journals != nil { // handle response } @@ -259,10 +268,12 @@ func main() { | `request` | [operations.ListJournalsRequest](../../pkg/models/operations/listjournalsrequest.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.ListJournalsResponse](../../pkg/models/operations/listjournalsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/managedata/README.md b/sync-for-payroll/docs/sdks/managedata/README.md index e4f13ab82..94b842778 100644 --- a/sync-for-payroll/docs/sdks/managedata/README.md +++ b/sync-for-payroll/docs/sdks/managedata/README.md @@ -3,7 +3,7 @@ ## Overview -Asynchronously retrieve data from an integration to refresh data in Codat. +Control how data is retrieved from an integration. ### Available Operations @@ -46,7 +46,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.DataStatuses != nil { // handle response } @@ -61,15 +60,18 @@ func main() { | `request` | [operations.GetDataStatusRequest](../../pkg/models/operations/getdatastatusrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetDataStatusResponse](../../pkg/models/operations/getdatastatusresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPullOperation Retrieve information about a single dataset or pull operation. @@ -102,7 +104,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PullOperation != nil { // handle response } @@ -117,15 +118,18 @@ func main() { | `request` | [operations.GetPullOperationRequest](../../pkg/models/operations/getpulloperationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetPullOperationResponse](../../pkg/models/operations/getpulloperationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPushOperation Retrieve push operation. @@ -158,7 +162,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PushOperation != nil { // handle response } @@ -173,15 +176,18 @@ func main() { | `request` | [operations.GetPushOperationRequest](../../pkg/models/operations/getpushoperationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetPushOperationResponse](../../pkg/models/operations/getpushoperationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List List push operation records. @@ -212,11 +218,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.PushOperations != nil { // handle response } @@ -231,15 +237,18 @@ func main() { | `request` | [operations.ListPushOperationsRequest](../../pkg/models/operations/listpushoperationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListPushOperationsResponse](../../pkg/models/operations/listpushoperationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## ListPullOperations Gets the pull operation history (datasets) for a given company. @@ -270,11 +279,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.PullOperations != nil { // handle response } @@ -289,15 +298,18 @@ func main() { | `request` | [operations.ListPullOperationsRequest](../../pkg/models/operations/listpulloperationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListPullOperationsResponse](../../pkg/models/operations/listpulloperationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## RefreshAllDataTypes Refreshes all data types with `fetch on first link` set to `true` for a given company. @@ -317,7 +329,6 @@ import( "context" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "log" - "net/http" ) func main() { @@ -334,8 +345,7 @@ func main() { if err != nil { log.Fatal(err) } - - if res.StatusCode == http.StatusOK { + if res != nil { // handle response } } @@ -349,15 +359,18 @@ func main() { | `request` | [operations.RefreshAllDataTypesRequest](../../pkg/models/operations/refreshalldatatypesrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.RefreshAllDataTypesResponse](../../pkg/models/operations/refreshalldatatypesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## RefreshDataType Refreshes a given data type for a given company. @@ -392,7 +405,6 @@ func main() { if err != nil { log.Fatal(err) } - if res.PullOperation != nil { // handle response } @@ -407,10 +419,12 @@ func main() { | `request` | [operations.RefreshDataTypeRequest](../../pkg/models/operations/refreshdatatyperequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.RefreshDataTypeResponse](../../pkg/models/operations/refreshdatatyperesponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-payroll/docs/sdks/trackingcategories/README.md b/sync-for-payroll/docs/sdks/trackingcategories/README.md index d00f6ccc1..456f19b15 100644 --- a/sync-for-payroll/docs/sdks/trackingcategories/README.md +++ b/sync-for-payroll/docs/sdks/trackingcategories/README.md @@ -3,7 +3,7 @@ ## Overview -Tracking categories +Get, create, and update Tracking Categories for additional categorization of payroll components. ### Available Operations @@ -44,12 +44,11 @@ func main() { ctx := context.Background() res, err := s.TrackingCategories.Get(ctx, operations.GetTrackingCategoryRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - TrackingCategoryID: "string", + TrackingCategoryID: "", }) if err != nil { log.Fatal(err) } - if res.TrackingCategoryTree != nil { // handle response } @@ -64,15 +63,18 @@ func main() { | `request` | [operations.GetTrackingCategoryRequest](../../pkg/models/operations/gettrackingcategoryrequest.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.GetTrackingCategoryResponse](../../pkg/models/operations/gettrackingcategoryresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List tracking categories* endpoint returns a list of [tracking categories](https://docs.codat.io/sync-for-payroll-api#/schemas/TrackingCategory) for a given company's connection. @@ -108,11 +110,11 @@ func main() { OrderBy: syncforpayroll.String("-modifiedDate"), Page: syncforpayroll.Int(1), PageSize: syncforpayroll.Int(100), + Query: syncforpayroll.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) } - if res.TrackingCategories != nil { // handle response } @@ -127,10 +129,12 @@ func main() { | `request` | [operations.ListTrackingCategoriesRequest](../../pkg/models/operations/listtrackingcategoriesrequest.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.ListTrackingCategoriesResponse](../../pkg/models/operations/listtrackingcategoriesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | diff --git a/sync-for-payroll/go.mod b/sync-for-payroll/go.mod index 805ad4912..1b35d68f3 100644 --- a/sync-for-payroll/go.mod +++ b/sync-for-payroll/go.mod @@ -5,6 +5,4 @@ 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/sync-for-payroll/go.sum b/sync-for-payroll/go.sum index ae03a472a..f95577939 100644 --- a/sync-for-payroll/go.sum +++ b/sync-for-payroll/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/sync-for-payroll/internal/hooks/hooks.go b/sync-for-payroll/internal/hooks/hooks.go new file mode 100644 index 000000000..8ea491aeb --- /dev/null +++ b/sync-for-payroll/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/sync-for-payroll/internal/hooks/registration.go b/sync-for-payroll/internal/hooks/registration.go new file mode 100644 index 000000000..fa131be81 --- /dev/null +++ b/sync-for-payroll/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/sync-for-payroll/journalentries.go b/sync-for-payroll/journalentries.go index 21cd67cc7..4bc4089a5 100644 --- a/sync-for-payroll/journalentries.go +++ b/sync-for-payroll/journalentries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// JournalEntries - Journal entries +// JournalEntries - Get, create, and update Journal entries. type JournalEntries struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newJournalEntries(sdkConfig sdkConfiguration) *JournalEntries { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=journalEntries) for integrations that support creating a journal entry. func (s *JournalEntries) Create(ctx context.Context, request operations.CreateJournalEntryRequest, opts ...operations.Option) (*operations.CreateJournalEntryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-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 *JournalEntries) Create(ctx context.Context, request operations.CreateJo 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, "JournalEntry", "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) 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,53 +111,109 @@ func (s *JournalEntries) Create(ctx context.Context, request operations.CreateJo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.CreateJournalEntryResponse{ 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.CreateJournalEntryResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -140,7 +221,12 @@ func (s *JournalEntries) Create(ctx context.Context, request operations.CreateJo res.CreateJournalEntryResponse = &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 @@ -158,32 +244,56 @@ func (s *JournalEntries) Create(ctx context.Context, request operations.CreateJo 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 + } // Delete journal entry // > **Use with caution** // > -// >Because journal entries underpin every transaction in an accounting platform, deleting a journal entry can affect every transaction for a given company. +// >Because journal entries underpin every transaction in an accounting software, deleting a journal entry can affect every transaction for a given company. // > // > **Before you proceed, make sure you understand the implications of deleting journal entries from an accounting perspective.** // -// The *Delete journal entry* endpoint allows you to delete a specified journal entry from an accounting platform. +// The *Delete journal entry* endpoint allows you to delete a specified journal entry from an accounting software. // // [Journal entries](https://docs.codat.io/sync-for-payroll-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. // @@ -195,24 +305,32 @@ func (s *JournalEntries) Create(ctx context.Context, request operations.CreateJo // // 2. [Push operation status endpoint](https://docs.codat.io/sync-for-payroll-api#/operations/get-push-operation). // -// A `Success` status indicates that the journal entry object was deleted from the accounting platform. +// A `Success` status indicates that the journal entry object was deleted from the accounting software. // -// 3. (Optional) Check that the journal entry was deleted from the accounting platform. +// 3. (Optional) Check that the journal entry was deleted from the accounting software. // // ### Effect on related objects // -// Be aware that deleting a journal entry from an accounting platform might cause related objects to be modified. For example, if you delete the journal entry for a paid invoice in QuickBooks Online, the invoice is deleted but the payment against that invoice is not. The payment is converted to a payment on account. +// Be aware that deleting a journal entry from an accounting software might cause related objects to be modified. For example, if you delete the journal entry for a paid invoice in QuickBooks Online, the invoice is deleted but the payment against that invoice is not. The payment is converted to a payment on account. // // ## Integration specifics -// Integrations that support soft delete do not permanently delete the object in the accounting platform. +// Integrations that support soft delete do not permanently delete the object in the accounting software. // // | Integration | Soft Deleted | // |-------------|--------------| // | QuickBooks Online | Yes | func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJournalEntryRequest, opts ...operations.Option) (*operations.DeleteJournalEntryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "delete-journal-entry", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -220,32 +338,47 @@ func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJo 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/{journalEntryId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/journalEntries/{journalEntryId}", 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) 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, @@ -253,53 +386,109 @@ func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.DeleteJournalEntryResponse{ 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 @@ -307,7 +496,12 @@ func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJo 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 @@ -323,22 +517,46 @@ func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJo 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 + } // Get journal entry @@ -350,9 +568,17 @@ func (s *JournalEntries) Delete(ctx context.Context, request operations.DeleteJo // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalEntryRequest, opts ...operations.Option) (*operations.GetJournalEntryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-journal-entry", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -360,28 +586,43 @@ func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalE return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journalEntries/{journalEntryId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journalEntries/{journalEntryId}", 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, @@ -389,53 +630,109 @@ func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalE }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetJournalEntryResponse{ 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.JournalEntry if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -443,7 +740,12 @@ func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalE res.JournalEntry = &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 @@ -461,22 +763,46 @@ func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalE 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 + } // GetCreateModel - Get create journal entry model @@ -490,9 +816,17 @@ func (s *JournalEntries) Get(ctx context.Context, request operations.GetJournalE // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=journalEntries) for integrations that support creating a journal entry. func (s *JournalEntries) GetCreateModel(ctx context.Context, request operations.GetCreateJournalEntryModelRequest, opts ...operations.Option) (*operations.GetCreateJournalEntryModelResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-create-journalEntry-model", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -500,28 +834,43 @@ func (s *JournalEntries) GetCreateModel(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}/connections/{connectionId}/options/journalEntries", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/journalEntries", 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, @@ -529,53 +878,109 @@ func (s *JournalEntries) GetCreateModel(ctx context.Context, request operations. }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetCreateJournalEntryModelResponse{ 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.PushOption if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -583,7 +988,12 @@ func (s *JournalEntries) GetCreateModel(ctx context.Context, request operations. res.PushOption = &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 @@ -599,22 +1009,46 @@ func (s *JournalEntries) GetCreateModel(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 + } // List journal entries @@ -624,9 +1058,17 @@ func (s *JournalEntries) GetCreateModel(ctx context.Context, request operations. // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *JournalEntries) List(ctx context.Context, request operations.ListJournalEntriesRequest, opts ...operations.Option) (*operations.ListJournalEntriesResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-journal-entries", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -634,32 +1076,47 @@ func (s *JournalEntries) List(ctx context.Context, request operations.ListJourna return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journalEntries", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journalEntries", 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, @@ -667,53 +1124,109 @@ func (s *JournalEntries) List(ctx context.Context, request operations.ListJourna }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.ListJournalEntriesResponse{ 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.JournalEntries if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -721,7 +1234,12 @@ func (s *JournalEntries) List(ctx context.Context, request operations.ListJourna res.JournalEntries = &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 @@ -741,20 +1259,44 @@ func (s *JournalEntries) List(ctx context.Context, request operations.ListJourna 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/sync-for-payroll/journals.go b/sync-for-payroll/journals.go index 3a4217751..f9a464628 100644 --- a/sync-for-payroll/journals.go +++ b/sync-for-payroll/journals.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// Journals +// Journals - Get, create, and update Journals. type Journals struct { sdkConfiguration sdkConfiguration } @@ -36,9 +39,17 @@ func newJournals(sdkConfig sdkConfiguration) *Journals { // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=journals) for integrations that support creating a journal. func (s *Journals) Create(ctx context.Context, request operations.CreateJournalRequest, opts ...operations.Option) (*operations.CreateJournalResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-journal", + 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 *Journals) Create(ctx context.Context, request operations.CreateJournalR 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/journals", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/journals", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "JournalPrototype", "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,53 +111,109 @@ func (s *Journals) Create(ctx context.Context, request operations.CreateJournalR }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.CreateJournalResponse{ 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.CreateJournalResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -140,7 +221,12 @@ func (s *Journals) Create(ctx context.Context, request operations.CreateJournalR res.CreateJournalResponse = &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 @@ -158,22 +244,46 @@ func (s *Journals) Create(ctx context.Context, request operations.CreateJournalR 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 + } // Get journal @@ -185,9 +295,17 @@ func (s *Journals) Create(ctx context.Context, request operations.CreateJournalR // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest, opts ...operations.Option) (*operations.GetJournalResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-journal", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -195,28 +313,43 @@ func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journals/{journalId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journals/{journalId}", 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, @@ -224,53 +357,109 @@ func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetJournalResponse{ 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.Journal if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -278,7 +467,12 @@ func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest res.Journal = &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 @@ -296,22 +490,46 @@ func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest 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 + } // GetCreateModel - Get create journal model @@ -325,9 +543,17 @@ func (s *Journals) Get(ctx context.Context, request operations.GetJournalRequest // // Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=journals) for integrations that support creating a journal. func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCreateJournalModelRequest, opts ...operations.Option) (*operations.GetCreateJournalModelResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-create-journal-model", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -335,28 +561,43 @@ func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCre 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}/options/journals", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/journals", 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, @@ -364,53 +605,109 @@ func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCre }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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.GetCreateJournalModelResponse{ 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.PushOption if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -418,7 +715,12 @@ func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCre res.PushOption = &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 @@ -434,22 +736,46 @@ func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCre 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 + } // List journals @@ -459,9 +785,17 @@ func (s *Journals) GetCreateModel(ctx context.Context, request operations.GetCre // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *Journals) List(ctx context.Context, request operations.ListJournalsRequest, opts ...operations.Option) (*operations.ListJournalsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-journals", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -469,32 +803,47 @@ func (s *Journals) List(ctx context.Context, request operations.ListJournalsRequ return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journals", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/journals", 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, @@ -502,53 +851,109 @@ func (s *Journals) List(ctx context.Context, request operations.ListJournalsRequ }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.ListJournalsResponse{ 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.Journals if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -556,7 +961,12 @@ func (s *Journals) List(ctx context.Context, request operations.ListJournalsRequ res.Journals = &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 @@ -576,20 +986,44 @@ func (s *Journals) List(ctx context.Context, request operations.ListJournalsRequ 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/sync-for-payroll/managedata.go b/sync-for-payroll/managedata.go index 5050b23fc..b045a2e65 100644 --- a/sync-for-payroll/managedata.go +++ b/sync-for-payroll/managedata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// ManageData - Asynchronously retrieve data from an integration to refresh data in Codat. +// ManageData - Control how data is retrieved from an integration. type ManageData struct { sdkConfiguration sdkConfiguration } @@ -28,9 +31,17 @@ func newManageData(sdkConfig sdkConfiguration) *ManageData { // GetDataStatus - Get data status // Get the state of each data type for a company func (s *ManageData) GetDataStatus(ctx context.Context, request operations.GetDataStatusRequest, opts ...operations.Option) (*operations.GetDataStatusResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-data-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 *ManageData) GetDataStatus(ctx context.Context, request operations.GetDa 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, @@ -67,61 +93,122 @@ func (s *ManageData) GetDataStatus(ctx context.Context, request operations.GetDa }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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.GetDataStatusResponse{ 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.GetDataStatusDataStatuses 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 @@ -137,30 +224,62 @@ func (s *ManageData) GetDataStatus(ctx context.Context, request operations.GetDa 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 *ManageData) 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 { @@ -168,28 +287,43 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -197,53 +331,109 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -251,7 +441,12 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge 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 @@ -267,30 +462,62 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge 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 + } // GetPushOperation - Get push operation // Retrieve push operation. func (s *ManageData) GetPushOperation(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 { @@ -298,28 +525,43 @@ func (s *ManageData) GetPushOperation(ctx context.Context, request operations.Ge 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, @@ -327,53 +569,109 @@ func (s *ManageData) GetPushOperation(ctx context.Context, request operations.Ge }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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 @@ -381,7 +679,12 @@ func (s *ManageData) GetPushOperation(ctx context.Context, request operations.Ge 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 @@ -397,30 +700,62 @@ func (s *ManageData) GetPushOperation(ctx context.Context, request operations.Ge 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 + } // List push operations // List push operation records. func (s *ManageData) List(ctx context.Context, request operations.ListPushOperationsRequest, opts ...operations.Option) (*operations.ListPushOperationsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-push-operations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -428,32 +763,47 @@ func (s *ManageData) List(ctx context.Context, request operations.ListPushOperat 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, @@ -461,53 +811,109 @@ func (s *ManageData) List(ctx context.Context, request operations.ListPushOperat }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.ListPushOperationsResponse{ 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 @@ -515,7 +921,12 @@ func (s *ManageData) List(ctx context.Context, request operations.ListPushOperat 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 @@ -533,30 +944,62 @@ func (s *ManageData) List(ctx context.Context, request operations.ListPushOperat 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 *ManageData) 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 { @@ -564,32 +1007,47 @@ func (s *ManageData) 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, @@ -597,53 +1055,109 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -651,7 +1165,12 @@ func (s *ManageData) 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 @@ -669,22 +1188,46 @@ func (s *ManageData) 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 + } // RefreshAllDataTypes - Refresh all data @@ -694,9 +1237,17 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. // // [Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`. func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations.RefreshAllDataTypesRequest, opts ...operations.Option) (*operations.RefreshAllDataTypesResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "refresh-all-data-types", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -704,28 +1255,43 @@ func (s *ManageData) RefreshAllDataTypes(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/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, @@ -733,49 +1299,100 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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", "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.RefreshAllDataTypesResponse{ 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: @@ -792,22 +1409,46 @@ func (s *ManageData) RefreshAllDataTypes(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 + } // RefreshDataType - Refresh data type @@ -815,9 +1456,17 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations // // This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. func (s *ManageData) RefreshDataType(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 { @@ -825,32 +1474,47 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - 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, @@ -858,53 +1522,109 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.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 @@ -912,7 +1632,12 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref 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 @@ -928,20 +1653,44 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref 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/sync-for-payroll/pkg/models/operations/createaccount.go b/sync-for-payroll/pkg/models/operations/createaccount.go index 94af2630e..3675b628d 100644 --- a/sync-for-payroll/pkg/models/operations/createaccount.go +++ b/sync-for-payroll/pkg/models/operations/createaccount.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/createcompany.go b/sync-for-payroll/pkg/models/operations/createcompany.go index 74ec06595..8fbc5a6d2 100644 --- a/sync-for-payroll/pkg/models/operations/createcompany.go +++ b/sync-for-payroll/pkg/models/operations/createcompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/createconnection.go b/sync-for-payroll/pkg/models/operations/createconnection.go index bed5808af..dcfb5a6a2 100644 --- a/sync-for-payroll/pkg/models/operations/createconnection.go +++ b/sync-for-payroll/pkg/models/operations/createconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/createjournal.go b/sync-for-payroll/pkg/models/operations/createjournal.go index 60b26c82c..256738453 100644 --- a/sync-for-payroll/pkg/models/operations/createjournal.go +++ b/sync-for-payroll/pkg/models/operations/createjournal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/createjournalentry.go b/sync-for-payroll/pkg/models/operations/createjournalentry.go index 7f65bf98c..079595a5f 100644 --- a/sync-for-payroll/pkg/models/operations/createjournalentry.go +++ b/sync-for-payroll/pkg/models/operations/createjournalentry.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/deletecompany.go b/sync-for-payroll/pkg/models/operations/deletecompany.go index 4fe14e7e9..e23526cf3 100644 --- a/sync-for-payroll/pkg/models/operations/deletecompany.go +++ b/sync-for-payroll/pkg/models/operations/deletecompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/deleteconnection.go b/sync-for-payroll/pkg/models/operations/deleteconnection.go index 6e5d2d358..c6574cf51 100644 --- a/sync-for-payroll/pkg/models/operations/deleteconnection.go +++ b/sync-for-payroll/pkg/models/operations/deleteconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/deletejournalentry.go b/sync-for-payroll/pkg/models/operations/deletejournalentry.go index 6a135429f..04fa16ea0 100644 --- a/sync-for-payroll/pkg/models/operations/deletejournalentry.go +++ b/sync-for-payroll/pkg/models/operations/deletejournalentry.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getaccount.go b/sync-for-payroll/pkg/models/operations/getaccount.go index c6f2158ac..927c3bf34 100644 --- a/sync-for-payroll/pkg/models/operations/getaccount.go +++ b/sync-for-payroll/pkg/models/operations/getaccount.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getaccountingprofile.go b/sync-for-payroll/pkg/models/operations/getaccountingprofile.go index b27f456ca..c2957b2a8 100644 --- a/sync-for-payroll/pkg/models/operations/getaccountingprofile.go +++ b/sync-for-payroll/pkg/models/operations/getaccountingprofile.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getcompany.go b/sync-for-payroll/pkg/models/operations/getcompany.go index 9bdc6f6de..60b847558 100644 --- a/sync-for-payroll/pkg/models/operations/getcompany.go +++ b/sync-for-payroll/pkg/models/operations/getcompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getconnection.go b/sync-for-payroll/pkg/models/operations/getconnection.go index 189184ef9..278af74b6 100644 --- a/sync-for-payroll/pkg/models/operations/getconnection.go +++ b/sync-for-payroll/pkg/models/operations/getconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getcreateaccountsmodel.go b/sync-for-payroll/pkg/models/operations/getcreateaccountsmodel.go index 17f69d964..31ea20d44 100644 --- a/sync-for-payroll/pkg/models/operations/getcreateaccountsmodel.go +++ b/sync-for-payroll/pkg/models/operations/getcreateaccountsmodel.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getcreatejournalentrymodel.go b/sync-for-payroll/pkg/models/operations/getcreatejournalentrymodel.go index e6ad59da3..535be0ad8 100644 --- a/sync-for-payroll/pkg/models/operations/getcreatejournalentrymodel.go +++ b/sync-for-payroll/pkg/models/operations/getcreatejournalentrymodel.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getcreatejournalmodel.go b/sync-for-payroll/pkg/models/operations/getcreatejournalmodel.go index 09e49be97..2c476caed 100644 --- a/sync-for-payroll/pkg/models/operations/getcreatejournalmodel.go +++ b/sync-for-payroll/pkg/models/operations/getcreatejournalmodel.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getdatastatus.go b/sync-for-payroll/pkg/models/operations/getdatastatus.go index bfd1f36cf..dbd9dc240 100644 --- a/sync-for-payroll/pkg/models/operations/getdatastatus.go +++ b/sync-for-payroll/pkg/models/operations/getdatastatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -19,11 +19,402 @@ func (o *GetDataStatusRequest) GetCompanyID() string { return o.CompanyID } +// GetDataStatusDataStatuses - OK +type GetDataStatusDataStatuses struct { + // Describes the state of data in the Codat cache for a company and data type + AccountTransactions *shared.DataStatus `json:"accountTransactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BalanceSheet *shared.DataStatus `json:"balanceSheet,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankAccounts *shared.DataStatus `json:"bankAccounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankTransactions *shared.DataStatus `json:"bankTransactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingAccountBalances *shared.DataStatus `json:"banking-accountBalances,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingAccounts *shared.DataStatus `json:"banking-accounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingTransactionCategories *shared.DataStatus `json:"banking-transactionCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingTransactions *shared.DataStatus `json:"banking-transactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BillCreditNotes *shared.DataStatus `json:"billCreditNotes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BillPayments *shared.DataStatus `json:"billPayments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Bills *shared.DataStatus `json:"bills,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CashFlowStatement *shared.DataStatus `json:"cashFlowStatement,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ChartOfAccounts *shared.DataStatus `json:"chartOfAccounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceCompanyInfo *shared.DataStatus `json:"commerce-companyInfo,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceCustomers *shared.DataStatus `json:"commerce-customers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceDisputes *shared.DataStatus `json:"commerce-disputes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceLocations *shared.DataStatus `json:"commerce-locations,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceOrders *shared.DataStatus `json:"commerce-orders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommercePaymentMethods *shared.DataStatus `json:"commerce-paymentMethods,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommercePayments *shared.DataStatus `json:"commerce-payments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceProductCategories *shared.DataStatus `json:"commerce-productCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceProducts *shared.DataStatus `json:"commerce-products,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceTaxComponents *shared.DataStatus `json:"commerce-taxComponents,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceTransactions *shared.DataStatus `json:"commerce-transactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Company *shared.DataStatus `json:"company,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CreditNotes *shared.DataStatus `json:"creditNotes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Customers *shared.DataStatus `json:"customers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + DirectCosts *shared.DataStatus `json:"directCosts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + DirectIncomes *shared.DataStatus `json:"directIncomes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Invoices *shared.DataStatus `json:"invoices,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ItemReceipts *shared.DataStatus `json:"itemReceipts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Items *shared.DataStatus `json:"items,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + JournalEntries *shared.DataStatus `json:"journalEntries,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Journals *shared.DataStatus `json:"journals,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + PaymentMethods *shared.DataStatus `json:"paymentMethods,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Payments *shared.DataStatus `json:"payments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ProfitAndLoss *shared.DataStatus `json:"profitAndLoss,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + PurchaseOrders *shared.DataStatus `json:"purchaseOrders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + SalesOrders *shared.DataStatus `json:"salesOrders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Suppliers *shared.DataStatus `json:"suppliers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + TaxRates *shared.DataStatus `json:"taxRates,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + TrackingCategories *shared.DataStatus `json:"trackingCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Transfers *shared.DataStatus `json:"transfers,omitempty"` +} + +func (o *GetDataStatusDataStatuses) GetAccountTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.AccountTransactions +} + +func (o *GetDataStatusDataStatuses) GetBalanceSheet() *shared.DataStatus { + if o == nil { + return nil + } + return o.BalanceSheet +} + +func (o *GetDataStatusDataStatuses) GetBankAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankAccounts +} + +func (o *GetDataStatusDataStatuses) GetBankTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankTransactions +} + +func (o *GetDataStatusDataStatuses) GetBankingAccountBalances() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccountBalances +} + +func (o *GetDataStatusDataStatuses) GetBankingAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccounts +} + +func (o *GetDataStatusDataStatuses) GetBankingTransactionCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactionCategories +} + +func (o *GetDataStatusDataStatuses) GetBankingTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactions +} + +func (o *GetDataStatusDataStatuses) GetBillCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillCreditNotes +} + +func (o *GetDataStatusDataStatuses) GetBillPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillPayments +} + +func (o *GetDataStatusDataStatuses) GetBills() *shared.DataStatus { + if o == nil { + return nil + } + return o.Bills +} + +func (o *GetDataStatusDataStatuses) GetCashFlowStatement() *shared.DataStatus { + if o == nil { + return nil + } + return o.CashFlowStatement +} + +func (o *GetDataStatusDataStatuses) GetChartOfAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ChartOfAccounts +} + +func (o *GetDataStatusDataStatuses) GetCommerceCompanyInfo() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCompanyInfo +} + +func (o *GetDataStatusDataStatuses) GetCommerceCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCustomers +} + +func (o *GetDataStatusDataStatuses) GetCommerceDisputes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceDisputes +} + +func (o *GetDataStatusDataStatuses) GetCommerceLocations() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceLocations +} + +func (o *GetDataStatusDataStatuses) GetCommerceOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceOrders +} + +func (o *GetDataStatusDataStatuses) GetCommercePaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePaymentMethods +} + +func (o *GetDataStatusDataStatuses) GetCommercePayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePayments +} + +func (o *GetDataStatusDataStatuses) GetCommerceProductCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProductCategories +} + +func (o *GetDataStatusDataStatuses) GetCommerceProducts() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProducts +} + +func (o *GetDataStatusDataStatuses) GetCommerceTaxComponents() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTaxComponents +} + +func (o *GetDataStatusDataStatuses) GetCommerceTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTransactions +} + +func (o *GetDataStatusDataStatuses) GetCompany() *shared.DataStatus { + if o == nil { + return nil + } + return o.Company +} + +func (o *GetDataStatusDataStatuses) GetCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CreditNotes +} + +func (o *GetDataStatusDataStatuses) GetCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Customers +} + +func (o *GetDataStatusDataStatuses) GetDirectCosts() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectCosts +} + +func (o *GetDataStatusDataStatuses) GetDirectIncomes() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectIncomes +} + +func (o *GetDataStatusDataStatuses) GetInvoices() *shared.DataStatus { + if o == nil { + return nil + } + return o.Invoices +} + +func (o *GetDataStatusDataStatuses) GetItemReceipts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ItemReceipts +} + +func (o *GetDataStatusDataStatuses) GetItems() *shared.DataStatus { + if o == nil { + return nil + } + return o.Items +} + +func (o *GetDataStatusDataStatuses) GetJournalEntries() *shared.DataStatus { + if o == nil { + return nil + } + return o.JournalEntries +} + +func (o *GetDataStatusDataStatuses) GetJournals() *shared.DataStatus { + if o == nil { + return nil + } + return o.Journals +} + +func (o *GetDataStatusDataStatuses) GetPaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.PaymentMethods +} + +func (o *GetDataStatusDataStatuses) GetPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.Payments +} + +func (o *GetDataStatusDataStatuses) GetProfitAndLoss() *shared.DataStatus { + if o == nil { + return nil + } + return o.ProfitAndLoss +} + +func (o *GetDataStatusDataStatuses) GetPurchaseOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.PurchaseOrders +} + +func (o *GetDataStatusDataStatuses) GetSalesOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.SalesOrders +} + +func (o *GetDataStatusDataStatuses) GetSuppliers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Suppliers +} + +func (o *GetDataStatusDataStatuses) GetTaxRates() *shared.DataStatus { + if o == nil { + return nil + } + return o.TaxRates +} + +func (o *GetDataStatusDataStatuses) GetTrackingCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.TrackingCategories +} + +func (o *GetDataStatusDataStatuses) GetTransfers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Transfers +} + type GetDataStatusResponse struct { // HTTP response content type for this operation ContentType string // OK - DataStatuses map[string]shared.DataStatus + DataStatuses *GetDataStatusDataStatuses // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing @@ -37,7 +428,7 @@ func (o *GetDataStatusResponse) GetContentType() string { return o.ContentType } -func (o *GetDataStatusResponse) GetDataStatuses() map[string]shared.DataStatus { +func (o *GetDataStatusResponse) GetDataStatuses() *GetDataStatusDataStatuses { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/models/operations/getjournal.go b/sync-for-payroll/pkg/models/operations/getjournal.go index 22c0b9e4d..b34940dfb 100644 --- a/sync-for-payroll/pkg/models/operations/getjournal.go +++ b/sync-for-payroll/pkg/models/operations/getjournal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getjournalentry.go b/sync-for-payroll/pkg/models/operations/getjournalentry.go index 93a9efcc0..6fbffb74e 100644 --- a/sync-for-payroll/pkg/models/operations/getjournalentry.go +++ b/sync-for-payroll/pkg/models/operations/getjournalentry.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getpulloperation.go b/sync-for-payroll/pkg/models/operations/getpulloperation.go index cdcd7dd2b..fd34be2b9 100644 --- a/sync-for-payroll/pkg/models/operations/getpulloperation.go +++ b/sync-for-payroll/pkg/models/operations/getpulloperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/getpushoperation.go b/sync-for-payroll/pkg/models/operations/getpushoperation.go index 5857d891a..5db10025f 100644 --- a/sync-for-payroll/pkg/models/operations/getpushoperation.go +++ b/sync-for-payroll/pkg/models/operations/getpushoperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/gettrackingcategory.go b/sync-for-payroll/pkg/models/operations/gettrackingcategory.go index 0bb79ae26..56de5efb9 100644 --- a/sync-for-payroll/pkg/models/operations/gettrackingcategory.go +++ b/sync-for-payroll/pkg/models/operations/gettrackingcategory.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listaccounts.go b/sync-for-payroll/pkg/models/operations/listaccounts.go index 85b345494..74035721d 100644 --- a/sync-for-payroll/pkg/models/operations/listaccounts.go +++ b/sync-for-payroll/pkg/models/operations/listaccounts.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listcompanies.go b/sync-for-payroll/pkg/models/operations/listcompanies.go index 05b9f51b0..ba0517f0d 100644 --- a/sync-for-payroll/pkg/models/operations/listcompanies.go +++ b/sync-for-payroll/pkg/models/operations/listcompanies.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listconnections.go b/sync-for-payroll/pkg/models/operations/listconnections.go index 377fc0534..47da013c5 100644 --- a/sync-for-payroll/pkg/models/operations/listconnections.go +++ b/sync-for-payroll/pkg/models/operations/listconnections.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listjournalentries.go b/sync-for-payroll/pkg/models/operations/listjournalentries.go index 72b5173d3..1e240c062 100644 --- a/sync-for-payroll/pkg/models/operations/listjournalentries.go +++ b/sync-for-payroll/pkg/models/operations/listjournalentries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listjournals.go b/sync-for-payroll/pkg/models/operations/listjournals.go index 9b9dadc20..070afa32d 100644 --- a/sync-for-payroll/pkg/models/operations/listjournals.go +++ b/sync-for-payroll/pkg/models/operations/listjournals.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listpulloperations.go b/sync-for-payroll/pkg/models/operations/listpulloperations.go index ce9462960..b2792750e 100644 --- a/sync-for-payroll/pkg/models/operations/listpulloperations.go +++ b/sync-for-payroll/pkg/models/operations/listpulloperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listpushoperations.go b/sync-for-payroll/pkg/models/operations/listpushoperations.go index 14eea8093..a3f4819c9 100644 --- a/sync-for-payroll/pkg/models/operations/listpushoperations.go +++ b/sync-for-payroll/pkg/models/operations/listpushoperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/listtrackingcategories.go b/sync-for-payroll/pkg/models/operations/listtrackingcategories.go index 1291a94aa..f39b2f93c 100644 --- a/sync-for-payroll/pkg/models/operations/listtrackingcategories.go +++ b/sync-for-payroll/pkg/models/operations/listtrackingcategories.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/options.go b/sync-for-payroll/pkg/models/operations/options.go index bc1e2c093..ef0eda5d3 100644 --- a/sync-for-payroll/pkg/models/operations/options.go +++ b/sync-for-payroll/pkg/models/operations/options.go @@ -1,10 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( "errors" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" + "time" ) var ErrUnsupportedOption = errors.New("unsupported option") @@ -12,12 +14,16 @@ var ErrUnsupportedOption = errors.New("unsupported option") const ( SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" + SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" + SupportedOptionURLOverride = "urlOverride" ) type Options struct { - ServerURL *string - Retries *utils.RetryConfig + ServerURL *string + Retries *retry.Config + Timeout *time.Duration + URLOverride *string } type Option func(*Options, ...string) error @@ -51,7 +57,7 @@ func WithTemplatedServerURL(serverURL string, params map[string]string) Option { } // WithRetries allows customizing the default retry configuration. -func WithRetries(config utils.RetryConfig) Option { +func WithRetries(config retry.Config) Option { return func(opts *Options, supportedOptions ...string) error { if !utils.Contains(supportedOptions, SupportedOptionRetries) { return ErrUnsupportedOption @@ -61,3 +67,27 @@ func WithRetries(config utils.RetryConfig) Option { return nil } } + +// WithOperationTimeout allows setting the request timeout applied for an operation. +func WithOperationTimeout(timeout time.Duration) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Timeout = &timeout + return nil + } +} + +// WithURLOverride allows overriding the URL. +func WithURLOverride(urlOverride string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionURLOverride) { + return ErrUnsupportedOption + } + + opts.URLOverride = &urlOverride + return nil + } +} diff --git a/sync-for-payroll/pkg/models/operations/refreshalldatatypes.go b/sync-for-payroll/pkg/models/operations/refreshalldatatypes.go index e63b26c41..187709751 100644 --- a/sync-for-payroll/pkg/models/operations/refreshalldatatypes.go +++ b/sync-for-payroll/pkg/models/operations/refreshalldatatypes.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/refreshdatatype.go b/sync-for-payroll/pkg/models/operations/refreshdatatype.go index 9a9f79557..80bea8e45 100644 --- a/sync-for-payroll/pkg/models/operations/refreshdatatype.go +++ b/sync-for-payroll/pkg/models/operations/refreshdatatype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/unlinkconnection.go b/sync-for-payroll/pkg/models/operations/unlinkconnection.go index 960a3db92..885770bcc 100644 --- a/sync-for-payroll/pkg/models/operations/unlinkconnection.go +++ b/sync-for-payroll/pkg/models/operations/unlinkconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/operations/updatecompany.go b/sync-for-payroll/pkg/models/operations/updatecompany.go index 196c6083f..086ef5d1a 100644 --- a/sync-for-payroll/pkg/models/operations/updatecompany.go +++ b/sync-for-payroll/pkg/models/operations/updatecompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-payroll/pkg/models/sdkerrors/errormessage.go b/sync-for-payroll/pkg/models/sdkerrors/errormessage.go index dab7b935f..285fb7349 100644 --- a/sync-for-payroll/pkg/models/sdkerrors/errormessage.go +++ b/sync-for-payroll/pkg/models/sdkerrors/errormessage.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors diff --git a/sync-for-payroll/pkg/models/sdkerrors/sdkerror.go b/sync-for-payroll/pkg/models/sdkerrors/sdkerror.go index 5c1affd31..7d63b9813 100644 --- a/sync-for-payroll/pkg/models/sdkerrors/sdkerror.go +++ b/sync-for-payroll/pkg/models/sdkerrors/sdkerror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors diff --git a/sync-for-payroll/pkg/models/shared/account.go b/sync-for-payroll/pkg/models/shared/account.go index 1eef241fa..9088022f8 100644 --- a/sync-for-payroll/pkg/models/shared/account.go +++ b/sync-for-payroll/pkg/models/shared/account.go @@ -1,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 Account struct { Status *AccountStatus `json:"status,omitempty"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Type of account Type *AccountType `json:"type,omitempty"` diff --git a/sync-for-payroll/pkg/models/shared/accountingaddresstype.go b/sync-for-payroll/pkg/models/shared/accountingaddresstype.go index c98699efe..a0c620b32 100644 --- a/sync-for-payroll/pkg/models/shared/accountingaddresstype.go +++ b/sync-for-payroll/pkg/models/shared/accountingaddresstype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -19,7 +19,6 @@ const ( func (e AccountingAddressType) ToPointer() *AccountingAddressType { return &e } - func (e *AccountingAddressType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/accountprototype.go b/sync-for-payroll/pkg/models/shared/accountprototype.go index 84450342d..474921c02 100644 --- a/sync-for-payroll/pkg/models/shared/accountprototype.go +++ b/sync-for-payroll/pkg/models/shared/accountprototype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -100,7 +100,7 @@ type AccountPrototype struct { Status *AccountStatus `json:"status,omitempty"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Type of account Type *AccountType `json:"type,omitempty"` diff --git a/sync-for-payroll/pkg/models/shared/accountref.go b/sync-for-payroll/pkg/models/shared/accountref.go index a62aae1ef..49e13a2b9 100644 --- a/sync-for-payroll/pkg/models/shared/accountref.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/models/shared/accounts.go b/sync-for-payroll/pkg/models/shared/accounts.go index 47aa7c2ba..9cc48a42a 100644 --- a/sync-for-payroll/pkg/models/shared/accounts.go +++ b/sync-for-payroll/pkg/models/shared/accounts.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/accountstatus.go b/sync-for-payroll/pkg/models/shared/accountstatus.go index 17493901b..c86b01e74 100644 --- a/sync-for-payroll/pkg/models/shared/accountstatus.go +++ b/sync-for-payroll/pkg/models/shared/accountstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e AccountStatus) ToPointer() *AccountStatus { return &e } - func (e *AccountStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/accounttype.go b/sync-for-payroll/pkg/models/shared/accounttype.go index 771c270b3..95bc921a7 100644 --- a/sync-for-payroll/pkg/models/shared/accounttype.go +++ b/sync-for-payroll/pkg/models/shared/accounttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -22,7 +22,6 @@ const ( func (e AccountType) ToPointer() *AccountType { return &e } - func (e *AccountType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/address.go b/sync-for-payroll/pkg/models/shared/address.go index f50214fb6..f480c4658 100644 --- a/sync-for-payroll/pkg/models/shared/address.go +++ b/sync-for-payroll/pkg/models/shared/address.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhook.go b/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhook.go index 80e4c8bdd..5e146f608 100644 --- a/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhook.go +++ b/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -11,9 +11,11 @@ type ClientRateLimitReachedWebhook struct { // Name of your client in Codat. ClientName *string `json:"ClientName,omitempty"` Data *ClientRateLimitReachedWebhookData `json:"Data,omitempty"` - // A human readable message about the webhook. + // A human-readable message about the webhook. Message *string `json:"Message,omitempty"` // Unique identifier for the rule. + // + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. RuleID *string `json:"RuleId,omitempty"` // The type of rule. RuleType *string `json:"RuleType,omitempty"` diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhookdata.go b/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhookdata.go index c93fcdbd5..fdbf9b562 100644 --- a/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhookdata.go +++ b/sync-for-payroll/pkg/models/shared/clientratelimitreachedwebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhook.go b/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhook.go index 6590a2378..84fdbc67b 100644 --- a/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhook.go +++ b/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -11,9 +11,11 @@ type ClientRateLimitResetWebhook struct { // Name of your client in Codat. ClientName *string `json:"ClientName,omitempty"` Data *ClientRateLimitResetWebhookData `json:"Data,omitempty"` - // A human readable message about the webhook. + // A human-readable message about the webhook. Message *string `json:"Message,omitempty"` // Unique identifier for the rule. + // + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. RuleID *string `json:"RuleId,omitempty"` // The type of rule. RuleType *string `json:"RuleType,omitempty"` diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhookdata.go b/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhookdata.go index ed8df8957..bd5fe0580 100644 --- a/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhookdata.go +++ b/sync-for-payroll/pkg/models/shared/clientratelimitresetwebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -25,7 +25,7 @@ type ClientRateLimitResetWebhookData 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. ExpiresUtc *string `json:"ExpiresUtc,omitempty"` - // Total number of request remaining for your client. + // Total number of requests remaining for your client. QuotaRemaining *int64 `json:"QuotaRemaining,omitempty"` // The reason for your rate limit quota being reset. ResetReason *string `json:"ResetReason,omitempty"` diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitwebhook.go b/sync-for-payroll/pkg/models/shared/clientratelimitwebhook.go new file mode 100644 index 000000000..5dfc990df --- /dev/null +++ b/sync-for-payroll/pkg/models/shared/clientratelimitwebhook.go @@ -0,0 +1,59 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ClientRateLimitWebhook struct { + // The type of event. + EventType *string `json:"eventType,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + GeneratedDate *string `json:"generatedDate,omitempty"` + // Unique identifier of the event. + ID *string `json:"id,omitempty"` + Payload *ClientRateLimitWebhookPayload `json:"payload,omitempty"` +} + +func (o *ClientRateLimitWebhook) GetEventType() *string { + if o == nil { + return nil + } + return o.EventType +} + +func (o *ClientRateLimitWebhook) GetGeneratedDate() *string { + if o == nil { + return nil + } + return o.GeneratedDate +} + +func (o *ClientRateLimitWebhook) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ClientRateLimitWebhook) GetPayload() *ClientRateLimitWebhookPayload { + if o == nil { + return nil + } + return o.Payload +} diff --git a/sync-for-payroll/pkg/models/shared/clientratelimitwebhookpayload.go b/sync-for-payroll/pkg/models/shared/clientratelimitwebhookpayload.go new file mode 100644 index 000000000..eb9ed0b2e --- /dev/null +++ b/sync-for-payroll/pkg/models/shared/clientratelimitwebhookpayload.go @@ -0,0 +1,51 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ClientRateLimitWebhookPayload struct { + // The number of available requests per day. + DailyQuota *int64 `json:"dailyQuota,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + ExpiryDate *string `json:"expiryDate,omitempty"` + // Total number of requests remaining for your client. + QuotaRemaining *int64 `json:"quotaRemaining,omitempty"` +} + +func (o *ClientRateLimitWebhookPayload) GetDailyQuota() *int64 { + if o == nil { + return nil + } + return o.DailyQuota +} + +func (o *ClientRateLimitWebhookPayload) GetExpiryDate() *string { + if o == nil { + return nil + } + return o.ExpiryDate +} + +func (o *ClientRateLimitWebhookPayload) GetQuotaRemaining() *int64 { + if o == nil { + return nil + } + return o.QuotaRemaining +} diff --git a/sync-for-payroll/pkg/models/shared/companies.go b/sync-for-payroll/pkg/models/shared/companies.go index 5a5574be6..2776b0604 100644 --- a/sync-for-payroll/pkg/models/shared/companies.go +++ b/sync-for-payroll/pkg/models/shared/companies.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/company.go b/sync-for-payroll/pkg/models/shared/company.go index aad2f2a42..d00b6c691 100644 --- a/sync-for-payroll/pkg/models/shared/company.go +++ b/sync-for-payroll/pkg/models/shared/company.go @@ -1,17 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -type GroupReference struct { - // Unique identifier for the group. - ID *string `json:"id,omitempty"` -} - -func (o *GroupReference) GetID() *string { - if o == nil { - return nil - } - return o.ID +// Tags - A collection of user-defined key-value pairs that store custom metadata against the company. +type Tags struct { } // Company - In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-payroll-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. @@ -45,8 +37,6 @@ type Company struct { DataConnections []Connection `json:"dataConnections,omitempty"` // Additional information about the company. This can be used to store foreign IDs, references, etc. Description *string `json:"description,omitempty"` - // An array of groups the company has been assigned to. - Groups []GroupReference `json:"groups,omitempty"` // Unique identifier for your SMB in Codat. ID string `json:"id"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -71,12 +61,10 @@ type Company struct { LastSync *string `json:"lastSync,omitempty"` // The name of the company Name string `json:"name"` - // `platformKeys` name used when creating the company. - // - // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - Platform *string `json:"platform,omitempty"` // The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. Redirect string `json:"redirect"` + // A collection of user-defined key-value pairs that store custom metadata against the company. + Tags *Tags `json:"tags,omitempty"` } func (o *Company) GetCreated() *string { @@ -107,13 +95,6 @@ func (o *Company) GetDescription() *string { return o.Description } -func (o *Company) GetGroups() []GroupReference { - if o == nil { - return nil - } - return o.Groups -} - func (o *Company) GetID() string { if o == nil { return "" @@ -135,16 +116,16 @@ func (o *Company) GetName() string { return o.Name } -func (o *Company) GetPlatform() *string { +func (o *Company) GetRedirect() string { if o == nil { - return nil + return "" } - return o.Platform + return o.Redirect } -func (o *Company) GetRedirect() string { +func (o *Company) GetTags() *Tags { if o == nil { - return "" + return nil } - return o.Redirect + return o.Tags } diff --git a/sync-for-payroll/pkg/models/shared/companyinfo.go b/sync-for-payroll/pkg/models/shared/companyinfo.go index fb77ebe97..17f829da8 100644 --- a/sync-for-payroll/pkg/models/shared/companyinfo.go +++ b/sync-for-payroll/pkg/models/shared/companyinfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -8,13 +8,13 @@ package shared // // > **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 CompanyInfo 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 []Address `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"` @@ -90,7 +90,7 @@ type CompanyInfo 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/sync-for-payroll/pkg/models/shared/companyrequestbody.go b/sync-for-payroll/pkg/models/shared/companyrequestbody.go index b16534c27..01191107d 100644 --- a/sync-for-payroll/pkg/models/shared/companyrequestbody.go +++ b/sync-for-payroll/pkg/models/shared/companyrequestbody.go @@ -1,12 +1,24 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +type GroupReference struct { + // Unique identifier for the group. + ID *string `json:"id,omitempty"` +} + +func (o *GroupReference) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + type CompanyRequestBody struct { // Additional information about the company. This can be used to store foreign IDs, references, etc. Description *string `json:"description,omitempty"` // Reference to the groups that the company is assigned to. - Groups []Items `json:"groups,omitempty"` + Groups []GroupReference `json:"groups,omitempty"` // Name of company being connected. Name string `json:"name"` } @@ -18,7 +30,7 @@ func (o *CompanyRequestBody) GetDescription() *string { return o.Description } -func (o *CompanyRequestBody) GetGroups() []Items { +func (o *CompanyRequestBody) GetGroups() []GroupReference { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/models/shared/connection.go b/sync-for-payroll/pkg/models/shared/connection.go index a324beab6..a478e4838 100644 --- a/sync-for-payroll/pkg/models/shared/connection.go +++ b/sync-for-payroll/pkg/models/shared/connection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -23,7 +23,6 @@ const ( func (e SourceType) ToPointer() *SourceType { return &e } - func (e *SourceType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -61,7 +60,7 @@ func (e *SourceType) UnmarshalJSON(data []byte) error { // // Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). type Connection struct { - AdditionalProperties interface{} `json:"additionalProperties,omitempty"` + AdditionalProperties any `json:"additionalProperties,omitempty"` ConnectionInfo map[string]string `json:"connectionInfo,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -122,7 +121,7 @@ type Connection struct { Status DataConnectionStatus `json:"status"` } -func (o *Connection) GetAdditionalProperties() interface{} { +func (o *Connection) GetAdditionalProperties() any { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/models/shared/connections.go b/sync-for-payroll/pkg/models/shared/connections.go index 24ae6e665..e20874757 100644 --- a/sync-for-payroll/pkg/models/shared/connections.go +++ b/sync-for-payroll/pkg/models/shared/connections.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/createaccountresponse.go b/sync-for-payroll/pkg/models/shared/createaccountresponse.go index 3f9826d7f..97dfb3424 100644 --- a/sync-for-payroll/pkg/models/shared/createaccountresponse.go +++ b/sync-for-payroll/pkg/models/shared/createaccountresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -147,7 +147,7 @@ type AccountingAccount struct { Status *AccountStatus `json:"status,omitempty"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Type of account Type *AccountType `json:"type,omitempty"` @@ -306,7 +306,7 @@ type CreateAccountResponse struct { Data *AccountingAccount `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"` diff --git a/sync-for-payroll/pkg/models/shared/createjournalentryresponse.go b/sync-for-payroll/pkg/models/shared/createjournalentryresponse.go index 45cc60eb1..bf1942f70 100644 --- a/sync-for-payroll/pkg/models/shared/createjournalentryresponse.go +++ b/sync-for-payroll/pkg/models/shared/createjournalentryresponse.go @@ -1,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 @@ -49,7 +49,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"` @@ -82,7 +82,7 @@ type AccountingJournalEntry 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"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -218,7 +218,7 @@ type CreateJournalEntryResponse struct { Data *AccountingJournalEntry `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"` diff --git a/sync-for-payroll/pkg/models/shared/createjournalresponse.go b/sync-for-payroll/pkg/models/shared/createjournalresponse.go index 237763771..877b0138d 100644 --- a/sync-for-payroll/pkg/models/shared/createjournalresponse.go +++ b/sync-for-payroll/pkg/models/shared/createjournalresponse.go @@ -1,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 @@ package shared // - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) // - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) // -// > When pushing journal entries to an accounting platform that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. +// > When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. // // Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. type AccountingJournal struct { @@ -173,7 +173,7 @@ type CreateJournalResponse struct { Data *AccountingJournal `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"` diff --git a/sync-for-payroll/pkg/models/shared/dataconnectionerror.go b/sync-for-payroll/pkg/models/shared/dataconnectionerror.go index 757486ba3..2bbff7093 100644 --- a/sync-for-payroll/pkg/models/shared/dataconnectionerror.go +++ b/sync-for-payroll/pkg/models/shared/dataconnectionerror.go @@ -1,9 +1,41 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +import ( + "encoding/json" + "fmt" +) + +// ErrorStatus - The current status of a transient error. Null statuses indicate that the error is not transient. +type ErrorStatus string + +const ( + ErrorStatusActive ErrorStatus = "Active" + ErrorStatusResolved ErrorStatus = "Resolved" +) + +func (e ErrorStatus) ToPointer() *ErrorStatus { + return &e +} +func (e *ErrorStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Active": + fallthrough + case "Resolved": + *e = ErrorStatus(v) + return nil + default: + return fmt.Errorf("invalid value for ErrorStatus: %v", v) + } +} + type DataConnectionError struct { - // A brief message about the error. + // A message about a error returned by Codat. ErrorMessage *string `json:"errorMessage,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -25,9 +57,31 @@ type DataConnectionError struct { // > Not all dates from Codat will contain information about time zones. // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. ErroredOnUtc *string `json:"erroredOnUtc,omitempty"` - // The HTTP status code returned by the error. + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + ResolvedOnUtc *string `json:"resolvedOnUtc,omitempty"` + // The current status of a transient error. Null statuses indicate that the error is not transient. + Status *ErrorStatus `json:"status,omitempty"` + // The HTTP status code returned by the source platform when the error occurred. StatusCode *string `json:"statusCode,omitempty"` - // A non-numeric status code/text. + // A non-numeric status code/text returned by the source platform when the error occurred. StatusText *string `json:"statusText,omitempty"` } @@ -45,6 +99,20 @@ func (o *DataConnectionError) GetErroredOnUtc() *string { return o.ErroredOnUtc } +func (o *DataConnectionError) GetResolvedOnUtc() *string { + if o == nil { + return nil + } + return o.ResolvedOnUtc +} + +func (o *DataConnectionError) GetStatus() *ErrorStatus { + if o == nil { + return nil + } + return o.Status +} + func (o *DataConnectionError) GetStatusCode() *string { if o == nil { return nil diff --git a/sync-for-payroll/pkg/models/shared/dataconnectionstatus.go b/sync-for-payroll/pkg/models/shared/dataconnectionstatus.go index ec5254876..f7e281bc9 100644 --- a/sync-for-payroll/pkg/models/shared/dataconnectionstatus.go +++ b/sync-for-payroll/pkg/models/shared/dataconnectionstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e DataConnectionStatus) ToPointer() *DataConnectionStatus { return &e } - func (e *DataConnectionStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/datastatus.go b/sync-for-payroll/pkg/models/shared/datastatus.go index 8fe5aa5fe..d126c24fd 100644 --- a/sync-for-payroll/pkg/models/shared/datastatus.go +++ b/sync-for-payroll/pkg/models/shared/datastatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -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 { @@ -160,9 +159,9 @@ func (e *DataTypes) UnmarshalJSON(data []byte) error { // DataStatus - Describes the state of data in the Codat cache for a company and data type type DataStatus struct { - // The current status of the dataset in Codat's cache. - CurrentStatus string `json:"currentStatus"` - // Available Data types + // The current status of the dataset. + CurrentStatus PropertieStatus `json:"currentStatus"` + // Available data types DataType DataTypes `json:"dataType"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -190,9 +189,9 @@ type DataStatus struct { LatestSyncID *string `json:"latestSyncId,omitempty"` } -func (o *DataStatus) GetCurrentStatus() string { +func (o *DataStatus) GetCurrentStatus() PropertieStatus { if o == nil { - return "" + return PropertieStatus("") } return o.CurrentStatus } diff --git a/sync-for-payroll/pkg/models/shared/datatype.go b/sync-for-payroll/pkg/models/shared/datatype.go index 33d80c2cb..1d26b3108 100644 --- a/sync-for-payroll/pkg/models/shared/datatype.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/models/shared/errorvalidation.go b/sync-for-payroll/pkg/models/shared/errorvalidation.go index 89c18c7fc..3f12091c8 100644 --- a/sync-for-payroll/pkg/models/shared/errorvalidation.go +++ b/sync-for-payroll/pkg/models/shared/errorvalidation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/errorvalidationitem.go b/sync-for-payroll/pkg/models/shared/errorvalidationitem.go index 9a3c1252f..b97f640eb 100644 --- a/sync-for-payroll/pkg/models/shared/errorvalidationitem.go +++ b/sync-for-payroll/pkg/models/shared/errorvalidationitem.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/halref.go b/sync-for-payroll/pkg/models/shared/halref.go index 06ee18c03..f7b86c830 100644 --- a/sync-for-payroll/pkg/models/shared/halref.go +++ b/sync-for-payroll/pkg/models/shared/halref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/items.go b/sync-for-payroll/pkg/models/shared/items.go deleted file mode 100644 index 347f72f2e..000000000 --- a/sync-for-payroll/pkg/models/shared/items.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type Items struct { - // Unique identifier for the group. - ID *string `json:"id,omitempty"` -} - -func (o *Items) GetID() *string { - if o == nil { - return nil - } - return o.ID -} diff --git a/sync-for-payroll/pkg/models/shared/journal.go b/sync-for-payroll/pkg/models/shared/journal.go index 1cfd6da40..3d3102878 100644 --- a/sync-for-payroll/pkg/models/shared/journal.go +++ b/sync-for-payroll/pkg/models/shared/journal.go @@ -1,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 @@ package shared // - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) // - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) // -// > When pushing journal entries to an accounting platform that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. +// > When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. type Journal 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: // diff --git a/sync-for-payroll/pkg/models/shared/journalentries.go b/sync-for-payroll/pkg/models/shared/journalentries.go index 9ade47c78..d35d33c7b 100644 --- a/sync-for-payroll/pkg/models/shared/journalentries.go +++ b/sync-for-payroll/pkg/models/shared/journalentries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/journalentry.go b/sync-for-payroll/pkg/models/shared/journalentry.go index 438b1de76..74791352f 100644 --- a/sync-for-payroll/pkg/models/shared/journalentry.go +++ b/sync-for-payroll/pkg/models/shared/journalentry.go @@ -1,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 @@ -47,7 +47,7 @@ type JournalEntry 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"` @@ -80,7 +80,7 @@ type JournalEntry 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"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // diff --git a/sync-for-payroll/pkg/models/shared/journalentryrecordref.go b/sync-for-payroll/pkg/models/shared/journalentryrecordref.go index 06db221ac..f6d9b9688 100644 --- a/sync-for-payroll/pkg/models/shared/journalentryrecordref.go +++ b/sync-for-payroll/pkg/models/shared/journalentryrecordref.go @@ -1,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 @@ -27,7 +27,6 @@ const ( 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 { diff --git a/sync-for-payroll/pkg/models/shared/journalline.go b/sync-for-payroll/pkg/models/shared/journalline.go index 0fd467898..a9486607f 100644 --- a/sync-for-payroll/pkg/models/shared/journalline.go +++ b/sync-for-payroll/pkg/models/shared/journalline.go @@ -1,12 +1,62 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared import ( + "encoding/json" + "fmt" "github.com/codatio/client-sdk-go/sync-for-payroll/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 +} + // Tracking - List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) type Tracking struct { RecordRefs []TrackingRecordRef `json:"recordRefs,omitempty"` @@ -21,7 +71,8 @@ func (o *Tracking) GetRecordRefs() []TrackingRecordRef { 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/sync-for-payroll/pkg/models/shared/journalprototype.go b/sync-for-payroll/pkg/models/shared/journalprototype.go index 9b15f0c7a..c6951278f 100644 --- a/sync-for-payroll/pkg/models/shared/journalprototype.go +++ b/sync-for-payroll/pkg/models/shared/journalprototype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/journalref.go b/sync-for-payroll/pkg/models/shared/journalref.go index e1c67bf37..bed9f332b 100644 --- a/sync-for-payroll/pkg/models/shared/journalref.go +++ b/sync-for-payroll/pkg/models/shared/journalref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/journals.go b/sync-for-payroll/pkg/models/shared/journals.go index 4f50d3f37..bc43e3143 100644 --- a/sync-for-payroll/pkg/models/shared/journals.go +++ b/sync-for-payroll/pkg/models/shared/journals.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/journalstatus.go b/sync-for-payroll/pkg/models/shared/journalstatus.go index d612b6fd8..a7176c05a 100644 --- a/sync-for-payroll/pkg/models/shared/journalstatus.go +++ b/sync-for-payroll/pkg/models/shared/journalstatus.go @@ -1,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 JournalStatus) ToPointer() *JournalStatus { return &e } - func (e *JournalStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/links.go b/sync-for-payroll/pkg/models/shared/links.go index df8dac300..9feb26261 100644 --- a/sync-for-payroll/pkg/models/shared/links.go +++ b/sync-for-payroll/pkg/models/shared/links.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/metadata.go b/sync-for-payroll/pkg/models/shared/metadata.go index 85a209bbb..851caf39d 100644 --- a/sync-for-payroll/pkg/models/shared/metadata.go +++ b/sync-for-payroll/pkg/models/shared/metadata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/phonenumber.go b/sync-for-payroll/pkg/models/shared/phonenumber.go index 8261c383a..104ad252b 100644 --- a/sync-for-payroll/pkg/models/shared/phonenumber.go +++ b/sync-for-payroll/pkg/models/shared/phonenumber.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 PhoneNumber 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/sync-for-payroll/pkg/models/shared/phonenumbertype.go b/sync-for-payroll/pkg/models/shared/phonenumbertype.go index 650172b3f..f9ed3f44c 100644 --- a/sync-for-payroll/pkg/models/shared/phonenumbertype.go +++ b/sync-for-payroll/pkg/models/shared/phonenumbertype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e PhoneNumberType) ToPointer() *PhoneNumberType { return &e } - func (e *PhoneNumberType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/propertiestatus.go b/sync-for-payroll/pkg/models/shared/propertiestatus.go new file mode 100644 index 000000000..db4998e77 --- /dev/null +++ b/sync-for-payroll/pkg/models/shared/propertiestatus.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// PropertieStatus - The current status of the dataset. +type PropertieStatus string + +const ( + PropertieStatusInitial PropertieStatus = "Initial" + PropertieStatusQueued PropertieStatus = "Queued" + PropertieStatusFetching PropertieStatus = "Fetching" + PropertieStatusMapQueued PropertieStatus = "MapQueued" + PropertieStatusMapping PropertieStatus = "Mapping" + PropertieStatusComplete PropertieStatus = "Complete" + PropertieStatusFetchError PropertieStatus = "FetchError" + PropertieStatusMapError PropertieStatus = "MapError" + PropertieStatusInternalError PropertieStatus = "InternalError" + PropertieStatusProcessingQueued PropertieStatus = "ProcessingQueued" + PropertieStatusProcessing PropertieStatus = "Processing" + PropertieStatusProcessingError PropertieStatus = "ProcessingError" + PropertieStatusValidationQueued PropertieStatus = "ValidationQueued" + PropertieStatusValidating PropertieStatus = "Validating" + PropertieStatusValidationError PropertieStatus = "ValidationError" + PropertieStatusAuthError PropertieStatus = "AuthError" + PropertieStatusCancelled PropertieStatus = "Cancelled" + PropertieStatusNotSupported PropertieStatus = "NotSupported" + PropertieStatusRateLimitError PropertieStatus = "RateLimitError" + PropertieStatusPermissionsError PropertieStatus = "PermissionsError" + PropertieStatusPrerequisiteNotMet PropertieStatus = "PrerequisiteNotMet" +) + +func (e PropertieStatus) ToPointer() *PropertieStatus { + return &e +} +func (e *PropertieStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Initial": + fallthrough + case "Queued": + fallthrough + case "Fetching": + fallthrough + case "MapQueued": + fallthrough + case "Mapping": + fallthrough + case "Complete": + fallthrough + case "FetchError": + fallthrough + case "MapError": + fallthrough + case "InternalError": + fallthrough + case "ProcessingQueued": + fallthrough + case "Processing": + fallthrough + case "ProcessingError": + fallthrough + case "ValidationQueued": + fallthrough + case "Validating": + fallthrough + case "ValidationError": + fallthrough + case "AuthError": + fallthrough + case "Cancelled": + fallthrough + case "NotSupported": + fallthrough + case "RateLimitError": + fallthrough + case "PermissionsError": + fallthrough + case "PrerequisiteNotMet": + *e = PropertieStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PropertieStatus: %v", v) + } +} diff --git a/sync-for-payroll/pkg/models/shared/pulloperation.go b/sync-for-payroll/pkg/models/shared/pulloperation.go index 44b956d89..052fbc10a 100644 --- a/sync-for-payroll/pkg/models/shared/pulloperation.go +++ b/sync-for-payroll/pkg/models/shared/pulloperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -7,40 +7,37 @@ import ( "fmt" ) -// PullOperationStatus - The current status of the pull operation. -type PullOperationStatus string +// DatasetStatus - The current status of the dataset. +type DatasetStatus 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" + DatasetStatusInitial DatasetStatus = "Initial" + DatasetStatusQueued DatasetStatus = "Queued" + DatasetStatusFetching DatasetStatus = "Fetching" + DatasetStatusMapQueued DatasetStatus = "MapQueued" + DatasetStatusMapping DatasetStatus = "Mapping" + DatasetStatusComplete DatasetStatus = "Complete" + DatasetStatusFetchError DatasetStatus = "FetchError" + DatasetStatusMapError DatasetStatus = "MapError" + DatasetStatusInternalError DatasetStatus = "InternalError" + DatasetStatusProcessingQueued DatasetStatus = "ProcessingQueued" + DatasetStatusProcessing DatasetStatus = "Processing" + DatasetStatusProcessingError DatasetStatus = "ProcessingError" + DatasetStatusValidationQueued DatasetStatus = "ValidationQueued" + DatasetStatusValidating DatasetStatus = "Validating" + DatasetStatusValidationError DatasetStatus = "ValidationError" + DatasetStatusAuthError DatasetStatus = "AuthError" + DatasetStatusCancelled DatasetStatus = "Cancelled" + DatasetStatusNotSupported DatasetStatus = "NotSupported" + DatasetStatusRateLimitError DatasetStatus = "RateLimitError" + DatasetStatusPermissionsError DatasetStatus = "PermissionsError" + DatasetStatusPrerequisiteNotMet DatasetStatus = "PrerequisiteNotMet" ) -func (e PullOperationStatus) ToPointer() *PullOperationStatus { +func (e DatasetStatus) ToPointer() *DatasetStatus { return &e } - -func (e *PullOperationStatus) UnmarshalJSON(data []byte) error { +func (e *DatasetStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -80,10 +77,6 @@ func (e *PullOperationStatus) UnmarshalJSON(data []byte) error { fallthrough case "Cancelled": fallthrough - case "Routing": - fallthrough - case "RoutingError": - fallthrough case "NotSupported": fallthrough case "RateLimitError": @@ -91,10 +84,10 @@ func (e *PullOperationStatus) UnmarshalJSON(data []byte) error { case "PermissionsError": fallthrough case "PrerequisiteNotMet": - *e = PullOperationStatus(v) + *e = DatasetStatus(v) return nil default: - return fmt.Errorf("invalid value for PullOperationStatus: %v", v) + return fmt.Errorf("invalid value for DatasetStatus: %v", v) } } @@ -127,7 +120,7 @@ type PullOperation struct { ConnectionID string `json:"connectionId"` // The data type you are requesting in a pull operation. DataType string `json:"dataType"` - // A message about a transient or persistent error. + // A message about a transient or persistent error returned by Codat or the source platform. ErrorMessage *string `json:"errorMessage,omitempty"` // Unique identifier of the pull operation. ID string `json:"id"` @@ -157,8 +150,8 @@ type PullOperation struct { // > Not all dates from Codat will contain information about time zones. // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. Requested string `json:"requested"` - // The current status of the pull operation. - Status 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 +226,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/sync-for-payroll/pkg/models/shared/pulloperations.go b/sync-for-payroll/pkg/models/shared/pulloperations.go index 36591729b..279571670 100644 --- a/sync-for-payroll/pkg/models/shared/pulloperations.go +++ b/sync-for-payroll/pkg/models/shared/pulloperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushchangetype.go b/sync-for-payroll/pkg/models/shared/pushchangetype.go index af522940e..d7a3d7a69 100644 --- a/sync-for-payroll/pkg/models/shared/pushchangetype.go +++ b/sync-for-payroll/pkg/models/shared/pushchangetype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e PushChangeType) ToPointer() *PushChangeType { return &e } - func (e *PushChangeType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/pushfieldvalidation.go b/sync-for-payroll/pkg/models/shared/pushfieldvalidation.go index bfe6460d6..02899cb77 100644 --- a/sync-for-payroll/pkg/models/shared/pushfieldvalidation.go +++ b/sync-for-payroll/pkg/models/shared/pushfieldvalidation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoperation.go b/sync-for-payroll/pkg/models/shared/pushoperation.go index b54e8efbb..fdb1a3ceb 100644 --- a/sync-for-payroll/pkg/models/shared/pushoperation.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/models/shared/pushoperationchange.go b/sync-for-payroll/pkg/models/shared/pushoperationchange.go index 500f01617..f7471e9a3 100644 --- a/sync-for-payroll/pkg/models/shared/pushoperationchange.go +++ b/sync-for-payroll/pkg/models/shared/pushoperationchange.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoperationref.go b/sync-for-payroll/pkg/models/shared/pushoperationref.go index 766073374..3e9ac25c0 100644 --- a/sync-for-payroll/pkg/models/shared/pushoperationref.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/models/shared/pushoperations.go b/sync-for-payroll/pkg/models/shared/pushoperations.go index 9d2ed7c86..23e30831d 100644 --- a/sync-for-payroll/pkg/models/shared/pushoperations.go +++ b/sync-for-payroll/pkg/models/shared/pushoperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoperationstatus.go b/sync-for-payroll/pkg/models/shared/pushoperationstatus.go index a795bac79..2f7070a10 100644 --- a/sync-for-payroll/pkg/models/shared/pushoperationstatus.go +++ b/sync-for-payroll/pkg/models/shared/pushoperationstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e PushOperationStatus) ToPointer() *PushOperationStatus { return &e } - func (e *PushOperationStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/pushoption.go b/sync-for-payroll/pkg/models/shared/pushoption.go index 39df89775..f0de79dcc 100644 --- a/sync-for-payroll/pkg/models/shared/pushoption.go +++ b/sync-for-payroll/pkg/models/shared/pushoption.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoptionchoice.go b/sync-for-payroll/pkg/models/shared/pushoptionchoice.go index 0e5cffbd5..e36c2c799 100644 --- a/sync-for-payroll/pkg/models/shared/pushoptionchoice.go +++ b/sync-for-payroll/pkg/models/shared/pushoptionchoice.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoptionproperty.go b/sync-for-payroll/pkg/models/shared/pushoptionproperty.go index 51f5137e9..fea745b1a 100644 --- a/sync-for-payroll/pkg/models/shared/pushoptionproperty.go +++ b/sync-for-payroll/pkg/models/shared/pushoptionproperty.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/pushoptiontype.go b/sync-for-payroll/pkg/models/shared/pushoptiontype.go index 799d12d4e..8049ad49a 100644 --- a/sync-for-payroll/pkg/models/shared/pushoptiontype.go +++ b/sync-for-payroll/pkg/models/shared/pushoptiontype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -24,7 +24,6 @@ const ( func (e PushOptionType) ToPointer() *PushOptionType { return &e } - func (e *PushOptionType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/pushvalidationinfo.go b/sync-for-payroll/pkg/models/shared/pushvalidationinfo.go index eb5756f08..c8f167d02 100644 --- a/sync-for-payroll/pkg/models/shared/pushvalidationinfo.go +++ b/sync-for-payroll/pkg/models/shared/pushvalidationinfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/schemadatatype.go b/sync-for-payroll/pkg/models/shared/schemadatatype.go index 19e3d610a..8d4d8cb8c 100644 --- a/sync-for-payroll/pkg/models/shared/schemadatatype.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/models/shared/security.go b/sync-for-payroll/pkg/models/shared/security.go index 5d91435a8..e1f80d158 100644 --- a/sync-for-payroll/pkg/models/shared/security.go +++ b/sync-for-payroll/pkg/models/shared/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/status.go b/sync-for-payroll/pkg/models/shared/status.go index b2b12ccbe..0447d9ce4 100644 --- a/sync-for-payroll/pkg/models/shared/status.go +++ b/sync-for-payroll/pkg/models/shared/status.go @@ -1,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/sync-for-payroll/pkg/models/shared/supplementaldata.go b/sync-for-payroll/pkg/models/shared/supplementaldata.go index edb51f9fc..8e62d3efc 100644 --- a/sync-for-payroll/pkg/models/shared/supplementaldata.go +++ b/sync-for-payroll/pkg/models/shared/supplementaldata.go @@ -1,15 +1,15 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared // SupplementalData - Supplemental data is additional data you can include in our standard data types. // -// It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. +// It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. type SupplementalData struct { - Content map[string]map[string]interface{} `json:"content,omitempty"` + Content map[string]map[string]any `json:"content,omitempty"` } -func (o *SupplementalData) GetContent() map[string]map[string]interface{} { +func (o *SupplementalData) GetContent() map[string]map[string]any { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/models/shared/trackingcategories.go b/sync-for-payroll/pkg/models/shared/trackingcategories.go index 2dc1ea4a8..00d5dc3cc 100644 --- a/sync-for-payroll/pkg/models/shared/trackingcategories.go +++ b/sync-for-payroll/pkg/models/shared/trackingcategories.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/trackingcategory.go b/sync-for-payroll/pkg/models/shared/trackingcategory.go index dab56d1b9..736638892 100644 --- a/sync-for-payroll/pkg/models/shared/trackingcategory.go +++ b/sync-for-payroll/pkg/models/shared/trackingcategory.go @@ -1,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 @@ -6,7 +6,7 @@ package shared // // > Language tip // > -// > Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting platforms. In Codat, we refer to these as tracking categories. +// > Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting software. In Codat, we refer to these as tracking categories. // // View the coverage for tracking categories in the Data coverage explorer. // diff --git a/sync-for-payroll/pkg/models/shared/trackingcategorytree.go b/sync-for-payroll/pkg/models/shared/trackingcategorytree.go index cc9dc10cb..cb6fe2556 100644 --- a/sync-for-payroll/pkg/models/shared/trackingcategorytree.go +++ b/sync-for-payroll/pkg/models/shared/trackingcategorytree.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/trackingrecordref.go b/sync-for-payroll/pkg/models/shared/trackingrecordref.go index 369fc30ff..49495e34e 100644 --- a/sync-for-payroll/pkg/models/shared/trackingrecordref.go +++ b/sync-for-payroll/pkg/models/shared/trackingrecordref.go @@ -1,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 TrackingRecordRefDataType) ToPointer() *TrackingRecordRefDataType { return &e } - func (e *TrackingRecordRefDataType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-payroll/pkg/models/shared/validation.go b/sync-for-payroll/pkg/models/shared/validation.go index bb4ce0816..9788c88dd 100644 --- a/sync-for-payroll/pkg/models/shared/validation.go +++ b/sync-for-payroll/pkg/models/shared/validation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/validationitem.go b/sync-for-payroll/pkg/models/shared/validationitem.go index 478e7bb7f..9993cc8f1 100644 --- a/sync-for-payroll/pkg/models/shared/validationitem.go +++ b/sync-for-payroll/pkg/models/shared/validationitem.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-payroll/pkg/models/shared/weblink.go b/sync-for-payroll/pkg/models/shared/weblink.go index 990eec6cb..b1ebb4dcc 100644 --- a/sync-for-payroll/pkg/models/shared/weblink.go +++ b/sync-for-payroll/pkg/models/shared/weblink.go @@ -1,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/sync-for-payroll/pkg/models/webhooks/clientratelimitreached.go b/sync-for-payroll/pkg/models/webhooks/clientratelimitreached.go index 90ff5ccd3..f9be2dcf5 100644 --- a/sync-for-payroll/pkg/models/webhooks/clientratelimitreached.go +++ b/sync-for-payroll/pkg/models/webhooks/clientratelimitreached.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks @@ -6,7 +6,7 @@ import ( "net/http" ) -type ClientRateLimitReachedResponse struct { +type ClientRateLimitReachedResponse1 struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -15,21 +15,21 @@ type ClientRateLimitReachedResponse struct { RawResponse *http.Response } -func (o *ClientRateLimitReachedResponse) GetContentType() string { +func (o *ClientRateLimitReachedResponse1) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *ClientRateLimitReachedResponse) GetStatusCode() int { +func (o *ClientRateLimitReachedResponse1) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *ClientRateLimitReachedResponse) GetRawResponse() *http.Response { +func (o *ClientRateLimitReachedResponse1) GetRawResponse() *http.Response { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/models/webhooks/clientratelimitreset.go b/sync-for-payroll/pkg/models/webhooks/clientratelimitreset.go index 2d0164927..3a7787447 100644 --- a/sync-for-payroll/pkg/models/webhooks/clientratelimitreset.go +++ b/sync-for-payroll/pkg/models/webhooks/clientratelimitreset.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks @@ -6,7 +6,7 @@ import ( "net/http" ) -type ClientRateLimitResetResponse struct { +type ClientRateLimitResetResponse1 struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -15,21 +15,21 @@ type ClientRateLimitResetResponse struct { RawResponse *http.Response } -func (o *ClientRateLimitResetResponse) GetContentType() string { +func (o *ClientRateLimitResetResponse1) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *ClientRateLimitResetResponse) GetStatusCode() int { +func (o *ClientRateLimitResetResponse1) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *ClientRateLimitResetResponse) GetRawResponse() *http.Response { +func (o *ClientRateLimitResetResponse1) GetRawResponse() *http.Response { if o == nil { return nil } diff --git a/sync-for-payroll/pkg/retry/config.go b/sync-for-payroll/pkg/retry/config.go new file mode 100644 index 000000000..c051b0a46 --- /dev/null +++ b/sync-for-payroll/pkg/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +} diff --git a/sync-for-payroll/pkg/types/bigint.go b/sync-for-payroll/pkg/types/bigint.go index afd0cd2b8..9c6a086d5 100644 --- a/sync-for-payroll/pkg/types/bigint.go +++ b/sync-for-payroll/pkg/types/bigint.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-payroll/pkg/types/date.go b/sync-for-payroll/pkg/types/date.go index c4648fa96..5b2782f21 100644 --- a/sync-for-payroll/pkg/types/date.go +++ b/sync-for-payroll/pkg/types/date.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-payroll/pkg/types/datetime.go b/sync-for-payroll/pkg/types/datetime.go index 0529b2556..3eff332da 100644 --- a/sync-for-payroll/pkg/types/datetime.go +++ b/sync-for-payroll/pkg/types/datetime.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-payroll/pkg/types/decimal.go b/sync-for-payroll/pkg/types/decimal.go index a42284b92..d8429bc6b 100644 --- a/sync-for-payroll/pkg/types/decimal.go +++ b/sync-for-payroll/pkg/types/decimal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-payroll/pkg/types/pointers.go b/sync-for-payroll/pkg/types/pointers.go index 4f15e99d4..35c439d26 100644 --- a/sync-for-payroll/pkg/types/pointers.go +++ b/sync-for-payroll/pkg/types/pointers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types @@ -8,3 +8,4 @@ func Int(i int) *int { return &i } func Int64(i int64) *int64 { return &i } func Float32(f float32) *float32 { return &f } func Float64(f float64) *float64 { return &f } +func Pointer[T any](v T) *T { return &v } diff --git a/sync-for-payroll/pkg/utils/contenttype.go b/sync-for-payroll/pkg/utils/contenttype.go index 8ed13e209..f6487e01e 100644 --- a/sync-for-payroll/pkg/utils/contenttype.go +++ b/sync-for-payroll/pkg/utils/contenttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -9,6 +9,10 @@ import ( ) func MatchContentType(contentType string, pattern string) bool { + if contentType == "" { + contentType = "application/octet-stream" + } + if contentType == pattern || pattern == "*" || pattern == "*/*" { return true } diff --git a/sync-for-payroll/pkg/utils/form.go b/sync-for-payroll/pkg/utils/form.go index a5fee866f..404f34bf4 100644 --- a/sync-for-payroll/pkg/utils/form.go +++ b/sync-for-payroll/pkg/utils/form.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/sync-for-payroll/pkg/utils/headers.go b/sync-for-payroll/pkg/utils/headers.go index 0837022e2..a07608bdc 100644 --- a/sync-for-payroll/pkg/utils/headers.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/utils/json.go b/sync-for-payroll/pkg/utils/json.go index c0f26dabc..1cf819777 100644 --- a/sync-for-payroll/pkg/utils/json.go +++ b/sync-for-payroll/pkg/utils/json.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -8,6 +8,7 @@ import ( "fmt" "math/big" "reflect" + "strconv" "strings" "time" "unsafe" @@ -164,11 +165,17 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool if field.Tag.Get("const") != "" { if r, ok := unmarhsaled[fieldName]; ok { val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { - val = val[1 : len(val)-1] + var err error + val, err = strconv.Unquote(val) + if err != nil { + return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) + } } - if val != field.Tag.Get("const") { - return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + constValue := field.Tag.Get("const") + if val != constValue { + return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } delete(unmarhsaled, fieldName) @@ -260,6 +267,18 @@ func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) switch typ.Kind() { + case reflect.Int64: + format := tag.Get("integer") + if format == "string" { + b := val.Interface().(int64) + return []byte(fmt.Sprintf(`"%d"`, b)), nil + } + case reflect.Float64: + format := tag.Get("number") + if format == "string" { + b := val.Interface().(float64) + return []byte(fmt.Sprintf(`"%g"`, b)), nil + } case reflect.Map: if isNil(typ, val) { return []byte("null"), nil @@ -349,6 +368,16 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc if bigIntTag == "string" { return []byte(fmt.Sprintf(`"%s"`, tagValue)) } + case reflect.TypeOf(int64(0)): + format := tag.Get("integer") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(float64(0)): + format := tag.Get("number") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } case reflect.TypeOf(decimal.Big{}): decimalTag := tag.Get("decimal") if decimalTag != "number" { @@ -377,6 +406,57 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa typ := dereferenceTypePointer(v.Type()) switch typ.Kind() { + case reflect.Int64: + var b int64 + + format := tag.Get("integer") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseInt(s, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse string as int64: %w", err) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } + case reflect.Float64: + var b float64 + + format := tag.Get("number") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseFloat(s, 64) + if err != nil { + return fmt.Errorf("failed to parse string as float64: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } case reflect.Map: if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { if v.CanAddr() { @@ -407,30 +487,29 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(m) return nil case reflect.Slice, reflect.Array: - if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } + var unmarshaled []json.RawMessage - var unmarhsaled []json.RawMessage - - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } - arrVal := v + arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) - for _, value := range unmarhsaled { + for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { return err } - arrVal = reflect.Append(arrVal, itemVal.Elem()) + arrVal.Index(index).Set(itemVal.Elem()) + } + + if v.Kind() == reflect.Pointer { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() } v.Set(arrVal) diff --git a/sync-for-payroll/pkg/utils/pathparams.go b/sync-for-payroll/pkg/utils/pathparams.go index 24a2e0780..9de565199 100644 --- a/sync-for-payroll/pkg/utils/pathparams.go +++ b/sync-for-payroll/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/sync-for-payroll/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/sync-for-payroll/pkg/utils/queryparams.go b/sync-for-payroll/pkg/utils/queryparams.go index 0e94bcee4..71af69be8 100644 --- a/sync-for-payroll/pkg/utils/queryparams.go +++ b/sync-for-payroll/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/sync-for-payroll/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/sync-for-payroll/pkg/utils/requestbody.go b/sync-for-payroll/pkg/utils/requestbody.go index 950f39a31..000226ef9 100644 --- a/sync-for-payroll/pkg/utils/requestbody.go +++ b/sync-for-payroll/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/sync-for-payroll/pkg/utils/retries.go b/sync-for-payroll/pkg/utils/retries.go index ff39d0d84..ca825431c 100644 --- a/sync-for-payroll/pkg/utils/retries.go +++ b/sync-for-payroll/pkg/utils/retries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/sync-for-payroll/pkg/utils/security.go b/sync-for-payroll/pkg/utils/security.go index ea1d4b2df..19dfa6f46 100644 --- a/sync-for-payroll/pkg/utils/security.go +++ b/sync-for-payroll/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] = prefixBearer(valToString(val)) + headers[secTag.Name] = prefixBearer(valToString(val)) case "oauth2": - client.headers[secTag.Name] = prefixBearer(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/sync-for-payroll/pkg/utils/utils.go b/sync-for-payroll/pkg/utils/utils.go index b4618bb35..adb2f7055 100644 --- a/sync-for-payroll/pkg/utils/utils.go +++ b/sync-for-payroll/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/sync-for-payroll/trackingcategories.go b/sync-for-payroll/trackingcategories.go index de1114097..32a542f7d 100644 --- a/sync-for-payroll/trackingcategories.go +++ b/sync-for-payroll/trackingcategories.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforpayroll @@ -6,15 +6,18 @@ import ( "bytes" "context" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-payroll/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-payroll/pkg/utils" "io" "net/http" ) -// TrackingCategories - Tracking categories +// TrackingCategories - Get, create, and update Tracking Categories for additional categorization of payroll components. type TrackingCategories struct { sdkConfiguration sdkConfiguration } @@ -34,9 +37,17 @@ func newTrackingCategories(sdkConfig sdkConfiguration) *TrackingCategories { // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *TrackingCategories) Get(ctx context.Context, request operations.GetTrackingCategoryRequest, opts ...operations.Option) (*operations.GetTrackingCategoryResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-tracking-category", + 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 *TrackingCategories) Get(ctx context.Context, request operations.GetTrac return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/trackingCategories/{trackingCategoryId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/trackingCategories/{trackingCategoryId}", 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,53 +99,109 @@ func (s *TrackingCategories) Get(ctx context.Context, request operations.GetTrac }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.GetTrackingCategoryResponse{ 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.TrackingCategoryTree if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -127,7 +209,12 @@ func (s *TrackingCategories) Get(ctx context.Context, request operations.GetTrac res.TrackingCategoryTree = &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 @@ -145,22 +232,46 @@ func (s *TrackingCategories) Get(ctx context.Context, request operations.GetTrac 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 + } // List tracking categories @@ -170,9 +281,17 @@ func (s *TrackingCategories) Get(ctx context.Context, request operations.GetTrac // // Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-payroll-api#/operations/refresh-company-data). func (s *TrackingCategories) List(ctx context.Context, request operations.ListTrackingCategoriesRequest, opts ...operations.Option) (*operations.ListTrackingCategoriesResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-tracking-categories", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -180,32 +299,47 @@ func (s *TrackingCategories) List(ctx context.Context, request operations.ListTr return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/trackingCategories", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/trackingCategories", 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, @@ -213,53 +347,109 @@ func (s *TrackingCategories) List(ctx context.Context, request operations.ListTr }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - 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") - } + } 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.ListTrackingCategoriesResponse{ 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.TrackingCategories if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -267,7 +457,12 @@ func (s *TrackingCategories) List(ctx context.Context, request operations.ListTr res.TrackingCategories = &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 @@ -287,20 +482,44 @@ func (s *TrackingCategories) List(ctx context.Context, request operations.ListTr 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 + }