diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index e94537f..c0e4c12 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 594731ce-66d4-43e3-8c52-6bf07481e7bf management: - docChecksum: dd329bc0918b4bf1ae9f9d626db08cfb + docChecksum: 55674d0eea947b0a529351eac1b719c4 docVersion: 0.0.1 speakeasyVersion: 1.606.0 generationVersion: 2.686.7 - releaseVersion: 0.1.0 - configChecksum: 06202174e8666aca651893367aac9f96 + releaseVersion: 0.2.0 + configChecksum: 2e4aceea16d5709fc004b52312098909 repoURL: https://github.com/midday-ai/midday-go.git installationURL: https://github.com/midday-ai/midday-go features: @@ -16,13 +16,13 @@ features: core: 3.9.3 defaultEnabledRetries: 0.2.0 devContainers: 2.90.0 + downloadStreams: 0.1.2 enums: 2.81.1 envVarSecurityUsage: 0.3.2 examples: 2.81.5 flattening: 2.81.1 globalSecurity: 2.82.11 globalSecurityCallbacks: 0.1.0 - globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.3 intellisenseMarkdownSupport: 0.1.0 nameOverrides: 2.81.2 @@ -30,18 +30,40 @@ features: responseFormat: 0.1.2 retries: 2.84.2 sdkHooks: 0.2.0 + unions: 2.85.12 generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json - .devcontainer/setup.sh - .gitattributes + - /models/apierrors/checkdesktopupdate.go + - /models/apierrors/createinvoice.go + - /models/apierrors/downloaddesktopupdate.go + - /models/apierrors/downloadfile.go + - /models/apierrors/downloadinvoice.go + - /models/apierrors/getdocumentpresignedurl.go + - /models/apierrors/getinboxpresignedurl.go + - /models/apierrors/gettransactionattachmentpresignedurl.go + - /models/apierrors/gmailoauthcallback.go + - /models/apierrors/inboxwebhook.go + - /models/apierrors/oautherrorresponse.go + - /models/apierrors/outlookoauthcallback.go + - /models/apierrors/postoauthauthorization.go + - /models/apierrors/proxyfile.go + - /models/apierrors/slackoauthcallback.go + - /models/components/burnrateitem.go - /models/components/createtag.go + - /models/components/createtransactionattachment.go + - /models/components/errorresponse.go - /models/components/expensesresultarray.go - - /models/components/getburnrateresponseschema.go - /models/components/getexpensesresponseschema.go - /models/components/getprofitresponseschema.go - /models/components/getrevenueresponseschema.go - /models/components/httpmetadata.go + - /models/components/notificationresponseschema.go + - /models/components/notificationschema.go + - /models/components/notificationsresponseschema.go + - /models/components/oauthtokenendpointrequest.go - /models/components/profitcurrent.go - /models/components/profitmeta.go - /models/components/profitpercentage.go @@ -61,8 +83,13 @@ generatedFiles: - /models/components/trackerprojectresponse.go - /models/components/trackerprojectsresponse.go - /models/components/transactionresponse.go + - /models/components/updateallnotificationsstatusresponseschema.go + - /models/components/updateallnotificationsstatusschema.go + - /models/operations/checkdesktopupdate.go - /models/operations/createbankaccount.go - /models/operations/createcustomer.go + - /models/operations/createinvoice.go + - /models/operations/createinvoicepaymentintent.go - /models/operations/createtag.go - /models/operations/createtrackerentriesbulk.go - /models/operations/createtrackerentry.go @@ -79,66 +106,158 @@ generatedFiles: - /models/operations/deletetrackerproject.go - /models/operations/deletetransaction.go - /models/operations/deletetransactions.go + - /models/operations/disconnectstripe.go + - /models/operations/downloaddesktopupdate.go + - /models/operations/downloadfile.go + - /models/operations/downloadinvoice.go + - /models/operations/fortnoxoauthcallback.go - /models/operations/getbankaccountbyid.go - - /models/operations/getburnratemetrics.go + - /models/operations/getburnratereports.go - /models/operations/getcurrenttimer.go - /models/operations/getcurrentuser.go - /models/operations/getcustomerbyid.go - /models/operations/getdocumentbyid.go - - /models/operations/getexpensesmetrics.go + - /models/operations/getdocumentpresignedurl.go + - /models/operations/getexpensesreports.go + - /models/operations/getfortnoxinstallurl.go + - /models/operations/getgmailinstallurl.go - /models/operations/getinboxitembyid.go + - /models/operations/getinboxpresignedurl.go - /models/operations/getinvoicebyid.go - - /models/operations/getinvoicespaymentstatus.go + - /models/operations/getinvoicepaymentstatus.go - /models/operations/getinvoicesummary.go - - /models/operations/getprofitmetrics.go - - /models/operations/getrevenuemetrics.go - - /models/operations/getrunwaymetrics.go - - /models/operations/getspendingmetrics.go + - /models/operations/getoauthauthorization.go + - /models/operations/getoutlookinstallurl.go + - /models/operations/getprofitreports.go + - /models/operations/getquickbooksinstallurl.go + - /models/operations/getrevenuereports.go + - /models/operations/getrunwayreports.go + - /models/operations/getslackinstallurl.go + - /models/operations/getspendingreports.go + - /models/operations/getstripeconnectstatus.go + - /models/operations/getstripeconnecturl.go - /models/operations/gettagbyid.go - /models/operations/getteambyid.go - /models/operations/gettimerstatus.go - /models/operations/gettrackerprojectbyid.go + - /models/operations/gettransactionattachmentpresignedurl.go - /models/operations/gettransactionbyid.go + - /models/operations/getxeroinstallurl.go + - /models/operations/gmailoauthcallback.go + - /models/operations/inboxwebhook.go - /models/operations/listbankaccounts.go - /models/operations/listcustomers.go - /models/operations/listdocuments.go - /models/operations/listinboxitems.go - /models/operations/listinvoices.go + - /models/operations/listnotifications.go - /models/operations/listtags.go - /models/operations/listteammembers.go - /models/operations/listteams.go - /models/operations/listtrackerentries.go - /models/operations/listtrackerprojects.go - /models/operations/listtransactions.go + - /models/operations/outlookoauthcallback.go + - /models/operations/plaidwebhook.go + - /models/operations/polarwebhook.go + - /models/operations/postoauthauthorization.go + - /models/operations/postoauthregister.go + - /models/operations/postoauthrevoke.go + - /models/operations/postoauthtoken.go + - /models/operations/proxyfile.go + - /models/operations/quickbooksoauthcallback.go - /models/operations/search.go + - /models/operations/slackinteractions.go + - /models/operations/slackoauthcallback.go + - /models/operations/slackwebhook.go - /models/operations/starttimer.go - /models/operations/stoptimer.go + - /models/operations/stripeconnectcallback.go + - /models/operations/stripewebhook.go + - /models/operations/tellerwebhook.go + - /models/operations/updateallnotificationsstatus.go - /models/operations/updatebankaccount.go - /models/operations/updatecurrentuser.go - /models/operations/updatecustomer.go - /models/operations/updateinboxitem.go + - /models/operations/updateinvoice.go + - /models/operations/updatenotificationstatus.go - /models/operations/updatetag.go - /models/operations/updateteambyid.go - /models/operations/updatetrackerentry.go - /models/operations/updatetrackerproject.go - /models/operations/updatetransaction.go - /models/operations/updatetransactions.go + - /models/operations/whatsappwebhook.go + - /models/operations/whatsappwebhookverify.go + - /models/operations/xerooauthcallback.go - USAGE.md - bankaccounts.go - customers.go + - desktop.go + - docs/models/apierrors/checkdesktopupdatebadgatewayerror.md + - docs/models/apierrors/conflicterror.md + - docs/models/apierrors/createinvoicebadrequesterror.md + - docs/models/apierrors/createinvoiceinternalservererror.md + - docs/models/apierrors/createinvoicenotfounderror.md + - docs/models/apierrors/downloaddesktopupdatebadgatewayerror.md + - docs/models/apierrors/downloaddesktopupdatebadrequesterror.md + - docs/models/apierrors/downloadfilebadrequesterror.md + - docs/models/apierrors/downloadfileinternalservererror.md + - docs/models/apierrors/downloadfilenotfounderror.md + - docs/models/apierrors/downloadfileunauthorizederror.md + - docs/models/apierrors/downloadinvoicebadrequesterror.md + - docs/models/apierrors/downloadinvoiceinternalservererror.md + - docs/models/apierrors/downloadinvoicenotfounderror.md + - docs/models/apierrors/downloadinvoiceunauthorizederror.md + - docs/models/apierrors/getdocumentpresignedurlbadrequesterror.md + - docs/models/apierrors/getdocumentpresignedurlinternalservererror.md + - docs/models/apierrors/getdocumentpresignedurlnotfounderror.md + - docs/models/apierrors/getinboxpresignedurlbadrequesterror.md + - docs/models/apierrors/getinboxpresignedurlinternalservererror.md + - docs/models/apierrors/getinboxpresignedurlnotfounderror.md + - docs/models/apierrors/gettransactionattachmentpresignedurlbadrequesterror.md + - docs/models/apierrors/gettransactionattachmentpresignedurlinternalservererror.md + - docs/models/apierrors/gettransactionattachmentpresignedurlnotfounderror.md + - docs/models/apierrors/gmailoauthcallbackbadrequesterror.md + - docs/models/apierrors/gmailoauthcallbackinternalservererror.md + - docs/models/apierrors/inboxwebhookbadrequesterror.md + - docs/models/apierrors/inboxwebhookinternalservererror.md + - docs/models/apierrors/oautherrorresponse.md + - docs/models/apierrors/outlookoauthcallbackbadrequesterror.md + - docs/models/apierrors/outlookoauthcallbackinternalservererror.md + - docs/models/apierrors/postoauthauthorizationbadrequesterror.md + - docs/models/apierrors/postoauthauthorizationunauthorizederror.md + - docs/models/apierrors/proxyfilebadrequesterror.md + - docs/models/apierrors/proxyfileinternalservererror.md + - docs/models/apierrors/proxyfilenotfounderror.md + - docs/models/apierrors/slackoauthcallbackbadrequesterror.md + - docs/models/apierrors/slackoauthcallbackinternalservererror.md - docs/models/components/account.md - docs/models/components/attachment.md + - docs/models/components/burnrateitem.md - docs/models/components/category.md - docs/models/components/connection.md - docs/models/components/createtag.md + - docs/models/components/createtransactionattachment.md - docs/models/components/customer.md + - docs/models/components/errorresponse.md - docs/models/components/expensesresultarray.md - - docs/models/components/getburnrateresponseschema.md - docs/models/components/getexpensesresponseschema.md - docs/models/components/getexpensesresponseschemameta.md - docs/models/components/getprofitresponseschema.md - docs/models/components/getrevenueresponseschema.md + - docs/models/components/granttypeauthorizationcode.md + - docs/models/components/granttyperefreshtoken.md - docs/models/components/httpmetadata.md + - docs/models/components/notificationresponseschema.md + - docs/models/components/notificationschema.md + - docs/models/components/notificationschemastatus.md + - docs/models/components/notificationsresponseschema.md + - docs/models/components/notificationsresponseschemameta.md + - docs/models/components/oauthtokenendpointrequest.md + - docs/models/components/oauthtokenendpointrequestauthorizationcode.md + - docs/models/components/oauthtokenendpointrequestrefreshtoken.md - docs/models/components/profitcurrent.md - docs/models/components/profitmeta.md - docs/models/components/profitmetatype.md @@ -156,6 +275,7 @@ generatedFiles: - docs/models/components/revenueresultitem.md - docs/models/components/revenuesummary.md - docs/models/components/security.md + - docs/models/components/source.md - docs/models/components/spendingresultarray.md - docs/models/components/summary.md - docs/models/components/tagresponse.md @@ -167,8 +287,17 @@ generatedFiles: - docs/models/components/trackerprojectsresponsemeta.md - docs/models/components/transactionresponse.md - docs/models/components/transactionresponsetag.md + - docs/models/components/updateallnotificationsstatusresponseschema.md + - docs/models/components/updateallnotificationsstatusschema.md + - docs/models/components/updateallnotificationsstatusschemastatus.md - docs/models/components/user.md - docs/models/operations/attachments.md + - docs/models/operations/bottomblock.md + - docs/models/operations/breakdown.md + - docs/models/operations/checkdesktopupdateresponse.md + - docs/models/operations/checkdesktopupdateresponsebody.md + - docs/models/operations/codechallengemethod.md + - docs/models/operations/companytype.md - docs/models/operations/createbankaccountrequest.md - docs/models/operations/createbankaccountresponse.md - docs/models/operations/createbankaccountresponsebody.md @@ -177,6 +306,13 @@ generatedFiles: - docs/models/operations/createcustomerresponsebody.md - docs/models/operations/createcustomertagrequest.md - docs/models/operations/createcustomertagresponse.md + - docs/models/operations/createinvoicepaymentintentrequest.md + - docs/models/operations/createinvoicepaymentintentresponse.md + - docs/models/operations/createinvoicepaymentintentresponsebody.md + - docs/models/operations/createinvoicerequest.md + - docs/models/operations/createinvoiceresponse.md + - docs/models/operations/createinvoiceresponsebody.md + - docs/models/operations/createinvoicestatus.md - docs/models/operations/createtagresponse.md - docs/models/operations/createtrackerentriesbulkcustomer.md - docs/models/operations/createtrackerentriesbulkdata.md @@ -196,13 +332,13 @@ generatedFiles: - docs/models/operations/createtrackerprojectresponse.md - docs/models/operations/createtrackerprojectstatus.md - docs/models/operations/createtrackerprojecttag.md - - docs/models/operations/createtransactionattachment.md - docs/models/operations/createtransactionrequest.md - docs/models/operations/createtransactionresponse.md - - docs/models/operations/createtransactionsattachment.md - docs/models/operations/createtransactionsresponse.md - docs/models/operations/currententry.md + - docs/models/operations/data.md - docs/models/operations/dateformatrequest.md + - docs/models/operations/decision.md - docs/models/operations/deletebankaccountrequest.md - docs/models/operations/deletebankaccountresponse.md - docs/models/operations/deletebankaccountresponsebody.md @@ -232,12 +368,27 @@ generatedFiles: - docs/models/operations/deletetransactionresponsebody.md - docs/models/operations/deletetransactionsresponse.md - docs/models/operations/deletetransactionsresponsebody.md + - docs/models/operations/deliverytype.md + - docs/models/operations/disconnectstriperesponse.md + - docs/models/operations/disconnectstriperesponsebody.md + - docs/models/operations/downloaddesktopupdaterequest.md + - docs/models/operations/downloaddesktopupdateresponse.md + - docs/models/operations/downloadfilerequest.md + - docs/models/operations/downloadfileresponse.md + - docs/models/operations/downloadinvoicerequest.md + - docs/models/operations/downloadinvoiceresponse.md + - docs/models/operations/downloadinvoicetype.md - docs/models/operations/entry.md + - docs/models/operations/error.md + - docs/models/operations/exportsettings.md + - docs/models/operations/fortnoxoauthcallbackrequest.md + - docs/models/operations/fortnoxoauthcallbackresponse.md + - docs/models/operations/fromdetails.md - docs/models/operations/getbankaccountbyidrequest.md - docs/models/operations/getbankaccountbyidresponse.md - docs/models/operations/getbankaccountbyidresponsebody.md - - docs/models/operations/getburnratemetricsrequest.md - - docs/models/operations/getburnratemetricsresponse.md + - docs/models/operations/getburnratereportsrequest.md + - docs/models/operations/getburnratereportsresponse.md - docs/models/operations/getcurrenttimercustomer.md - docs/models/operations/getcurrenttimerdata.md - docs/models/operations/getcurrenttimerproject.md @@ -257,31 +408,57 @@ generatedFiles: - docs/models/operations/getdocumentbyidrequest.md - docs/models/operations/getdocumentbyidresponse.md - docs/models/operations/getdocumentbyidresponsebody.md - - docs/models/operations/getexpensesmetricsrequest.md - - docs/models/operations/getexpensesmetricsresponse.md + - docs/models/operations/getdocumentpresignedurlrequest.md + - docs/models/operations/getdocumentpresignedurlresponse.md + - docs/models/operations/getdocumentpresignedurlresponsebody.md + - docs/models/operations/getexpensesreportsrequest.md + - docs/models/operations/getexpensesreportsresponse.md + - docs/models/operations/getfortnoxinstallurlresponse.md + - docs/models/operations/getfortnoxinstallurlresponsebody.md + - docs/models/operations/getgmailinstallurlresponse.md + - docs/models/operations/getgmailinstallurlresponsebody.md - docs/models/operations/getinboxitembyidrequest.md - docs/models/operations/getinboxitembyidresponse.md - docs/models/operations/getinboxitembyidresponsebody.md - docs/models/operations/getinboxitembyidtransaction.md + - docs/models/operations/getinboxpresignedurlrequest.md + - docs/models/operations/getinboxpresignedurlresponse.md + - docs/models/operations/getinboxpresignedurlresponsebody.md - docs/models/operations/getinvoicebyidcustomer.md - docs/models/operations/getinvoicebyidrequest.md - docs/models/operations/getinvoicebyidresponse.md - docs/models/operations/getinvoicebyidresponsebody.md - docs/models/operations/getinvoicebyidstatus.md - - docs/models/operations/getinvoicespaymentstatusresponse.md - - docs/models/operations/getinvoicespaymentstatusresponsebody.md + - docs/models/operations/getinvoicepaymentstatusresponse.md + - docs/models/operations/getinvoicepaymentstatusresponsebody.md - docs/models/operations/getinvoicesummaryrequest.md - docs/models/operations/getinvoicesummaryresponse.md - docs/models/operations/getinvoicesummaryresponsebody.md - docs/models/operations/getinvoicesummarystatus.md - - docs/models/operations/getprofitmetricsrequest.md - - docs/models/operations/getprofitmetricsresponse.md - - docs/models/operations/getrevenuemetricsrequest.md - - docs/models/operations/getrevenuemetricsresponse.md - - docs/models/operations/getrunwaymetricsrequest.md - - docs/models/operations/getrunwaymetricsresponse.md - - docs/models/operations/getspendingmetricsrequest.md - - docs/models/operations/getspendingmetricsresponse.md + - docs/models/operations/getoauthauthorizationrequest.md + - docs/models/operations/getoauthauthorizationresponse.md + - docs/models/operations/getoauthauthorizationresponsebody.md + - docs/models/operations/getoauthauthorizationstatus.md + - docs/models/operations/getoutlookinstallurlresponse.md + - docs/models/operations/getoutlookinstallurlresponsebody.md + - docs/models/operations/getprofitreportsrequest.md + - docs/models/operations/getprofitreportsresponse.md + - docs/models/operations/getprofitreportsrevenuetype.md + - docs/models/operations/getquickbooksinstallurlresponse.md + - docs/models/operations/getquickbooksinstallurlresponsebody.md + - docs/models/operations/getrevenuereportsrequest.md + - docs/models/operations/getrevenuereportsresponse.md + - docs/models/operations/getrevenuereportsrevenuetype.md + - docs/models/operations/getrunwayreportsrequest.md + - docs/models/operations/getrunwayreportsresponse.md + - docs/models/operations/getslackinstallurlresponse.md + - docs/models/operations/getslackinstallurlresponsebody.md + - docs/models/operations/getspendingreportsrequest.md + - docs/models/operations/getspendingreportsresponse.md + - docs/models/operations/getstripeconnectstatusresponse.md + - docs/models/operations/getstripeconnectstatusresponsebody.md + - docs/models/operations/getstripeconnecturlresponse.md + - docs/models/operations/getstripeconnecturlresponsebody.md - docs/models/operations/gettagbyidrequest.md - docs/models/operations/gettagbyidresponse.md - docs/models/operations/getteambyidplan.md @@ -292,10 +469,22 @@ generatedFiles: - docs/models/operations/gettimerstatusrequest.md - docs/models/operations/gettimerstatusresponse.md - docs/models/operations/gettimerstatusresponsebody.md + - docs/models/operations/gettimerstatustrackerproject.md - docs/models/operations/gettrackerprojectbyidrequest.md - docs/models/operations/gettrackerprojectbyidresponse.md + - docs/models/operations/gettransactionattachmentpresignedurlrequest.md + - docs/models/operations/gettransactionattachmentpresignedurlresponse.md + - docs/models/operations/gettransactionattachmentpresignedurlresponsebody.md - docs/models/operations/gettransactionbyidrequest.md - docs/models/operations/gettransactionbyidresponse.md + - docs/models/operations/getxeroinstallurlresponse.md + - docs/models/operations/getxeroinstallurlresponsebody.md + - docs/models/operations/gmailoauthcallbackrequest.md + - docs/models/operations/gmailoauthcallbackresponse.md + - docs/models/operations/heardabout.md + - docs/models/operations/inboxwebhookresponse.md + - docs/models/operations/inboxwebhookresponsebody.md + - docs/models/operations/lineitem.md - docs/models/operations/listbankaccountsdata.md - docs/models/operations/listbankaccountsrequest.md - docs/models/operations/listbankaccountsresponse.md @@ -326,6 +515,10 @@ generatedFiles: - docs/models/operations/listinvoicesresponse.md - docs/models/operations/listinvoicesresponsebody.md - docs/models/operations/listinvoicesstatus.md + - docs/models/operations/listnotificationsrequest.md + - docs/models/operations/listnotificationsresponse.md + - docs/models/operations/listnotificationsstatusenum1.md + - docs/models/operations/listnotificationsstatusenum2.md - docs/models/operations/listtagsresponse.md - docs/models/operations/listteammembersdata.md - docs/models/operations/listteammembersrequest.md @@ -349,14 +542,51 @@ generatedFiles: - docs/models/operations/listtransactionsrequest.md - docs/models/operations/listtransactionsresponse.md - docs/models/operations/listtransactionsresponsebody.md + - docs/models/operations/listtransactionsstatus.md - docs/models/operations/listtransactionstype.md + - docs/models/operations/manual.md + - docs/models/operations/name.md + - docs/models/operations/notedetails.md - docs/models/operations/option.md + - docs/models/operations/outlookoauthcallbackrequest.md + - docs/models/operations/outlookoauthcallbackresponse.md + - docs/models/operations/paymentdetails.md + - docs/models/operations/plaidwebhookresponse.md + - docs/models/operations/plaidwebhookresponsebody.md + - docs/models/operations/platforms.md + - docs/models/operations/polarwebhookresponse.md + - docs/models/operations/polarwebhookresponsebody.md + - docs/models/operations/postoauthauthorizationrequest.md + - docs/models/operations/postoauthauthorizationresponse.md + - docs/models/operations/postoauthauthorizationresponsebody.md + - docs/models/operations/postoauthregisterrequest.md + - docs/models/operations/postoauthregisterresponse.md + - docs/models/operations/postoauthregisterresponsebody1.md + - docs/models/operations/postoauthregisterresponsebody2.md + - docs/models/operations/postoauthrevokerequest.md + - docs/models/operations/postoauthrevokeresponse.md + - docs/models/operations/postoauthrevokeresponsebody.md + - docs/models/operations/postoauthtokenresponse.md + - docs/models/operations/postoauthtokenresponsebody.md + - docs/models/operations/proxyfilerequest.md + - docs/models/operations/proxyfileresponse.md + - docs/models/operations/quickbooksoauthcallbackrequest.md + - docs/models/operations/quickbooksoauthcallbackresponse.md - docs/models/operations/requestbody.md + - docs/models/operations/responsetype.md - docs/models/operations/result.md - docs/models/operations/role.md + - docs/models/operations/scope.md - docs/models/operations/searchrequest.md - docs/models/operations/searchresponse.md - docs/models/operations/searchresponsebody.md + - docs/models/operations/size.md + - docs/models/operations/slackinteractionsresponse.md + - docs/models/operations/slackinteractionsresponsebody.md + - docs/models/operations/slackoauthcallbackrequest.md + - docs/models/operations/slackoauthcallbackresponse.md + - docs/models/operations/slackwebhookresponse.md + - docs/models/operations/slackwebhookresponsebody.md - docs/models/operations/starttimercustomer.md - docs/models/operations/starttimerdata.md - docs/models/operations/starttimerproject.md @@ -364,14 +594,33 @@ generatedFiles: - docs/models/operations/starttimerresponse.md - docs/models/operations/starttimerresponsebody.md - docs/models/operations/starttimeruser.md + - docs/models/operations/status.md - docs/models/operations/stoptimercustomer.md - - docs/models/operations/stoptimerdata.md - - docs/models/operations/stoptimerproject.md + - docs/models/operations/stoptimerdata1.md + - docs/models/operations/stoptimerdata2.md + - docs/models/operations/stoptimerproject1.md + - docs/models/operations/stoptimerproject2.md - docs/models/operations/stoptimerrequest.md - docs/models/operations/stoptimerresponse.md - docs/models/operations/stoptimerresponsebody.md + - docs/models/operations/stoptimertrackerproject.md - docs/models/operations/stoptimeruser.md - - docs/models/operations/trackerproject.md + - docs/models/operations/stripeconnectcallbackrequest.md + - docs/models/operations/stripeconnectcallbackresponse.md + - docs/models/operations/stripewebhookresponse.md + - docs/models/operations/stripewebhookresponsebody.md + - docs/models/operations/tab.md + - docs/models/operations/tellerwebhookresponse.md + - docs/models/operations/tellerwebhookresponsebody.md + - docs/models/operations/template.md + - docs/models/operations/templatedeliverytype.md + - docs/models/operations/templatefromdetails.md + - docs/models/operations/templatenotedetails.md + - docs/models/operations/templatepaymentdetails.md + - docs/models/operations/tokentype.md + - docs/models/operations/tokentypehint.md + - docs/models/operations/topblock.md + - docs/models/operations/updateallnotificationsstatusresponse.md - docs/models/operations/updatebankaccountrequest.md - docs/models/operations/updatebankaccountrequestbody.md - docs/models/operations/updatebankaccountresponse.md @@ -394,6 +643,17 @@ generatedFiles: - docs/models/operations/updateinboxitemresponsebody.md - docs/models/operations/updateinboxitemstatus.md - docs/models/operations/updateinboxitemtransaction.md + - docs/models/operations/updateinvoicecustomer.md + - docs/models/operations/updateinvoicerequest.md + - docs/models/operations/updateinvoicerequestbody.md + - docs/models/operations/updateinvoiceresponse.md + - docs/models/operations/updateinvoiceresponsebody.md + - docs/models/operations/updateinvoicestatusrequest.md + - docs/models/operations/updateinvoicestatusresponse.md + - docs/models/operations/updatenotificationstatusrequest.md + - docs/models/operations/updatenotificationstatusrequestbody.md + - docs/models/operations/updatenotificationstatusresponse.md + - docs/models/operations/updatenotificationstatusstatus.md - docs/models/operations/updatetagrequest.md - docs/models/operations/updatetagrequestbody.md - docs/models/operations/updatetagresponse.md @@ -426,13 +686,25 @@ generatedFiles: - docs/models/operations/updatetransactionsresponsebody.md - docs/models/operations/updatetransactionsstatus.md - docs/models/operations/updatetransactionstatus.md + - docs/models/operations/whatsappwebhookresponse.md + - docs/models/operations/whatsappwebhookresponsebody.md + - docs/models/operations/whatsappwebhookverifyrequest.md + - docs/models/operations/whatsappwebhookverifyresponse.md + - docs/models/operations/xerooauthcallbackrequest.md + - docs/models/operations/xerooauthcallbackresponse.md - docs/sdks/bankaccounts/README.md - docs/sdks/customers/README.md + - docs/sdks/desktop/README.md - docs/sdks/documents/README.md + - docs/sdks/files/README.md - docs/sdks/inbox/README.md + - docs/sdks/integrations/README.md + - docs/sdks/invoicepayments/README.md - docs/sdks/invoices/README.md - - docs/sdks/metrics/README.md - docs/sdks/midday/README.md + - docs/sdks/notifications/README.md + - docs/sdks/oauth/README.md + - docs/sdks/reports/README.md - docs/sdks/search/README.md - docs/sdks/tags/README.md - docs/sdks/teams/README.md @@ -441,9 +713,12 @@ generatedFiles: - docs/sdks/trackertimer/README.md - docs/sdks/transactions/README.md - docs/sdks/users/README.md + - docs/sdks/webhooks/README.md - documents.go + - files.go - go.mod - inbox.go + - integrations.go - internal/config/sdkconfiguration.go - internal/hooks/hooks.go - internal/utils/contenttype.go @@ -457,11 +732,14 @@ generatedFiles: - internal/utils/retries.go - internal/utils/security.go - internal/utils/utils.go + - invoicepayments.go - invoices.go - - metrics.go - midday.go - models/apierrors/apierror.go - models/operations/options.go + - notifications.go + - oauth.go + - reports.go - retry/config.go - search.go - tags.go @@ -476,6 +754,7 @@ generatedFiles: - types/decimal.go - types/pointers.go - users.go + - webhooks.go examples: listTransactions: speakeasy-default-list-transactions: @@ -491,20 +770,29 @@ examples: end: "2024-04-30T23:59:59.999Z" accounts: ["account-1", "account-2"] assignees: ["user-1", "user-2"] - statuses: ["pending", "completed"] + statuses: ["in_review", "export_error"] recurring: ["monthly", "annually"] attachments: "include" amountRange: [100, 1000] amount: ["150.75", "299.99"] type: "expense" + manual: "include" + exported: false + fulfilled: true responses: "200": application/json: {"meta": {"cursor": "eyJpZCI6IjQ1NiJ9", "hasPreviousPage": false, "hasNextPage": true}, "data": [{"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTransaction: speakeasy-default-create-transaction: + requestBody: + application/json: {"name": "", "amount": 5744.12, "currency": "Forint", "date": "2024-01-12", "bankAccountId": ""} responses: "200": application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getTransactionById: speakeasy-default-get-transaction-by-id: parameters: @@ -513,6 +801,8 @@ examples: responses: "200": application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteTransaction: speakeasy-default-delete-transaction: parameters: @@ -521,34 +811,54 @@ examples: responses: "200": application/json: {"id": "3a643eea-659a-4768-b14f-07f06ea711b4"} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTransaction: speakeasy-default-update-transaction: parameters: path: id: "f0c1d0ef-5679-4c1b-9698-2c64e97e8c1d" + requestBody: + application/json: {} responses: "200": application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTransactions: speakeasy-default-create-transactions: + requestBody: + application/json: [{"name": "", "amount": 5142.41, "currency": "Gourde", "date": "2024-03-22", "bankAccountId": ""}] responses: "200": application/json: [{"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}] + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteTransactions: speakeasy-default-delete-transactions: + requestBody: + application/json: ["c0db9ee1-75c5-4621-84a2-0c38d2dc3106", "e5581754-1917-44fa-a324-166437019d98", "a8bccdfb-07ed-4359-8712-46b82316d8f9"] responses: "200": application/json: [{"id": "c0db9ee1-75c5-4621-84a2-0c38d2dc3106"}, {"id": "c0db9ee1-75c5-4621-84a2-0c38d2dc3106"}, {"id": "c0db9ee1-75c5-4621-84a2-0c38d2dc3106"}] + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTransactions: speakeasy-default-update-transactions: + requestBody: + application/json: {"ids": ["", "", ""]} responses: "200": application/json: {"meta": {"cursor": "eyJpZCI6IjQ1NiJ9", "hasPreviousPage": false, "hasNextPage": true}, "data": [{"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}, {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Office Supplies Purchase", "amount": 150.75, "taxAmount": 15.07, "taxRate": 10, "taxType": "VAT", "currency": "USD", "counterpartyName": "Spotify AB", "date": "2024-05-01T12:00:00.000Z", "category": {"id": "office-supplies", "name": "Office Supplies", "color": "#FF5733", "taxRate": 10, "taxType": "VAT", "slug": "office-supplies"}, "status": "completed", "internal": false, "recurring": false, "manual": false, "frequency": "monthly", "isFulfilled": true, "note": "Paid with company credit card for office renovation", "account": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Company Credit Card", "currency": "USD", "connection": {"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", "name": "Chase Bank", "logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"}}, "tags": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "name": "invoice"}, {"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c", "name": "travel"}], "attachments": [{"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b", "path": ["e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a", "transactions", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "receipt.pdf"], "size": 1928716, "type": "application/pdf", "filename": "receipt.pdf"}]}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} listTeams: speakeasy-default-list-teams: responses: "200": application/json: {"data": [{"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}, {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}, {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getTeamById: speakeasy-default-get-team-by-id: parameters: @@ -557,16 +867,20 @@ examples: responses: "200": application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTeamById: speakeasy-default-update-team-by-id: parameters: path: id: "123e4567-e89b-12d3-a456-426614174000" requestBody: - application/json: {"name": "Acme Corporation", "email": "team@acme.com", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "baseCurrency": "USD", "countryCode": "US"} + application/json: {"name": "Acme Corporation", "email": "team@acme.com", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "baseCurrency": "USD", "countryCode": "US", "fiscalYearStartMonth": 4, "companyType": "solo_founder", "heardAbout": "twitter"} responses: "200": application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"} + default: + application/json: {"error": "Internal Server Error", "code": 500} listTeamMembers: speakeasy-default-list-team-members: parameters: @@ -575,18 +889,24 @@ examples: responses: "200": application/json: {"data": [{"id": "123e4567-e89b-12d3-a456-426614174000", "role": "owner", "fullName": "John Doe", "avatarUrl": "https://cdn.midday.ai/avatars/john-doe.png"}, {"id": "123e4567-e89b-12d3-a456-426614174000", "role": "owner", "fullName": "John Doe", "avatarUrl": "https://cdn.midday.ai/avatars/john-doe.png"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getCurrentUser: speakeasy-default-get-current-user: responses: "200": - application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "fullName": "Jane Doe", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd", "team": {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}} + application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "fullName": "Jane Doe", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd", "fileKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZWFtSWQiOiIxMjM0NTY3OC05YWJjLWRlZmctMTIzNC01Njc4OTBhYmNkZWYifQ.signature", "team": {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateCurrentUser: speakeasy-default-update-current-user: requestBody: - application/json: {"fullName": "Jane Doe", "teamId": "team-abc123", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd"} + application/json: {"fullName": "Jane Doe", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd"} responses: "200": - application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "fullName": "Jane Doe", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd", "team": {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}} + application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "fullName": "Jane Doe", "email": "jane.doe@acme.com", "avatarUrl": "https://cdn.midday.ai/avatars/jane-doe.jpg", "locale": "en-US", "weekStartsOnMonday": true, "timezone": "America/New_York", "timezoneAutoSync": true, "timeFormat": 24, "dateFormat": "yyyy-MM-dd", "fileKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZWFtSWQiOiIxMjM0NTY3OC05YWJjLWRlZmctMTIzNC01Njc4OTBhYmNkZWYifQ.signature", "team": {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "Acme Corporation", "logoUrl": "https://cdn.midday.ai/logos/acme-corp.png", "plan": "pro"}} + default: + application/json: {"error": "Internal Server Error", "code": 500} listCustomers: speakeasy-default-list-customers: parameters: @@ -598,13 +918,17 @@ examples: responses: "200": application/json: {"meta": {"cursor": "eyJpZCI6IjQ1NiJ9", "hasPreviousPage": false, "hasNextPage": true}, "data": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} createCustomer: speakeasy-default-create-customer: requestBody: - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "phone": "+1-555-123-4567", "website": "https://acme.com", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "contact": "John Smith", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "phone": "+1-555-123-4567", "website": "https://acme.com", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "contact": "John Smith", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} responses: "201": - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "totalRevenue": 15000.5, "outstandingAmount": 2500, "lastInvoiceDate": "2024-04-15", "invoiceCurrency": "USD", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}], "description": "A cloud-based project management platform for remote teams.", "industry": "Software", "companyType": "SaaS", "employeeCount": "51-200", "foundedYear": 2018, "estimatedRevenue": "$10M-$50M", "fundingStage": "Series A", "totalFunding": "$15M", "headquartersLocation": "San Francisco, CA", "timezone": "America/Los_Angeles", "linkedinUrl": "https://linkedin.com/company/acme", "twitterUrl": "https://twitter.com/acme", "instagramUrl": "https://instagram.com/acme", "facebookUrl": "https://facebook.com/acme", "logoUrl": "https://example.com/logo.png", "ceoName": "Jane Smith", "financeContact": "John Doe", "financeContactEmail": "finance@acme.com", "primaryLanguage": "en", "fiscalYearEnd": "December", "enrichmentStatus": "completed", "enrichedAt": "2024-05-01T12:34:56.789Z"} + default: + application/json: {"error": "Internal Server Error", "code": 500} getCustomerById: speakeasy-default-get-customer-by-id: parameters: @@ -612,7 +936,9 @@ examples: id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" responses: "200": - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "totalRevenue": 15000.5, "outstandingAmount": 2500, "lastInvoiceDate": "2024-04-15", "invoiceCurrency": "USD", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}], "description": "A cloud-based project management platform for remote teams.", "industry": "Software", "companyType": "SaaS", "employeeCount": "51-200", "foundedYear": 2018, "estimatedRevenue": "$10M-$50M", "fundingStage": "Series A", "totalFunding": "$15M", "headquartersLocation": "San Francisco, CA", "timezone": "America/Los_Angeles", "linkedinUrl": "https://linkedin.com/company/acme", "twitterUrl": "https://twitter.com/acme", "instagramUrl": "https://instagram.com/acme", "facebookUrl": "https://facebook.com/acme", "logoUrl": "https://example.com/logo.png", "ceoName": "Jane Smith", "financeContact": "John Doe", "financeContactEmail": "finance@acme.com", "primaryLanguage": "en", "fiscalYearEnd": "December", "enrichmentStatus": "completed", "enrichedAt": "2024-05-01T12:34:56.789Z"} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteCustomer: speakeasy-default-delete-customer: parameters: @@ -620,22 +946,28 @@ examples: id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" responses: "200": - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "totalRevenue": 15000.5, "outstandingAmount": 2500, "lastInvoiceDate": "2024-04-15", "invoiceCurrency": "USD", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}], "description": "A cloud-based project management platform for remote teams.", "industry": "Software", "companyType": "SaaS", "employeeCount": "51-200", "foundedYear": 2018, "estimatedRevenue": "$10M-$50M", "fundingStage": "Series A", "totalFunding": "$15M", "headquartersLocation": "San Francisco, CA", "timezone": "America/Los_Angeles", "linkedinUrl": "https://linkedin.com/company/acme", "twitterUrl": "https://twitter.com/acme", "instagramUrl": "https://instagram.com/acme", "facebookUrl": "https://facebook.com/acme", "logoUrl": "https://example.com/logo.png", "ceoName": "Jane Smith", "financeContact": "John Doe", "financeContactEmail": "finance@acme.com", "primaryLanguage": "en", "fiscalYearEnd": "December", "enrichmentStatus": "completed", "enrichedAt": "2024-05-01T12:34:56.789Z"} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateCustomer: speakeasy-default-update-customer: parameters: path: id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" requestBody: - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "phone": "+1-555-123-4567", "website": "https://acme.com", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "contact": "John Smith", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "phone": "+1-555-123-4567", "website": "https://acme.com", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "contact": "John Smith", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} responses: "200": - application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}]} + application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "Acme Corporation", "email": "contact@acme.com", "billingEmail": "finance@acme.com, accounting@acme.com", "phone": "+1-555-123-4567", "website": "https://acme.com", "createdAt": "2024-05-01T12:34:56.789Z", "country": "United States", "addressLine1": "123 Main Street", "addressLine2": "Suite 400", "city": "San Francisco", "state": "California", "zip": "94105", "note": "Preferred contact method is email. Large enterprise client.", "vatNumber": "US123456789", "countryCode": "US", "token": "cus_abc123xyz789", "contact": "John Smith", "invoiceCount": 12, "projectCount": 3, "totalRevenue": 15000.5, "outstandingAmount": 2500, "lastInvoiceDate": "2024-04-15", "invoiceCurrency": "USD", "tags": [{"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "name": "VIP"}, {"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "name": "Enterprise"}], "description": "A cloud-based project management platform for remote teams.", "industry": "Software", "companyType": "SaaS", "employeeCount": "51-200", "foundedYear": 2018, "estimatedRevenue": "$10M-$50M", "fundingStage": "Series A", "totalFunding": "$15M", "headquartersLocation": "San Francisco, CA", "timezone": "America/Los_Angeles", "linkedinUrl": "https://linkedin.com/company/acme", "twitterUrl": "https://twitter.com/acme", "instagramUrl": "https://instagram.com/acme", "facebookUrl": "https://facebook.com/acme", "logoUrl": "https://example.com/logo.png", "ceoName": "Jane Smith", "financeContact": "John Doe", "financeContactEmail": "finance@acme.com", "primaryLanguage": "en", "fiscalYearEnd": "December", "enrichmentStatus": "completed", "enrichedAt": "2024-05-01T12:34:56.789Z"} + default: + application/json: {"error": "Internal Server Error", "code": 500} listBankAccounts: speakeasy-default-list-bank-accounts: responses: "200": application/json: {"data": [{"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", "name": "Checking Account", "currency": "USD", "type": "depository", "enabled": true, "balance": 1500.75, "manual": false}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createBankAccount: speakeasy-default-create-bank-account: requestBody: @@ -643,6 +975,8 @@ examples: responses: "201": application/json: {"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", "name": "Checking Account", "currency": "USD", "type": "depository", "enabled": true, "balance": 1500.75, "manual": false} + default: + application/json: {"error": "Internal Server Error", "code": 500} getBankAccountById: speakeasy-default-get-bank-account-by-id: parameters: @@ -651,6 +985,8 @@ examples: responses: "200": application/json: {"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", "name": "Checking Account", "currency": "USD", "type": "depository", "enabled": true, "balance": 1500.75, "manual": false} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteBankAccount: speakeasy-default-delete-bank-account: parameters: @@ -659,6 +995,8 @@ examples: responses: "200": application/json: {"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", "name": "Checking Account", "currency": "USD", "type": "depository", "enabled": true, "balance": 1500.75, "manual": false} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateBankAccount: speakeasy-default-update-bank-account: parameters: @@ -669,18 +1007,24 @@ examples: responses: "200": application/json: {"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", "name": "Checking Account", "currency": "USD", "type": "depository", "enabled": true, "balance": 1500.75, "manual": false} + default: + application/json: {"error": "Internal Server Error", "code": 500} listTags: speakeasy-default-list-tags: responses: "200": application/json: {"data": [{"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Important"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTag: speakeasy-default-create-tag: requestBody: application/json: {"name": "Important"} responses: "201": - application/json: {"data": [{"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Important"}]} + application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Important"} + default: + application/json: {"error": "Internal Server Error", "code": 500} getTagById: speakeasy-default-get-tag-by-id: parameters: @@ -689,11 +1033,16 @@ examples: responses: "200": application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Important"} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteTag: speakeasy-default-delete-tag: parameters: path: id: "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f" + responses: + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTag: speakeasy-default-update-tag: parameters: @@ -704,6 +1053,8 @@ examples: responses: "200": application/json: {"id": "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", "name": "Important"} + default: + application/json: {"error": "Internal Server Error", "code": 500} listDocuments: speakeasy-default-list-documents: parameters: @@ -712,9 +1063,13 @@ examples: pageSize: 20 q: "invoice" tags: ["tag1", "tag2"] + start: "2024-01-01" + end: "2024-12-31" responses: "200": application/json: {"meta": {"cursor": "20", "hasPreviousPage": false, "hasNextPage": true}, "data": [{"id": "doc_1234567890abcdef", "title": "Invoice April 2024", "pathTokens": ["invoices", "2024", "april", "invoice-123.pdf"], "metadata": {"size": 204800, "mimetype": "application/pdf"}, "processingStatus": "processed", "summary": "Invoice for April 2024, total $1,200.00", "date": "2024-04-30"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getDocumentById: speakeasy-default-get-document-by-id: parameters: @@ -723,6 +1078,8 @@ examples: responses: "200": application/json: {"id": "doc_1234567890abcdef", "title": "Invoice April 2024", "pathTokens": ["invoices", "2024", "april", "invoice-123.pdf"], "metadata": {"size": 204800, "mimetype": "application/pdf"}, "processingStatus": "processed", "summary": "Invoice for April 2024, total $1,200.00", "date": "2024-04-30"} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteDocument: speakeasy-default-delete-document: parameters: @@ -731,11 +1088,15 @@ examples: responses: "200": application/json: {"id": ""} + default: + application/json: {"error": "Internal Server Error", "code": 500} listInboxItems: speakeasy-default-list-inbox-items: responses: "200": application/json: {"meta": {"cursor": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "hasPreviousPage": false, "hasNextPage": true}, "data": [{"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "fileName": "invoice-123.pdf", "filePath": ["inbox", "2024", "05", "invoice-123.pdf"], "displayName": "Invoice May 2024", "amount": 123.45, "currency": "USD", "contentType": "application/pdf", "date": "2024-05-01", "status": "pending", "createdAt": "2024-05-01T12:34:56.789Z", "website": "https://vendor.com", "description": "Invoice for May 2024 services", "transaction": {"id": "a1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "amount": 123.45, "currency": "USD", "name": "Acme Corp", "date": "2024-05-01"}}, {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "fileName": "invoice-123.pdf", "filePath": ["inbox", "2024", "05", "invoice-123.pdf"], "displayName": "Invoice May 2024", "amount": 123.45, "currency": "USD", "contentType": "application/pdf", "date": "2024-05-01", "status": "pending", "createdAt": "2024-05-01T12:34:56.789Z", "website": "https://vendor.com", "description": "Invoice for May 2024 services", "transaction": {"id": "a1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "amount": 123.45, "currency": "USD", "name": "Acme Corp", "date": "2024-05-01"}}, {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "fileName": "invoice-123.pdf", "filePath": ["inbox", "2024", "05", "invoice-123.pdf"], "displayName": "Invoice May 2024", "amount": 123.45, "currency": "USD", "contentType": "application/pdf", "date": "2024-05-01", "status": "pending", "createdAt": "2024-05-01T12:34:56.789Z", "website": "https://vendor.com", "description": "Invoice for May 2024 services", "transaction": {"id": "a1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "amount": 123.45, "currency": "USD", "name": "Acme Corp", "date": "2024-05-01"}}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getInboxItemById: speakeasy-default-get-inbox-item-by-id: parameters: @@ -744,6 +1105,8 @@ examples: responses: "200": application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "fileName": "invoice-123.pdf", "filePath": ["inbox", "2024", "05", "invoice-123.pdf"], "displayName": "Invoice May 2024", "amount": 123.45, "currency": "USD", "contentType": "application/pdf", "date": "2024-05-01", "status": "pending", "createdAt": "2024-05-01T12:34:56.789Z", "website": "https://vendor.com", "description": "Invoice for May 2024 services", "transaction": {"id": "a1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "amount": 123.45, "currency": "USD", "name": "Acme Corp", "date": "2024-05-01"}} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteInboxItem: speakeasy-default-delete-inbox-item: parameters: @@ -752,6 +1115,8 @@ examples: responses: "200": application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4"} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateInboxItem: speakeasy-default-update-inbox-item: parameters: @@ -762,21 +1127,28 @@ examples: responses: "200": application/json: {"id": "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "fileName": "invoice-123.pdf", "filePath": ["inbox", "2024", "05", "invoice-123.pdf"], "displayName": "Invoice May 2024", "amount": 123.45, "currency": "USD", "contentType": "application/pdf", "date": "2024-05-01", "status": "pending", "createdAt": "2024-05-01T12:34:56.789Z", "website": "https://vendor.com", "description": "Invoice for May 2024 services", "transaction": {"id": "a1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4", "amount": 123.45, "currency": "USD", "name": "Acme Corp", "date": "2024-05-01"}} + default: + application/json: {"error": "Internal Server Error", "code": 500} listInvoices: speakeasy-default-list-invoices: parameters: query: cursor: "25" - sort: ["createdAt", "desc"] + sort: ["created_at", "desc"] pageSize: 25 q: "Acme" start: "2024-01-01" end: "2024-01-31" statuses: ["paid", "unpaid"] customers: ["customer-uuid-1", "customer-uuid-2"] + ids: ["invoice-uuid-1", "invoice-uuid-2"] + recurringIds: ["recurring-uuid-1", "recurring-uuid-2"] + recurring: true responses: "200": application/json: {"meta": {"cursor": "25", "hasPreviousPage": false, "hasNextPage": true}, "data": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} get_/invoices/payment-status: speakeasy-default-get-/invoices/payment-status: responses: @@ -787,9 +1159,12 @@ examples: parameters: query: status: "paid" + statuses: ["draft", "unpaid"] responses: "200": - application/json: [{"currency": "SEK", "totalAmount": 224171.25, "invoiceCount": 15}] + application/json: {"currency": "USD", "totalAmount": 224171.25, "invoiceCount": 15, "breakdown": [{"currency": "EUR", "originalAmount": 15000.5, "convertedAmount": 16250.75, "count": 5}, {"currency": "GBP", "originalAmount": 8000.25, "convertedAmount": 9200.5, "count": 3}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getInvoiceById: speakeasy-default-get-invoice-by-id: parameters: @@ -797,7 +1172,9 @@ examples: id: "" responses: "200": - application/json: {"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a", "status": "paid", "dueDate": "2024-06-30T23:59:59.000Z", "issueDate": "2024-06-01T00:00:00.000Z", "invoiceNumber": "INV-2024-001", "amount": 1500.75, "currency": "USD", "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "Acme Corporation", "website": "https://acme.com", "email": "info@acme.com"}, "paidAt": "2024-06-15T12:00:00.000Z", "reminderSentAt": "2024-06-10T09:00:00.000Z", "note": "Thank you for your business.", "vat": 120, "tax": 80, "discount": 50, "subtotal": 1400, "viewedAt": "2024-06-05T14:30:00.000Z", "customerName": "Acme Corporation", "sentTo": "billing@acme.com", "sentAt": "2024-06-02T08:00:00.000Z", "createdAt": "2024-06-01T07:00:00.000Z", "updatedAt": "2024-06-15T10:00:00.000Z"} + application/json: {"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a", "status": "paid", "dueDate": "2024-06-30T23:59:59.000Z", "issueDate": "2024-06-01T00:00:00.000Z", "invoiceNumber": "INV-2024-001", "amount": 1500.75, "currency": "USD", "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "Acme Corporation", "website": "https://acme.com", "email": "info@acme.com"}, "paidAt": "2024-06-15T12:00:00.000Z", "reminderSentAt": "2024-06-10T09:00:00.000Z", "note": "Thank you for your business.", "vat": 120, "tax": 80, "discount": 50, "subtotal": 1400, "viewedAt": "2024-06-05T14:30:00.000Z", "customerName": "Acme Corporation", "sentTo": "billing@acme.com", "sentAt": "2024-06-02T08:00:00.000Z", "createdAt": "2024-06-01T07:00:00.000Z", "updatedAt": "2024-06-15T10:00:00.000Z", "pdfUrl": "https://app.midday.ai/api/download/invoice?token=eef58951-1682-4062-b010-425866032390", "previewUrl": "https://app.midday.ai/i/eef58951-1682-4062-b010-425866032390"} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteInvoice: speakeasy-default-delete-invoice: parameters: @@ -806,6 +1183,8 @@ examples: responses: "200": application/json: {"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a"} + default: + application/json: {"error": "Internal Server Error", "code": 500} search: speakeasy-default-search: parameters: @@ -818,6 +1197,8 @@ examples: responses: "200": application/json: [{"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a", "type": "invoice", "relevance": 0.92, "created_at": "2024-06-01T00:00:00.000Z", "data": {"invoiceNumber": "INV-2024-001", "customerName": "Acme Corporation", "amount": 1500.75}}] + default: + application/json: {"error": "Internal Server Error", "code": 500} getRevenueMetrics: speakeasy-default-get-revenue-metrics: parameters: @@ -890,10 +1271,12 @@ examples: status: "in_progress" customers: ["customer-1", "customer-2"] tags: ["tag-1", "tag-2"] - sort: ["-createdAt", "name"] + sort: ["created_at", "desc"] responses: "200": application/json: {"meta": {"hasNextPage": true, "hasPreviousPage": false}, "data": [{"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [{"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}, {"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}], "users": [{"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, {"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}]}, {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [{"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}, {"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}], "users": [{"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, {"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}]}, {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [{"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}, {"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}], "users": [{"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, {"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}]}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTrackerProject: "": requestBody: @@ -907,6 +1290,8 @@ examples: responses: "200": application/json: {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [], "users": [{"id": "f1e2d3c4-b5a6-7890-abcd-1234567890ef", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} getTrackerProjectById: speakeasy-default-get-tracker-project-by-id: parameters: @@ -915,6 +1300,8 @@ examples: responses: "200": application/json: {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [], "users": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteTrackerProject: speakeasy-default-delete-tracker-project: parameters: @@ -923,6 +1310,8 @@ examples: responses: "200": application/json: {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f"} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTrackerProject: speakeasy-default-update-tracker-project: parameters: @@ -933,6 +1322,8 @@ examples: responses: "200": application/json: {"id": "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", "name": "Website Redesign", "description": "Complete redesign of the company website with modern UI/UX and improved performance", "status": "in_progress", "estimate": 120, "currency": "USD", "createdAt": "2024-05-01T12:00:00.000Z", "totalDuration": 43200, "totalAmount": 3600, "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef", "name": "Acme Corporation", "website": "https://acme.com"}, "tags": [{"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}, {"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}, {"id": "d1e2f3a4-b5c6-7890-abcd-1234567890ef", "name": "Design"}], "users": null} + default: + application/json: {"error": "Internal Server Error", "code": 500} listTrackerEntries: speakeasy-default-list-tracker-entries: parameters: @@ -943,6 +1334,8 @@ examples: responses: "200": application/json: {"meta": {"totalDuration": 86400, "totalAmount": 1800, "from": "2024-04-01", "to": "2024-04-30"}, "result": {"key": [{"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": 28800, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}, {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": 28800, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}, {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": 28800, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}], "key1": [], "key2": []}} + default: + application/json: {"error": "Internal Server Error", "code": 500} deleteTrackerEntry: speakeasy-default-delete-tracker-entry: parameters: @@ -951,6 +1344,8 @@ examples: responses: "200": application/json: {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2"} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTrackerEntry: speakeasy-default-create-tracker-entry: requestBody: @@ -958,6 +1353,8 @@ examples: responses: "201": application/json: {"data": [{"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": 28800, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} createTrackerEntriesBulk: speakeasy-default-create-tracker-entries-bulk: requestBody: @@ -965,6 +1362,8 @@ examples: responses: "201": application/json: {"data": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} updateTrackerEntry: speakeasy-default-update-tracker-entry: parameters: @@ -975,6 +1374,8 @@ examples: responses: "200": application/json: {"data": [{"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": 28800, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} startTimer: speakeasy-default-start-timer: requestBody: @@ -982,6 +1383,8 @@ examples: responses: "201": application/json: {"data": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": -1, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}} + default: + application/json: {"error": "Internal Server Error", "code": 500} stopTimer: speakeasy-default-stop-timer: requestBody: @@ -989,6 +1392,8 @@ examples: responses: "200": application/json: {"data": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": -1, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}} + default: + application/json: {"error": "Internal Server Error", "code": 500} getCurrentTimer: speakeasy-default-get-current-timer: parameters: @@ -997,6 +1402,8 @@ examples: responses: "200": application/json: {"data": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "duration": -1, "start": "2024-04-15T09:00:00.000Z", "stop": "2024-04-15T17:00:00.000Z", "teamId": "team-1234", "description": "Worked on implementing user authentication feature", "rate": 75, "currency": "USD", "billed": false, "date": "2024-04-15", "user": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "fullName": "Jane Doe", "avatarUrl": "https://cdn.midday.ai/avatar.jpg"}, "project": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-03-01T10:00:00.000Z", "rate": 75, "currency": "USD", "status": "in_progress", "description": "Complete website redesign with modern UI/UX", "name": "Website Redesign Project", "billable": true, "estimate": 120, "customer": {"id": "customer-1234", "name": "Acme Corporation"}}}} + default: + application/json: {"error": "Internal Server Error", "code": 500} getTimerStatus: speakeasy-default-get-timer-status: parameters: @@ -1005,6 +1412,495 @@ examples: responses: "200": application/json: {"data": {"isRunning": true, "currentEntry": {"id": "a26a5a54-1e28-4c83-b854-2821b87e4a97", "start": "", "description": "brr debit greedy lasting because offset outset generously", "projectId": "f2d14591-a762-4edc-b444-ff2f1ff3b4b8", "trackerProject": {"id": "2cabaa5d-6000-419b-b904-099b57ddc208", "name": ""}}, "elapsedTime": 1800}} + default: + application/json: {"error": "Internal Server Error", "code": 500} + postOAuthRegister: + speakeasy-default-post-O-auth-register: + requestBody: + application/json: {"client_name": "ChatGPT", "redirect_uris": ["https://chatgpt.com/connector/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "token_endpoint_auth_method": "none", "scope": "transactions.read invoices.read", "logo_uri": "https://example.com/logo.png", "client_uri": "https://example.com", "response_types": ["code"]} + responses: + "200": + application/json: {"client_id": "mid_client_abcdef123456789", "client_name": "ChatGPT", "redirect_uris": ["https://chatgpt.com/connector/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "token_endpoint_auth_method": "none", "response_types": ["code"]} + "201": + application/json: {"client_id": "mid_client_abcdef123456789", "client_name": "ChatGPT", "redirect_uris": ["https://chatgpt.com/connector/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "token_endpoint_auth_method": "none", "response_types": ["code"]} + "400": + application/json: {"error": "invalid_request", "error_description": "The request is missing a required parameter", "error_uri": "https://docs.midday.ai/errors/invalid_request", "state": "abc123xyz789_secure-random-state-value"} + getOAuthAuthorization: + speakeasy-default-get-O-auth-authorization: + parameters: + query: + response_type: "code" + client_id: "mid_client_abcdef123456789" + redirect_uri: "https://myapp.com/callback" + scope: "transactions.read invoices.read" + state: "abc123xyz789_secure-random-state-value" + code_challenge: "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM" + code_challenge_method: "S256" + resource: "https://api.midday.ai" + responses: + "200": + application/json: {"id": "123e4567-e89b-12d3-a456-426614174000", "name": "My Raycast Extension", "description": "A Raycast extension for managing transactions", "overview": "This application provides advanced transaction management features including:\n- Real-time sync\n- Advanced filtering", "developerName": "Acme Corp", "logoUrl": "https://example.com/logo.png", "website": "https://myapp.com", "installUrl": "https://myapp.com/install", "screenshots": ["https://example.com/screenshot1.png", "https://example.com/screenshot2.png"], "clientId": "mid_client_abcdef123456789", "scopes": ["transactions.read", "invoices.read"], "redirectUri": "https://myapp.com/callback", "state": "abc123xyz789_secure-random-state-value", "status": "approved"} + "400": + application/json: {"error": "invalid_request", "error_description": "The request is missing a required parameter", "error_uri": "https://docs.midday.ai/errors/invalid_request", "state": "abc123xyz789_secure-random-state-value"} + postOAuthAuthorization: + speakeasy-default-post-O-auth-authorization: + requestBody: + application/json: {"client_id": "mid_client_abcdef123456789", "decision": "allow", "scopes": ["transactions.read", "invoices.read"], "redirect_uri": "https://myapp.com/callback", "state": "abc123xyz789_secure-random-state-value", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "teamId": "123e4567-e89b-12d3-a456-426614174000"} + responses: + "200": + application/json: {"redirect_url": "https://trained-outset.info"} + "400": + application/json: {"redirect_url": "https://young-ferret.name/"} + "401": + application/json: {"redirect_url": "https://impressive-giant.info"} + postOAuthToken: + speakeasy-default-post-O-auth-token: + requestBody: + application/json: {"grant_type": "refresh_token", "refresh_token": "mid_rt_abcdef123456789", "client_id": "mid_client_abcdef123456789", "client_secret": "mid_secret_abcdef123456789", "scope": "transactions.read invoices.read"} + application/x-www-form-urlencoded: {"grant_type": "refresh_token", "refresh_token": "mid_rt_abcdef123456789", "client_id": "mid_client_abcdef123456789", "client_secret": "mid_secret_abcdef123456789", "scope": "transactions.read invoices.read"} + responses: + "200": + application/json: {"access_token": "mid_access_token_abcdef123456789", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "mid_refresh_token_abcdef123456789", "scope": "transactions.read invoices.read"} + "400": + application/json: {"error": "invalid_request", "error_description": "The request is missing a required parameter", "error_uri": "https://docs.midday.ai/errors/invalid_request", "state": "abc123xyz789_secure-random-state-value"} + postOAuthRevoke: + speakeasy-default-post-O-auth-revoke: + requestBody: + application/json: {"token": "mid_access_token_abcdef123456789", "token_type_hint": "access_token", "client_id": "mid_client_abcdef123456789", "client_secret": "mid_secret_abcdef123456789"} + application/x-www-form-urlencoded: {"token": "mid_access_token_abcdef123456789", "token_type_hint": "access_token", "client_id": "mid_client_abcdef123456789", "client_secret": "mid_secret_abcdef123456789"} + responses: + "200": + application/json: {"success": true} + default: + application/json: {"error": "Internal Server Error", "code": 500} + inboxWebhook: + speakeasy-default-inbox-webhook: + requestBody: + application/json: "" + responses: + "200": + application/json: {"success": true} + "400": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + plaidWebhook: + speakeasy-default-plaid-webhook: + responses: + "200": + application/json: {"success": false} + polarWebhook: + speakeasy-default-polar-webhook: + responses: + "200": + application/json: {"received": true} + stripeWebhook: + speakeasy-default-stripe-webhook: + responses: + "200": + application/json: {"received": true} + tellerWebhook: + speakeasy-default-teller-webhook: + responses: + "200": + application/json: {"success": true} + whatsappWebhookVerify: + speakeasy-default-whatsapp-webhook-verify: + parameters: + query: + hub.mode: "" + hub.verify_token: "" + hub.challenge: "" + responses: + "200": + text/plain: "" + whatsappWebhook: + speakeasy-default-whatsapp-webhook: + requestBody: + application/json: "" + responses: + "200": + application/json: {"success": false} + proxyFile: + speakeasy-default-proxy-file: + parameters: + query: + filePath: "vault/documents/2024/invoice.pdf" + fk: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" + responses: + "200": + application/octet-stream: "x-file: example.file" + "400": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + downloadFile: + speakeasy-default-download-file: + parameters: + query: + path: "vault/documents/2024/invoice.pdf" + filename: "invoice.pdf" + fk: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" + responses: + "200": + application/octet-stream: "x-file: example.file" + "400": + application/json: {"error": ""} + "401": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + downloadInvoice: + speakeasy-default-download-invoice: + parameters: + query: + id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" + fk: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." + token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." + preview: false + type: "invoice" + responses: + "200": + application/pdf: "x-file: example.file" + "400": + application/json: {"error": ""} + "401": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + slackOAuthCallback: + speakeasy-default-slack-O-auth-callback: + parameters: + query: + code: "" + state: "North Carolina" + responses: + "400": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + getSlackInstallUrl: + speakeasy-default-get-slack-install-url: + responses: + "200": + application/json: {"url": "https://difficult-hawk.name/"} + slackWebhook: + speakeasy-default-slack-webhook: + responses: + "200": + application/json: {} + default: + application/json: {"error": "Internal Server Error", "code": 500} + slackInteractions: + speakeasy-default-slack-interactions: + responses: + "200": + application/json: {"ok": false} + default: + application/json: {"error": "Internal Server Error", "code": 500} + gmailOAuthCallback: + speakeasy-default-gmail-O-auth-callback: + parameters: + query: + state: "Delaware" + responses: + "400": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + getGmailInstallUrl: + speakeasy-default-get-gmail-install-url: + responses: + "200": + application/json: {"url": "https://finished-laughter.info"} + outlookOAuthCallback: + speakeasy-default-outlook-O-auth-callback: + parameters: + query: + state: "New Hampshire" + responses: + "400": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + getOutlookInstallUrl: + speakeasy-default-get-outlook-install-url: + responses: + "200": + application/json: {"url": "https://electric-soybean.net"} + xeroOAuthCallback: + speakeasy-default-xero-O-auth-callback: + parameters: + query: + state: "Maryland" + getXeroInstallUrl: + speakeasy-default-get-xero-install-url: + responses: + "200": + application/json: {"url": "https://insecure-iridescence.com"} + quickBooksOAuthCallback: + speakeasy-default-quick-books-O-auth-callback: + parameters: + query: + state: "Georgia" + getQuickBooksInstallUrl: + speakeasy-default-get-quick-books-install-url: + responses: + "200": + application/json: {"url": "https://wise-arcade.com/"} + fortnoxOAuthCallback: + speakeasy-default-fortnox-O-auth-callback: + parameters: + query: + state: "South Dakota" + getFortnoxInstallUrl: + speakeasy-default-get-fortnox-install-url: + responses: + "200": + application/json: {"url": "https://uncomfortable-puppet.com"} + getStripeConnectUrl: + speakeasy-default-get-stripe-connect-url: + responses: + "200": + application/json: {"url": "https://immaculate-pigpen.name"} + stripeConnectCallback: + speakeasy-default-stripe-connect-callback: + parameters: + query: + state: "California" + disconnectStripe: + speakeasy-default-disconnect-stripe: + responses: + "200": + application/json: {"success": false} + createInvoicePaymentIntent: + speakeasy-default-create-invoice-payment-intent: + requestBody: + application/json: {"token": ""} + responses: + "200": + application/json: {"clientSecret": "", "amount": 9036.31, "currency": "Balboa", "stripeAccountId": ""} + getStripeConnectStatus: + speakeasy-default-get-stripe-connect-status: + responses: + "200": + application/json: {"connected": true, "status": "", "stripeAccountId": ""} + checkDesktopUpdate: + speakeasy-default-check-desktop-update: + responses: + "200": + application/json: {"version": "", "platforms": {"key": {"signature": "", "url": "https://limping-warming.com"}}} + "502": + application/json: {"error": ""} + downloadDesktopUpdate: + speakeasy-default-download-desktop-update: + parameters: + query: + url: "https://github.com/midday-ai/midday/releases/download/midday-v1.0.0/Midday.app.tar.gz" + responses: + "200": + application/octet-stream: "x-file: example.file" + "400": + application/json: {"error": ""} + "502": + application/json: {"error": ""} + listNotifications: + speakeasy-default-list-notifications: + parameters: + query: + cursor: "20" + pageSize: 20 + status: ["unread", "read"] + userId: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + priority: 5 + maxPriority: 3 + responses: + "200": + application/json: {"data": [], "meta": {"cursor": "40", "hasPreviousPage": true, "hasNextPage": false}} + default: + application/json: {"error": "Internal Server Error", "code": 500} + updateNotificationStatus: + speakeasy-default-update-notification-status: + parameters: + path: + notificationId: "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2" + requestBody: + application/json: {"status": "read"} + responses: + "200": + application/json: {"data": {"id": "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", "createdAt": "2024-04-15T09:00:00.000Z", "teamId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "userId": "c2d3e4f5-a6b7-8901-bcde-f23456789012", "type": "transactions_created", "priority": 3, "source": "system", "status": "unread", "metadata": {"transactionCount": 5, "dateRange": {"from": "2024-04-01", "to": "2024-04-15"}}, "lastUsedAt": "2024-04-15T11:00:00.000Z"}} + default: + application/json: {"error": "Internal Server Error", "code": 500} + updateAllNotificationsStatus: + speakeasy-default-update-all-notifications-status: + requestBody: + application/json: {"status": "read"} + responses: + "200": + application/json: {"data": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} + getTransactionAttachmentPreSignedUrl: + speakeasy-default-get-transaction-attachment-pre-signed-url: + parameters: + path: + transactionId: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" + attachmentId: "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388" + query: + download: true + responses: + "200": + application/json: {"url": "https://service.midday.ai/storage/v1/object/sign/vault/transactions/receipt.pdf?token=abc123&expires=1640995200", "expiresAt": "2024-04-15T10:01:00.000Z", "fileName": "receipt.pdf"} + "400": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + getDocumentPreSignedUrl: + speakeasy-default-get-document-pre-signed-url: + parameters: + path: + id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" + query: + download: true + responses: + "200": + application/json: {"url": "https://service.midday.ai/storage/v1/object/sign/vault/documents/2024/invoice.pdf?token=abc123&expires=1640995200", "expiresAt": "2024-04-15T10:01:00.000Z", "fileName": "invoice-april-2024.pdf"} + "400": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + getInboxPreSignedUrl: + speakeasy-default-get-inbox-pre-signed-url: + parameters: + path: + id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4" + query: + download: true + responses: + "200": + application/json: {"url": "https://service.midday.ai/storage/v1/object/sign/vault/inbox/document.pdf?token=abc123&expires=1640995200", "expiresAt": "2024-04-15T10:01:00.000Z", "fileName": "invoice.pdf"} + "400": + application/json: {"error": ""} + "404": + application/json: {"error": ""} + "500": + application/json: {"error": ""} + createInvoice: + speakeasy-default-create-invoice: + requestBody: + application/json: {"template": {"customerLabel": "Bill To", "title": "Invoice", "fromLabel": "From", "invoiceNoLabel": "Invoice #", "issueDateLabel": "Issue Date", "dueDateLabel": "Due Date", "descriptionLabel": "Description", "priceLabel": "Rate", "quantityLabel": "Qty", "totalLabel": "Amount", "totalSummaryLabel": "Total", "vatLabel": "VAT", "taxLabel": "Sales Tax", "discountLabel": "Discount", "timezone": "America/Los_Angeles", "paymentLabel": "Payment Information", "noteLabel": "Notes", "logoUrl": "https://example.com/logo.png", "currency": "USD", "dateFormat": "MM/dd/yyyy", "includeVat": false, "includeTax": true, "includeDiscount": false, "includeDecimals": true, "includePdf": true, "sendCopy": true, "includeUnits": true, "includeQr": false, "taxRate": 8.5, "vatRate": 0, "size": "letter", "deliveryType": "create", "locale": "en-US", "paymentDetails": {}, "fromDetails": {}}, "fromDetails": {}, "customerId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "paymentDetails": {}, "noteDetails": {}, "dueDate": "2024-07-15T23:59:59.000Z", "issueDate": "2024-06-15T00:00:00.000Z", "invoiceNumber": "INV-2024-001", "logoUrl": "https://example.com/logo.png", "tax": 85, "topBlock": {}, "bottomBlock": {}, "amount": 1085, "lineItems": [{"quantity": 40, "price": 75, "tax": 8.5, "name": {}}, {"quantity": 20, "price": 50, "tax": 8.5, "name": {}}], "deliveryType": "create", "scheduledAt": "2024-07-01T09:00:00.000Z"} + responses: + "201": + application/json: {"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a", "status": "draft", "createdAt": "2024-06-01T07:00:00.000Z", "updatedAt": "2024-06-01T07:00:00.000Z", "pdfUrl": "https://app.midday.ai/api/download/invoice?token=eyJ...", "previewUrl": "https://app.midday.ai/i/eyJ..."} + "400": + application/json: {"message": "scheduledAt is required for scheduled delivery"} + "404": + application/json: {"message": "Customer not found"} + "409": + application/json: {"message": "Invoice number 'INV-2024-001' is already used. Please provide a different invoice number or omit it to auto-generate one."} + "500": + application/json: {"message": "Failed to create invoice"} + getInvoicePaymentStatus: + speakeasy-default-get-invoice-payment-status: + responses: + "200": + application/json: {"score": 85, "paymentStatus": "good"} + default: + application/json: {"error": "Internal Server Error", "code": 500} + updateInvoice: + speakeasy-default-update-invoice: + parameters: + path: + id: "" + requestBody: + application/json: {"status": "paid", "paidAt": "2024-06-15T12:00:00.000Z", "internalNote": "Payment received via bank transfer"} + responses: + "200": + application/json: {"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a", "status": "paid", "dueDate": "2024-06-30T23:59:59.000Z", "issueDate": "2024-06-01T00:00:00.000Z", "invoiceNumber": "INV-2024-001", "amount": 1500.75, "currency": "USD", "customer": {"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "Acme Corporation", "website": "https://acme.com", "email": "info@acme.com"}, "paidAt": "2024-06-15T12:00:00.000Z", "reminderSentAt": "2024-06-10T09:00:00.000Z", "note": "Thank you for your business.", "vat": 120, "tax": 80, "discount": 50, "subtotal": 1400, "viewedAt": "2024-06-05T14:30:00.000Z", "customerName": "Acme Corporation", "sentTo": "billing@acme.com", "sentAt": "2024-06-02T08:00:00.000Z", "createdAt": "2024-06-01T07:00:00.000Z", "updatedAt": "2024-06-15T10:00:00.000Z", "pdfUrl": "https://app.midday.ai/api/download/invoice?token=eef58951-1682-4062-b010-425866032390", "previewUrl": "https://app.midday.ai/i/eef58951-1682-4062-b010-425866032390"} + default: + application/json: {"error": "Internal Server Error", "code": 500} + getRevenueReports: + speakeasy-default-get-revenue-reports: + parameters: + query: + from: "2023-01-01" + to: "2023-12-31" + currency: "USD" + revenueType: "net" + responses: + "200": + application/json: {"summary": {"currentTotal": 10000, "prevTotal": 8000, "currency": "USD"}, "meta": {"type": "revenue", "currency": "USD"}, "result": []} + default: + application/json: {"error": "Internal Server Error", "code": 500} + getProfitReports: + speakeasy-default-get-profit-reports: + parameters: + query: + from: "2023-01-01" + to: "2023-12-31" + currency: "USD" + revenueType: "net" + responses: + "200": + application/json: {"summary": {"currentTotal": 10000, "prevTotal": 8000, "currency": "USD"}, "meta": {"type": "profit", "currency": "USD"}, "result": [{"date": "2023-01-31", "percentage": {"value": 25, "status": "positive"}, "current": {"date": "2023-01-31", "value": 1000, "currency": "USD"}, "previous": {"date": "2022-01-31", "value": 800, "currency": "USD"}}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} + getBurnRateReports: + speakeasy-default-get-burn-rate-reports: + parameters: + query: + from: "2023-01-01" + to: "2023-12-31" + currency: "USD" + responses: + "200": + application/json: [{"date": "2024-01-01", "value": 647366.44, "currency": "SEK"}] + default: + application/json: {"error": "Internal Server Error", "code": 500} + getRunwayReports: + speakeasy-default-get-runway-reports: + parameters: + query: + currency: "USD" + responses: + "200": + application/json: 12 + default: + application/json: {"error": "Internal Server Error", "code": 500} + getExpensesReports: + speakeasy-default-get-expenses-reports: + parameters: + query: + from: "2023-01-01" + to: "2023-12-31" + currency: "USD" + responses: + "200": + application/json: {"summary": {"averageExpense": 121054.86, "currency": "SEK"}, "meta": {"type": "expense", "currency": "SEK"}, "result": [{"date": "2024-01-01 00:00:00", "value": 637898.68, "currency": "SEK", "recurring": 9467.76, "total": 647366.44}]} + default: + application/json: {"error": "Internal Server Error", "code": 500} + getSpendingReports: + speakeasy-default-get-spending-reports: + parameters: + query: + from: "2023-01-01" + to: "2023-12-31" + currency: "USD" + responses: + "200": + application/json: [{"name": "Taxes", "slug": "taxes", "amount": -1256445, "currency": "SEK", "color": "#8492A6", "percentage": 44}] + default: + application/json: {"error": "Internal Server Error", "code": 500} examplesVersion: 1.0.2 generatedTests: {} -releaseNotes: "## SDK Changes Detected:\n* `Midday.Metrics.Revenue()`: `response.Result.[]` **Changed** **Breaking** :warning:\n* `Midday.TrackerEntries.List()`: `response.Result.{}.[].Project` **Changed** **Breaking** :warning:\n* `Midday.Metrics.Profit()`: `response.Result.[]` **Changed** **Breaking** :warning:\n* `Midday.Transactions.Update()`: `response` **Changed**\n* `Midday.Transactions.UpdateMany()`: `response.Data.[]` **Changed**\n* `Midday.TrackerTimer.StopTimer()`: **Added**\n* `Midday.TrackerTimer.GetCurrentTimer()`: **Added**\n* `Midday.TrackerTimer.GetTimerStatus()`: **Added**\n* `Midday.Tracker.Delete()`: **Deleted** **Breaking** :warning:\n* `Midday.Transactions.List()`: `response.Data.[]` **Changed**\n* `Midday.Transactions.Create()`: `response` **Changed**\n* `Midday.Transactions.Get()`: `response` **Changed**\n* `Midday.TrackerEntries.Create()`: **Added**\n* `Midday.Transactions.CreateMany()`: `response.[]` **Changed**\n* `Midday.TrackerTimer.StartTimer()`: **Added**\n* `Midday.Teams.Update()`: \n * `request.RequestBody.CountryCode` **Added**\n* `Midday.Users.Get()`: `response.TimezoneAutoSync` **Added**\n* `Midday.Users.Update()`: \n * `request.Request.TimezoneAutoSync` **Added**\n * `response.TimezoneAutoSync` **Added**\n* `Midday.Customers.List()`: `response.Data.[].BillingEmail` **Added**\n* `Midday.Customers.Create()`: \n * `request.Request.BillingEmail` **Added**\n * `response.BillingEmail` **Added**\n* `Midday.Customers.Get()`: `response.BillingEmail` **Added**\n* `Midday.Customers.Delete()`: `response.BillingEmail` **Added**\n* `Midday.Customers.Update()`: \n * `request.RequestBody.BillingEmail` **Added**\n * `response.BillingEmail` **Added**\n* `Midday.Inbox.Update()`: `request.RequestBody` **Changed**\n* `Midday.TrackerEntries.Update()`: **Added**\n* `Midday.TrackerEntries.Delete()`: **Added**\n* `Midday.TrackerEntries.CreateBulk()`: **Added**\n" +releaseNotes: "## SDK Changes Detected:\n* `Midday.Transactions.List()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.TrackerTimer.GetTimerStatus()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerTimer.GetCurrentTimer()`: `response` **Changed** **Breaking** :warning:\n* `Midday.TrackerTimer.StopTimer()`: `response` **Changed** **Breaking** :warning:\n* `Midday.TrackerTimer.StartTimer()`: `response` **Changed** **Breaking** :warning:\n* `Midday.TrackerEntries.Update()`: \n * `request.RequestBody.AssignedId` **Changed**\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerEntries.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerEntries.CreateBulk()`: \n * `request.Request.Entries.[].AssignedId` **Changed**\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerEntries.Create()`: \n * `request.Request.AssignedId` **Changed**\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerEntries.List()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerProjects.Update()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerProjects.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerProjects.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerProjects.Create()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.TrackerProjects.List()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Search.Search()`: \n * `request.Request.RelevanceThreshold` **Changed**\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Invoices.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Invoices.Get()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Invoices.Summary()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Invoices.List()`: \n * `request.Request` **Changed**\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Inbox.Update()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Inbox.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Inbox.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Inbox.List()`: \n * `request.Request` **Changed**\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Documents.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Documents.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Documents.List()`: \n * `request.Request` **Changed**\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Tags.Update()`: \n * `request.RequestBody` **Changed** **Breaking** :warning:\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Tags.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Tags.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Tags.Create()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Tags.List()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.BankAccounts.Update()`: \n * `request.RequestBody` **Changed** **Breaking** :warning:\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.BankAccounts.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.BankAccounts.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.BankAccounts.Create()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.BankAccounts.List()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Customers.Update()`: \n * `request.RequestBody` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Customers.Delete()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Customers.Get()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Customers.Create()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Customers.List()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Users.Update()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Users.Get()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Teams.Members()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Teams.Update()`: \n * `request.RequestBody` **Changed** **Breaking** :warning:\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Teams.Get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Teams.List()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Transactions.UpdateMany()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Transactions.DeleteMany()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Transactions.CreateMany()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Transactions.Update()`: \n * `request.RequestBody` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Transactions.Delete()`: `response.status[default]` **Added** **Breaking** :warning:\n* `Midday.Transactions.Get()`: `response` **Changed** **Breaking** :warning:\n* `Midday.Transactions.Create()`: \n * `request.Request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Midday.Integrations.GetFortnoxInstallUrl()`: **Added**\n* `Midday.InvoicePayments.GetStripeConnectUrl()`: **Added**\n* `Midday.Metrics.Spending()`: **Deleted** **Breaking** :warning:\n* `Midday.Metrics.Runway()`: **Deleted** **Breaking** :warning:\n* `Midday.Metrics.Burn-Rate()`: **Deleted** **Breaking** :warning:\n* `Midday.Metrics.Profit()`: **Deleted** **Breaking** :warning:\n* `Midday.Metrics.Revenue()`: **Deleted** **Breaking** :warning:\n* `Midday.Invoices.Get/invoices/payment-Status()`: **Deleted** **Breaking** :warning:\n* `Midday.Reports.Spending()`: **Added**\n* `Midday.Reports.Expenses()`: **Added**\n* `Midday.Reports.Runway()`: **Added**\n* `Midday.Reports.Burn-Rate()`: **Added**\n* `Midday.Reports.Profit()`: **Added**\n* `Midday.Reports.Revenue()`: **Added**\n* `Midday.Invoices.Update()`: **Added**\n* `Midday.Invoices.PaymentStatus()`: **Added**\n* `Midday.Invoices.Create()`: **Added**\n* `Midday.Inbox.GetPreSignedUrl()`: **Added**\n* `Midday.Documents.GetPreSignedUrl()`: **Added**\n* `Midday.Transactions.GetAttachmentPreSignedUrl()`: **Added**\n* `Midday.Notifications.UpdateAllStatus()`: **Added**\n* `Midday.Notifications.UpdateStatus()`: **Added**\n* `Midday.Notifications.List()`: **Added**\n* `Midday.Desktop.DownloadUpdate()`: **Added**\n* `Midday.Desktop.CheckUpdate()`: **Added**\n* `Midday.InvoicePayments.GetStripeConnectStatus()`: **Added**\n* `Midday.InvoicePayments.CreateInvoicePaymentIntent()`: **Added**\n* `Midday.InvoicePayments.DisconnectStripe()`: **Added**\n* `Midday.InvoicePayments.StripeConnectCallback()`: **Added**\n* `Midday.Metrics.Expenses()`: **Deleted** **Breaking** :warning:\n* `Midday.OAuth.PostOAuthRegister()`: **Added**\n* `Midday.Integrations.FortnoxOAuthCallback()`: **Added**\n* `Midday.Integrations.GetQuickBooksInstallUrl()`: **Added**\n* `Midday.Integrations.QuickBooksOAuthCallback()`: **Added**\n* `Midday.Integrations.GetXeroInstallUrl()`: **Added**\n* `Midday.Integrations.XeroOAuthCallback()`: **Added**\n* `Midday.Integrations.GetOutlookInstallUrl()`: **Added**\n* `Midday.Integrations.OutlookOAuthCallback()`: **Added**\n* `Midday.Integrations.GetGmailInstallUrl()`: **Added**\n* `Midday.Integrations.GmailOAuthCallback()`: **Added**\n* `Midday.Integrations.SlackInteractions()`: **Added**\n* `Midday.Integrations.SlackWebhook()`: **Added**\n* `Midday.Integrations.GetSlackInstallUrl()`: **Added**\n* `Midday.Integrations.SlackOAuthCallback()`: **Added**\n* `Midday.Files.DownloadInvoice()`: **Added**\n* `Midday.Files.DownloadFile()`: **Added**\n* `Midday.Files.Proxy()`: **Added**\n* `Midday.Webhooks.WhatsappWebhook()`: **Added**\n* `Midday.Webhooks.WhatsappWebhookVerify()`: **Added**\n* `Midday.Webhooks.TellerWebhook()`: **Added**\n* `Midday.Webhooks.StripeWebhook()`: **Added**\n* `Midday.Webhooks.PolarWebhook()`: **Added**\n* `Midday.Webhooks.PlaidWebhook()`: **Added**\n* `Midday.Webhooks.InboxWebhook()`: **Added**\n* `Midday.OAuth.PostOAuthRevoke()`: **Added**\n* `Midday.OAuth.PostOAuthToken()`: **Added**\n* `Midday.OAuth.PostOAuthAuthorization()`: **Added**\n* `Midday.OAuth.GetOAuthAuthorization()`: **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index da76a1c..cbd4a62 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -25,7 +25,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false go: - version: 0.1.0 + version: 0.2.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: MiddayError diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d14195a..906fd50 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,19 +2,19 @@ speakeasyVersion: 1.606.0 sources: Midday-OAS: sourceNamespace: midday-api - sourceRevisionDigest: sha256:f914bc30ad4ad47a5888b409e12b3dde9ccf093bf10ea24be3416a97ab950e4e - sourceBlobDigest: sha256:e4822e044b4565fa816fe6cdd727bc82ccbac8008057a1da0e440106d8c3a87a + sourceRevisionDigest: sha256:21e7bf14de99237457465b08581adc32497444a0df412700665694bc1e4fe5f7 + sourceBlobDigest: sha256:820b4a0cdaf0e1ee1e853fc7036f76047c0725bf4f1fe4f81dfc8973a295036b tags: - latest - - speakeasy-sdk-regen-1749687693 + - speakeasy-sdk-regen-1776904886 targets: midday: source: Midday-OAS sourceNamespace: midday-api - sourceRevisionDigest: sha256:f914bc30ad4ad47a5888b409e12b3dde9ccf093bf10ea24be3416a97ab950e4e - sourceBlobDigest: sha256:e4822e044b4565fa816fe6cdd727bc82ccbac8008057a1da0e440106d8c3a87a + sourceRevisionDigest: sha256:21e7bf14de99237457465b08581adc32497444a0df412700665694bc1e4fe5f7 + sourceBlobDigest: sha256:820b4a0cdaf0e1ee1e853fc7036f76047c0725bf4f1fe4f81dfc8973a295036b codeSamplesNamespace: midday-oas-go-code-samples - codeSamplesRevisionDigest: sha256:c37ffda8783f0a2730b2ec00b348ad1050a6a4e106c6422a080115f6cbaf6ffc + codeSamplesRevisionDigest: sha256:79199d10dd7b9fc25b44be3b448dc171693e0529389ac5dfcaaa647ebbf4554f workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 17c4f39..86c04bd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage, ## Summary -Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage, Financial Overview & your own Assistant. +Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage & Financial Overview. @@ -53,66 +53,41 @@ package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "log" + "os" ) func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Tags: []string{ - "tag-1", - "tag-2", + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", - }, - Recurring: []string{ - "monthly", - "annually", - }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), - }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } @@ -125,79 +100,55 @@ func main() { ### Per-Client Security Schemes -This SDK supports the following security scheme globally: +This SDK supports the following security schemes globally: -| Name | Type | Scheme | Environment Variable | -| ------- | ---- | ----------- | -------------------- | -| `Token` | http | HTTP Bearer | `MIDDAY_TOKEN` | +| Name | Type | Scheme | Environment Variable | +| -------- | ------ | ------------ | -------------------- | +| `Oauth2` | oauth2 | OAuth2 token | `MIDDAY_OAUTH2` | +| `Token` | http | HTTP Bearer | `MIDDAY_TOKEN` | -You can configure it using the `WithSecurity` option when initializing the SDK client instance. For example: +You can set the security parameters through the `WithSecurity` option when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example: ```go package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "log" + "os" ) func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", - }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - Tags: []string{ - "tag-1", - "tag-2", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", - }, - Recurring: []string{ - "monthly", - "annually", - }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), - }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } @@ -227,11 +178,23 @@ func main() { * [Delete](docs/sdks/customers/README.md#delete) - Delete a customer * [Update](docs/sdks/customers/README.md#update) - Update a customer +### [Desktop](docs/sdks/desktop/README.md) + +* [CheckUpdate](docs/sdks/desktop/README.md#checkupdate) - Check for desktop app updates +* [DownloadUpdate](docs/sdks/desktop/README.md#downloadupdate) - Download desktop app update artifact + ### [Documents](docs/sdks/documents/README.md) * [List](docs/sdks/documents/README.md#list) - List all documents * [Get](docs/sdks/documents/README.md#get) - Retrieve a document * [Delete](docs/sdks/documents/README.md#delete) - Delete a document +* [GetPreSignedURL](docs/sdks/documents/README.md#getpresignedurl) - Generate pre-signed URL for document + +### [Files](docs/sdks/files/README.md) + +* [Proxy](docs/sdks/files/README.md#proxy) - Proxy file from storage +* [DownloadFile](docs/sdks/files/README.md#downloadfile) - Download file from vault +* [DownloadInvoice](docs/sdks/files/README.md#downloadinvoice) - Download invoice PDF ### [Inbox](docs/sdks/inbox/README.md) @@ -239,24 +202,66 @@ func main() { * [Get](docs/sdks/inbox/README.md#get) - Retrieve a inbox item * [Delete](docs/sdks/inbox/README.md#delete) - Delete a inbox item * [Update](docs/sdks/inbox/README.md#update) - Update a inbox item +* [GetPreSignedURL](docs/sdks/inbox/README.md#getpresignedurl) - Generate pre-signed URL for inbox attachment + +### [Integrations](docs/sdks/integrations/README.md) + +* [SlackOAuthCallback](docs/sdks/integrations/README.md#slackoauthcallback) - Slack OAuth callback +* [GetSlackInstallURL](docs/sdks/integrations/README.md#getslackinstallurl) - Get Slack install URL +* [SlackWebhook](docs/sdks/integrations/README.md#slackwebhook) - Slack webhook handler +* [SlackInteractions](docs/sdks/integrations/README.md#slackinteractions) - Slack interactions handler +* [GmailOAuthCallback](docs/sdks/integrations/README.md#gmailoauthcallback) - Gmail OAuth callback +* [GetGmailInstallURL](docs/sdks/integrations/README.md#getgmailinstallurl) - Get Gmail install URL +* [OutlookOAuthCallback](docs/sdks/integrations/README.md#outlookoauthcallback) - Outlook OAuth callback +* [GetOutlookInstallURL](docs/sdks/integrations/README.md#getoutlookinstallurl) - Get Outlook install URL +* [XeroOAuthCallback](docs/sdks/integrations/README.md#xerooauthcallback) - Xero OAuth callback +* [GetXeroInstallURL](docs/sdks/integrations/README.md#getxeroinstallurl) - Get Xero install URL +* [QuickBooksOAuthCallback](docs/sdks/integrations/README.md#quickbooksoauthcallback) - QuickBooks OAuth callback +* [GetQuickBooksInstallURL](docs/sdks/integrations/README.md#getquickbooksinstallurl) - Get QuickBooks install URL +* [FortnoxOAuthCallback](docs/sdks/integrations/README.md#fortnoxoauthcallback) - Fortnox OAuth callback +* [GetFortnoxInstallURL](docs/sdks/integrations/README.md#getfortnoxinstallurl) - Get Fortnox install URL + +### [InvoicePayments](docs/sdks/invoicepayments/README.md) + +* [GetStripeConnectURL](docs/sdks/invoicepayments/README.md#getstripeconnecturl) - Get Stripe Connect URL +* [StripeConnectCallback](docs/sdks/invoicepayments/README.md#stripeconnectcallback) - Stripe Connect OAuth callback +* [DisconnectStripe](docs/sdks/invoicepayments/README.md#disconnectstripe) - Disconnect Stripe account +* [CreateInvoicePaymentIntent](docs/sdks/invoicepayments/README.md#createinvoicepaymentintent) - Create payment intent for invoice +* [GetStripeConnectStatus](docs/sdks/invoicepayments/README.md#getstripeconnectstatus) - Get Stripe Connect status ### [Invoices](docs/sdks/invoices/README.md) * [List](docs/sdks/invoices/README.md#list) - List all invoices -* [GetInvoicesPaymentStatus](docs/sdks/invoices/README.md#getinvoicespaymentstatus) - Payment status +* [Create](docs/sdks/invoices/README.md#create) - Create an invoice +* [PaymentStatus](docs/sdks/invoices/README.md#paymentstatus) - Payment status * [Summary](docs/sdks/invoices/README.md#summary) - Invoice summary * [Get](docs/sdks/invoices/README.md#get) - Retrieve a invoice +* [Update](docs/sdks/invoices/README.md#update) - Update an invoice * [Delete](docs/sdks/invoices/README.md#delete) - Delete a invoice -### [Metrics](docs/sdks/metrics/README.md) -* [Revenue](docs/sdks/metrics/README.md#revenue) - Revenue metrics -* [Profit](docs/sdks/metrics/README.md#profit) - Profit metrics -* [BurnRate](docs/sdks/metrics/README.md#burnrate) - Burn rate metrics -* [Runway](docs/sdks/metrics/README.md#runway) - Runway metrics -* [Expenses](docs/sdks/metrics/README.md#expenses) - Expense metrics -* [Spending](docs/sdks/metrics/README.md#spending) - Spending metrics +### [Notifications](docs/sdks/notifications/README.md) + +* [List](docs/sdks/notifications/README.md#list) - List all notifications +* [UpdateStatus](docs/sdks/notifications/README.md#updatestatus) - Update notification status +* [UpdateAllStatus](docs/sdks/notifications/README.md#updateallstatus) - Update status of all notifications + +### [OAuth](docs/sdks/oauth/README.md) + +* [PostOAuthRegister](docs/sdks/oauth/README.md#postoauthregister) - Dynamic Client Registration +* [GetOAuthAuthorization](docs/sdks/oauth/README.md#getoauthauthorization) - OAuth Authorization Endpoint +* [PostOAuthAuthorization](docs/sdks/oauth/README.md#postoauthauthorization) - OAuth Authorization Decision +* [PostOAuthToken](docs/sdks/oauth/README.md#postoauthtoken) - OAuth Token Exchange +* [PostOAuthRevoke](docs/sdks/oauth/README.md#postoauthrevoke) - OAuth Token Revocation + +### [Reports](docs/sdks/reports/README.md) +* [Revenue](docs/sdks/reports/README.md#revenue) - Revenue reports +* [Profit](docs/sdks/reports/README.md#profit) - Profit reports +* [BurnRate](docs/sdks/reports/README.md#burnrate) - Burn rate reports +* [Runway](docs/sdks/reports/README.md#runway) - Runway reports +* [Expenses](docs/sdks/reports/README.md#expenses) - Expense reports +* [Spending](docs/sdks/reports/README.md#spending) - Spending reports ### [Search](docs/sdks/search/README.md) @@ -307,6 +312,7 @@ func main() { * [Get](docs/sdks/transactions/README.md#get) - Retrieve a transaction * [Delete](docs/sdks/transactions/README.md#delete) - Delete a transaction * [Update](docs/sdks/transactions/README.md#update) - Update a transaction +* [GetAttachmentPreSignedURL](docs/sdks/transactions/README.md#getattachmentpresignedurl) - Generate pre-signed URL for transaction attachment * [CreateMany](docs/sdks/transactions/README.md#createmany) - Bulk create transactions * [DeleteMany](docs/sdks/transactions/README.md#deletemany) - Bulk delete transactions * [UpdateMany](docs/sdks/transactions/README.md#updatemany) - Bulk update transactions @@ -316,6 +322,16 @@ func main() { * [Get](docs/sdks/users/README.md#get) - Retrieve the current user * [Update](docs/sdks/users/README.md#update) - Update the current user +### [Webhooks](docs/sdks/webhooks/README.md) + +* [InboxWebhook](docs/sdks/webhooks/README.md#inboxwebhook) - Inbox webhook +* [PlaidWebhook](docs/sdks/webhooks/README.md#plaidwebhook) - Plaid webhook handler +* [PolarWebhook](docs/sdks/webhooks/README.md#polarwebhook) - Polar webhook handler +* [StripeWebhook](docs/sdks/webhooks/README.md#stripewebhook) - Stripe webhook handler +* [TellerWebhook](docs/sdks/webhooks/README.md#tellerwebhook) - Teller webhook handler +* [WhatsappWebhookVerify](docs/sdks/webhooks/README.md#whatsappwebhookverify) - WhatsApp webhook verification +* [WhatsappWebhook](docs/sdks/webhooks/README.md#whatsappwebhook) - WhatsApp webhook + @@ -331,63 +347,38 @@ package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "github.com/midday-ai/midday-go/retry" "log" "models/operations" + "os" ) func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", - }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", - }, - Tags: []string{ - "tag-1", - "tag-2", - }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - Statuses: []string{ - "pending", - "completed", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Recurring: []string{ - "monthly", - "annually", + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), - }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }, operations.WithRetries( retry.Config{ Strategy: "backoff", @@ -402,7 +393,7 @@ func main() { if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } @@ -416,9 +407,11 @@ package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "github.com/midday-ai/midday-go/retry" "log" + "os" ) func main() { @@ -436,58 +429,31 @@ func main() { }, RetryConnectionErrors: false, }), - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", - }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", - }, - Tags: []string{ - "tag-1", - "tag-2", - }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - Recurring: []string{ - "monthly", - "annually", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } @@ -502,11 +468,12 @@ Handling errors in this SDK should largely match your expectations. All operatio By Default, an API error will return `apierrors.APIError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. -For example, the `List` function may return the following errors: +For example, the `PostOAuthRegister` function may return the following errors: -| Error Type | Status Code | Content Type | -| ------------------ | ----------- | ------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | +| Error Type | Status Code | Content Type | +| ---------------------------- | ----------- | ---------------- | +| apierrors.OAuthErrorResponse | 400 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | ### Example @@ -518,64 +485,45 @@ import ( "errors" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "log" + "os" ) func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", - }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", - }, - Tags: []string{ - "tag-1", - "tag-2", - }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - Recurring: []string{ - "monthly", - "annually", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { + var e *apierrors.OAuthErrorResponse + if errors.As(err, &e) { + // handle error + log.Fatal(e.Error()) + } + var e *apierrors.APIError if errors.As(err, &e) { // handle error @@ -599,8 +547,10 @@ package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "log" + "os" ) func main() { @@ -608,58 +558,31 @@ func main() { s := middaygo.New( middaygo.WithServerURL("https://api.midday.ai"), - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", - }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", - }, - Tags: []string{ - "tag-1", - "tag-2", - }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", - }, - Recurring: []string{ - "monthly", - "annually", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Amount: []string{ - "150.75", - "299.99", + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } diff --git a/RELEASES.md b/RELEASES.md index 4dbdd72..e014977 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -8,4 +8,14 @@ Based on: ### Generated - [go v0.1.0] . ### Releases -- [Go v0.1.0] https://github.com/midday-ai/midday-go/releases/tag/v0.1.0 - . \ No newline at end of file +- [Go v0.1.0] https://github.com/midday-ai/midday-go/releases/tag/v0.1.0 - . + +## 2026-05-13 00:47:28 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.606.0 (2.686.7) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.2.0] . +### Releases +- [Go v0.2.0] https://github.com/midday-ai/midday-go/releases/tag/v0.2.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 42da4e4..ca5f6fb 100644 --- a/USAGE.md +++ b/USAGE.md @@ -5,66 +5,41 @@ package main import ( "context" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/components" "github.com/midday-ai/midday-go/models/operations" "log" + "os" ) func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ - Cursor: middaygo.String("eyJpZCI6IjEyMyJ9"), - Sort: []string{ - "date", - "desc", + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", }, - PageSize: middaygo.Float64(50), - Q: middaygo.String("office supplies"), - Categories: []string{ - "office-supplies", - "travel", + GrantTypes: []string{ + "authorization_code", + "refresh_token", }, - Tags: []string{ - "tag-1", - "tag-2", + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", }, - Start: middaygo.String("2024-04-01T00:00:00.000Z"), - End: middaygo.String("2024-04-30T23:59:59.999Z"), - Accounts: []string{ - "account-1", - "account-2", - }, - Assignees: []string{ - "user-1", - "user-2", - }, - Statuses: []string{ - "pending", - "completed", - }, - Recurring: []string{ - "monthly", - "annually", - }, - Attachments: operations.AttachmentsInclude.ToPointer(), - AmountRange: []*float64{ - middaygo.Float64(100), - middaygo.Float64(1000), - }, - Amount: []string{ - "150.75", - "299.99", - }, - Type: operations.ListTransactionsTypeExpense.ToPointer(), }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.TwoHundredApplicationJSONObject != nil { // handle response } } diff --git a/bankaccounts.go b/bankaccounts.go index 605fad1..ddf0327 100644 --- a/bankaccounts.go +++ b/bankaccounts.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// BankAccounts - Manage bank accounts type BankAccounts struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -107,6 +108,16 @@ func (s *BankAccounts) List(ctx context.Context, enabled *bool, manual *bool, op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -115,11 +126,7 @@ func (s *BankAccounts) List(ctx context.Context, enabled *bool, manual *bool, op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -235,11 +242,26 @@ func (s *BankAccounts) List(ctx context.Context, enabled *bool, manual *bool, op } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -248,7 +270,7 @@ func (s *BankAccounts) List(ctx context.Context, enabled *bool, manual *bool, op // Create a bank account // Create a new bank account for the authenticated team. -func (s *BankAccounts) Create(ctx context.Context, request *operations.CreateBankAccountRequest, opts ...operations.Option) (*operations.CreateBankAccountResponse, error) { +func (s *BankAccounts) Create(ctx context.Context, request operations.CreateBankAccountRequest, opts ...operations.Option) (*operations.CreateBankAccountResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -281,7 +303,7 @@ func (s *BankAccounts) Create(ctx context.Context, request *operations.CreateBan OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -320,6 +342,16 @@ func (s *BankAccounts) Create(ctx context.Context, request *operations.CreateBan if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -328,11 +360,7 @@ func (s *BankAccounts) Create(ctx context.Context, request *operations.CreateBan httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -448,11 +476,26 @@ func (s *BankAccounts) Create(ctx context.Context, request *operations.CreateBan } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -530,6 +573,16 @@ func (s *BankAccounts) Get(ctx context.Context, id string, opts ...operations.Op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -538,11 +591,7 @@ func (s *BankAccounts) Get(ctx context.Context, id string, opts ...operations.Op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -658,11 +707,26 @@ func (s *BankAccounts) Get(ctx context.Context, id string, opts ...operations.Op } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -740,6 +804,16 @@ func (s *BankAccounts) Delete(ctx context.Context, id string, opts ...operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -748,11 +822,7 @@ func (s *BankAccounts) Delete(ctx context.Context, id string, opts ...operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -868,11 +938,26 @@ func (s *BankAccounts) Delete(ctx context.Context, id string, opts ...operations } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -881,7 +966,7 @@ func (s *BankAccounts) Delete(ctx context.Context, id string, opts ...operations // Update a bank account // Update a bank account by ID for the authenticated team. -func (s *BankAccounts) Update(ctx context.Context, id string, requestBody *operations.UpdateBankAccountRequestBody, opts ...operations.Option) (*operations.UpdateBankAccountResponse, error) { +func (s *BankAccounts) Update(ctx context.Context, id string, requestBody operations.UpdateBankAccountRequestBody, opts ...operations.Option) (*operations.UpdateBankAccountResponse, error) { request := operations.UpdateBankAccountRequest{ ID: id, RequestBody: requestBody, @@ -919,7 +1004,7 @@ func (s *BankAccounts) Update(ctx context.Context, id string, requestBody *opera OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -958,6 +1043,16 @@ func (s *BankAccounts) Update(ctx context.Context, id string, requestBody *opera if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -966,11 +1061,7 @@ func (s *BankAccounts) Update(ctx context.Context, id string, requestBody *opera httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1086,11 +1177,26 @@ func (s *BankAccounts) Update(ctx context.Context, id string, requestBody *opera } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/customers.go b/customers.go index 6f0786b..26054db 100644 --- a/customers.go +++ b/customers.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Customers - Manage customers type Customers struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -109,6 +110,16 @@ func (s *Customers) List(ctx context.Context, q *string, sort []string, cursor * if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -117,11 +128,7 @@ func (s *Customers) List(ctx context.Context, q *string, sort []string, cursor * httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -237,11 +244,26 @@ func (s *Customers) List(ctx context.Context, q *string, sort []string, cursor * } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -250,7 +272,7 @@ func (s *Customers) List(ctx context.Context, q *string, sort []string, cursor * // Create customer // Create a new customer for the authenticated team. -func (s *Customers) Create(ctx context.Context, request *operations.CreateCustomerRequest, opts ...operations.Option) (*operations.CreateCustomerResponse, error) { +func (s *Customers) Create(ctx context.Context, request operations.CreateCustomerRequest, opts ...operations.Option) (*operations.CreateCustomerResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -283,7 +305,7 @@ func (s *Customers) Create(ctx context.Context, request *operations.CreateCustom OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -322,6 +344,16 @@ func (s *Customers) Create(ctx context.Context, request *operations.CreateCustom if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -330,11 +362,7 @@ func (s *Customers) Create(ctx context.Context, request *operations.CreateCustom httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -450,11 +478,26 @@ func (s *Customers) Create(ctx context.Context, request *operations.CreateCustom } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -532,6 +575,16 @@ func (s *Customers) Get(ctx context.Context, id string, opts ...operations.Optio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -540,11 +593,7 @@ func (s *Customers) Get(ctx context.Context, id string, opts ...operations.Optio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -660,11 +709,26 @@ func (s *Customers) Get(ctx context.Context, id string, opts ...operations.Optio } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -742,6 +806,16 @@ func (s *Customers) Delete(ctx context.Context, id string, opts ...operations.Op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -750,11 +824,7 @@ func (s *Customers) Delete(ctx context.Context, id string, opts ...operations.Op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -870,11 +940,26 @@ func (s *Customers) Delete(ctx context.Context, id string, opts ...operations.Op } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -883,7 +968,7 @@ func (s *Customers) Delete(ctx context.Context, id string, opts ...operations.Op // Update a customer // Update a customer by ID for the authenticated team. -func (s *Customers) Update(ctx context.Context, id string, requestBody *operations.UpdateCustomerRequestBody, opts ...operations.Option) (*operations.UpdateCustomerResponse, error) { +func (s *Customers) Update(ctx context.Context, id string, requestBody operations.UpdateCustomerRequestBody, opts ...operations.Option) (*operations.UpdateCustomerResponse, error) { request := operations.UpdateCustomerRequest{ ID: id, RequestBody: requestBody, @@ -921,7 +1006,7 @@ func (s *Customers) Update(ctx context.Context, id string, requestBody *operatio OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -960,6 +1045,16 @@ func (s *Customers) Update(ctx context.Context, id string, requestBody *operatio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -968,11 +1063,7 @@ func (s *Customers) Update(ctx context.Context, id string, requestBody *operatio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1088,11 +1179,26 @@ func (s *Customers) Update(ctx context.Context, id string, requestBody *operatio } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/desktop.go b/desktop.go new file mode 100644 index 0000000..4a7407b --- /dev/null +++ b/desktop.go @@ -0,0 +1,532 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// Desktop app endpoints +type Desktop struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newDesktop(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Desktop { + return &Desktop{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// CheckUpdate - Check for desktop app updates +// Returns the latest desktop app version info in Tauri updater format. Download URLs are rewritten to proxy through this API. +func (s *Desktop) CheckUpdate(ctx context.Context, opts ...operations.Option) (*operations.CheckDesktopUpdateResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/desktop/update") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "checkDesktopUpdate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "502", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CheckDesktopUpdateResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.CheckDesktopUpdateResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 502: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.CheckDesktopUpdateBadGatewayError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DownloadUpdate - Download desktop app update artifact +// Proxies the download of a desktop app update artifact from GitHub releases. Only URLs pointing to the midday-ai/midday repository are accepted. +func (s *Desktop) DownloadUpdate(ctx context.Context, url_ string, opts ...operations.Option) (*operations.DownloadDesktopUpdateResponse, error) { + request := operations.DownloadDesktopUpdateRequest{ + URL: url_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/desktop/update/download") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "downloadDesktopUpdate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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/octet-stream") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "502", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DownloadDesktopUpdateResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/octet-stream`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadDesktopUpdateBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 502: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadDesktopUpdateBadGatewayError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/docs/models/apierrors/checkdesktopupdatebadgatewayerror.md b/docs/models/apierrors/checkdesktopupdatebadgatewayerror.md new file mode 100644 index 0000000..b7c7509 --- /dev/null +++ b/docs/models/apierrors/checkdesktopupdatebadgatewayerror.md @@ -0,0 +1,11 @@ +# CheckDesktopUpdateBadGatewayError + +Failed to fetch update info from upstream + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/conflicterror.md b/docs/models/apierrors/conflicterror.md new file mode 100644 index 0000000..02f4c4c --- /dev/null +++ b/docs/models/apierrors/conflicterror.md @@ -0,0 +1,11 @@ +# ConflictError + +Conflict. Invoice number already exists. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `Message` | *string* | :heavy_check_mark: | Error message about the conflict | Invoice number 'INV-2024-001' is already used. Please provide a different invoice number or omit it to auto-generate one. | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/apierrors/createinvoicebadrequesterror.md b/docs/models/apierrors/createinvoicebadrequesterror.md new file mode 100644 index 0000000..3ec9f91 --- /dev/null +++ b/docs/models/apierrors/createinvoicebadrequesterror.md @@ -0,0 +1,11 @@ +# CreateInvoiceBadRequestError + +Bad request. Invalid input data or validation errors. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Message` | *string* | :heavy_check_mark: | Error message describing the validation failure | scheduledAt is required for scheduled delivery | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/apierrors/createinvoiceinternalservererror.md b/docs/models/apierrors/createinvoiceinternalservererror.md new file mode 100644 index 0000000..08bc12f --- /dev/null +++ b/docs/models/apierrors/createinvoiceinternalservererror.md @@ -0,0 +1,11 @@ +# CreateInvoiceInternalServerError + +Internal server error. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Message` | *string* | :heavy_check_mark: | Error message | Failed to create invoice | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getrunwaymetricsresponse.md b/docs/models/apierrors/createinvoicenotfounderror.md similarity index 74% rename from docs/models/operations/getrunwaymetricsresponse.md rename to docs/models/apierrors/createinvoicenotfounderror.md index 30c7836..b3683f6 100644 --- a/docs/models/operations/getrunwaymetricsresponse.md +++ b/docs/models/apierrors/createinvoicenotfounderror.md @@ -1,9 +1,11 @@ -# GetRunwayMetricsResponse +# CreateInvoiceNotFoundError + +Customer not found. ## Fields | Field | Type | Required | Description | Example | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `GetRunwayResponseSchema` | **float64* | :heavy_minus_sign: | Runway metrics for the authenticated team. | 12 | \ No newline at end of file +| `Message` | *string* | :heavy_check_mark: | Error message | Customer not found | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/apierrors/downloaddesktopupdatebadgatewayerror.md b/docs/models/apierrors/downloaddesktopupdatebadgatewayerror.md new file mode 100644 index 0000000..bd4987a --- /dev/null +++ b/docs/models/apierrors/downloaddesktopupdatebadgatewayerror.md @@ -0,0 +1,11 @@ +# DownloadDesktopUpdateBadGatewayError + +Failed to download artifact from upstream + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloaddesktopupdatebadrequesterror.md b/docs/models/apierrors/downloaddesktopupdatebadrequesterror.md new file mode 100644 index 0000000..479a935 --- /dev/null +++ b/docs/models/apierrors/downloaddesktopupdatebadrequesterror.md @@ -0,0 +1,11 @@ +# DownloadDesktopUpdateBadRequestError + +Invalid download URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadfilebadrequesterror.md b/docs/models/apierrors/downloadfilebadrequesterror.md new file mode 100644 index 0000000..811b1b3 --- /dev/null +++ b/docs/models/apierrors/downloadfilebadrequesterror.md @@ -0,0 +1,11 @@ +# DownloadFileBadRequestError + +Bad request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadfileinternalservererror.md b/docs/models/apierrors/downloadfileinternalservererror.md new file mode 100644 index 0000000..4958ec1 --- /dev/null +++ b/docs/models/apierrors/downloadfileinternalservererror.md @@ -0,0 +1,11 @@ +# DownloadFileInternalServerError + +Internal server error + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadfilenotfounderror.md b/docs/models/apierrors/downloadfilenotfounderror.md new file mode 100644 index 0000000..a2622f4 --- /dev/null +++ b/docs/models/apierrors/downloadfilenotfounderror.md @@ -0,0 +1,11 @@ +# DownloadFileNotFoundError + +Not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadfileunauthorizederror.md b/docs/models/apierrors/downloadfileunauthorizederror.md new file mode 100644 index 0000000..f552da7 --- /dev/null +++ b/docs/models/apierrors/downloadfileunauthorizederror.md @@ -0,0 +1,11 @@ +# DownloadFileUnauthorizedError + +Unauthorized + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadinvoicebadrequesterror.md b/docs/models/apierrors/downloadinvoicebadrequesterror.md new file mode 100644 index 0000000..a7f0521 --- /dev/null +++ b/docs/models/apierrors/downloadinvoicebadrequesterror.md @@ -0,0 +1,11 @@ +# DownloadInvoiceBadRequestError + +Bad request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadinvoiceinternalservererror.md b/docs/models/apierrors/downloadinvoiceinternalservererror.md new file mode 100644 index 0000000..8f42e0e --- /dev/null +++ b/docs/models/apierrors/downloadinvoiceinternalservererror.md @@ -0,0 +1,11 @@ +# DownloadInvoiceInternalServerError + +Internal server error + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadinvoicenotfounderror.md b/docs/models/apierrors/downloadinvoicenotfounderror.md new file mode 100644 index 0000000..d74359a --- /dev/null +++ b/docs/models/apierrors/downloadinvoicenotfounderror.md @@ -0,0 +1,11 @@ +# DownloadInvoiceNotFoundError + +Not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/downloadinvoiceunauthorizederror.md b/docs/models/apierrors/downloadinvoiceunauthorizederror.md new file mode 100644 index 0000000..1e9ea13 --- /dev/null +++ b/docs/models/apierrors/downloadinvoiceunauthorizederror.md @@ -0,0 +1,11 @@ +# DownloadInvoiceUnauthorizedError + +Unauthorized + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getdocumentpresignedurlbadrequesterror.md b/docs/models/apierrors/getdocumentpresignedurlbadrequesterror.md new file mode 100644 index 0000000..d4a3c5f --- /dev/null +++ b/docs/models/apierrors/getdocumentpresignedurlbadrequesterror.md @@ -0,0 +1,11 @@ +# GetDocumentPreSignedURLBadRequestError + +Bad request - Document file path not available + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getdocumentpresignedurlinternalservererror.md b/docs/models/apierrors/getdocumentpresignedurlinternalservererror.md new file mode 100644 index 0000000..00aa720 --- /dev/null +++ b/docs/models/apierrors/getdocumentpresignedurlinternalservererror.md @@ -0,0 +1,11 @@ +# GetDocumentPreSignedURLInternalServerError + +Internal server error - Failed to generate pre-signed URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getdocumentpresignedurlnotfounderror.md b/docs/models/apierrors/getdocumentpresignedurlnotfounderror.md new file mode 100644 index 0000000..e468e2a --- /dev/null +++ b/docs/models/apierrors/getdocumentpresignedurlnotfounderror.md @@ -0,0 +1,11 @@ +# GetDocumentPreSignedURLNotFoundError + +Document not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getinboxpresignedurlbadrequesterror.md b/docs/models/apierrors/getinboxpresignedurlbadrequesterror.md new file mode 100644 index 0000000..a168272 --- /dev/null +++ b/docs/models/apierrors/getinboxpresignedurlbadrequesterror.md @@ -0,0 +1,11 @@ +# GetInboxPreSignedURLBadRequestError + +Bad request - Attachment file path not available + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getinboxpresignedurlinternalservererror.md b/docs/models/apierrors/getinboxpresignedurlinternalservererror.md new file mode 100644 index 0000000..25d9635 --- /dev/null +++ b/docs/models/apierrors/getinboxpresignedurlinternalservererror.md @@ -0,0 +1,11 @@ +# GetInboxPreSignedURLInternalServerError + +Internal server error - Failed to generate pre-signed URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/getinboxpresignedurlnotfounderror.md b/docs/models/apierrors/getinboxpresignedurlnotfounderror.md new file mode 100644 index 0000000..02ba52c --- /dev/null +++ b/docs/models/apierrors/getinboxpresignedurlnotfounderror.md @@ -0,0 +1,11 @@ +# GetInboxPreSignedURLNotFoundError + +Inbox item not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/gettransactionattachmentpresignedurlbadrequesterror.md b/docs/models/apierrors/gettransactionattachmentpresignedurlbadrequesterror.md new file mode 100644 index 0000000..0c20bc9 --- /dev/null +++ b/docs/models/apierrors/gettransactionattachmentpresignedurlbadrequesterror.md @@ -0,0 +1,11 @@ +# GetTransactionAttachmentPreSignedURLBadRequestError + +Bad request - Attachment file path not available + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/gettransactionattachmentpresignedurlinternalservererror.md b/docs/models/apierrors/gettransactionattachmentpresignedurlinternalservererror.md new file mode 100644 index 0000000..7a84173 --- /dev/null +++ b/docs/models/apierrors/gettransactionattachmentpresignedurlinternalservererror.md @@ -0,0 +1,11 @@ +# GetTransactionAttachmentPreSignedURLInternalServerError + +Internal server error - Failed to generate pre-signed URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/gettransactionattachmentpresignedurlnotfounderror.md b/docs/models/apierrors/gettransactionattachmentpresignedurlnotfounderror.md new file mode 100644 index 0000000..3089171 --- /dev/null +++ b/docs/models/apierrors/gettransactionattachmentpresignedurlnotfounderror.md @@ -0,0 +1,11 @@ +# GetTransactionAttachmentPreSignedURLNotFoundError + +Transaction or attachment not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/gmailoauthcallbackbadrequesterror.md b/docs/models/apierrors/gmailoauthcallbackbadrequesterror.md new file mode 100644 index 0000000..2788270 --- /dev/null +++ b/docs/models/apierrors/gmailoauthcallbackbadrequesterror.md @@ -0,0 +1,11 @@ +# GmailOAuthCallbackBadRequestError + +Invalid request parameters + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/gmailoauthcallbackinternalservererror.md b/docs/models/apierrors/gmailoauthcallbackinternalservererror.md new file mode 100644 index 0000000..c821ecf --- /dev/null +++ b/docs/models/apierrors/gmailoauthcallbackinternalservererror.md @@ -0,0 +1,11 @@ +# GmailOAuthCallbackInternalServerError + +Failed to process OAuth callback + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/inboxwebhookbadrequesterror.md b/docs/models/apierrors/inboxwebhookbadrequesterror.md new file mode 100644 index 0000000..2e12c87 --- /dev/null +++ b/docs/models/apierrors/inboxwebhookbadrequesterror.md @@ -0,0 +1,12 @@ +# InboxWebhookBadRequestError + +Invalid request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `Errors` | [][operations.Error](../../models/operations/error.md) | :heavy_minus_sign: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/inboxwebhookinternalservererror.md b/docs/models/apierrors/inboxwebhookinternalservererror.md new file mode 100644 index 0000000..7dc4da9 --- /dev/null +++ b/docs/models/apierrors/inboxwebhookinternalservererror.md @@ -0,0 +1,11 @@ +# InboxWebhookInternalServerError + +Internal server error + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/oautherrorresponse.md b/docs/models/apierrors/oautherrorresponse.md new file mode 100644 index 0000000..bd63670 --- /dev/null +++ b/docs/models/apierrors/oautherrorresponse.md @@ -0,0 +1,12 @@ +# OAuthErrorResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | Error code | invalid_request | +| `ErrorDescription` | **string* | :heavy_minus_sign: | Human-readable error description | The request is missing a required parameter | +| `ErrorURI` | **string* | :heavy_minus_sign: | URI to a human-readable error page | https://docs.midday.ai/errors/invalid_request | +| `State` | **string* | :heavy_minus_sign: | Opaque state parameter from the original request | abc123xyz789_secure-random-state-value | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/apierrors/outlookoauthcallbackbadrequesterror.md b/docs/models/apierrors/outlookoauthcallbackbadrequesterror.md new file mode 100644 index 0000000..9bc39bb --- /dev/null +++ b/docs/models/apierrors/outlookoauthcallbackbadrequesterror.md @@ -0,0 +1,11 @@ +# OutlookOAuthCallbackBadRequestError + +Invalid request parameters + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/outlookoauthcallbackinternalservererror.md b/docs/models/apierrors/outlookoauthcallbackinternalservererror.md new file mode 100644 index 0000000..edaaef4 --- /dev/null +++ b/docs/models/apierrors/outlookoauthcallbackinternalservererror.md @@ -0,0 +1,11 @@ +# OutlookOAuthCallbackInternalServerError + +Failed to process OAuth callback + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/postoauthauthorizationbadrequesterror.md b/docs/models/apierrors/postoauthauthorizationbadrequesterror.md new file mode 100644 index 0000000..0291af7 --- /dev/null +++ b/docs/models/apierrors/postoauthauthorizationbadrequesterror.md @@ -0,0 +1,11 @@ +# PostOAuthAuthorizationBadRequestError + +Invalid request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `RedirectURL` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/postoauthauthorizationunauthorizederror.md b/docs/models/apierrors/postoauthauthorizationunauthorizederror.md new file mode 100644 index 0000000..52197ae --- /dev/null +++ b/docs/models/apierrors/postoauthauthorizationunauthorizederror.md @@ -0,0 +1,11 @@ +# PostOAuthAuthorizationUnauthorizedError + +Unauthorized + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `RedirectURL` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/proxyfilebadrequesterror.md b/docs/models/apierrors/proxyfilebadrequesterror.md new file mode 100644 index 0000000..f06d43e --- /dev/null +++ b/docs/models/apierrors/proxyfilebadrequesterror.md @@ -0,0 +1,11 @@ +# ProxyFileBadRequestError + +Bad request + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/proxyfileinternalservererror.md b/docs/models/apierrors/proxyfileinternalservererror.md new file mode 100644 index 0000000..a13008d --- /dev/null +++ b/docs/models/apierrors/proxyfileinternalservererror.md @@ -0,0 +1,11 @@ +# ProxyFileInternalServerError + +Internal server error + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/proxyfilenotfounderror.md b/docs/models/apierrors/proxyfilenotfounderror.md new file mode 100644 index 0000000..7b83d7b --- /dev/null +++ b/docs/models/apierrors/proxyfilenotfounderror.md @@ -0,0 +1,11 @@ +# ProxyFileNotFoundError + +Not found + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/slackoauthcallbackbadrequesterror.md b/docs/models/apierrors/slackoauthcallbackbadrequesterror.md new file mode 100644 index 0000000..91587bb --- /dev/null +++ b/docs/models/apierrors/slackoauthcallbackbadrequesterror.md @@ -0,0 +1,11 @@ +# SlackOAuthCallbackBadRequestError + +Invalid request parameters + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/apierrors/slackoauthcallbackinternalservererror.md b/docs/models/apierrors/slackoauthcallbackinternalservererror.md new file mode 100644 index 0000000..4396c8e --- /dev/null +++ b/docs/models/apierrors/slackoauthcallbackinternalservererror.md @@ -0,0 +1,11 @@ +# SlackOAuthCallbackInternalServerError + +Failed to process OAuth callback + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Error` | *string* | :heavy_check_mark: | N/A | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/account.md b/docs/models/components/account.md index 195ef9a..3d9154b 100644 --- a/docs/models/components/account.md +++ b/docs/models/components/account.md @@ -1,6 +1,6 @@ # Account -Bank account information associated with the transaction +Bank account information associated with the transaction. Null when no account is linked. ## Fields @@ -10,4 +10,4 @@ Bank account information associated with the transaction | `ID` | *string* | :heavy_check_mark: | Unique identifier of the bank account | a43dc3a5-6925-4d91-ac9c-4c1a34bdb388 | | `Name` | *string* | :heavy_check_mark: | Display name of the bank account | Company Credit Card | | `Currency` | *string* | :heavy_check_mark: | Currency of the bank account in ISO 4217 format | USD | -| `Connection` | [components.Connection](../../models/components/connection.md) | :heavy_check_mark: | Bank connection information associated with the account | {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Chase Bank",
"logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"
} | \ No newline at end of file +| `Connection` | [components.Connection](../../models/components/connection.md) | :heavy_check_mark: | Bank connection information associated with the account. Null for manual accounts. | {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Chase Bank",
"logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"
} | \ No newline at end of file diff --git a/docs/models/components/getburnrateresponseschema.md b/docs/models/components/burnrateitem.md similarity index 97% rename from docs/models/components/getburnrateresponseschema.md rename to docs/models/components/burnrateitem.md index b2ab3af..144cce8 100644 --- a/docs/models/components/getburnrateresponseschema.md +++ b/docs/models/components/burnrateitem.md @@ -1,4 +1,4 @@ -# GetBurnRateResponseSchema +# BurnRateItem ## Fields diff --git a/docs/models/components/connection.md b/docs/models/components/connection.md index b886204..4dcbce2 100644 --- a/docs/models/components/connection.md +++ b/docs/models/components/connection.md @@ -1,6 +1,6 @@ # Connection -Bank connection information associated with the account +Bank connection information associated with the account. Null for manual accounts. ## Fields diff --git a/docs/models/operations/createtransactionattachment.md b/docs/models/components/createtransactionattachment.md similarity index 100% rename from docs/models/operations/createtransactionattachment.md rename to docs/models/components/createtransactionattachment.md diff --git a/docs/models/components/errorresponse.md b/docs/models/components/errorresponse.md new file mode 100644 index 0000000..dcece45 --- /dev/null +++ b/docs/models/components/errorresponse.md @@ -0,0 +1,9 @@ +# ErrorResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | +| `Error` | *string* | :heavy_check_mark: | Error message | Internal Server Error | +| `Code` | **int64* | :heavy_minus_sign: | HTTP status code | 500 | \ No newline at end of file diff --git a/docs/models/components/granttypeauthorizationcode.md b/docs/models/components/granttypeauthorizationcode.md new file mode 100644 index 0000000..b3c9435 --- /dev/null +++ b/docs/models/components/granttypeauthorizationcode.md @@ -0,0 +1,10 @@ +# GrantTypeAuthorizationCode + +OAuth grant type, must be 'authorization_code' + + +## Values + +| Name | Value | +| --------------------------------------------- | --------------------------------------------- | +| `GrantTypeAuthorizationCodeAuthorizationCode` | authorization_code | \ No newline at end of file diff --git a/docs/models/components/granttyperefreshtoken.md b/docs/models/components/granttyperefreshtoken.md new file mode 100644 index 0000000..b903d28 --- /dev/null +++ b/docs/models/components/granttyperefreshtoken.md @@ -0,0 +1,10 @@ +# GrantTypeRefreshToken + +OAuth grant type, must be 'refresh_token' + + +## Values + +| Name | Value | +| ----------------------------------- | ----------------------------------- | +| `GrantTypeRefreshTokenRefreshToken` | refresh_token | \ No newline at end of file diff --git a/docs/models/components/notificationresponseschema.md b/docs/models/components/notificationresponseschema.md new file mode 100644 index 0000000..48e0a4a --- /dev/null +++ b/docs/models/components/notificationresponseschema.md @@ -0,0 +1,8 @@ +# NotificationResponseSchema + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `Data` | [components.NotificationSchema](../../models/components/notificationschema.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationschema.md b/docs/models/components/notificationschema.md new file mode 100644 index 0000000..cde3480 --- /dev/null +++ b/docs/models/components/notificationschema.md @@ -0,0 +1,17 @@ +# NotificationSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the notification | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `CreatedAt` | *string* | :heavy_check_mark: | ISO timestamp when the notification was created | 2024-04-15T09:00:00.000Z | +| `TeamID` | *string* | :heavy_check_mark: | Unique identifier of the team | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `UserID` | *string* | :heavy_check_mark: | Unique identifier of the user (if applicable) | c2d3e4f5-a6b7-8901-bcde-f23456789012 | +| `Type` | *string* | :heavy_check_mark: | Type of notification | transactions_created | +| `Priority` | *int64* | :heavy_check_mark: | Priority level of the notification (1-3 = user notifications, 4-10 = system) | 3 | +| `Source` | [components.Source](../../models/components/source.md) | :heavy_check_mark: | Source of the notification | system | +| `Status` | [components.NotificationSchemaStatus](../../models/components/notificationschemastatus.md) | :heavy_check_mark: | Current status of the notification | unread | +| `Metadata` | map[string]*any* | :heavy_check_mark: | Additional metadata for the notification | {
"transactionCount": 5,
"dateRange": {
"from": "2024-04-01",
"to": "2024-04-15"
}
} | +| `LastUsedAt` | *string* | :heavy_check_mark: | ISO timestamp when the notification was last used by the system | 2024-04-15T11:00:00.000Z | \ No newline at end of file diff --git a/docs/models/components/notificationschemastatus.md b/docs/models/components/notificationschemastatus.md new file mode 100644 index 0000000..d548014 --- /dev/null +++ b/docs/models/components/notificationschemastatus.md @@ -0,0 +1,12 @@ +# NotificationSchemaStatus + +Current status of the notification + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `NotificationSchemaStatusUnread` | unread | +| `NotificationSchemaStatusRead` | read | +| `NotificationSchemaStatusArchived` | archived | \ No newline at end of file diff --git a/docs/models/components/notificationsresponseschema.md b/docs/models/components/notificationsresponseschema.md new file mode 100644 index 0000000..0cf1e68 --- /dev/null +++ b/docs/models/components/notificationsresponseschema.md @@ -0,0 +1,9 @@ +# NotificationsResponseSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Data` | [][components.NotificationSchema](../../models/components/notificationschema.md) | :heavy_check_mark: | Array of notifications | +| `Meta` | [components.NotificationsResponseSchemaMeta](../../models/components/notificationsresponseschemameta.md) | :heavy_check_mark: | Pagination metadata | \ No newline at end of file diff --git a/docs/models/components/notificationsresponseschemameta.md b/docs/models/components/notificationsresponseschemameta.md new file mode 100644 index 0000000..8f87e72 --- /dev/null +++ b/docs/models/components/notificationsresponseschemameta.md @@ -0,0 +1,12 @@ +# NotificationsResponseSchemaMeta + +Pagination metadata + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `Cursor` | *string* | :heavy_check_mark: | Cursor for pagination (null if no more pages) | 40 | +| `HasPreviousPage` | *bool* | :heavy_check_mark: | Whether there are previous pages available | true | +| `HasNextPage` | *bool* | :heavy_check_mark: | Whether there are more pages available | false | \ No newline at end of file diff --git a/docs/models/components/oauthtokenendpointrequest.md b/docs/models/components/oauthtokenendpointrequest.md new file mode 100644 index 0000000..0d8a027 --- /dev/null +++ b/docs/models/components/oauthtokenendpointrequest.md @@ -0,0 +1,17 @@ +# OAuthTokenEndpointRequest + + +## Supported Types + +### OAuthTokenEndpointRequestAuthorizationCode + +```go +oAuthTokenEndpointRequest := components.CreateOAuthTokenEndpointRequestOAuthTokenEndpointRequestAuthorizationCode(components.OAuthTokenEndpointRequestAuthorizationCode{/* values here */}) +``` + +### OAuthTokenEndpointRequestRefreshToken + +```go +oAuthTokenEndpointRequest := components.CreateOAuthTokenEndpointRequestOAuthTokenEndpointRequestRefreshToken(components.OAuthTokenEndpointRequestRefreshToken{/* values here */}) +``` + diff --git a/docs/models/components/oauthtokenendpointrequestauthorizationcode.md b/docs/models/components/oauthtokenendpointrequestauthorizationcode.md new file mode 100644 index 0000000..07b1889 --- /dev/null +++ b/docs/models/components/oauthtokenendpointrequestauthorizationcode.md @@ -0,0 +1,13 @@ +# OAuthTokenEndpointRequestAuthorizationCode + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `GrantType` | [components.GrantTypeAuthorizationCode](../../models/components/granttypeauthorizationcode.md) | :heavy_check_mark: | OAuth grant type, must be 'authorization_code' | authorization_code | +| `Code` | *string* | :heavy_check_mark: | Authorization code received from authorization endpoint | mid_authorization_code_abcdef123456789 | +| `RedirectURI` | *string* | :heavy_check_mark: | Redirect URI used in authorization request | https://myapp.com/callback | +| `ClientID` | *string* | :heavy_check_mark: | Client ID of the OAuth application | mid_client_abcdef123456789 | +| `ClientSecret` | **string* | :heavy_minus_sign: | Client secret of the OAuth application (required for confidential clients) | mid_secret_abcdef123456789 | +| `CodeVerifier` | **string* | :heavy_minus_sign: | Code verifier for PKCE (required for public clients using PKCE) | dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | \ No newline at end of file diff --git a/docs/models/components/oauthtokenendpointrequestrefreshtoken.md b/docs/models/components/oauthtokenendpointrequestrefreshtoken.md new file mode 100644 index 0000000..3963c84 --- /dev/null +++ b/docs/models/components/oauthtokenendpointrequestrefreshtoken.md @@ -0,0 +1,12 @@ +# OAuthTokenEndpointRequestRefreshToken + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `GrantType` | [components.GrantTypeRefreshToken](../../models/components/granttyperefreshtoken.md) | :heavy_check_mark: | OAuth grant type, must be 'refresh_token' | refresh_token | +| `RefreshToken` | *string* | :heavy_check_mark: | Refresh token received from token endpoint | mid_rt_abcdef123456789 | +| `ClientID` | *string* | :heavy_check_mark: | Client ID of the OAuth application | mid_client_abcdef123456789 | +| `ClientSecret` | **string* | :heavy_minus_sign: | Client secret of the OAuth application (required for confidential clients) | mid_secret_abcdef123456789 | +| `Scope` | **string* | :heavy_minus_sign: | Space-separated list of requested scopes (optional) | transactions.read invoices.read | \ No newline at end of file diff --git a/docs/models/components/security.md b/docs/models/components/security.md index a89bfc4..58188a8 100644 --- a/docs/models/components/security.md +++ b/docs/models/components/security.md @@ -5,4 +5,5 @@ | Field | Type | Required | Description | Example | | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `Oauth2` | **string* | :heavy_minus_sign: | N/A | | | `Token` | **string* | :heavy_minus_sign: | N/A | MIDDAY_API_KEY | \ No newline at end of file diff --git a/docs/models/components/source.md b/docs/models/components/source.md new file mode 100644 index 0000000..979529e --- /dev/null +++ b/docs/models/components/source.md @@ -0,0 +1,11 @@ +# Source + +Source of the notification + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `SourceSystem` | system | +| `SourceUser` | user | \ No newline at end of file diff --git a/docs/models/components/transactionresponse.md b/docs/models/components/transactionresponse.md index be163e0..54944d4 100644 --- a/docs/models/components/transactionresponse.md +++ b/docs/models/components/transactionresponse.md @@ -22,6 +22,6 @@ | `Frequency` | *string* | :heavy_check_mark: | Frequency of the recurring transaction if applicable (weekly, monthly, annually, irregular) | monthly | | `IsFulfilled` | *bool* | :heavy_check_mark: | Whether the transaction has been fulfilled or processed | true | | `Note` | *string* | :heavy_check_mark: | Optional note or memo attached to the transaction | Paid with company credit card for office renovation | -| `Account` | [components.Account](../../models/components/account.md) | :heavy_check_mark: | Bank account information associated with the transaction | {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Company Credit Card",
"currency": "USD",
"connection": {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Chase Bank",
"logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"
}
} | +| `Account` | [components.Account](../../models/components/account.md) | :heavy_check_mark: | Bank account information associated with the transaction. Null when no account is linked. | {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Company Credit Card",
"currency": "USD",
"connection": {
"id": "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388",
"name": "Chase Bank",
"logoUrl": "https://cdn.midday.ai/logos/chase-bank.png"
}
} | | `Tags` | [][components.TransactionResponseTag](../../models/components/transactionresponsetag.md) | :heavy_check_mark: | Array of tags associated with the transaction for categorization and filtering | [
{
"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b",
"name": "invoice"
},
{
"id": "c8e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7c",
"name": "travel"
}
] | | `Attachments` | [][components.Attachment](../../models/components/attachment.md) | :heavy_check_mark: | Array of file attachments associated with the transaction (receipts, invoices, etc.) | [
{
"id": "b7e2f8c1-3d4a-4e2b-9f1a-2c3d4e5f6a7b",
"path": [
"e1f2d3c4-b5a6-7d8e-9f0a-1b2c3d4e5f6a",
"transactions",
"9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"receipt.pdf"
],
"size": 1928716,
"type": "application/pdf",
"filename": "receipt.pdf"
}
] | \ No newline at end of file diff --git a/docs/models/components/updateallnotificationsstatusresponseschema.md b/docs/models/components/updateallnotificationsstatusresponseschema.md new file mode 100644 index 0000000..51d879b --- /dev/null +++ b/docs/models/components/updateallnotificationsstatusresponseschema.md @@ -0,0 +1,8 @@ +# UpdateAllNotificationsStatusResponseSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `Data` | [][components.NotificationSchema](../../models/components/notificationschema.md) | :heavy_check_mark: | Array of updated notifications | \ No newline at end of file diff --git a/docs/models/components/updateallnotificationsstatusschema.md b/docs/models/components/updateallnotificationsstatusschema.md new file mode 100644 index 0000000..bc029c0 --- /dev/null +++ b/docs/models/components/updateallnotificationsstatusschema.md @@ -0,0 +1,8 @@ +# UpdateAllNotificationsStatusSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `Status` | [components.UpdateAllNotificationsStatusSchemaStatus](../../models/components/updateallnotificationsstatusschemastatus.md) | :heavy_check_mark: | The new status to apply to all notifications for the authenticated user | read | \ No newline at end of file diff --git a/docs/models/components/updateallnotificationsstatusschemastatus.md b/docs/models/components/updateallnotificationsstatusschemastatus.md new file mode 100644 index 0000000..02e0823 --- /dev/null +++ b/docs/models/components/updateallnotificationsstatusschemastatus.md @@ -0,0 +1,12 @@ +# UpdateAllNotificationsStatusSchemaStatus + +The new status to apply to all notifications for the authenticated user + + +## Values + +| Name | Value | +| -------------------------------------------------- | -------------------------------------------------- | +| `UpdateAllNotificationsStatusSchemaStatusUnread` | unread | +| `UpdateAllNotificationsStatusSchemaStatusRead` | read | +| `UpdateAllNotificationsStatusSchemaStatusArchived` | archived | \ No newline at end of file diff --git a/docs/models/operations/bottomblock.md b/docs/models/operations/bottomblock.md new file mode 100644 index 0000000..af53462 --- /dev/null +++ b/docs/models/operations/bottomblock.md @@ -0,0 +1,9 @@ +# BottomBlock + +Custom content block to display at the bottom of the invoice in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/breakdown.md b/docs/models/operations/breakdown.md new file mode 100644 index 0000000..4b83540 --- /dev/null +++ b/docs/models/operations/breakdown.md @@ -0,0 +1,11 @@ +# Breakdown + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Currency` | *string* | :heavy_check_mark: | Original currency of the invoices | EUR | +| `OriginalAmount` | *float64* | :heavy_check_mark: | Total amount in original currency | 15000.5 | +| `ConvertedAmount` | *float64* | :heavy_check_mark: | Amount converted to base currency | 16250.75 | +| `Count` | *float64* | :heavy_check_mark: | Number of invoices in this currency | 5 | \ No newline at end of file diff --git a/docs/models/operations/checkdesktopupdateresponse.md b/docs/models/operations/checkdesktopupdateresponse.md new file mode 100644 index 0000000..99176ca --- /dev/null +++ b/docs/models/operations/checkdesktopupdateresponse.md @@ -0,0 +1,9 @@ +# CheckDesktopUpdateResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.CheckDesktopUpdateResponseBody](../../models/operations/checkdesktopupdateresponsebody.md) | :heavy_minus_sign: | Update manifest in Tauri updater format | \ No newline at end of file diff --git a/docs/models/operations/checkdesktopupdateresponsebody.md b/docs/models/operations/checkdesktopupdateresponsebody.md new file mode 100644 index 0000000..887a776 --- /dev/null +++ b/docs/models/operations/checkdesktopupdateresponsebody.md @@ -0,0 +1,13 @@ +# CheckDesktopUpdateResponseBody + +Update manifest in Tauri updater format + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `Version` | *string* | :heavy_check_mark: | N/A | +| `Notes` | **string* | :heavy_minus_sign: | N/A | +| `PubDate` | **string* | :heavy_minus_sign: | N/A | +| `Platforms` | map[string][operations.Platforms](../../models/operations/platforms.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/codechallengemethod.md b/docs/models/operations/codechallengemethod.md new file mode 100644 index 0000000..73bbab8 --- /dev/null +++ b/docs/models/operations/codechallengemethod.md @@ -0,0 +1,10 @@ +# CodeChallengeMethod + +Code challenge method, must be S256 + + +## Values + +| Name | Value | +| ------------------------- | ------------------------- | +| `CodeChallengeMethodS256` | S256 | \ No newline at end of file diff --git a/docs/models/operations/companytype.md b/docs/models/operations/companytype.md new file mode 100644 index 0000000..e834439 --- /dev/null +++ b/docs/models/operations/companytype.md @@ -0,0 +1,19 @@ +# CompanyType + +Type of company or team + + +## Values + +| Name | Value | +| ------------------------ | ------------------------ | +| `CompanyTypeFreelancer` | freelancer | +| `CompanyTypeSoloFounder` | solo_founder | +| `CompanyTypeSmallTeam` | small_team | +| `CompanyTypeStartup` | startup | +| `CompanyTypeAgency` | agency | +| `CompanyTypeEcommerce` | ecommerce | +| `CompanyTypeCreator` | creator | +| `CompanyTypeNonProfit` | non_profit | +| `CompanyTypeAccountant` | accountant | +| `CompanyTypeExploring` | exploring | \ No newline at end of file diff --git a/docs/models/operations/createbankaccountresponse.md b/docs/models/operations/createbankaccountresponse.md index 93cdfab..e019dff 100644 --- a/docs/models/operations/createbankaccountresponse.md +++ b/docs/models/operations/createbankaccountresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.CreateBankAccountResponseBody](../../models/operations/createbankaccountresponsebody.md) | :heavy_minus_sign: | Bank account created | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | \ No newline at end of file +| `Object` | [*operations.CreateBankAccountResponseBody](../../models/operations/createbankaccountresponsebody.md) | :heavy_minus_sign: | Bank account created | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/createcustomerrequest.md b/docs/models/operations/createcustomerrequest.md index f47b582..0f3de2f 100644 --- a/docs/models/operations/createcustomerrequest.md +++ b/docs/models/operations/createcustomerrequest.md @@ -8,7 +8,7 @@ | `ID` | **string* | :heavy_minus_sign: | Unique identifier of the customer. Required for updates, omit for new customers | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | **string* | :heavy_minus_sign: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | **string* | :heavy_minus_sign: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Country` | **string* | :heavy_minus_sign: | Country name where the customer is located | United States | | `AddressLine1` | **string* | :heavy_minus_sign: | First line of the customer's address | 123 Main Street | | `AddressLine2` | **string* | :heavy_minus_sign: | Second line of the customer's address (suite, apartment, etc.) | Suite 400 | diff --git a/docs/models/operations/createcustomerresponse.md b/docs/models/operations/createcustomerresponse.md index 9100f9d..e7b2c21 100644 --- a/docs/models/operations/createcustomerresponse.md +++ b/docs/models/operations/createcustomerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.CreateCustomerResponseBody](../../models/operations/createcustomerresponsebody.md) | :heavy_minus_sign: | Customer created | \ No newline at end of file +| `Object` | [*operations.CreateCustomerResponseBody](../../models/operations/createcustomerresponsebody.md) | :heavy_minus_sign: | Customer created | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createcustomerresponsebody.md b/docs/models/operations/createcustomerresponsebody.md index 70c52be..67451b1 100644 --- a/docs/models/operations/createcustomerresponsebody.md +++ b/docs/models/operations/createcustomerresponsebody.md @@ -10,7 +10,7 @@ Customer created | `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | *string* | :heavy_check_mark: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | *string* | :heavy_check_mark: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Phone` | *string* | :heavy_check_mark: | Primary phone number of the customer | +1-555-123-4567 | | `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the customer was created in ISO 8601 format | 2024-05-01T12:34:56.789Z | @@ -27,4 +27,30 @@ Customer created | `Contact` | *string* | :heavy_check_mark: | Primary contact person's name at the customer organization | John Smith | | `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices created for this customer | 12 | | `ProjectCount` | *float64* | :heavy_check_mark: | Total number of projects associated with this customer | 3 | -| `Tags` | [][operations.CreateCustomerTagResponse](../../models/operations/createcustomertagresponse.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | \ No newline at end of file +| `TotalRevenue` | **float64* | :heavy_minus_sign: | Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. | 15000.5 | +| `OutstandingAmount` | **float64* | :heavy_minus_sign: | Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. | 2500 | +| `LastInvoiceDate` | **string* | :heavy_minus_sign: | Date of the most recent invoice in ISO 8601 format. Only returned in list queries. | 2024-04-15 | +| `InvoiceCurrency` | **string* | :heavy_minus_sign: | Primary currency used in invoices for this customer. Only returned in list queries. | USD | +| `Tags` | [][operations.CreateCustomerTagResponse](../../models/operations/createcustomertagresponse.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | +| `Description` | *string* | :heavy_check_mark: | AI-generated description of what the company does | A cloud-based project management platform for remote teams. | +| `Industry` | *string* | :heavy_check_mark: | Primary industry of the company | Software | +| `CompanyType` | *string* | :heavy_check_mark: | Business model type | SaaS | +| `EmployeeCount` | *string* | :heavy_check_mark: | Estimated number of employees | 51-200 | +| `FoundedYear` | *float64* | :heavy_check_mark: | Year the company was founded | 2018 | +| `EstimatedRevenue` | *string* | :heavy_check_mark: | Estimated annual revenue range | $10M-$50M | +| `FundingStage` | *string* | :heavy_check_mark: | Current funding stage | Series A | +| `TotalFunding` | *string* | :heavy_check_mark: | Total funding raised | $15M | +| `HeadquartersLocation` | *string* | :heavy_check_mark: | Company headquarters location | San Francisco, CA | +| `Timezone` | *string* | :heavy_check_mark: | IANA timezone of the company headquarters | America/Los_Angeles | +| `LinkedinURL` | *string* | :heavy_check_mark: | LinkedIn company page URL | https://linkedin.com/company/acme | +| `TwitterURL` | *string* | :heavy_check_mark: | Twitter/X profile URL | https://twitter.com/acme | +| `InstagramURL` | *string* | :heavy_check_mark: | Instagram profile URL | https://instagram.com/acme | +| `FacebookURL` | *string* | :heavy_check_mark: | Facebook page URL | https://facebook.com/acme | +| `LogoURL` | *string* | :heavy_check_mark: | URL to the company logo | https://example.com/logo.png | +| `CeoName` | *string* | :heavy_check_mark: | Name of the CEO or founder | Jane Smith | +| `FinanceContact` | *string* | :heavy_check_mark: | Name of the finance/AP contact for invoicing | John Doe | +| `FinanceContactEmail` | *string* | :heavy_check_mark: | Email of the finance/AP contact | finance@acme.com | +| `PrimaryLanguage` | *string* | :heavy_check_mark: | Primary business language (ISO 639-1 code) | en | +| `FiscalYearEnd` | *string* | :heavy_check_mark: | Month when the fiscal year ends | December | +| `EnrichmentStatus` | *string* | :heavy_check_mark: | Status of the enrichment process | completed | +| `EnrichedAt` | *string* | :heavy_check_mark: | When the customer was last enriched | 2024-05-01T12:34:56.789Z | \ No newline at end of file diff --git a/docs/models/operations/createinvoicepaymentintentrequest.md b/docs/models/operations/createinvoicepaymentintentrequest.md new file mode 100644 index 0000000..ae641ae --- /dev/null +++ b/docs/models/operations/createinvoicepaymentintentrequest.md @@ -0,0 +1,8 @@ +# CreateInvoicePaymentIntentRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `Token` | *string* | :heavy_check_mark: | Invoice token for authentication | \ No newline at end of file diff --git a/docs/models/operations/createinvoicepaymentintentresponse.md b/docs/models/operations/createinvoicepaymentintentresponse.md new file mode 100644 index 0000000..ba0edd5 --- /dev/null +++ b/docs/models/operations/createinvoicepaymentintentresponse.md @@ -0,0 +1,9 @@ +# CreateInvoicePaymentIntentResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.CreateInvoicePaymentIntentResponseBody](../../models/operations/createinvoicepaymentintentresponsebody.md) | :heavy_minus_sign: | Payment intent created | \ No newline at end of file diff --git a/docs/models/operations/createinvoicepaymentintentresponsebody.md b/docs/models/operations/createinvoicepaymentintentresponsebody.md new file mode 100644 index 0000000..68057b8 --- /dev/null +++ b/docs/models/operations/createinvoicepaymentintentresponsebody.md @@ -0,0 +1,13 @@ +# CreateInvoicePaymentIntentResponseBody + +Payment intent created + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ClientSecret` | *string* | :heavy_check_mark: | N/A | +| `Amount` | *float64* | :heavy_check_mark: | N/A | +| `Currency` | *string* | :heavy_check_mark: | N/A | +| `StripeAccountID` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createinvoicerequest.md b/docs/models/operations/createinvoicerequest.md new file mode 100644 index 0000000..12283bf --- /dev/null +++ b/docs/models/operations/createinvoicerequest.md @@ -0,0 +1,27 @@ +# CreateInvoiceRequest + +Schema for creating an invoice. The deliveryType determines if it stays as a draft, gets finalized immediately, or gets scheduled for later processing. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Template` | [operations.Template](../../models/operations/template.md) | :heavy_check_mark: | Invoice template details | | +| `FromDetails` | [*operations.FromDetails](../../models/operations/fromdetails.md) | :heavy_minus_sign: | Sender details in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc, 123 Main St, City, Country"
}
]
}
]
} | +| `CustomerID` | *string* | :heavy_check_mark: | Unique identifier for the customer (required) | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `PaymentDetails` | [*operations.PaymentDetails](../../models/operations/paymentdetails.md) | :heavy_minus_sign: | Payment details in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Bank: 123456, IBAN: DE1234567890"
}
]
}
]
} | +| `NoteDetails` | [*operations.NoteDetails](../../models/operations/notedetails.md) | :heavy_minus_sign: | Additional notes for the invoice in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Thank you for your business."
}
]
}
]
} | +| `DueDate` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Due date of the invoice in ISO 8601 format. Defaults to issue date + payment terms (30 days) if not provided. | 2024-06-30T23:59:59.000Z | +| `IssueDate` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Issue date of the invoice in ISO 8601 format. Defaults to current date if not provided. | 2024-06-01T00:00:00.000Z | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Invoice number as shown to the customer (auto-generated if not provided) | INV-2024-001 | +| `LogoURL` | **string* | :heavy_minus_sign: | URL of the logo to display on the invoice | https://example.com/logo.png | +| `Vat` | **float64* | :heavy_minus_sign: | VAT amount for the invoice | 150 | +| `Tax` | **float64* | :heavy_minus_sign: | Tax amount for the invoice | 50 | +| `Discount` | **float64* | :heavy_minus_sign: | Discount applied to the invoice | 100 | +| `TopBlock` | [*operations.TopBlock](../../models/operations/topblock.md) | :heavy_minus_sign: | Custom content block to display at the top of the invoice in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "123 Main St, City, Country"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Visit our website: "
},
{
"type": "text",
"text": "https://acme.com",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://acme.com"
}
}
]
}
]
}
]
} | +| `BottomBlock` | [*operations.BottomBlock](../../models/operations/bottomblock.md) | :heavy_minus_sign: | Custom content block to display at the bottom of the invoice in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "123 Main St, City, Country"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Visit our website: "
},
{
"type": "text",
"text": "https://acme.com",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://acme.com"
}
}
]
}
]
}
]
} | +| `Amount` | **float64* | :heavy_minus_sign: | Total amount of the invoice | 1500.75 | +| `LineItems` | [][operations.LineItem](../../models/operations/lineitem.md) | :heavy_minus_sign: | List of line items for the invoice | | +| `DeliveryType` | [operations.DeliveryType](../../models/operations/deliverytype.md) | :heavy_check_mark: | How the invoice should be processed: 'create' - finalize immediately, 'create_and_send' - finalize and send to customer, 'scheduled' - schedule for automatic processing at specified date | create | +| `ScheduledAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Scheduled date of the invoice in ISO 8601 format with timezone offset (e.g., Z or +00:00). Required when deliveryType is 'scheduled'. Must be in the future. | 2024-06-30T23:59:59.000Z | \ No newline at end of file diff --git a/docs/models/operations/createinvoiceresponse.md b/docs/models/operations/createinvoiceresponse.md new file mode 100644 index 0000000..21882f9 --- /dev/null +++ b/docs/models/operations/createinvoiceresponse.md @@ -0,0 +1,9 @@ +# CreateInvoiceResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.CreateInvoiceResponseBody](../../models/operations/createinvoiceresponsebody.md) | :heavy_minus_sign: | Invoice created successfully. Status depends on deliveryType: 'scheduled' for scheduled invoices, 'unpaid' for create/create_and_send. | \ No newline at end of file diff --git a/docs/models/operations/createinvoiceresponsebody.md b/docs/models/operations/createinvoiceresponsebody.md new file mode 100644 index 0000000..09e5070 --- /dev/null +++ b/docs/models/operations/createinvoiceresponsebody.md @@ -0,0 +1,15 @@ +# CreateInvoiceResponseBody + +Response after creating a draft invoice + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier for the draft invoice | b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a | +| `Status` | [operations.CreateInvoiceStatus](../../models/operations/createinvoicestatus.md) | :heavy_check_mark: | Current status of the invoice | draft | +| `CreatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was created (ISO 8601) | 2024-06-01T07:00:00.000Z | +| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-01T07:00:00.000Z | +| `PdfURL` | *string* | :heavy_check_mark: | Direct URL to download the invoice PDF | https://app.midday.ai/api/download/invoice?token=eyJ... | +| `PreviewURL` | *string* | :heavy_check_mark: | Direct URL to preview the invoice in browser | https://app.midday.ai/i/eyJ... | \ No newline at end of file diff --git a/docs/models/operations/createinvoicestatus.md b/docs/models/operations/createinvoicestatus.md new file mode 100644 index 0000000..d6e030d --- /dev/null +++ b/docs/models/operations/createinvoicestatus.md @@ -0,0 +1,15 @@ +# CreateInvoiceStatus + +Current status of the invoice + + +## Values + +| Name | Value | +| ------------------------------ | ------------------------------ | +| `CreateInvoiceStatusDraft` | draft | +| `CreateInvoiceStatusOverdue` | overdue | +| `CreateInvoiceStatusPaid` | paid | +| `CreateInvoiceStatusUnpaid` | unpaid | +| `CreateInvoiceStatusCanceled` | canceled | +| `CreateInvoiceStatusScheduled` | scheduled | \ No newline at end of file diff --git a/docs/models/operations/createtagresponse.md b/docs/models/operations/createtagresponse.md index 89dac50..761318b 100644 --- a/docs/models/operations/createtagresponse.md +++ b/docs/models/operations/createtagresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TagsResponse` | [*components.TagsResponse](../../models/components/tagsresponse.md) | :heavy_minus_sign: | Tag created | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `TagResponse` | [*components.TagResponse](../../models/components/tagresponse.md) | :heavy_minus_sign: | Tag created | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createtrackerentriesbulkresponse.md b/docs/models/operations/createtrackerentriesbulkresponse.md index 45851e4..0f781c4 100644 --- a/docs/models/operations/createtrackerentriesbulkresponse.md +++ b/docs/models/operations/createtrackerentriesbulkresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.CreateTrackerEntriesBulkResponseBody](../../models/operations/createtrackerentriesbulkresponsebody.md) | :heavy_minus_sign: | Tracker entries created successfully. | \ No newline at end of file +| `Object` | [*operations.CreateTrackerEntriesBulkResponseBody](../../models/operations/createtrackerentriesbulkresponsebody.md) | :heavy_minus_sign: | Tracker entries created successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createtrackerentryrequest.md b/docs/models/operations/createtrackerentryrequest.md index f80330b..1c2126d 100644 --- a/docs/models/operations/createtrackerentryrequest.md +++ b/docs/models/operations/createtrackerentryrequest.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | -| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | -| `AssignedID` | *string* | :heavy_check_mark: | Unique identifier of the user assigned to this tracker entry | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | -| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | -| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | -| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | +| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | +| `AssignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | +| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file diff --git a/docs/models/operations/createtrackerentryresponse.md b/docs/models/operations/createtrackerentryresponse.md index ddb1174..8076499 100644 --- a/docs/models/operations/createtrackerentryresponse.md +++ b/docs/models/operations/createtrackerentryresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.CreateTrackerEntryResponseBody](../../models/operations/createtrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry created successfully. | \ No newline at end of file +| `Object` | [*operations.CreateTrackerEntryResponseBody](../../models/operations/createtrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry created successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createtrackerprojectresponse.md b/docs/models/operations/createtrackerprojectresponse.md index 75223fc..d0c22bc 100644 --- a/docs/models/operations/createtrackerprojectresponse.md +++ b/docs/models/operations/createtrackerprojectresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project created successfully. | \ No newline at end of file +| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project created successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createtransactionrequest.md b/docs/models/operations/createtransactionrequest.md index 590f155..47315a6 100644 --- a/docs/models/operations/createtransactionrequest.md +++ b/docs/models/operations/createtransactionrequest.md @@ -14,4 +14,4 @@ | `CategorySlug` | **string* | :heavy_minus_sign: | Category slug for the transaction. | | `Note` | **string* | :heavy_minus_sign: | Note for the transaction. | | `Internal` | **bool* | :heavy_minus_sign: | Whether the transaction is internal. | -| `Attachments` | [][operations.CreateTransactionAttachment](../../models/operations/createtransactionattachment.md) | :heavy_minus_sign: | Array of attachments for the transaction. | \ No newline at end of file +| `Attachments` | [][components.CreateTransactionAttachment](../../models/components/createtransactionattachment.md) | :heavy_minus_sign: | Array of attachments for the transaction. | \ No newline at end of file diff --git a/docs/models/operations/createtransactionresponse.md b/docs/models/operations/createtransactionresponse.md index ede02fc..2dd2275 100644 --- a/docs/models/operations/createtransactionresponse.md +++ b/docs/models/operations/createtransactionresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction created | \ No newline at end of file +| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction created | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/createtransactionsattachment.md b/docs/models/operations/createtransactionsattachment.md deleted file mode 100644 index a02d2cc..0000000 --- a/docs/models/operations/createtransactionsattachment.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateTransactionsAttachment - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | -| `Path` | []*string* | :heavy_check_mark: | Path(s) of the attachment file(s). | -| `Name` | *string* | :heavy_check_mark: | Name of the attachment file. | -| `Size` | *float64* | :heavy_check_mark: | Size of the attachment file in bytes. | -| `Type` | *string* | :heavy_check_mark: | MIME type of the attachment file. | \ No newline at end of file diff --git a/docs/models/operations/createtransactionsresponse.md b/docs/models/operations/createtransactionsresponse.md index cf66c3f..07cb72f 100644 --- a/docs/models/operations/createtransactionsresponse.md +++ b/docs/models/operations/createtransactionsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TransactionResponses` | [][components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transactions created | \ No newline at end of file +| `TransactionResponses` | [][components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transactions created | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/currententry.md b/docs/models/operations/currententry.md index 662193f..768e528 100644 --- a/docs/models/operations/currententry.md +++ b/docs/models/operations/currententry.md @@ -5,10 +5,10 @@ Current running timer details, null if not running ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | -| `Start` | *string* | :heavy_check_mark: | N/A | -| `Description` | *string* | :heavy_check_mark: | N/A | -| `ProjectID` | *string* | :heavy_check_mark: | N/A | -| `TrackerProject` | [operations.TrackerProject](../../models/operations/trackerproject.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | N/A | +| `Start` | *string* | :heavy_check_mark: | N/A | +| `Description` | *string* | :heavy_check_mark: | N/A | +| `ProjectID` | *string* | :heavy_check_mark: | N/A | +| `TrackerProject` | [operations.GetTimerStatusTrackerProject](../../models/operations/gettimerstatustrackerproject.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/data.md b/docs/models/operations/data.md new file mode 100644 index 0000000..8806ee8 --- /dev/null +++ b/docs/models/operations/data.md @@ -0,0 +1,17 @@ +# Data + + +## Supported Types + +### StopTimerData1 + +```go +data := operations.CreateDataStopTimerData1(operations.StopTimerData1{/* values here */}) +``` + +### StopTimerData2 + +```go +data := operations.CreateDataStopTimerData2(operations.StopTimerData2{/* values here */}) +``` + diff --git a/docs/models/operations/decision.md b/docs/models/operations/decision.md new file mode 100644 index 0000000..0c2d5a6 --- /dev/null +++ b/docs/models/operations/decision.md @@ -0,0 +1,11 @@ +# Decision + +User's authorization decision + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `DecisionAllow` | allow | +| `DecisionDeny` | deny | \ No newline at end of file diff --git a/docs/models/operations/deletebankaccountrequest.md b/docs/models/operations/deletebankaccountrequest.md index e82c49a..3ef00dc 100644 --- a/docs/models/operations/deletebankaccountrequest.md +++ b/docs/models/operations/deletebankaccountrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | \ No newline at end of file diff --git a/docs/models/operations/deletebankaccountresponse.md b/docs/models/operations/deletebankaccountresponse.md index 49b7795..b5b0e31 100644 --- a/docs/models/operations/deletebankaccountresponse.md +++ b/docs/models/operations/deletebankaccountresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.DeleteBankAccountResponseBody](../../models/operations/deletebankaccountresponsebody.md) | :heavy_minus_sign: | Bank account deleted | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | \ No newline at end of file +| `Object` | [*operations.DeleteBankAccountResponseBody](../../models/operations/deletebankaccountresponsebody.md) | :heavy_minus_sign: | Bank account deleted | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/deletecustomerrequest.md b/docs/models/operations/deletecustomerrequest.md index 7a2ae02..89b2946 100644 --- a/docs/models/operations/deletecustomerrequest.md +++ b/docs/models/operations/deletecustomerrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file diff --git a/docs/models/operations/deletecustomerresponse.md b/docs/models/operations/deletecustomerresponse.md index b715831..d10e6f6 100644 --- a/docs/models/operations/deletecustomerresponse.md +++ b/docs/models/operations/deletecustomerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteCustomerResponseBody](../../models/operations/deletecustomerresponsebody.md) | :heavy_minus_sign: | Customer deleted | \ No newline at end of file +| `Object` | [*operations.DeleteCustomerResponseBody](../../models/operations/deletecustomerresponsebody.md) | :heavy_minus_sign: | Customer deleted | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletecustomerresponsebody.md b/docs/models/operations/deletecustomerresponsebody.md index baa039e..0320419 100644 --- a/docs/models/operations/deletecustomerresponsebody.md +++ b/docs/models/operations/deletecustomerresponsebody.md @@ -10,7 +10,7 @@ Customer deleted | `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | *string* | :heavy_check_mark: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | *string* | :heavy_check_mark: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Phone` | *string* | :heavy_check_mark: | Primary phone number of the customer | +1-555-123-4567 | | `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the customer was created in ISO 8601 format | 2024-05-01T12:34:56.789Z | @@ -27,4 +27,30 @@ Customer deleted | `Contact` | *string* | :heavy_check_mark: | Primary contact person's name at the customer organization | John Smith | | `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices created for this customer | 12 | | `ProjectCount` | *float64* | :heavy_check_mark: | Total number of projects associated with this customer | 3 | -| `Tags` | [][operations.DeleteCustomerTag](../../models/operations/deletecustomertag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | \ No newline at end of file +| `TotalRevenue` | **float64* | :heavy_minus_sign: | Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. | 15000.5 | +| `OutstandingAmount` | **float64* | :heavy_minus_sign: | Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. | 2500 | +| `LastInvoiceDate` | **string* | :heavy_minus_sign: | Date of the most recent invoice in ISO 8601 format. Only returned in list queries. | 2024-04-15 | +| `InvoiceCurrency` | **string* | :heavy_minus_sign: | Primary currency used in invoices for this customer. Only returned in list queries. | USD | +| `Tags` | [][operations.DeleteCustomerTag](../../models/operations/deletecustomertag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | +| `Description` | *string* | :heavy_check_mark: | AI-generated description of what the company does | A cloud-based project management platform for remote teams. | +| `Industry` | *string* | :heavy_check_mark: | Primary industry of the company | Software | +| `CompanyType` | *string* | :heavy_check_mark: | Business model type | SaaS | +| `EmployeeCount` | *string* | :heavy_check_mark: | Estimated number of employees | 51-200 | +| `FoundedYear` | *float64* | :heavy_check_mark: | Year the company was founded | 2018 | +| `EstimatedRevenue` | *string* | :heavy_check_mark: | Estimated annual revenue range | $10M-$50M | +| `FundingStage` | *string* | :heavy_check_mark: | Current funding stage | Series A | +| `TotalFunding` | *string* | :heavy_check_mark: | Total funding raised | $15M | +| `HeadquartersLocation` | *string* | :heavy_check_mark: | Company headquarters location | San Francisco, CA | +| `Timezone` | *string* | :heavy_check_mark: | IANA timezone of the company headquarters | America/Los_Angeles | +| `LinkedinURL` | *string* | :heavy_check_mark: | LinkedIn company page URL | https://linkedin.com/company/acme | +| `TwitterURL` | *string* | :heavy_check_mark: | Twitter/X profile URL | https://twitter.com/acme | +| `InstagramURL` | *string* | :heavy_check_mark: | Instagram profile URL | https://instagram.com/acme | +| `FacebookURL` | *string* | :heavy_check_mark: | Facebook page URL | https://facebook.com/acme | +| `LogoURL` | *string* | :heavy_check_mark: | URL to the company logo | https://example.com/logo.png | +| `CeoName` | *string* | :heavy_check_mark: | Name of the CEO or founder | Jane Smith | +| `FinanceContact` | *string* | :heavy_check_mark: | Name of the finance/AP contact for invoicing | John Doe | +| `FinanceContactEmail` | *string* | :heavy_check_mark: | Email of the finance/AP contact | finance@acme.com | +| `PrimaryLanguage` | *string* | :heavy_check_mark: | Primary business language (ISO 639-1 code) | en | +| `FiscalYearEnd` | *string* | :heavy_check_mark: | Month when the fiscal year ends | December | +| `EnrichmentStatus` | *string* | :heavy_check_mark: | Status of the enrichment process | completed | +| `EnrichedAt` | *string* | :heavy_check_mark: | When the customer was last enriched | 2024-05-01T12:34:56.789Z | \ No newline at end of file diff --git a/docs/models/operations/deletedocumentresponse.md b/docs/models/operations/deletedocumentresponse.md index 63ba9a0..fb9d89c 100644 --- a/docs/models/operations/deletedocumentresponse.md +++ b/docs/models/operations/deletedocumentresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteDocumentResponseBody](../../models/operations/deletedocumentresponsebody.md) | :heavy_minus_sign: | Document deleted successfully | \ No newline at end of file +| `Object` | [*operations.DeleteDocumentResponseBody](../../models/operations/deletedocumentresponsebody.md) | :heavy_minus_sign: | Document deleted successfully | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deleteinboxitemrequest.md b/docs/models/operations/deleteinboxitemrequest.md index 7e63675..2ecac89 100644 --- a/docs/models/operations/deleteinboxitemrequest.md +++ b/docs/models/operations/deleteinboxitemrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the inbox item to delete. | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file diff --git a/docs/models/operations/deleteinboxitemresponse.md b/docs/models/operations/deleteinboxitemresponse.md index 1450faf..30c17e3 100644 --- a/docs/models/operations/deleteinboxitemresponse.md +++ b/docs/models/operations/deleteinboxitemresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteInboxItemResponseBody](../../models/operations/deleteinboxitemresponsebody.md) | :heavy_minus_sign: | Delete a inbox item by its ID. | \ No newline at end of file +| `Object` | [*operations.DeleteInboxItemResponseBody](../../models/operations/deleteinboxitemresponsebody.md) | :heavy_minus_sign: | Delete a inbox item by its ID. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deleteinvoiceresponse.md b/docs/models/operations/deleteinvoiceresponse.md index a340b62..7f43eae 100644 --- a/docs/models/operations/deleteinvoiceresponse.md +++ b/docs/models/operations/deleteinvoiceresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteInvoiceResponseBody](../../models/operations/deleteinvoiceresponsebody.md) | :heavy_minus_sign: | Delete a invoice by its unique identifier for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.DeleteInvoiceResponseBody](../../models/operations/deleteinvoiceresponsebody.md) | :heavy_minus_sign: | Delete a invoice by its unique identifier for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletetagrequest.md b/docs/models/operations/deletetagrequest.md index 97af7c0..b68bba6 100644 --- a/docs/models/operations/deletetagrequest.md +++ b/docs/models/operations/deletetagrequest.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | The UUID of the tag to delete. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | \ No newline at end of file diff --git a/docs/models/operations/deletetagresponse.md b/docs/models/operations/deletetagresponse.md index 0b6480a..0b5c622 100644 --- a/docs/models/operations/deletetagresponse.md +++ b/docs/models/operations/deletetagresponse.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletetrackerentryrequest.md b/docs/models/operations/deletetrackerentryrequest.md index 01c028f..03c0cb5 100644 --- a/docs/models/operations/deletetrackerentryrequest.md +++ b/docs/models/operations/deletetrackerentryrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the tracker entry to delete | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | \ No newline at end of file diff --git a/docs/models/operations/deletetrackerentryresponse.md b/docs/models/operations/deletetrackerentryresponse.md index 343e5e8..ac86c13 100644 --- a/docs/models/operations/deletetrackerentryresponse.md +++ b/docs/models/operations/deletetrackerentryresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteTrackerEntryResponseBody](../../models/operations/deletetrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry deleted successfully. | \ No newline at end of file +| `Object` | [*operations.DeleteTrackerEntryResponseBody](../../models/operations/deletetrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry deleted successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletetrackerprojectrequest.md b/docs/models/operations/deletetrackerprojectrequest.md index 031a7e6..503d91c 100644 --- a/docs/models/operations/deletetrackerprojectrequest.md +++ b/docs/models/operations/deletetrackerprojectrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | \ No newline at end of file diff --git a/docs/models/operations/deletetrackerprojectresponse.md b/docs/models/operations/deletetrackerprojectresponse.md index db9347f..9ed26ad 100644 --- a/docs/models/operations/deletetrackerprojectresponse.md +++ b/docs/models/operations/deletetrackerprojectresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteTrackerProjectResponseBody](../../models/operations/deletetrackerprojectresponsebody.md) | :heavy_minus_sign: | Tracker project deleted successfully. | \ No newline at end of file +| `Object` | [*operations.DeleteTrackerProjectResponseBody](../../models/operations/deletetrackerprojectresponsebody.md) | :heavy_minus_sign: | Tracker project deleted successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletetransactionrequest.md b/docs/models/operations/deletetransactionrequest.md index a45cb52..03d8ce0 100644 --- a/docs/models/operations/deletetransactionrequest.md +++ b/docs/models/operations/deletetransactionrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------- | ---------------------- | ---------------------- | ---------------------- | +| `ID` | *string* | :heavy_check_mark: | Transaction ID (UUID). | \ No newline at end of file diff --git a/docs/models/operations/deletetransactionresponse.md b/docs/models/operations/deletetransactionresponse.md index c469d71..69158b4 100644 --- a/docs/models/operations/deletetransactionresponse.md +++ b/docs/models/operations/deletetransactionresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.DeleteTransactionResponseBody](../../models/operations/deletetransactionresponsebody.md) | :heavy_minus_sign: | Transaction deleted | \ No newline at end of file +| `Object` | [*operations.DeleteTransactionResponseBody](../../models/operations/deletetransactionresponsebody.md) | :heavy_minus_sign: | Transaction deleted | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deletetransactionsresponse.md b/docs/models/operations/deletetransactionsresponse.md index 75d6622..9f0f762 100644 --- a/docs/models/operations/deletetransactionsresponse.md +++ b/docs/models/operations/deletetransactionsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ResponseBodies` | [][operations.DeleteTransactionsResponseBody](../../models/operations/deletetransactionsresponsebody.md) | :heavy_minus_sign: | Transactions deleted | \ No newline at end of file +| `ResponseBodies` | [][operations.DeleteTransactionsResponseBody](../../models/operations/deletetransactionsresponsebody.md) | :heavy_minus_sign: | Transactions deleted | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/deliverytype.md b/docs/models/operations/deliverytype.md new file mode 100644 index 0000000..0bb695a --- /dev/null +++ b/docs/models/operations/deliverytype.md @@ -0,0 +1,12 @@ +# DeliveryType + +How the invoice should be processed: 'create' - finalize immediately, 'create_and_send' - finalize and send to customer, 'scheduled' - schedule for automatic processing at specified date + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `DeliveryTypeCreate` | create | +| `DeliveryTypeCreateAndSend` | create_and_send | +| `DeliveryTypeScheduled` | scheduled | \ No newline at end of file diff --git a/docs/models/operations/disconnectstriperesponse.md b/docs/models/operations/disconnectstriperesponse.md new file mode 100644 index 0000000..504caf6 --- /dev/null +++ b/docs/models/operations/disconnectstriperesponse.md @@ -0,0 +1,9 @@ +# DisconnectStripeResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.DisconnectStripeResponseBody](../../models/operations/disconnectstriperesponsebody.md) | :heavy_minus_sign: | Successfully disconnected | \ No newline at end of file diff --git a/docs/models/operations/disconnectstriperesponsebody.md b/docs/models/operations/disconnectstriperesponsebody.md new file mode 100644 index 0000000..5f6dfe1 --- /dev/null +++ b/docs/models/operations/disconnectstriperesponsebody.md @@ -0,0 +1,10 @@ +# DisconnectStripeResponseBody + +Successfully disconnected + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/downloaddesktopupdaterequest.md b/docs/models/operations/downloaddesktopupdaterequest.md new file mode 100644 index 0000000..5fffb9c --- /dev/null +++ b/docs/models/operations/downloaddesktopupdaterequest.md @@ -0,0 +1,8 @@ +# DownloadDesktopUpdateRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `URL` | *string* | :heavy_check_mark: | The artifact download URL to proxy | https://github.com/midday-ai/midday/releases/download/midday-v1.0.0/Midday.app.tar.gz | \ No newline at end of file diff --git a/docs/models/operations/downloaddesktopupdateresponse.md b/docs/models/operations/downloaddesktopupdateresponse.md new file mode 100644 index 0000000..a659969 --- /dev/null +++ b/docs/models/operations/downloaddesktopupdateresponse.md @@ -0,0 +1,9 @@ +# DownloadDesktopUpdateResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Update artifact binary | \ No newline at end of file diff --git a/docs/models/operations/downloadfilerequest.md b/docs/models/operations/downloadfilerequest.md new file mode 100644 index 0000000..2def797 --- /dev/null +++ b/docs/models/operations/downloadfilerequest.md @@ -0,0 +1,10 @@ +# DownloadFileRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Path` | *string* | :heavy_check_mark: | Path to the file in storage. Can include or exclude 'vault/' prefix. | vault/documents/2024/invoice.pdf | +| `Filename` | **string* | :heavy_minus_sign: | Optional filename for the Content-Disposition header. | invoice.pdf | +| `Fk` | *string* | :heavy_check_mark: | Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. | a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 | \ No newline at end of file diff --git a/docs/models/operations/downloadfileresponse.md b/docs/models/operations/downloadfileresponse.md new file mode 100644 index 0000000..cb7815a --- /dev/null +++ b/docs/models/operations/downloadfileresponse.md @@ -0,0 +1,9 @@ +# DownloadFileResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | File content | \ No newline at end of file diff --git a/docs/models/operations/downloadinvoicerequest.md b/docs/models/operations/downloadinvoicerequest.md new file mode 100644 index 0000000..68d5f06 --- /dev/null +++ b/docs/models/operations/downloadinvoicerequest.md @@ -0,0 +1,12 @@ +# DownloadInvoiceRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | Invoice ID (UUID). Requires team file key (fk) query parameter for authentication. | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `Fk` | **string* | :heavy_minus_sign: | Team file key for authenticated invoice access. Required when using invoice ID. This key is returned in the user data response (GET /users/me) as the `fileKey` field. | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... | +| `Token` | **string* | :heavy_minus_sign: | Invoice access token for public access. When used alone (without id), allows public access to the invoice. | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... | +| `Preview` | **bool* | :heavy_minus_sign: | If true, the PDF will be displayed inline. If false, it will be downloaded. | false | +| `Type` | [*operations.DownloadInvoiceType](../../models/operations/downloadinvoicetype.md) | :heavy_minus_sign: | Type of document to download. Use 'receipt' to download a receipt for paid invoices. | invoice | \ No newline at end of file diff --git a/docs/models/operations/downloadinvoiceresponse.md b/docs/models/operations/downloadinvoiceresponse.md new file mode 100644 index 0000000..8f0c72d --- /dev/null +++ b/docs/models/operations/downloadinvoiceresponse.md @@ -0,0 +1,9 @@ +# DownloadInvoiceResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Invoice PDF | \ No newline at end of file diff --git a/docs/models/operations/downloadinvoicetype.md b/docs/models/operations/downloadinvoicetype.md new file mode 100644 index 0000000..2422e12 --- /dev/null +++ b/docs/models/operations/downloadinvoicetype.md @@ -0,0 +1,11 @@ +# DownloadInvoiceType + +Type of document to download. Use 'receipt' to download a receipt for paid invoices. + + +## Values + +| Name | Value | +| ---------------------------- | ---------------------------- | +| `DownloadInvoiceTypeInvoice` | invoice | +| `DownloadInvoiceTypeReceipt` | receipt | \ No newline at end of file diff --git a/docs/models/operations/entry.md b/docs/models/operations/entry.md index 06e9ee8..98caedd 100644 --- a/docs/models/operations/entry.md +++ b/docs/models/operations/entry.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | -| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | -| `AssignedID` | *string* | :heavy_check_mark: | Unique identifier of the user assigned to this tracker entry | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | -| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | -| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | -| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | +| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | +| `AssignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | +| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file diff --git a/docs/models/operations/error.md b/docs/models/operations/error.md new file mode 100644 index 0000000..a30cea0 --- /dev/null +++ b/docs/models/operations/error.md @@ -0,0 +1,9 @@ +# Error + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Path` | *string* | :heavy_check_mark: | N/A | +| `Message` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/exportsettings.md b/docs/models/operations/exportsettings.md new file mode 100644 index 0000000..ace1fe0 --- /dev/null +++ b/docs/models/operations/exportsettings.md @@ -0,0 +1,15 @@ +# ExportSettings + +Export settings for transactions + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `CsvDelimiter` | *string* | :heavy_check_mark: | N/A | +| `IncludeCSV` | *bool* | :heavy_check_mark: | N/A | +| `IncludeXLSX` | *bool* | :heavy_check_mark: | N/A | +| `SendEmail` | *bool* | :heavy_check_mark: | N/A | +| `SendCopyToMe` | **bool* | :heavy_minus_sign: | N/A | +| `AccountantEmail` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/fortnoxoauthcallbackrequest.md b/docs/models/operations/fortnoxoauthcallbackrequest.md new file mode 100644 index 0000000..d443908 --- /dev/null +++ b/docs/models/operations/fortnoxoauthcallbackrequest.md @@ -0,0 +1,10 @@ +# FortnoxOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from Fortnox | +| `State` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | \ No newline at end of file diff --git a/docs/models/operations/fortnoxoauthcallbackresponse.md b/docs/models/operations/fortnoxoauthcallbackresponse.md new file mode 100644 index 0000000..19bfdd1 --- /dev/null +++ b/docs/models/operations/fortnoxoauthcallbackresponse.md @@ -0,0 +1,9 @@ +# FortnoxOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/fromdetails.md b/docs/models/operations/fromdetails.md new file mode 100644 index 0000000..4ddb1d8 --- /dev/null +++ b/docs/models/operations/fromdetails.md @@ -0,0 +1,9 @@ +# FromDetails + +Sender details in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/getbankaccountbyidrequest.md b/docs/models/operations/getbankaccountbyidrequest.md index fc1c9e9..f3a959d 100644 --- a/docs/models/operations/getbankaccountbyidrequest.md +++ b/docs/models/operations/getbankaccountbyidrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | \ No newline at end of file diff --git a/docs/models/operations/getbankaccountbyidresponse.md b/docs/models/operations/getbankaccountbyidresponse.md index f161688..7994fc1 100644 --- a/docs/models/operations/getbankaccountbyidresponse.md +++ b/docs/models/operations/getbankaccountbyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.GetBankAccountByIDResponseBody](../../models/operations/getbankaccountbyidresponsebody.md) | :heavy_minus_sign: | Bank account details | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | \ No newline at end of file +| `Object` | [*operations.GetBankAccountByIDResponseBody](../../models/operations/getbankaccountbyidresponsebody.md) | :heavy_minus_sign: | Bank account details | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/getburnratemetricsrequest.md b/docs/models/operations/getburnratemetricsrequest.md deleted file mode 100644 index 9b1fc0e..0000000 --- a/docs/models/operations/getburnratemetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetBurnRateMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getburnratemetricsresponse.md b/docs/models/operations/getburnratemetricsresponse.md deleted file mode 100644 index 21764cf..0000000 --- a/docs/models/operations/getburnratemetricsresponse.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetBurnRateMetricsResponse - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `GetBurnRateResponseSchemas` | [][components.GetBurnRateResponseSchema](../../models/components/getburnrateresponseschema.md) | :heavy_minus_sign: | Burn rate metrics for the authenticated team. | \ No newline at end of file diff --git a/docs/models/operations/getburnratereportsrequest.md b/docs/models/operations/getburnratereportsrequest.md new file mode 100644 index 0000000..154e053 --- /dev/null +++ b/docs/models/operations/getburnratereportsrequest.md @@ -0,0 +1,10 @@ +# GetBurnRateReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `To` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | \ No newline at end of file diff --git a/docs/models/operations/getburnratereportsresponse.md b/docs/models/operations/getburnratereportsresponse.md new file mode 100644 index 0000000..96fbe31 --- /dev/null +++ b/docs/models/operations/getburnratereportsresponse.md @@ -0,0 +1,10 @@ +# GetBurnRateReportsResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `GetBurnRateResponseSchema` | [][components.BurnRateItem](../../models/components/burnrateitem.md) | :heavy_minus_sign: | Burn rate reports for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getcurrenttimerdata.md b/docs/models/operations/getcurrenttimerdata.md index ec1b068..661bbc2 100644 --- a/docs/models/operations/getcurrenttimerdata.md +++ b/docs/models/operations/getcurrenttimerdata.md @@ -9,7 +9,7 @@ | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the tracker entry was created in ISO 8601 format | 2024-04-15T09:00:00.000Z | | `Duration` | *float64* | :heavy_check_mark: | Duration of the timer entry in seconds. -1 indicates running, null for paused, positive number for completed | -1 | | `Start` | *string* | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format. Null for running timers. | 2024-04-15T17:00:00.000Z | | `TeamID` | *string* | :heavy_check_mark: | Unique identifier of the team that owns this tracker entry | team-1234 | | `Description` | *string* | :heavy_check_mark: | Description or notes for the tracker entry | Worked on implementing user authentication feature | | `Rate` | *float64* | :heavy_check_mark: | Hourly rate applied to this tracker entry | 75 | diff --git a/docs/models/operations/getcurrenttimerrequest.md b/docs/models/operations/getcurrenttimerrequest.md index 1ec5507..a671c0e 100644 --- a/docs/models/operations/getcurrenttimerrequest.md +++ b/docs/models/operations/getcurrenttimerrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `AssignedID` | **string* | :heavy_minus_sign: | N/A | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `AssignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | \ No newline at end of file diff --git a/docs/models/operations/getcurrenttimerresponse.md b/docs/models/operations/getcurrenttimerresponse.md index 4eae1f3..18efb52 100644 --- a/docs/models/operations/getcurrenttimerresponse.md +++ b/docs/models/operations/getcurrenttimerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetCurrentTimerResponseBody](../../models/operations/getcurrenttimerresponsebody.md) | :heavy_minus_sign: | Current timer retrieved successfully. | \ No newline at end of file +| `Object` | [*operations.GetCurrentTimerResponseBody](../../models/operations/getcurrenttimerresponsebody.md) | :heavy_minus_sign: | Current timer retrieved successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getcurrentuserresponse.md b/docs/models/operations/getcurrentuserresponse.md index e0f3f2d..22e419e 100644 --- a/docs/models/operations/getcurrentuserresponse.md +++ b/docs/models/operations/getcurrentuserresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetCurrentUserResponseBody](../../models/operations/getcurrentuserresponsebody.md) | :heavy_minus_sign: | Retrieve the current user for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.GetCurrentUserResponseBody](../../models/operations/getcurrentuserresponsebody.md) | :heavy_minus_sign: | Retrieve the current user for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getcurrentuserresponsebody.md b/docs/models/operations/getcurrentuserresponsebody.md index b9df7ab..ec5f15d 100644 --- a/docs/models/operations/getcurrentuserresponsebody.md +++ b/docs/models/operations/getcurrentuserresponsebody.md @@ -5,16 +5,17 @@ Retrieve the current user for the authenticated team. ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | Unique identifier of the user | 123e4567-e89b-12d3-a456-426614174000 | -| `FullName` | *string* | :heavy_check_mark: | Full name of the user | Jane Doe | -| `Email` | *string* | :heavy_check_mark: | Email address of the user | jane.doe@acme.com | -| `AvatarURL` | *string* | :heavy_check_mark: | URL to the user's avatar image | https://cdn.midday.ai/avatars/jane-doe.jpg | -| `Locale` | *string* | :heavy_check_mark: | User's preferred locale for internationalization (language and region) | en-US | -| `WeekStartsOnMonday` | *bool* | :heavy_check_mark: | Whether the user's calendar week starts on Monday (true) or Sunday (false) | true | -| `Timezone` | *string* | :heavy_check_mark: | User's timezone identifier in IANA Time Zone Database format | America/New_York | -| `TimezoneAutoSync` | *bool* | :heavy_check_mark: | Whether to automatically sync timezone with browser timezone | true | -| `TimeFormat` | *float64* | :heavy_check_mark: | User's preferred time format: 12 for 12-hour format, 24 for 24-hour format | 24 | -| `DateFormat` | [operations.GetCurrentUserDateFormat](../../models/operations/getcurrentuserdateformat.md) | :heavy_check_mark: | User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' | yyyy-MM-dd | -| `Team` | [operations.GetCurrentUserTeam](../../models/operations/getcurrentuserteam.md) | :heavy_check_mark: | Team information that the user belongs to | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the user | 123e4567-e89b-12d3-a456-426614174000 | +| `FullName` | *string* | :heavy_check_mark: | Full name of the user | Jane Doe | +| `Email` | *string* | :heavy_check_mark: | Email address of the user | jane.doe@acme.com | +| `AvatarURL` | *string* | :heavy_check_mark: | URL to the user's avatar image | https://cdn.midday.ai/avatars/jane-doe.jpg | +| `Locale` | *string* | :heavy_check_mark: | User's preferred locale for internationalization (language and region) | en-US | +| `WeekStartsOnMonday` | *bool* | :heavy_check_mark: | Whether the user's calendar week starts on Monday (true) or Sunday (false) | true | +| `Timezone` | *string* | :heavy_check_mark: | User's timezone identifier in IANA Time Zone Database format | America/New_York | +| `TimezoneAutoSync` | *bool* | :heavy_check_mark: | Whether to automatically sync timezone with browser timezone | true | +| `TimeFormat` | *float64* | :heavy_check_mark: | User's preferred time format: 12 for 12-hour format, 24 for 24-hour format | 24 | +| `DateFormat` | [operations.GetCurrentUserDateFormat](../../models/operations/getcurrentuserdateformat.md) | :heavy_check_mark: | User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' | yyyy-MM-dd | +| `FileKey` | *string* | :heavy_check_mark: | Team file key (JWT token) for proxy/download access to team files. This compact JWT token contains the team ID and is shared by all team members. Use this token as the `fk` query parameter when accessing file endpoints (proxy, download). The token is team-scoped and provides access to files belonging to the user's team. Returns null if the user has no team. | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZWFtSWQiOiIxMjM0NTY3OC05YWJjLWRlZmctMTIzNC01Njc4OTBhYmNkZWYifQ.signature | +| `Team` | [operations.GetCurrentUserTeam](../../models/operations/getcurrentuserteam.md) | :heavy_check_mark: | Team information that the user belongs to | | \ No newline at end of file diff --git a/docs/models/operations/getcustomerbyidrequest.md b/docs/models/operations/getcustomerbyidrequest.md index 27953a0..c3364ba 100644 --- a/docs/models/operations/getcustomerbyidrequest.md +++ b/docs/models/operations/getcustomerbyidrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file diff --git a/docs/models/operations/getcustomerbyidresponse.md b/docs/models/operations/getcustomerbyidresponse.md index 24b4218..ef636d3 100644 --- a/docs/models/operations/getcustomerbyidresponse.md +++ b/docs/models/operations/getcustomerbyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetCustomerByIDResponseBody](../../models/operations/getcustomerbyidresponsebody.md) | :heavy_minus_sign: | Retrieve a customer by ID for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.GetCustomerByIDResponseBody](../../models/operations/getcustomerbyidresponsebody.md) | :heavy_minus_sign: | Retrieve a customer by ID for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getcustomerbyidresponsebody.md b/docs/models/operations/getcustomerbyidresponsebody.md index b2decf0..8ed2420 100644 --- a/docs/models/operations/getcustomerbyidresponsebody.md +++ b/docs/models/operations/getcustomerbyidresponsebody.md @@ -10,7 +10,7 @@ Retrieve a customer by ID for the authenticated team. | `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | *string* | :heavy_check_mark: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | *string* | :heavy_check_mark: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Phone` | *string* | :heavy_check_mark: | Primary phone number of the customer | +1-555-123-4567 | | `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the customer was created in ISO 8601 format | 2024-05-01T12:34:56.789Z | @@ -27,4 +27,30 @@ Retrieve a customer by ID for the authenticated team. | `Contact` | *string* | :heavy_check_mark: | Primary contact person's name at the customer organization | John Smith | | `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices created for this customer | 12 | | `ProjectCount` | *float64* | :heavy_check_mark: | Total number of projects associated with this customer | 3 | -| `Tags` | [][operations.GetCustomerByIDTag](../../models/operations/getcustomerbyidtag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | \ No newline at end of file +| `TotalRevenue` | **float64* | :heavy_minus_sign: | Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. | 15000.5 | +| `OutstandingAmount` | **float64* | :heavy_minus_sign: | Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. | 2500 | +| `LastInvoiceDate` | **string* | :heavy_minus_sign: | Date of the most recent invoice in ISO 8601 format. Only returned in list queries. | 2024-04-15 | +| `InvoiceCurrency` | **string* | :heavy_minus_sign: | Primary currency used in invoices for this customer. Only returned in list queries. | USD | +| `Tags` | [][operations.GetCustomerByIDTag](../../models/operations/getcustomerbyidtag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | +| `Description` | *string* | :heavy_check_mark: | AI-generated description of what the company does | A cloud-based project management platform for remote teams. | +| `Industry` | *string* | :heavy_check_mark: | Primary industry of the company | Software | +| `CompanyType` | *string* | :heavy_check_mark: | Business model type | SaaS | +| `EmployeeCount` | *string* | :heavy_check_mark: | Estimated number of employees | 51-200 | +| `FoundedYear` | *float64* | :heavy_check_mark: | Year the company was founded | 2018 | +| `EstimatedRevenue` | *string* | :heavy_check_mark: | Estimated annual revenue range | $10M-$50M | +| `FundingStage` | *string* | :heavy_check_mark: | Current funding stage | Series A | +| `TotalFunding` | *string* | :heavy_check_mark: | Total funding raised | $15M | +| `HeadquartersLocation` | *string* | :heavy_check_mark: | Company headquarters location | San Francisco, CA | +| `Timezone` | *string* | :heavy_check_mark: | IANA timezone of the company headquarters | America/Los_Angeles | +| `LinkedinURL` | *string* | :heavy_check_mark: | LinkedIn company page URL | https://linkedin.com/company/acme | +| `TwitterURL` | *string* | :heavy_check_mark: | Twitter/X profile URL | https://twitter.com/acme | +| `InstagramURL` | *string* | :heavy_check_mark: | Instagram profile URL | https://instagram.com/acme | +| `FacebookURL` | *string* | :heavy_check_mark: | Facebook page URL | https://facebook.com/acme | +| `LogoURL` | *string* | :heavy_check_mark: | URL to the company logo | https://example.com/logo.png | +| `CeoName` | *string* | :heavy_check_mark: | Name of the CEO or founder | Jane Smith | +| `FinanceContact` | *string* | :heavy_check_mark: | Name of the finance/AP contact for invoicing | John Doe | +| `FinanceContactEmail` | *string* | :heavy_check_mark: | Email of the finance/AP contact | finance@acme.com | +| `PrimaryLanguage` | *string* | :heavy_check_mark: | Primary business language (ISO 639-1 code) | en | +| `FiscalYearEnd` | *string* | :heavy_check_mark: | Month when the fiscal year ends | December | +| `EnrichmentStatus` | *string* | :heavy_check_mark: | Status of the enrichment process | completed | +| `EnrichedAt` | *string* | :heavy_check_mark: | When the customer was last enriched | 2024-05-01T12:34:56.789Z | \ No newline at end of file diff --git a/docs/models/operations/getdocumentbyidresponse.md b/docs/models/operations/getdocumentbyidresponse.md index 9f0a87b..546dc62 100644 --- a/docs/models/operations/getdocumentbyidresponse.md +++ b/docs/models/operations/getdocumentbyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.GetDocumentByIDResponseBody](../../models/operations/getdocumentbyidresponsebody.md) | :heavy_minus_sign: | Retrieve a document by its unique identifier | {
"id": "doc_1234567890abcdef",
"title": "Invoice April 2024",
"pathTokens": [
"invoices",
"2024",
"april",
"invoice-123.pdf"
],
"metadata": {
"size": 204800,
"mimetype": "application/pdf"
},
"processingStatus": "processed",
"summary": "Invoice for April 2024, total $1,200.00",
"date": "2024-04-30"
} | \ No newline at end of file +| `Object` | [*operations.GetDocumentByIDResponseBody](../../models/operations/getdocumentbyidresponsebody.md) | :heavy_minus_sign: | Retrieve a document by its unique identifier | {
"id": "doc_1234567890abcdef",
"title": "Invoice April 2024",
"pathTokens": [
"invoices",
"2024",
"april",
"invoice-123.pdf"
],
"metadata": {
"size": 204800,
"mimetype": "application/pdf"
},
"processingStatus": "processed",
"summary": "Invoice for April 2024, total $1,200.00",
"date": "2024-04-30"
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/getdocumentpresignedurlrequest.md b/docs/models/operations/getdocumentpresignedurlrequest.md new file mode 100644 index 0000000..66f0aa9 --- /dev/null +++ b/docs/models/operations/getdocumentpresignedurlrequest.md @@ -0,0 +1,9 @@ +# GetDocumentPreSignedURLRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the document to generate a pre-signed URL for | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `Download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | \ No newline at end of file diff --git a/docs/models/operations/getdocumentpresignedurlresponse.md b/docs/models/operations/getdocumentpresignedurlresponse.md new file mode 100644 index 0000000..8dda133 --- /dev/null +++ b/docs/models/operations/getdocumentpresignedurlresponse.md @@ -0,0 +1,9 @@ +# GetDocumentPreSignedURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetDocumentPreSignedURLResponseBody](../../models/operations/getdocumentpresignedurlresponsebody.md) | :heavy_minus_sign: | Pre-signed URL generated successfully | \ No newline at end of file diff --git a/docs/models/operations/getdocumentpresignedurlresponsebody.md b/docs/models/operations/getdocumentpresignedurlresponsebody.md new file mode 100644 index 0000000..10397c1 --- /dev/null +++ b/docs/models/operations/getdocumentpresignedurlresponsebody.md @@ -0,0 +1,12 @@ +# GetDocumentPreSignedURLResponseBody + +Pre-signed URL generated successfully + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `URL` | *string* | :heavy_check_mark: | Pre-signed URL for accessing the document, valid for 60 seconds | https://service.midday.ai/storage/v1/object/sign/vault/documents/2024/invoice.pdf?token=abc123&expires=1640995200 | +| `ExpiresAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | ISO 8601 timestamp when the URL expires | 2024-04-15T10:01:00.000Z | +| `FileName` | *string* | :heavy_check_mark: | Original filename of the document | invoice-april-2024.pdf | \ No newline at end of file diff --git a/docs/models/operations/getexpensesmetricsrequest.md b/docs/models/operations/getexpensesmetricsrequest.md deleted file mode 100644 index e7af1e1..0000000 --- a/docs/models/operations/getexpensesmetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetExpensesMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getexpensesreportsrequest.md b/docs/models/operations/getexpensesreportsrequest.md new file mode 100644 index 0000000..f7bf82d --- /dev/null +++ b/docs/models/operations/getexpensesreportsrequest.md @@ -0,0 +1,10 @@ +# GetExpensesReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `To` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | \ No newline at end of file diff --git a/docs/models/operations/getexpensesreportsresponse.md b/docs/models/operations/getexpensesreportsresponse.md new file mode 100644 index 0000000..2ff466a --- /dev/null +++ b/docs/models/operations/getexpensesreportsresponse.md @@ -0,0 +1,10 @@ +# GetExpensesReportsResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `GetExpensesResponseSchema` | [*components.GetExpensesResponseSchema](../../models/components/getexpensesresponseschema.md) | :heavy_minus_sign: | Expense reports for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getfortnoxinstallurlresponse.md b/docs/models/operations/getfortnoxinstallurlresponse.md new file mode 100644 index 0000000..4dfd637 --- /dev/null +++ b/docs/models/operations/getfortnoxinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetFortnoxInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetFortnoxInstallURLResponseBody](../../models/operations/getfortnoxinstallurlresponsebody.md) | :heavy_minus_sign: | Fortnox install URL | \ No newline at end of file diff --git a/docs/models/operations/getfortnoxinstallurlresponsebody.md b/docs/models/operations/getfortnoxinstallurlresponsebody.md new file mode 100644 index 0000000..99d0501 --- /dev/null +++ b/docs/models/operations/getfortnoxinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetFortnoxInstallURLResponseBody + +Fortnox install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getgmailinstallurlresponse.md b/docs/models/operations/getgmailinstallurlresponse.md new file mode 100644 index 0000000..51c1d57 --- /dev/null +++ b/docs/models/operations/getgmailinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetGmailInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetGmailInstallURLResponseBody](../../models/operations/getgmailinstallurlresponsebody.md) | :heavy_minus_sign: | Gmail install URL | \ No newline at end of file diff --git a/docs/models/operations/getgmailinstallurlresponsebody.md b/docs/models/operations/getgmailinstallurlresponsebody.md new file mode 100644 index 0000000..e8467cd --- /dev/null +++ b/docs/models/operations/getgmailinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetGmailInstallURLResponseBody + +Gmail install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getinboxitembyidrequest.md b/docs/models/operations/getinboxitembyidrequest.md index d179d3d..d0ade0b 100644 --- a/docs/models/operations/getinboxitembyidrequest.md +++ b/docs/models/operations/getinboxitembyidrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the inbox item. | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | \ No newline at end of file diff --git a/docs/models/operations/getinboxitembyidresponse.md b/docs/models/operations/getinboxitembyidresponse.md index 480fe31..3dd32aa 100644 --- a/docs/models/operations/getinboxitembyidresponse.md +++ b/docs/models/operations/getinboxitembyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetInboxItemByIDResponseBody](../../models/operations/getinboxitembyidresponsebody.md) | :heavy_minus_sign: | Retrieve an inbox item by its ID. | \ No newline at end of file +| `Object` | [*operations.GetInboxItemByIDResponseBody](../../models/operations/getinboxitembyidresponsebody.md) | :heavy_minus_sign: | Retrieve an inbox item by its ID. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getinboxpresignedurlrequest.md b/docs/models/operations/getinboxpresignedurlrequest.md new file mode 100644 index 0000000..cefc766 --- /dev/null +++ b/docs/models/operations/getinboxpresignedurlrequest.md @@ -0,0 +1,9 @@ +# GetInboxPreSignedURLRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the inbox item to generate a pre-signed URL for | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `Download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | \ No newline at end of file diff --git a/docs/models/operations/getinboxpresignedurlresponse.md b/docs/models/operations/getinboxpresignedurlresponse.md new file mode 100644 index 0000000..b8bfa7e --- /dev/null +++ b/docs/models/operations/getinboxpresignedurlresponse.md @@ -0,0 +1,9 @@ +# GetInboxPreSignedURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetInboxPreSignedURLResponseBody](../../models/operations/getinboxpresignedurlresponsebody.md) | :heavy_minus_sign: | Pre-signed URL generated successfully | \ No newline at end of file diff --git a/docs/models/operations/getinboxpresignedurlresponsebody.md b/docs/models/operations/getinboxpresignedurlresponsebody.md new file mode 100644 index 0000000..00bb7f8 --- /dev/null +++ b/docs/models/operations/getinboxpresignedurlresponsebody.md @@ -0,0 +1,12 @@ +# GetInboxPreSignedURLResponseBody + +Pre-signed URL generated successfully + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `URL` | *string* | :heavy_check_mark: | Pre-signed URL for accessing the inbox attachment, valid for 60 seconds | https://service.midday.ai/storage/v1/object/sign/vault/inbox/document.pdf?token=abc123&expires=1640995200 | +| `ExpiresAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | ISO 8601 timestamp when the URL expires | 2024-04-15T10:01:00.000Z | +| `FileName` | *string* | :heavy_check_mark: | Original filename of the inbox attachment | invoice.pdf | \ No newline at end of file diff --git a/docs/models/operations/getinvoicebyidresponse.md b/docs/models/operations/getinvoicebyidresponse.md index 467ec9c..b772012 100644 --- a/docs/models/operations/getinvoicebyidresponse.md +++ b/docs/models/operations/getinvoicebyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetInvoiceByIDResponseBody](../../models/operations/getinvoicebyidresponsebody.md) | :heavy_minus_sign: | Retrieve a invoice by its unique identifier for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.GetInvoiceByIDResponseBody](../../models/operations/getinvoicebyidresponsebody.md) | :heavy_minus_sign: | Retrieve a invoice by its unique identifier for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getinvoicebyidresponsebody.md b/docs/models/operations/getinvoicebyidresponsebody.md index 49a7c05..ed6afbe 100644 --- a/docs/models/operations/getinvoicebyidresponsebody.md +++ b/docs/models/operations/getinvoicebyidresponsebody.md @@ -11,8 +11,8 @@ Invoice object | `Status` | [operations.GetInvoiceByIDStatus](../../models/operations/getinvoicebyidstatus.md) | :heavy_check_mark: | Current status of the invoice | paid | | `DueDate` | *string* | :heavy_check_mark: | Due date of the invoice in ISO 8601 format | 2024-06-30T23:59:59.000Z | | `IssueDate` | *string* | :heavy_check_mark: | Issue date of the invoice in ISO 8601 format | 2024-06-01T00:00:00.000Z | -| `InvoiceNumber` | *string* | :heavy_check_mark: | Invoice number as shown to the customer | INV-2024-001 | -| `Amount` | *float64* | :heavy_check_mark: | Total amount of the invoice | 1500.75 | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Invoice number as shown to the customer (auto-generated if not provided) | INV-2024-001 | +| `Amount` | *float64* | :heavy_check_mark: | Total amount of the invoice, or null if not yet calculated | 1500.75 | | `Currency` | *string* | :heavy_check_mark: | Currency code (ISO 4217) for the invoice amount | USD | | `Customer` | [operations.GetInvoiceByIDCustomer](../../models/operations/getinvoicebyidcustomer.md) | :heavy_check_mark: | Customer details | | | `PaidAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was paid (ISO 8601), or null if unpaid | 2024-06-15T12:00:00.000Z | @@ -27,4 +27,6 @@ Invoice object | `SentTo` | *string* | :heavy_check_mark: | Email address to which the invoice was sent, or null if not sent | billing@acme.com | | `SentAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was sent (ISO 8601), or null if not sent | 2024-06-02T08:00:00.000Z | | `CreatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was created (ISO 8601) | 2024-06-01T07:00:00.000Z | -| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-15T10:00:00.000Z | \ No newline at end of file +| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-15T10:00:00.000Z | +| `PdfURL` | *string* | :heavy_check_mark: | URL to download the invoice PDF, or null if not generated | https://app.midday.ai/api/download/invoice?token=eef58951-1682-4062-b010-425866032390 | +| `PreviewURL` | *string* | :heavy_check_mark: | URL to preview the invoice in the browser, or null if not generated | https://app.midday.ai/i/eef58951-1682-4062-b010-425866032390 | \ No newline at end of file diff --git a/docs/models/operations/getinvoicepaymentstatusresponse.md b/docs/models/operations/getinvoicepaymentstatusresponse.md new file mode 100644 index 0000000..7c3e7cd --- /dev/null +++ b/docs/models/operations/getinvoicepaymentstatusresponse.md @@ -0,0 +1,10 @@ +# GetInvoicePaymentStatusResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetInvoicePaymentStatusResponseBody](../../models/operations/getinvoicepaymentstatusresponsebody.md) | :heavy_minus_sign: | Payment status for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getinvoicespaymentstatusresponsebody.md b/docs/models/operations/getinvoicepaymentstatusresponsebody.md similarity index 96% rename from docs/models/operations/getinvoicespaymentstatusresponsebody.md rename to docs/models/operations/getinvoicepaymentstatusresponsebody.md index 3cd3b0b..0619dcf 100644 --- a/docs/models/operations/getinvoicespaymentstatusresponsebody.md +++ b/docs/models/operations/getinvoicepaymentstatusresponsebody.md @@ -1,4 +1,4 @@ -# GetInvoicesPaymentStatusResponseBody +# GetInvoicePaymentStatusResponseBody Payment status for the authenticated team. diff --git a/docs/models/operations/getinvoicespaymentstatusresponse.md b/docs/models/operations/getinvoicespaymentstatusresponse.md deleted file mode 100644 index fca2d74..0000000 --- a/docs/models/operations/getinvoicespaymentstatusresponse.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetInvoicesPaymentStatusResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetInvoicesPaymentStatusResponseBody](../../models/operations/getinvoicespaymentstatusresponsebody.md) | :heavy_minus_sign: | Payment status for the authenticated team. | \ No newline at end of file diff --git a/docs/models/operations/getinvoicesummaryrequest.md b/docs/models/operations/getinvoicesummaryrequest.md index 9d08efd..0e75156 100644 --- a/docs/models/operations/getinvoicesummaryrequest.md +++ b/docs/models/operations/getinvoicesummaryrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `Status` | [*operations.GetInvoiceSummaryStatus](../../models/operations/getinvoicesummarystatus.md) | :heavy_minus_sign: | Filter summary by invoice status | paid | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Statuses` | [][operations.GetInvoiceSummaryStatus](../../models/operations/getinvoicesummarystatus.md) | :heavy_minus_sign: | Filter summary by invoice statuses | [
"draft",
"unpaid"
] | \ No newline at end of file diff --git a/docs/models/operations/getinvoicesummaryresponse.md b/docs/models/operations/getinvoicesummaryresponse.md index b83ed77..7bd7530 100644 --- a/docs/models/operations/getinvoicesummaryresponse.md +++ b/docs/models/operations/getinvoicesummaryresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `ResponseBodies` | [][operations.GetInvoiceSummaryResponseBody](../../models/operations/getinvoicesummaryresponsebody.md) | :heavy_minus_sign: | Summary of invoices for the authenticated team. | [
{
"currency": "SEK",
"totalAmount": 224171.25,
"invoiceCount": 15
}
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | +| `Object` | [*operations.GetInvoiceSummaryResponseBody](../../models/operations/getinvoicesummaryresponsebody.md) | :heavy_minus_sign: | Summary of invoices for the authenticated team. | {
"currency": "USD",
"totalAmount": 224171.25,
"invoiceCount": 15,
"breakdown": [
{
"currency": "EUR",
"originalAmount": 15000.5,
"convertedAmount": 16250.75,
"count": 5
},
{
"currency": "GBP",
"originalAmount": 8000.25,
"convertedAmount": 9200.5,
"count": 3
}
]
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/getinvoicesummaryresponsebody.md b/docs/models/operations/getinvoicesummaryresponsebody.md index e8dbb29..1067fd9 100644 --- a/docs/models/operations/getinvoicesummaryresponsebody.md +++ b/docs/models/operations/getinvoicesummaryresponsebody.md @@ -1,10 +1,13 @@ # GetInvoiceSummaryResponseBody +Invoice summary object containing total amount converted to team's base currency and total invoice count. + ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `Currency` | *string* | :heavy_check_mark: | Currency of the invoice | SEK | -| `TotalAmount` | *float64* | :heavy_check_mark: | Total amount of the invoice | 224171.25 | -| `InvoiceCount` | *float64* | :heavy_check_mark: | Number of invoices for this currency | 15 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Currency` | *string* | :heavy_check_mark: | Base currency of the team | USD | +| `TotalAmount` | *float64* | :heavy_check_mark: | Total amount of all invoices converted to base currency | 224171.25 | +| `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices | 15 | +| `Breakdown` | [][operations.Breakdown](../../models/operations/breakdown.md) | :heavy_minus_sign: | Currency breakdown when multiple currencies are involved | [
{
"currency": "EUR",
"originalAmount": 15000.5,
"convertedAmount": 16250.75,
"count": 5
},
{
"currency": "GBP",
"originalAmount": 8000.25,
"convertedAmount": 9200.5,
"count": 3
}
] | \ No newline at end of file diff --git a/docs/models/operations/getinvoicesummarystatus.md b/docs/models/operations/getinvoicesummarystatus.md index fa06603..39184f5 100644 --- a/docs/models/operations/getinvoicesummarystatus.md +++ b/docs/models/operations/getinvoicesummarystatus.md @@ -1,14 +1,13 @@ # GetInvoiceSummaryStatus -Filter summary by invoice status - ## Values -| Name | Value | -| --------------------------------- | --------------------------------- | -| `GetInvoiceSummaryStatusDraft` | draft | -| `GetInvoiceSummaryStatusOverdue` | overdue | -| `GetInvoiceSummaryStatusPaid` | paid | -| `GetInvoiceSummaryStatusUnpaid` | unpaid | -| `GetInvoiceSummaryStatusCanceled` | canceled | \ No newline at end of file +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `GetInvoiceSummaryStatusDraft` | draft | +| `GetInvoiceSummaryStatusOverdue` | overdue | +| `GetInvoiceSummaryStatusPaid` | paid | +| `GetInvoiceSummaryStatusUnpaid` | unpaid | +| `GetInvoiceSummaryStatusCanceled` | canceled | +| `GetInvoiceSummaryStatusScheduled` | scheduled | \ No newline at end of file diff --git a/docs/models/operations/getoauthauthorizationrequest.md b/docs/models/operations/getoauthauthorizationrequest.md new file mode 100644 index 0000000..4afda20 --- /dev/null +++ b/docs/models/operations/getoauthauthorizationrequest.md @@ -0,0 +1,15 @@ +# GetOAuthAuthorizationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `ResponseType` | [operations.ResponseType](../../models/operations/responsetype.md) | :heavy_check_mark: | OAuth response type, must be 'code' | code | +| `ClientID` | *string* | :heavy_check_mark: | Client ID of the OAuth application | mid_client_abcdef123456789 | +| `RedirectURI` | *string* | :heavy_check_mark: | Redirect URI for OAuth callback | https://myapp.com/callback | +| `Scope` | *string* | :heavy_check_mark: | Space-separated list of requested scopes | transactions.read invoices.read | +| `State` | *string* | :heavy_check_mark: | Opaque state parameter for CSRF protection | abc123xyz789_secure-random-state-value | +| `CodeChallenge` | **string* | :heavy_minus_sign: | Code challenge for PKCE (S256) | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `CodeChallengeMethod` | [*operations.CodeChallengeMethod](../../models/operations/codechallengemethod.md) | :heavy_minus_sign: | Code challenge method, must be S256 | S256 | +| `Resource` | **string* | :heavy_minus_sign: | Resource parameter per RFC 9728 — identifies the MCP server | https://api.midday.ai | \ No newline at end of file diff --git a/docs/models/operations/getoauthauthorizationresponse.md b/docs/models/operations/getoauthauthorizationresponse.md new file mode 100644 index 0000000..851d3d1 --- /dev/null +++ b/docs/models/operations/getoauthauthorizationresponse.md @@ -0,0 +1,9 @@ +# GetOAuthAuthorizationResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetOAuthAuthorizationResponseBody](../../models/operations/getoauthauthorizationresponsebody.md) | :heavy_minus_sign: | Application information for consent screen | \ No newline at end of file diff --git a/docs/models/operations/getoauthauthorizationresponsebody.md b/docs/models/operations/getoauthauthorizationresponsebody.md new file mode 100644 index 0000000..159c51f --- /dev/null +++ b/docs/models/operations/getoauthauthorizationresponsebody.md @@ -0,0 +1,23 @@ +# GetOAuthAuthorizationResponseBody + +Application information for consent screen + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Application ID | 123e4567-e89b-12d3-a456-426614174000 | +| `Name` | *string* | :heavy_check_mark: | Application name | My Raycast Extension | +| `Description` | *string* | :heavy_check_mark: | Application description | A Raycast extension for managing transactions | +| `Overview` | *string* | :heavy_check_mark: | Application overview | This application provides advanced transaction management features including:
- Real-time sync
- Advanced filtering | +| `DeveloperName` | *string* | :heavy_check_mark: | The person or company developing this application | Acme Corp | +| `LogoURL` | *string* | :heavy_check_mark: | Application logo URL | https://example.com/logo.png | +| `Website` | *string* | :heavy_check_mark: | Application website | https://myapp.com | +| `InstallURL` | *string* | :heavy_check_mark: | An optional URL for installing the application | https://myapp.com/install | +| `Screenshots` | []*string* | :heavy_check_mark: | Up to 4 screenshots that will be displayed on the apps page | [
"https://example.com/screenshot1.png",
"https://example.com/screenshot2.png"
] | +| `ClientID` | *string* | :heavy_check_mark: | Client ID | mid_client_abcdef123456789 | +| `Scopes` | []*string* | :heavy_check_mark: | Requested scopes | [
"transactions.read",
"invoices.read"
] | +| `RedirectURI` | *string* | :heavy_check_mark: | Redirect URI | https://myapp.com/callback | +| `State` | **string* | :heavy_minus_sign: | Opaque state parameter | abc123xyz789_secure-random-state-value | +| `Status` | [operations.GetOAuthAuthorizationStatus](../../models/operations/getoauthauthorizationstatus.md) | :heavy_check_mark: | Application verification status | approved | \ No newline at end of file diff --git a/docs/models/operations/getoauthauthorizationstatus.md b/docs/models/operations/getoauthauthorizationstatus.md new file mode 100644 index 0000000..cff75e3 --- /dev/null +++ b/docs/models/operations/getoauthauthorizationstatus.md @@ -0,0 +1,13 @@ +# GetOAuthAuthorizationStatus + +Application verification status + + +## Values + +| Name | Value | +| ------------------------------------- | ------------------------------------- | +| `GetOAuthAuthorizationStatusDraft` | draft | +| `GetOAuthAuthorizationStatusPending` | pending | +| `GetOAuthAuthorizationStatusApproved` | approved | +| `GetOAuthAuthorizationStatusRejected` | rejected | \ No newline at end of file diff --git a/docs/models/operations/getoutlookinstallurlresponse.md b/docs/models/operations/getoutlookinstallurlresponse.md new file mode 100644 index 0000000..13649fa --- /dev/null +++ b/docs/models/operations/getoutlookinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetOutlookInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetOutlookInstallURLResponseBody](../../models/operations/getoutlookinstallurlresponsebody.md) | :heavy_minus_sign: | Outlook install URL | \ No newline at end of file diff --git a/docs/models/operations/getoutlookinstallurlresponsebody.md b/docs/models/operations/getoutlookinstallurlresponsebody.md new file mode 100644 index 0000000..1df9d69 --- /dev/null +++ b/docs/models/operations/getoutlookinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetOutlookInstallURLResponseBody + +Outlook install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getprofitmetricsrequest.md b/docs/models/operations/getprofitmetricsrequest.md deleted file mode 100644 index 03b4a9f..0000000 --- a/docs/models/operations/getprofitmetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetProfitMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getprofitreportsrequest.md b/docs/models/operations/getprofitreportsrequest.md new file mode 100644 index 0000000..8715738 --- /dev/null +++ b/docs/models/operations/getprofitreportsrequest.md @@ -0,0 +1,11 @@ +# GetProfitReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `To` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `RevenueType` | [*operations.GetProfitReportsRevenueType](../../models/operations/getprofitreportsrevenuetype.md) | :heavy_minus_sign: | Type of revenue calculation | net | \ No newline at end of file diff --git a/docs/models/operations/getprofitmetricsresponse.md b/docs/models/operations/getprofitreportsresponse.md similarity index 75% rename from docs/models/operations/getprofitmetricsresponse.md rename to docs/models/operations/getprofitreportsresponse.md index e2c6759..5a0056d 100644 --- a/docs/models/operations/getprofitmetricsresponse.md +++ b/docs/models/operations/getprofitreportsresponse.md @@ -1,4 +1,4 @@ -# GetProfitMetricsResponse +# GetProfitReportsResponse ## Fields @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `GetProfitResponseSchema` | [*components.GetProfitResponseSchema](../../models/components/getprofitresponseschema.md) | :heavy_minus_sign: | Profit metrics for the authenticated team. | \ No newline at end of file +| `GetProfitResponseSchema` | [*components.GetProfitResponseSchema](../../models/components/getprofitresponseschema.md) | :heavy_minus_sign: | Profit reports for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getprofitreportsrevenuetype.md b/docs/models/operations/getprofitreportsrevenuetype.md new file mode 100644 index 0000000..6ea6c13 --- /dev/null +++ b/docs/models/operations/getprofitreportsrevenuetype.md @@ -0,0 +1,11 @@ +# GetProfitReportsRevenueType + +Type of revenue calculation + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `GetProfitReportsRevenueTypeGross` | gross | +| `GetProfitReportsRevenueTypeNet` | net | \ No newline at end of file diff --git a/docs/models/operations/getquickbooksinstallurlresponse.md b/docs/models/operations/getquickbooksinstallurlresponse.md new file mode 100644 index 0000000..e8eca2a --- /dev/null +++ b/docs/models/operations/getquickbooksinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetQuickBooksInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetQuickBooksInstallURLResponseBody](../../models/operations/getquickbooksinstallurlresponsebody.md) | :heavy_minus_sign: | QuickBooks install URL | \ No newline at end of file diff --git a/docs/models/operations/getquickbooksinstallurlresponsebody.md b/docs/models/operations/getquickbooksinstallurlresponsebody.md new file mode 100644 index 0000000..c652c7e --- /dev/null +++ b/docs/models/operations/getquickbooksinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetQuickBooksInstallURLResponseBody + +QuickBooks install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getrevenuemetricsrequest.md b/docs/models/operations/getrevenuemetricsrequest.md deleted file mode 100644 index a510485..0000000 --- a/docs/models/operations/getrevenuemetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetRevenueMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getrevenuereportsrequest.md b/docs/models/operations/getrevenuereportsrequest.md new file mode 100644 index 0000000..3c2f409 --- /dev/null +++ b/docs/models/operations/getrevenuereportsrequest.md @@ -0,0 +1,11 @@ +# GetRevenueReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `To` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `RevenueType` | [*operations.GetRevenueReportsRevenueType](../../models/operations/getrevenuereportsrevenuetype.md) | :heavy_minus_sign: | Type of revenue calculation | net | \ No newline at end of file diff --git a/docs/models/operations/getrevenuereportsresponse.md b/docs/models/operations/getrevenuereportsresponse.md new file mode 100644 index 0000000..ec0ecb4 --- /dev/null +++ b/docs/models/operations/getrevenuereportsresponse.md @@ -0,0 +1,10 @@ +# GetRevenueReportsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `GetRevenueResponseSchema` | [*components.GetRevenueResponseSchema](../../models/components/getrevenueresponseschema.md) | :heavy_minus_sign: | Revenue reports for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getrevenuereportsrevenuetype.md b/docs/models/operations/getrevenuereportsrevenuetype.md new file mode 100644 index 0000000..d680fd7 --- /dev/null +++ b/docs/models/operations/getrevenuereportsrevenuetype.md @@ -0,0 +1,11 @@ +# GetRevenueReportsRevenueType + +Type of revenue calculation + + +## Values + +| Name | Value | +| ----------------------------------- | ----------------------------------- | +| `GetRevenueReportsRevenueTypeGross` | gross | +| `GetRevenueReportsRevenueTypeNet` | net | \ No newline at end of file diff --git a/docs/models/operations/getrunwaymetricsrequest.md b/docs/models/operations/getrunwaymetricsrequest.md deleted file mode 100644 index 6600374..0000000 --- a/docs/models/operations/getrunwaymetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetRunwayMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getrunwayreportsrequest.md b/docs/models/operations/getrunwayreportsrequest.md new file mode 100644 index 0000000..1b27061 --- /dev/null +++ b/docs/models/operations/getrunwayreportsrequest.md @@ -0,0 +1,8 @@ +# GetRunwayReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | \ No newline at end of file diff --git a/docs/models/operations/getrunwayreportsresponse.md b/docs/models/operations/getrunwayreportsresponse.md new file mode 100644 index 0000000..e57415b --- /dev/null +++ b/docs/models/operations/getrunwayreportsresponse.md @@ -0,0 +1,10 @@ +# GetRunwayReportsResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | +| `GetRunwayResponseSchema` | **float64* | :heavy_minus_sign: | Runway reports for the authenticated team. | 12 | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/getslackinstallurlresponse.md b/docs/models/operations/getslackinstallurlresponse.md new file mode 100644 index 0000000..8a14232 --- /dev/null +++ b/docs/models/operations/getslackinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetSlackInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetSlackInstallURLResponseBody](../../models/operations/getslackinstallurlresponsebody.md) | :heavy_minus_sign: | Slack install URL | \ No newline at end of file diff --git a/docs/models/operations/getslackinstallurlresponsebody.md b/docs/models/operations/getslackinstallurlresponsebody.md new file mode 100644 index 0000000..caed2b0 --- /dev/null +++ b/docs/models/operations/getslackinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetSlackInstallURLResponseBody + +Slack install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getspendingmetricsrequest.md b/docs/models/operations/getspendingmetricsrequest.md deleted file mode 100644 index d3bd6d6..0000000 --- a/docs/models/operations/getspendingmetricsrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetSpendingMetricsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `Currency` | **string* | :heavy_minus_sign: | N/A | USD | \ No newline at end of file diff --git a/docs/models/operations/getspendingreportsrequest.md b/docs/models/operations/getspendingreportsrequest.md new file mode 100644 index 0000000..1d06823 --- /dev/null +++ b/docs/models/operations/getspendingreportsrequest.md @@ -0,0 +1,10 @@ +# GetSpendingReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `To` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `Currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | \ No newline at end of file diff --git a/docs/models/operations/getspendingmetricsresponse.md b/docs/models/operations/getspendingreportsresponse.md similarity index 75% rename from docs/models/operations/getspendingmetricsresponse.md rename to docs/models/operations/getspendingreportsresponse.md index 7aecad4..fba869b 100644 --- a/docs/models/operations/getspendingmetricsresponse.md +++ b/docs/models/operations/getspendingreportsresponse.md @@ -1,4 +1,4 @@ -# GetSpendingMetricsResponse +# GetSpendingReportsResponse ## Fields @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `SpendingResultArray` | [][components.SpendingResultArray](../../models/components/spendingresultarray.md) | :heavy_minus_sign: | Spending metrics for the authenticated team. | \ No newline at end of file +| `SpendingResultArray` | [][components.SpendingResultArray](../../models/components/spendingresultarray.md) | :heavy_minus_sign: | Spending reports for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getstripeconnectstatusresponse.md b/docs/models/operations/getstripeconnectstatusresponse.md new file mode 100644 index 0000000..7305d81 --- /dev/null +++ b/docs/models/operations/getstripeconnectstatusresponse.md @@ -0,0 +1,9 @@ +# GetStripeConnectStatusResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetStripeConnectStatusResponseBody](../../models/operations/getstripeconnectstatusresponsebody.md) | :heavy_minus_sign: | Stripe Connect status | \ No newline at end of file diff --git a/docs/models/operations/getstripeconnectstatusresponsebody.md b/docs/models/operations/getstripeconnectstatusresponsebody.md new file mode 100644 index 0000000..af5876b --- /dev/null +++ b/docs/models/operations/getstripeconnectstatusresponsebody.md @@ -0,0 +1,12 @@ +# GetStripeConnectStatusResponseBody + +Stripe Connect status + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Connected` | *bool* | :heavy_check_mark: | N/A | +| `Status` | *string* | :heavy_check_mark: | N/A | +| `StripeAccountID` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getstripeconnecturlresponse.md b/docs/models/operations/getstripeconnecturlresponse.md new file mode 100644 index 0000000..3849942 --- /dev/null +++ b/docs/models/operations/getstripeconnecturlresponse.md @@ -0,0 +1,9 @@ +# GetStripeConnectURLResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetStripeConnectURLResponseBody](../../models/operations/getstripeconnecturlresponsebody.md) | :heavy_minus_sign: | Stripe Connect OAuth URL | \ No newline at end of file diff --git a/docs/models/operations/getstripeconnecturlresponsebody.md b/docs/models/operations/getstripeconnecturlresponsebody.md new file mode 100644 index 0000000..8c3b771 --- /dev/null +++ b/docs/models/operations/getstripeconnecturlresponsebody.md @@ -0,0 +1,10 @@ +# GetStripeConnectURLResponseBody + +Stripe Connect OAuth URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettagbyidrequest.md b/docs/models/operations/gettagbyidrequest.md index eeff26b..955aa2a 100644 --- a/docs/models/operations/gettagbyidrequest.md +++ b/docs/models/operations/gettagbyidrequest.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | The UUID of the tag. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | \ No newline at end of file diff --git a/docs/models/operations/gettagbyidresponse.md b/docs/models/operations/gettagbyidresponse.md index 4fb17a6..f73eca4 100644 --- a/docs/models/operations/gettagbyidresponse.md +++ b/docs/models/operations/gettagbyidresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TagResponse` | [*components.TagResponse](../../models/components/tagresponse.md) | :heavy_minus_sign: | Retrieve a tag by ID for the authenticated team. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `TagResponse` | [*components.TagResponse](../../models/components/tagresponse.md) | :heavy_minus_sign: | Retrieve a tag by ID for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getteambyidrequest.md b/docs/models/operations/getteambyidrequest.md index a5e948d..723caed 100644 --- a/docs/models/operations/getteambyidrequest.md +++ b/docs/models/operations/getteambyidrequest.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file diff --git a/docs/models/operations/getteambyidresponse.md b/docs/models/operations/getteambyidresponse.md index 161be61..b56902e 100644 --- a/docs/models/operations/getteambyidresponse.md +++ b/docs/models/operations/getteambyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetTeamByIDResponseBody](../../models/operations/getteambyidresponsebody.md) | :heavy_minus_sign: | Team details | \ No newline at end of file +| `Object` | [*operations.GetTeamByIDResponseBody](../../models/operations/getteambyidresponsebody.md) | :heavy_minus_sign: | Team details | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/gettimerstatusrequest.md b/docs/models/operations/gettimerstatusrequest.md index ab16413..8de578e 100644 --- a/docs/models/operations/gettimerstatusrequest.md +++ b/docs/models/operations/gettimerstatusrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `AssignedID` | **string* | :heavy_minus_sign: | N/A | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `AssignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | \ No newline at end of file diff --git a/docs/models/operations/gettimerstatusresponse.md b/docs/models/operations/gettimerstatusresponse.md index 6bf4979..b74143d 100644 --- a/docs/models/operations/gettimerstatusresponse.md +++ b/docs/models/operations/gettimerstatusresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.GetTimerStatusResponseBody](../../models/operations/gettimerstatusresponsebody.md) | :heavy_minus_sign: | Timer status retrieved successfully. | \ No newline at end of file +| `Object` | [*operations.GetTimerStatusResponseBody](../../models/operations/gettimerstatusresponsebody.md) | :heavy_minus_sign: | Timer status retrieved successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/gettimerstatustrackerproject.md b/docs/models/operations/gettimerstatustrackerproject.md new file mode 100644 index 0000000..3774a32 --- /dev/null +++ b/docs/models/operations/gettimerstatustrackerproject.md @@ -0,0 +1,9 @@ +# GetTimerStatusTrackerProject + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | *string* | :heavy_check_mark: | N/A | +| `Name` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettrackerprojectbyidrequest.md b/docs/models/operations/gettrackerprojectbyidrequest.md index ce4fd02..f78637b 100644 --- a/docs/models/operations/gettrackerprojectbyidrequest.md +++ b/docs/models/operations/gettrackerprojectbyidrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | \ No newline at end of file diff --git a/docs/models/operations/gettrackerprojectbyidresponse.md b/docs/models/operations/gettrackerprojectbyidresponse.md index 8e99456..dfa5f2a 100644 --- a/docs/models/operations/gettrackerprojectbyidresponse.md +++ b/docs/models/operations/gettrackerprojectbyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project by ID for the authenticated team. | \ No newline at end of file +| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project by ID for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/gettransactionattachmentpresignedurlrequest.md b/docs/models/operations/gettransactionattachmentpresignedurlrequest.md new file mode 100644 index 0000000..c8fe39f --- /dev/null +++ b/docs/models/operations/gettransactionattachmentpresignedurlrequest.md @@ -0,0 +1,10 @@ +# GetTransactionAttachmentPreSignedURLRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `TransactionID` | *string* | :heavy_check_mark: | Unique identifier of the transaction | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `AttachmentID` | *string* | :heavy_check_mark: | Unique identifier of the attachment to generate a pre-signed URL for | a43dc3a5-6925-4d91-ac9c-4c1a34bdb388 | +| `Download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | \ No newline at end of file diff --git a/docs/models/operations/gettransactionattachmentpresignedurlresponse.md b/docs/models/operations/gettransactionattachmentpresignedurlresponse.md new file mode 100644 index 0000000..c6d9e67 --- /dev/null +++ b/docs/models/operations/gettransactionattachmentpresignedurlresponse.md @@ -0,0 +1,9 @@ +# GetTransactionAttachmentPreSignedURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetTransactionAttachmentPreSignedURLResponseBody](../../models/operations/gettransactionattachmentpresignedurlresponsebody.md) | :heavy_minus_sign: | Pre-signed URL generated successfully | \ No newline at end of file diff --git a/docs/models/operations/gettransactionattachmentpresignedurlresponsebody.md b/docs/models/operations/gettransactionattachmentpresignedurlresponsebody.md new file mode 100644 index 0000000..df1949a --- /dev/null +++ b/docs/models/operations/gettransactionattachmentpresignedurlresponsebody.md @@ -0,0 +1,12 @@ +# GetTransactionAttachmentPreSignedURLResponseBody + +Pre-signed URL generated successfully + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `URL` | *string* | :heavy_check_mark: | Pre-signed URL for accessing the attachment, valid for 60 seconds | https://service.midday.ai/storage/v1/object/sign/vault/transactions/receipt.pdf?token=abc123&expires=1640995200 | +| `ExpiresAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | ISO 8601 timestamp when the URL expires | 2024-04-15T10:01:00.000Z | +| `FileName` | *string* | :heavy_check_mark: | Original filename of the attachment | receipt.pdf | \ No newline at end of file diff --git a/docs/models/operations/gettransactionbyidrequest.md b/docs/models/operations/gettransactionbyidrequest.md index 3b0ed55..31ae50a 100644 --- a/docs/models/operations/gettransactionbyidrequest.md +++ b/docs/models/operations/gettransactionbyidrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------- | ---------------------- | ---------------------- | ---------------------- | +| `ID` | *string* | :heavy_check_mark: | Transaction ID (UUID). | \ No newline at end of file diff --git a/docs/models/operations/gettransactionbyidresponse.md b/docs/models/operations/gettransactionbyidresponse.md index 49b3705..b7412d8 100644 --- a/docs/models/operations/gettransactionbyidresponse.md +++ b/docs/models/operations/gettransactionbyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction details | \ No newline at end of file +| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction details | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/getxeroinstallurlresponse.md b/docs/models/operations/getxeroinstallurlresponse.md new file mode 100644 index 0000000..81fcf64 --- /dev/null +++ b/docs/models/operations/getxeroinstallurlresponse.md @@ -0,0 +1,9 @@ +# GetXeroInstallURLResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.GetXeroInstallURLResponseBody](../../models/operations/getxeroinstallurlresponsebody.md) | :heavy_minus_sign: | Xero install URL | \ No newline at end of file diff --git a/docs/models/operations/getxeroinstallurlresponsebody.md b/docs/models/operations/getxeroinstallurlresponsebody.md new file mode 100644 index 0000000..340681d --- /dev/null +++ b/docs/models/operations/getxeroinstallurlresponsebody.md @@ -0,0 +1,10 @@ +# GetXeroInstallURLResponseBody + +Xero install URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gmailoauthcallbackrequest.md b/docs/models/operations/gmailoauthcallbackrequest.md new file mode 100644 index 0000000..91c4b4c --- /dev/null +++ b/docs/models/operations/gmailoauthcallbackrequest.md @@ -0,0 +1,10 @@ +# GmailOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from Google | +| `State` | *string* | :heavy_check_mark: | Encrypted OAuth state parameter | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | \ No newline at end of file diff --git a/docs/models/operations/gmailoauthcallbackresponse.md b/docs/models/operations/gmailoauthcallbackresponse.md new file mode 100644 index 0000000..d2ae828 --- /dev/null +++ b/docs/models/operations/gmailoauthcallbackresponse.md @@ -0,0 +1,9 @@ +# GmailOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/heardabout.md b/docs/models/operations/heardabout.md new file mode 100644 index 0000000..dcc4eb1 --- /dev/null +++ b/docs/models/operations/heardabout.md @@ -0,0 +1,17 @@ +# HeardAbout + +How the user heard about the product + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `HeardAboutTwitter` | twitter | +| `HeardAboutYoutube` | youtube | +| `HeardAboutFriend` | friend | +| `HeardAboutGoogle` | google | +| `HeardAboutBlog` | blog | +| `HeardAboutPodcast` | podcast | +| `HeardAboutGithub` | github | +| `HeardAboutOther` | other | \ No newline at end of file diff --git a/docs/models/operations/getrevenuemetricsresponse.md b/docs/models/operations/inboxwebhookresponse.md similarity index 78% rename from docs/models/operations/getrevenuemetricsresponse.md rename to docs/models/operations/inboxwebhookresponse.md index b1f9d24..79039cc 100644 --- a/docs/models/operations/getrevenuemetricsresponse.md +++ b/docs/models/operations/inboxwebhookresponse.md @@ -1,4 +1,4 @@ -# GetRevenueMetricsResponse +# InboxWebhookResponse ## Fields @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `GetRevenueResponseSchema` | [*components.GetRevenueResponseSchema](../../models/components/getrevenueresponseschema.md) | :heavy_minus_sign: | Revenue metrics for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.InboxWebhookResponseBody](../../models/operations/inboxwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/inboxwebhookresponsebody.md b/docs/models/operations/inboxwebhookresponsebody.md new file mode 100644 index 0000000..0763aa2 --- /dev/null +++ b/docs/models/operations/inboxwebhookresponsebody.md @@ -0,0 +1,10 @@ +# InboxWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/lineitem.md b/docs/models/operations/lineitem.md new file mode 100644 index 0000000..99c8542 --- /dev/null +++ b/docs/models/operations/lineitem.md @@ -0,0 +1,15 @@ +# LineItem + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `Quantity` | **float64* | :heavy_minus_sign: | N/A | | +| `Unit` | **string* | :heavy_minus_sign: | N/A | | +| `Price` | **float64* | :heavy_minus_sign: | N/A | | +| `Vat` | **float64* | :heavy_minus_sign: | N/A | | +| `Tax` | **float64* | :heavy_minus_sign: | N/A | | +| `TaxRate` | **float64* | :heavy_minus_sign: | N/A | | +| `Name` | [*operations.Name](../../models/operations/name.md) | :heavy_minus_sign: | Line item description in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Web Development Services"
}
]
}
]
} | +| `ProductID` | **string* | :heavy_minus_sign: | Optional reference to a saved product | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | \ No newline at end of file diff --git a/docs/models/operations/listbankaccountsrequest.md b/docs/models/operations/listbankaccountsrequest.md index c03e8a4..5c8dc84 100644 --- a/docs/models/operations/listbankaccountsrequest.md +++ b/docs/models/operations/listbankaccountsrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Enabled` | **bool* | :heavy_minus_sign: | N/A | -| `Manual` | **bool* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `Enabled` | **bool* | :heavy_minus_sign: | Whether the bank account is enabled. | +| `Manual` | **bool* | :heavy_minus_sign: | Whether the bank account is a manual account. | \ No newline at end of file diff --git a/docs/models/operations/listbankaccountsresponse.md b/docs/models/operations/listbankaccountsresponse.md index 96eaf9f..6ea6370 100644 --- a/docs/models/operations/listbankaccountsresponse.md +++ b/docs/models/operations/listbankaccountsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListBankAccountsResponseBody](../../models/operations/listbankaccountsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of bank accounts | \ No newline at end of file +| `Object` | [*operations.ListBankAccountsResponseBody](../../models/operations/listbankaccountsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of bank accounts | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listcustomersdata.md b/docs/models/operations/listcustomersdata.md index e71ffc3..23ccd29 100644 --- a/docs/models/operations/listcustomersdata.md +++ b/docs/models/operations/listcustomersdata.md @@ -8,7 +8,7 @@ | `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | *string* | :heavy_check_mark: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | *string* | :heavy_check_mark: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Phone` | *string* | :heavy_check_mark: | Primary phone number of the customer | +1-555-123-4567 | | `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the customer was created in ISO 8601 format | 2024-05-01T12:34:56.789Z | @@ -25,4 +25,30 @@ | `Contact` | *string* | :heavy_check_mark: | Primary contact person's name at the customer organization | John Smith | | `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices created for this customer | 12 | | `ProjectCount` | *float64* | :heavy_check_mark: | Total number of projects associated with this customer | 3 | -| `Tags` | [][operations.ListCustomersTag](../../models/operations/listcustomerstag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | \ No newline at end of file +| `TotalRevenue` | **float64* | :heavy_minus_sign: | Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. | 15000.5 | +| `OutstandingAmount` | **float64* | :heavy_minus_sign: | Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. | 2500 | +| `LastInvoiceDate` | **string* | :heavy_minus_sign: | Date of the most recent invoice in ISO 8601 format. Only returned in list queries. | 2024-04-15 | +| `InvoiceCurrency` | **string* | :heavy_minus_sign: | Primary currency used in invoices for this customer. Only returned in list queries. | USD | +| `Tags` | [][operations.ListCustomersTag](../../models/operations/listcustomerstag.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | +| `Description` | *string* | :heavy_check_mark: | AI-generated description of what the company does | A cloud-based project management platform for remote teams. | +| `Industry` | *string* | :heavy_check_mark: | Primary industry of the company | Software | +| `CompanyType` | *string* | :heavy_check_mark: | Business model type | SaaS | +| `EmployeeCount` | *string* | :heavy_check_mark: | Estimated number of employees | 51-200 | +| `FoundedYear` | *float64* | :heavy_check_mark: | Year the company was founded | 2018 | +| `EstimatedRevenue` | *string* | :heavy_check_mark: | Estimated annual revenue range | $10M-$50M | +| `FundingStage` | *string* | :heavy_check_mark: | Current funding stage | Series A | +| `TotalFunding` | *string* | :heavy_check_mark: | Total funding raised | $15M | +| `HeadquartersLocation` | *string* | :heavy_check_mark: | Company headquarters location | San Francisco, CA | +| `Timezone` | *string* | :heavy_check_mark: | IANA timezone of the company headquarters | America/Los_Angeles | +| `LinkedinURL` | *string* | :heavy_check_mark: | LinkedIn company page URL | https://linkedin.com/company/acme | +| `TwitterURL` | *string* | :heavy_check_mark: | Twitter/X profile URL | https://twitter.com/acme | +| `InstagramURL` | *string* | :heavy_check_mark: | Instagram profile URL | https://instagram.com/acme | +| `FacebookURL` | *string* | :heavy_check_mark: | Facebook page URL | https://facebook.com/acme | +| `LogoURL` | *string* | :heavy_check_mark: | URL to the company logo | https://example.com/logo.png | +| `CeoName` | *string* | :heavy_check_mark: | Name of the CEO or founder | Jane Smith | +| `FinanceContact` | *string* | :heavy_check_mark: | Name of the finance/AP contact for invoicing | John Doe | +| `FinanceContactEmail` | *string* | :heavy_check_mark: | Email of the finance/AP contact | finance@acme.com | +| `PrimaryLanguage` | *string* | :heavy_check_mark: | Primary business language (ISO 639-1 code) | en | +| `FiscalYearEnd` | *string* | :heavy_check_mark: | Month when the fiscal year ends | December | +| `EnrichmentStatus` | *string* | :heavy_check_mark: | Status of the enrichment process | completed | +| `EnrichedAt` | *string* | :heavy_check_mark: | When the customer was last enriched | 2024-05-01T12:34:56.789Z | \ No newline at end of file diff --git a/docs/models/operations/listcustomersrequest.md b/docs/models/operations/listcustomersrequest.md index 5fd7758..45caa36 100644 --- a/docs/models/operations/listcustomersrequest.md +++ b/docs/models/operations/listcustomersrequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `Q` | **string* | :heavy_minus_sign: | N/A | acme | -| `Sort` | []*string* | :heavy_minus_sign: | N/A | [
"name",
"asc"
] | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | eyJpZCI6IjEyMyJ9 | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | 20 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Q` | **string* | :heavy_minus_sign: | Search query string to filter customers by name, email, or other text fields | acme | +| `Sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Columns: name, created_at, contact, email, invoices, projects, tags, industry, country, total_revenue, outstanding, last_invoice. Direction: asc or desc. | [
"name",
"asc"
] | +| `Cursor` | **string* | :heavy_minus_sign: | Cursor for pagination, representing the last item from the previous page | eyJpZCI6IjEyMyJ9 | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of customers to return per page (1-100) | 20 | \ No newline at end of file diff --git a/docs/models/operations/listcustomersresponse.md b/docs/models/operations/listcustomersresponse.md index 1e4041e..6f41735 100644 --- a/docs/models/operations/listcustomersresponse.md +++ b/docs/models/operations/listcustomersresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListCustomersResponseBody](../../models/operations/listcustomersresponsebody.md) | :heavy_minus_sign: | Retrieve a list of customers for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.ListCustomersResponseBody](../../models/operations/listcustomersresponsebody.md) | :heavy_minus_sign: | Retrieve a list of customers for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listdocumentsrequest.md b/docs/models/operations/listdocumentsrequest.md index a31feee..7c167f3 100644 --- a/docs/models/operations/listdocumentsrequest.md +++ b/docs/models/operations/listdocumentsrequest.md @@ -3,10 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | 20 | -| `Sort` | []*string* | :heavy_minus_sign: | N/A | | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | 20 | -| `Q` | **string* | :heavy_minus_sign: | N/A | invoice | -| `Tags` | []*string* | :heavy_minus_sign: | N/A | [
"tag1",
"tag2"
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Cursor` | **string* | :heavy_minus_sign: | A cursor for pagination. Pass the value returned from the previous response to get the next page. | 20 | +| `Sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Currently documents are sorted by created date descending. | | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of documents to return per page. | 20 | +| `Q` | **string* | :heavy_minus_sign: | Search query string to filter documents by text. | invoice | +| `Tags` | []*string* | :heavy_minus_sign: | Array of tag IDs to filter documents by tags. | [
"tag1",
"tag2"
] | +| `Start` | **string* | :heavy_minus_sign: | Start date for filtering documents (ISO 8601 date). | 2024-01-01 | +| `End` | **string* | :heavy_minus_sign: | End date for filtering documents (ISO 8601 date). | 2024-12-31 | \ No newline at end of file diff --git a/docs/models/operations/listdocumentsresponse.md b/docs/models/operations/listdocumentsresponse.md index ca12236..5694ba0 100644 --- a/docs/models/operations/listdocumentsresponse.md +++ b/docs/models/operations/listdocumentsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.ListDocumentsResponseBody](../../models/operations/listdocumentsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of documents for the authenticated team. | {
"meta": {
"cursor": "20",
"hasPreviousPage": false,
"hasNextPage": true
},
"data": [
{
"id": "doc_1234567890abcdef",
"title": "Invoice April 2024",
"pathTokens": [
"invoices",
"2024",
"april",
"invoice-123.pdf"
],
"metadata": {
"size": 204800,
"mimetype": "application/pdf"
},
"processingStatus": "processed",
"summary": "Invoice for April 2024, total $1,200.00",
"date": "2024-04-30"
}
]
} | \ No newline at end of file +| `Object` | [*operations.ListDocumentsResponseBody](../../models/operations/listdocumentsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of documents for the authenticated team. | {
"meta": {
"cursor": "20",
"hasPreviousPage": false,
"hasNextPage": true
},
"data": [
{
"id": "doc_1234567890abcdef",
"title": "Invoice April 2024",
"pathTokens": [
"invoices",
"2024",
"april",
"invoice-123.pdf"
],
"metadata": {
"size": 204800,
"mimetype": "application/pdf"
},
"processingStatus": "processed",
"summary": "Invoice for April 2024, total $1,200.00",
"date": "2024-04-30"
}
]
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/listinboxitemsrequest.md b/docs/models/operations/listinboxitemsrequest.md index 1ce4e58..85158d6 100644 --- a/docs/models/operations/listinboxitemsrequest.md +++ b/docs/models/operations/listinboxitemsrequest.md @@ -3,10 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | -| `Order` | **string* | :heavy_minus_sign: | N/A | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | -| `Q` | **string* | :heavy_minus_sign: | N/A | -| `Status` | [*operations.ListInboxItemsStatus](../../models/operations/listinboxitemsstatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `Cursor` | **string* | :heavy_minus_sign: | Pagination cursor from previous response | +| `Order` | **string* | :heavy_minus_sign: | Sort direction: asc or desc | +| `Sort` | **string* | :heavy_minus_sign: | Sort field. Valid values: alphabetical, document_date. Defaults to created date. | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of items per page (1-100) | +| `Q` | **string* | :heavy_minus_sign: | Search query to filter inbox items | +| `Status` | [*operations.ListInboxItemsStatus](../../models/operations/listinboxitemsstatus.md) | :heavy_minus_sign: | Filter by processing status: done (processed), pending (awaiting action), suggested_match (auto-matched), no_match (unmatched), other | +| `Tab` | [*operations.Tab](../../models/operations/tab.md) | :heavy_minus_sign: | Tab filter: all or other | \ No newline at end of file diff --git a/docs/models/operations/listinboxitemsresponse.md b/docs/models/operations/listinboxitemsresponse.md index 8608a7e..d2411ae 100644 --- a/docs/models/operations/listinboxitemsresponse.md +++ b/docs/models/operations/listinboxitemsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListInboxItemsResponseBody](../../models/operations/listinboxitemsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of inbox items for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.ListInboxItemsResponseBody](../../models/operations/listinboxitemsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of inbox items for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listinboxitemsstatus.md b/docs/models/operations/listinboxitemsstatus.md index 7a858c4..a47a916 100644 --- a/docs/models/operations/listinboxitemsstatus.md +++ b/docs/models/operations/listinboxitemsstatus.md @@ -1,9 +1,14 @@ # ListInboxItemsStatus +Filter by processing status: done (processed), pending (awaiting action), suggested_match (auto-matched), no_match (unmatched), other + ## Values -| Name | Value | -| ----------------------------- | ----------------------------- | -| `ListInboxItemsStatusDone` | done | -| `ListInboxItemsStatusPending` | pending | \ No newline at end of file +| Name | Value | +| ------------------------------------ | ------------------------------------ | +| `ListInboxItemsStatusDone` | done | +| `ListInboxItemsStatusPending` | pending | +| `ListInboxItemsStatusSuggestedMatch` | suggested_match | +| `ListInboxItemsStatusNoMatch` | no_match | +| `ListInboxItemsStatusOther` | other | \ No newline at end of file diff --git a/docs/models/operations/listinvoicesdata.md b/docs/models/operations/listinvoicesdata.md index c8234af..de86f22 100644 --- a/docs/models/operations/listinvoicesdata.md +++ b/docs/models/operations/listinvoicesdata.md @@ -11,8 +11,8 @@ Invoice object | `Status` | [operations.ListInvoicesStatus](../../models/operations/listinvoicesstatus.md) | :heavy_check_mark: | Current status of the invoice | paid | | `DueDate` | *string* | :heavy_check_mark: | Due date of the invoice in ISO 8601 format | 2024-06-30T23:59:59.000Z | | `IssueDate` | *string* | :heavy_check_mark: | Issue date of the invoice in ISO 8601 format | 2024-06-01T00:00:00.000Z | -| `InvoiceNumber` | *string* | :heavy_check_mark: | Invoice number as shown to the customer | INV-2024-001 | -| `Amount` | *float64* | :heavy_check_mark: | Total amount of the invoice | 1500.75 | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Invoice number as shown to the customer (auto-generated if not provided) | INV-2024-001 | +| `Amount` | *float64* | :heavy_check_mark: | Total amount of the invoice, or null if not yet calculated | 1500.75 | | `Currency` | *string* | :heavy_check_mark: | Currency code (ISO 4217) for the invoice amount | USD | | `Customer` | [operations.ListInvoicesCustomer](../../models/operations/listinvoicescustomer.md) | :heavy_check_mark: | Customer details | | | `PaidAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was paid (ISO 8601), or null if unpaid | 2024-06-15T12:00:00.000Z | @@ -27,4 +27,6 @@ Invoice object | `SentTo` | *string* | :heavy_check_mark: | Email address to which the invoice was sent, or null if not sent | billing@acme.com | | `SentAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was sent (ISO 8601), or null if not sent | 2024-06-02T08:00:00.000Z | | `CreatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was created (ISO 8601) | 2024-06-01T07:00:00.000Z | -| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-15T10:00:00.000Z | \ No newline at end of file +| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-15T10:00:00.000Z | +| `PdfURL` | *string* | :heavy_check_mark: | URL to download the invoice PDF, or null if not generated | https://app.midday.ai/api/download/invoice?token=eef58951-1682-4062-b010-425866032390 | +| `PreviewURL` | *string* | :heavy_check_mark: | URL to preview the invoice in the browser, or null if not generated | https://app.midday.ai/i/eef58951-1682-4062-b010-425866032390 | \ No newline at end of file diff --git a/docs/models/operations/listinvoicesrequest.md b/docs/models/operations/listinvoicesrequest.md index 494d067..e101828 100644 --- a/docs/models/operations/listinvoicesrequest.md +++ b/docs/models/operations/listinvoicesrequest.md @@ -3,13 +3,16 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | 25 | -| `Sort` | []*string* | :heavy_minus_sign: | N/A | [
"createdAt",
"desc"
] | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | 25 | -| `Q` | **string* | :heavy_minus_sign: | N/A | Acme | -| `Start` | **string* | :heavy_minus_sign: | N/A | 2024-01-01 | -| `End` | **string* | :heavy_minus_sign: | N/A | 2024-01-31 | -| `Statuses` | []*string* | :heavy_minus_sign: | N/A | [
"paid",
"unpaid"
] | -| `Customers` | []*string* | :heavy_minus_sign: | N/A | [
"customer-uuid-1",
"customer-uuid-2"
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `Cursor` | **string* | :heavy_minus_sign: | A cursor for pagination, representing the last item from the previous page. | 25 | +| `Sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Columns: created_at, due_date, issue_date, amount, status, customer, invoice_number. Direction: asc or desc. | [
"created_at",
"desc"
] | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of invoices to return per page (1-100). | 25 | +| `Q` | **string* | :heavy_minus_sign: | Search query string to filter invoices by text. | Acme | +| `Start` | **string* | :heavy_minus_sign: | Start date (inclusive) for filtering invoices, in ISO 8601 format. | 2024-01-01 | +| `End` | **string* | :heavy_minus_sign: | End date (inclusive) for filtering invoices, in ISO 8601 format. | 2024-01-31 | +| `Statuses` | []*string* | :heavy_minus_sign: | List of invoice statuses to filter by (e.g., 'paid', 'unpaid', 'overdue'). | [
"paid",
"unpaid"
] | +| `Customers` | []*string* | :heavy_minus_sign: | List of customer IDs to filter invoices. | [
"customer-uuid-1",
"customer-uuid-2"
] | +| `Ids` | []*string* | :heavy_minus_sign: | List of invoice IDs to filter by. | [
"invoice-uuid-1",
"invoice-uuid-2"
] | +| `RecurringIds` | []*string* | :heavy_minus_sign: | List of recurring series IDs to filter invoices by (shows all invoices from these series). | [
"recurring-uuid-1",
"recurring-uuid-2"
] | +| `Recurring` | **bool* | :heavy_minus_sign: | Filter by recurring status. true = only recurring invoices, false = only non-recurring invoices. | true | \ No newline at end of file diff --git a/docs/models/operations/listinvoicesresponse.md b/docs/models/operations/listinvoicesresponse.md index 318af77..6705d96 100644 --- a/docs/models/operations/listinvoicesresponse.md +++ b/docs/models/operations/listinvoicesresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListInvoicesResponseBody](../../models/operations/listinvoicesresponsebody.md) | :heavy_minus_sign: | A list of invoices for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.ListInvoicesResponseBody](../../models/operations/listinvoicesresponsebody.md) | :heavy_minus_sign: | A list of invoices for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listnotificationsrequest.md b/docs/models/operations/listnotificationsrequest.md new file mode 100644 index 0000000..00c8b50 --- /dev/null +++ b/docs/models/operations/listnotificationsrequest.md @@ -0,0 +1,13 @@ +# ListNotificationsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Cursor` | **string* | :heavy_minus_sign: | Cursor for pagination, representing the last item from the previous page | 20 | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of notifications to return per page (1-100) | 20 | +| `Status` | [*operations.Status](../../models/operations/status.md) | :heavy_minus_sign: | Filter by notification status. Can be a single status or array of statuses. unread = new notifications, read = viewed but not dismissed, archived = dismissed from view | [
"unread",
"read"
] | +| `UserID` | **string* | :heavy_minus_sign: | Filter notifications by specific user ID | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `Priority` | **int64* | :heavy_minus_sign: | Filter notifications by priority level (1-10) | 5 | +| `MaxPriority` | **int64* | :heavy_minus_sign: | Filter notifications by maximum priority level (priority <= maxPriority). Use 3 for user-facing notifications only. | 3 | \ No newline at end of file diff --git a/docs/models/operations/listnotificationsresponse.md b/docs/models/operations/listnotificationsresponse.md new file mode 100644 index 0000000..3bd41d7 --- /dev/null +++ b/docs/models/operations/listnotificationsresponse.md @@ -0,0 +1,10 @@ +# ListNotificationsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `NotificationsResponseSchema` | [*components.NotificationsResponseSchema](../../models/components/notificationsresponseschema.md) | :heavy_minus_sign: | Retrieve a list of notifications for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listnotificationsstatusenum1.md b/docs/models/operations/listnotificationsstatusenum1.md new file mode 100644 index 0000000..d0fcb1e --- /dev/null +++ b/docs/models/operations/listnotificationsstatusenum1.md @@ -0,0 +1,10 @@ +# ListNotificationsStatusEnum1 + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `ListNotificationsStatusEnum1Unread` | unread | +| `ListNotificationsStatusEnum1Read` | read | +| `ListNotificationsStatusEnum1Archived` | archived | \ No newline at end of file diff --git a/docs/models/operations/listnotificationsstatusenum2.md b/docs/models/operations/listnotificationsstatusenum2.md new file mode 100644 index 0000000..3d15e64 --- /dev/null +++ b/docs/models/operations/listnotificationsstatusenum2.md @@ -0,0 +1,10 @@ +# ListNotificationsStatusEnum2 + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `ListNotificationsStatusEnum2Unread` | unread | +| `ListNotificationsStatusEnum2Read` | read | +| `ListNotificationsStatusEnum2Archived` | archived | \ No newline at end of file diff --git a/docs/models/operations/listtagsresponse.md b/docs/models/operations/listtagsresponse.md index 56f9c8b..5b9c5f1 100644 --- a/docs/models/operations/listtagsresponse.md +++ b/docs/models/operations/listtagsresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TagsResponse` | [*components.TagsResponse](../../models/components/tagsresponse.md) | :heavy_minus_sign: | Retrieve a list of tags for the authenticated team. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `TagsResponse` | [*components.TagsResponse](../../models/components/tagsresponse.md) | :heavy_minus_sign: | Retrieve a list of tags for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listteammembersrequest.md b/docs/models/operations/listteammembersrequest.md index a89aae4..58aa64d 100644 --- a/docs/models/operations/listteammembersrequest.md +++ b/docs/models/operations/listteammembersrequest.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file diff --git a/docs/models/operations/listteammembersresponse.md b/docs/models/operations/listteammembersresponse.md index f057479..25d5a3d 100644 --- a/docs/models/operations/listteammembersresponse.md +++ b/docs/models/operations/listteammembersresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListTeamMembersResponseBody](../../models/operations/listteammembersresponsebody.md) | :heavy_minus_sign: | Team members | \ No newline at end of file +| `Object` | [*operations.ListTeamMembersResponseBody](../../models/operations/listteammembersresponsebody.md) | :heavy_minus_sign: | Team members | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listteamsresponse.md b/docs/models/operations/listteamsresponse.md index fe88f71..541fca6 100644 --- a/docs/models/operations/listteamsresponse.md +++ b/docs/models/operations/listteamsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListTeamsResponseBody](../../models/operations/listteamsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of teams for the authenticated user. | \ No newline at end of file +| `Object` | [*operations.ListTeamsResponseBody](../../models/operations/listteamsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of teams for the authenticated user. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listtrackerentriesrequest.md b/docs/models/operations/listtrackerentriesrequest.md index dc8c0ea..0f62461 100644 --- a/docs/models/operations/listtrackerentriesrequest.md +++ b/docs/models/operations/listtrackerentriesrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `From` | *string* | :heavy_check_mark: | N/A | 2024-04-01 | -| `To` | *string* | :heavy_check_mark: | N/A | 2024-04-30 | -| `ProjectID` | **string* | :heavy_minus_sign: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `From` | *string* | :heavy_check_mark: | Start date of the range (inclusive) in YYYY-MM-DD format | 2024-04-01 | +| `To` | *string* | :heavy_check_mark: | End date of the range (inclusive) in YYYY-MM-DD format | 2024-04-30 | +| `ProjectID` | **string* | :heavy_minus_sign: | Optional project ID to filter tracker entries by specific project | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | \ No newline at end of file diff --git a/docs/models/operations/listtrackerentriesresponse.md b/docs/models/operations/listtrackerentriesresponse.md index ee6da19..20e32e1 100644 --- a/docs/models/operations/listtrackerentriesresponse.md +++ b/docs/models/operations/listtrackerentriesresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListTrackerEntriesResponseBody](../../models/operations/listtrackerentriesresponsebody.md) | :heavy_minus_sign: | List all tracker entries for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.ListTrackerEntriesResponseBody](../../models/operations/listtrackerentriesresponsebody.md) | :heavy_minus_sign: | List all tracker entries for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listtrackerprojectsrequest.md b/docs/models/operations/listtrackerprojectsrequest.md index 0b44742..c3f79c0 100644 --- a/docs/models/operations/listtrackerprojectsrequest.md +++ b/docs/models/operations/listtrackerprojectsrequest.md @@ -3,14 +3,14 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | eyJpZCI6IjEyMyJ9 | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | 20 | -| `Q` | **string* | :heavy_minus_sign: | N/A | website | -| `Start` | **string* | :heavy_minus_sign: | N/A | 2024-04-01 | -| `End` | **string* | :heavy_minus_sign: | N/A | 2024-04-30 | -| `Status` | [*operations.ListTrackerProjectsStatus](../../models/operations/listtrackerprojectsstatus.md) | :heavy_minus_sign: | Filter projects by status | in_progress | -| `Customers` | []*string* | :heavy_minus_sign: | N/A | [
"customer-1",
"customer-2"
] | -| `Tags` | []*string* | :heavy_minus_sign: | N/A | [
"tag-1",
"tag-2"
] | -| `Sort` | []*string* | :heavy_minus_sign: | N/A | [
"-createdAt",
"name"
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `Cursor` | **string* | :heavy_minus_sign: | Cursor for pagination, representing the last item from the previous page | eyJpZCI6IjEyMyJ9 | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of projects to return per page (1-100) | 20 | +| `Q` | **string* | :heavy_minus_sign: | Search query string to filter projects by name or description | website | +| `Start` | **string* | :heavy_minus_sign: | Start date for filtering projects by creation date in YYYY-MM-DD format | 2024-04-01 | +| `End` | **string* | :heavy_minus_sign: | End date for filtering projects by creation date in YYYY-MM-DD format | 2024-04-30 | +| `Status` | [*operations.ListTrackerProjectsStatus](../../models/operations/listtrackerprojectsstatus.md) | :heavy_minus_sign: | Filter projects by status | in_progress | +| `Customers` | []*string* | :heavy_minus_sign: | Array of customer IDs to filter projects by specific customers | [
"customer-1",
"customer-2"
] | +| `Tags` | []*string* | :heavy_minus_sign: | Array of tag IDs to filter projects by specific tags | [
"tag-1",
"tag-2"
] | +| `Sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Columns: name, created_at, time, amount, assigned, customer, tags. Direction: asc or desc. | [
"created_at",
"desc"
] | \ No newline at end of file diff --git a/docs/models/operations/listtrackerprojectsresponse.md b/docs/models/operations/listtrackerprojectsresponse.md index 60f23d2..3753ff1 100644 --- a/docs/models/operations/listtrackerprojectsresponse.md +++ b/docs/models/operations/listtrackerprojectsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TrackerProjectsResponse` | [*components.TrackerProjectsResponse](../../models/components/trackerprojectsresponse.md) | :heavy_minus_sign: | List all tracker projects for the authenticated team. | \ No newline at end of file +| `TrackerProjectsResponse` | [*components.TrackerProjectsResponse](../../models/components/trackerprojectsresponse.md) | :heavy_minus_sign: | List all tracker projects for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listtransactionsrequest.md b/docs/models/operations/listtransactionsrequest.md index fb08653..ed07d7e 100644 --- a/docs/models/operations/listtransactionsrequest.md +++ b/docs/models/operations/listtransactionsrequest.md @@ -5,19 +5,22 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Cursor` | **string* | :heavy_minus_sign: | N/A | eyJpZCI6IjEyMyJ9 | -| `Sort` | []*string* | :heavy_minus_sign: | N/A | [
"date",
"desc"
] | -| `PageSize` | **float64* | :heavy_minus_sign: | N/A | 50 | -| `Q` | **string* | :heavy_minus_sign: | N/A | office supplies | -| `Categories` | []*string* | :heavy_minus_sign: | N/A | [
"office-supplies",
"travel"
] | -| `Tags` | []*string* | :heavy_minus_sign: | N/A | [
"tag-1",
"tag-2"
] | -| `Start` | **string* | :heavy_minus_sign: | N/A | 2024-04-01T00:00:00.000Z | -| `End` | **string* | :heavy_minus_sign: | N/A | 2024-04-30T23:59:59.999Z | -| `Accounts` | []*string* | :heavy_minus_sign: | N/A | [
"account-1",
"account-2"
] | -| `Assignees` | []*string* | :heavy_minus_sign: | N/A | [
"user-1",
"user-2"
] | -| `Statuses` | []*string* | :heavy_minus_sign: | N/A | [
"pending",
"completed"
] | -| `Recurring` | []*string* | :heavy_minus_sign: | N/A | [
"monthly",
"annually"
] | +| `Cursor` | **string* | :heavy_minus_sign: | Cursor for pagination, representing the last item from the previous page | eyJpZCI6IjEyMyJ9 | +| `Sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Columns: date, amount, name, status, attachment, assigned, bank_account, category, tags, counterparty. Direction: asc or desc. | [
"date",
"desc"
] | +| `PageSize` | **float64* | :heavy_minus_sign: | Number of transactions to return per page (1-10000) | 50 | +| `Q` | **string* | :heavy_minus_sign: | Search query string to filter transactions by name, description, or other text fields | office supplies | +| `Categories` | []*string* | :heavy_minus_sign: | Array of category slugs to filter transactions by specific categories | [
"office-supplies",
"travel"
] | +| `Tags` | []*string* | :heavy_minus_sign: | Array of tag IDs to filter transactions by specific tags | [
"tag-1",
"tag-2"
] | +| `Start` | **string* | :heavy_minus_sign: | Start date (inclusive) for filtering transactions in ISO 8601 format | 2024-04-01T00:00:00.000Z | +| `End` | **string* | :heavy_minus_sign: | End date (inclusive) for filtering transactions in ISO 8601 format | 2024-04-30T23:59:59.999Z | +| `Accounts` | []*string* | :heavy_minus_sign: | Array of bank account IDs to filter transactions by specific accounts | [
"account-1",
"account-2"
] | +| `Assignees` | []*string* | :heavy_minus_sign: | Array of user IDs to filter transactions by assigned users | [
"user-1",
"user-2"
] | +| `Statuses` | [][operations.ListTransactionsStatus](../../models/operations/listtransactionsstatus.md) | :heavy_minus_sign: | Array of transaction list status filters. Supported UI filters: 'blank', 'receipt_match', 'in_review', 'export_error', 'exported', 'excluded', 'archived' | [
"in_review",
"export_error"
] | +| `Recurring` | []*string* | :heavy_minus_sign: | Array of recurring frequency values to filter by. Available frequencies: 'weekly', 'monthly', 'annually', 'irregular' | [
"monthly",
"annually"
] | | `Attachments` | [*operations.Attachments](../../models/operations/attachments.md) | :heavy_minus_sign: | Filter transactions based on attachment presence. 'include' returns only transactions with attachments, 'exclude' returns only transactions without attachments | include | -| `AmountRange` | []*float64* | :heavy_minus_sign: | N/A | [
100,
1000
] | -| `Amount` | []*string* | :heavy_minus_sign: | N/A | [
"150.75",
"299.99"
] | -| `Type` | [*operations.ListTransactionsType](../../models/operations/listtransactionstype.md) | :heavy_minus_sign: | Transaction type to filter by. 'income' for money received, 'expense' for money spent | expense | \ No newline at end of file +| `AmountRange` | []*float64* | :heavy_minus_sign: | Amount range as [min, max] to filter transactions by monetary value | [
100,
1000
] | +| `Amount` | []*string* | :heavy_minus_sign: | Array of specific amounts (as strings) to filter transactions by exact values | [
"150.75",
"299.99"
] | +| `Type` | [*operations.ListTransactionsType](../../models/operations/listtransactionstype.md) | :heavy_minus_sign: | Filter by transaction type. 'income' for money received, 'expense' for money spent | expense | +| `Manual` | [*operations.Manual](../../models/operations/manual.md) | :heavy_minus_sign: | Filter transactions based on whether they were manually imported. 'include' returns only manual transactions, 'exclude' returns only non-manual transactions | include | +| `Exported` | **bool* | :heavy_minus_sign: | Filter by export status. true = only exported transactions, false = only NOT exported transactions, undefined = no filter | false | +| `Fulfilled` | **bool* | :heavy_minus_sign: | Filter by fulfillment status. true = transactions ready for review (has attachments OR status=completed), false = not ready, undefined = no filter | true | \ No newline at end of file diff --git a/docs/models/operations/listtransactionsresponse.md b/docs/models/operations/listtransactionsresponse.md index f73f0f0..2e83aec 100644 --- a/docs/models/operations/listtransactionsresponse.md +++ b/docs/models/operations/listtransactionsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.ListTransactionsResponseBody](../../models/operations/listtransactionsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of transactions for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.ListTransactionsResponseBody](../../models/operations/listtransactionsresponsebody.md) | :heavy_minus_sign: | Retrieve a list of transactions for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/listtransactionsstatus.md b/docs/models/operations/listtransactionsstatus.md new file mode 100644 index 0000000..5d605b7 --- /dev/null +++ b/docs/models/operations/listtransactionsstatus.md @@ -0,0 +1,14 @@ +# ListTransactionsStatus + + +## Values + +| Name | Value | +| ------------------------------------ | ------------------------------------ | +| `ListTransactionsStatusBlank` | blank | +| `ListTransactionsStatusReceiptMatch` | receipt_match | +| `ListTransactionsStatusInReview` | in_review | +| `ListTransactionsStatusExportError` | export_error | +| `ListTransactionsStatusExported` | exported | +| `ListTransactionsStatusExcluded` | excluded | +| `ListTransactionsStatusArchived` | archived | \ No newline at end of file diff --git a/docs/models/operations/listtransactionstype.md b/docs/models/operations/listtransactionstype.md index bd229f8..6807b59 100644 --- a/docs/models/operations/listtransactionstype.md +++ b/docs/models/operations/listtransactionstype.md @@ -1,6 +1,6 @@ # ListTransactionsType -Transaction type to filter by. 'income' for money received, 'expense' for money spent +Filter by transaction type. 'income' for money received, 'expense' for money spent ## Values diff --git a/docs/models/operations/manual.md b/docs/models/operations/manual.md new file mode 100644 index 0000000..f3127db --- /dev/null +++ b/docs/models/operations/manual.md @@ -0,0 +1,11 @@ +# Manual + +Filter transactions based on whether they were manually imported. 'include' returns only manual transactions, 'exclude' returns only non-manual transactions + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `ManualInclude` | include | +| `ManualExclude` | exclude | \ No newline at end of file diff --git a/docs/models/operations/name.md b/docs/models/operations/name.md new file mode 100644 index 0000000..d755936 --- /dev/null +++ b/docs/models/operations/name.md @@ -0,0 +1,9 @@ +# Name + +Line item description in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/notedetails.md b/docs/models/operations/notedetails.md new file mode 100644 index 0000000..0a94190 --- /dev/null +++ b/docs/models/operations/notedetails.md @@ -0,0 +1,9 @@ +# NoteDetails + +Additional notes for the invoice in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/outlookoauthcallbackrequest.md b/docs/models/operations/outlookoauthcallbackrequest.md new file mode 100644 index 0000000..71d6e76 --- /dev/null +++ b/docs/models/operations/outlookoauthcallbackrequest.md @@ -0,0 +1,10 @@ +# OutlookOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from Microsoft | +| `State` | *string* | :heavy_check_mark: | Encrypted OAuth state parameter | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | \ No newline at end of file diff --git a/docs/models/operations/outlookoauthcallbackresponse.md b/docs/models/operations/outlookoauthcallbackresponse.md new file mode 100644 index 0000000..20a2d39 --- /dev/null +++ b/docs/models/operations/outlookoauthcallbackresponse.md @@ -0,0 +1,9 @@ +# OutlookOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/paymentdetails.md b/docs/models/operations/paymentdetails.md new file mode 100644 index 0000000..1895a21 --- /dev/null +++ b/docs/models/operations/paymentdetails.md @@ -0,0 +1,9 @@ +# PaymentDetails + +Payment details in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/plaidwebhookresponse.md b/docs/models/operations/plaidwebhookresponse.md new file mode 100644 index 0000000..83f7511 --- /dev/null +++ b/docs/models/operations/plaidwebhookresponse.md @@ -0,0 +1,9 @@ +# PlaidWebhookResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.PlaidWebhookResponseBody](../../models/operations/plaidwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/plaidwebhookresponsebody.md b/docs/models/operations/plaidwebhookresponsebody.md new file mode 100644 index 0000000..068244c --- /dev/null +++ b/docs/models/operations/plaidwebhookresponsebody.md @@ -0,0 +1,10 @@ +# PlaidWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/platforms.md b/docs/models/operations/platforms.md new file mode 100644 index 0000000..f91d797 --- /dev/null +++ b/docs/models/operations/platforms.md @@ -0,0 +1,9 @@ +# Platforms + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Signature` | *string* | :heavy_check_mark: | N/A | +| `URL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/polarwebhookresponse.md b/docs/models/operations/polarwebhookresponse.md new file mode 100644 index 0000000..4cc183f --- /dev/null +++ b/docs/models/operations/polarwebhookresponse.md @@ -0,0 +1,9 @@ +# PolarWebhookResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.PolarWebhookResponseBody](../../models/operations/polarwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/polarwebhookresponsebody.md b/docs/models/operations/polarwebhookresponsebody.md new file mode 100644 index 0000000..c70eea5 --- /dev/null +++ b/docs/models/operations/polarwebhookresponsebody.md @@ -0,0 +1,10 @@ +# PolarWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Received` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postoauthauthorizationrequest.md b/docs/models/operations/postoauthauthorizationrequest.md new file mode 100644 index 0000000..911c254 --- /dev/null +++ b/docs/models/operations/postoauthauthorizationrequest.md @@ -0,0 +1,14 @@ +# PostOAuthAuthorizationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `ClientID` | *string* | :heavy_check_mark: | Client ID of the OAuth application | mid_client_abcdef123456789 | +| `Decision` | [operations.Decision](../../models/operations/decision.md) | :heavy_check_mark: | User's authorization decision | allow | +| `Scopes` | [][operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | Scopes the user has approved | [
"transactions.read",
"invoices.read"
] | +| `RedirectURI` | *string* | :heavy_check_mark: | Redirect URI for OAuth callback | https://myapp.com/callback | +| `State` | **string* | :heavy_minus_sign: | Opaque state parameter for CSRF protection | abc123xyz789_secure-random-state-value | +| `CodeChallenge` | **string* | :heavy_minus_sign: | Code challenge for PKCE (S256 method assumed) | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `TeamID` | *string* | :heavy_check_mark: | Team ID to authorize the application for | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file diff --git a/docs/models/operations/postoauthauthorizationresponse.md b/docs/models/operations/postoauthauthorizationresponse.md new file mode 100644 index 0000000..f2d21a8 --- /dev/null +++ b/docs/models/operations/postoauthauthorizationresponse.md @@ -0,0 +1,9 @@ +# PostOAuthAuthorizationResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.PostOAuthAuthorizationResponseBody](../../models/operations/postoauthauthorizationresponsebody.md) | :heavy_minus_sign: | Authorization decision processed, returns redirect URL | \ No newline at end of file diff --git a/docs/models/operations/postoauthauthorizationresponsebody.md b/docs/models/operations/postoauthauthorizationresponsebody.md new file mode 100644 index 0000000..64488cd --- /dev/null +++ b/docs/models/operations/postoauthauthorizationresponsebody.md @@ -0,0 +1,10 @@ +# PostOAuthAuthorizationResponseBody + +Authorization decision processed, returns redirect URL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `RedirectURL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postoauthregisterrequest.md b/docs/models/operations/postoauthregisterrequest.md new file mode 100644 index 0000000..aca86ec --- /dev/null +++ b/docs/models/operations/postoauthregisterrequest.md @@ -0,0 +1,15 @@ +# PostOAuthRegisterRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `ClientName` | *string* | :heavy_check_mark: | Human-readable name of the client | ChatGPT | +| `RedirectUris` | []*string* | :heavy_check_mark: | Array of redirect URIs | [
"https://chatgpt.com/connector/oauth/callback"
] | +| `GrantTypes` | []*string* | :heavy_minus_sign: | Requested grant types | [
"authorization_code",
"refresh_token"
] | +| `TokenEndpointAuthMethod` | **string* | :heavy_minus_sign: | Token endpoint authentication method | none | +| `Scope` | **string* | :heavy_minus_sign: | Space-separated requested scopes | transactions.read invoices.read | +| `LogoURI` | **string* | :heavy_minus_sign: | URL of the client logo | https://example.com/logo.png | +| `ClientURI` | **string* | :heavy_minus_sign: | URL of the client homepage | https://example.com | +| `ResponseTypes` | []*string* | :heavy_minus_sign: | Requested response types | [
"code"
] | \ No newline at end of file diff --git a/docs/models/operations/postoauthregisterresponse.md b/docs/models/operations/postoauthregisterresponse.md new file mode 100644 index 0000000..ba49901 --- /dev/null +++ b/docs/models/operations/postoauthregisterresponse.md @@ -0,0 +1,10 @@ +# PostOAuthRegisterResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `TwoHundredApplicationJSONObject` | [*operations.PostOAuthRegisterResponseBody1](../../models/operations/postoauthregisterresponsebody1.md) | :heavy_minus_sign: | Existing client returned (deduplicated) | +| `TwoHundredAndOneApplicationJSONObject` | [*operations.PostOAuthRegisterResponseBody2](../../models/operations/postoauthregisterresponsebody2.md) | :heavy_minus_sign: | Client registered successfully | \ No newline at end of file diff --git a/docs/models/operations/postoauthregisterresponsebody1.md b/docs/models/operations/postoauthregisterresponsebody1.md new file mode 100644 index 0000000..f5a1fd0 --- /dev/null +++ b/docs/models/operations/postoauthregisterresponsebody1.md @@ -0,0 +1,15 @@ +# PostOAuthRegisterResponseBody1 + +Existing client returned (deduplicated) + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `ClientID` | *string* | :heavy_check_mark: | Assigned client ID | mid_client_abcdef123456789 | +| `ClientName` | *string* | :heavy_check_mark: | Human-readable name of the client | ChatGPT | +| `RedirectUris` | []*string* | :heavy_check_mark: | Registered redirect URIs | [
"https://chatgpt.com/connector/oauth/callback"
] | +| `GrantTypes` | []*string* | :heavy_check_mark: | Granted grant types | [
"authorization_code",
"refresh_token"
] | +| `TokenEndpointAuthMethod` | *string* | :heavy_check_mark: | Token endpoint authentication method | none | +| `ResponseTypes` | []*string* | :heavy_check_mark: | Supported response types | [
"code"
] | \ No newline at end of file diff --git a/docs/models/operations/postoauthregisterresponsebody2.md b/docs/models/operations/postoauthregisterresponsebody2.md new file mode 100644 index 0000000..eb7ca31 --- /dev/null +++ b/docs/models/operations/postoauthregisterresponsebody2.md @@ -0,0 +1,15 @@ +# PostOAuthRegisterResponseBody2 + +Client registered successfully + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `ClientID` | *string* | :heavy_check_mark: | Assigned client ID | mid_client_abcdef123456789 | +| `ClientName` | *string* | :heavy_check_mark: | Human-readable name of the client | ChatGPT | +| `RedirectUris` | []*string* | :heavy_check_mark: | Registered redirect URIs | [
"https://chatgpt.com/connector/oauth/callback"
] | +| `GrantTypes` | []*string* | :heavy_check_mark: | Granted grant types | [
"authorization_code",
"refresh_token"
] | +| `TokenEndpointAuthMethod` | *string* | :heavy_check_mark: | Token endpoint authentication method | none | +| `ResponseTypes` | []*string* | :heavy_check_mark: | Supported response types | [
"code"
] | \ No newline at end of file diff --git a/docs/models/operations/postoauthrevokerequest.md b/docs/models/operations/postoauthrevokerequest.md new file mode 100644 index 0000000..29bbbcb --- /dev/null +++ b/docs/models/operations/postoauthrevokerequest.md @@ -0,0 +1,11 @@ +# PostOAuthRevokeRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `Token` | *string* | :heavy_check_mark: | Token to revoke (access token or refresh token) | mid_access_token_abcdef123456789 | +| `TokenTypeHint` | [*operations.TokenTypeHint](../../models/operations/tokentypehint.md) | :heavy_minus_sign: | Hint about the token type | access_token | +| `ClientID` | *string* | :heavy_check_mark: | Client ID of the OAuth application | mid_client_abcdef123456789 | +| `ClientSecret` | **string* | :heavy_minus_sign: | Client secret of the OAuth application (required for confidential clients) | mid_secret_abcdef123456789 | \ No newline at end of file diff --git a/docs/models/operations/postoauthrevokeresponse.md b/docs/models/operations/postoauthrevokeresponse.md new file mode 100644 index 0000000..797a904 --- /dev/null +++ b/docs/models/operations/postoauthrevokeresponse.md @@ -0,0 +1,10 @@ +# PostOAuthRevokeResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.PostOAuthRevokeResponseBody](../../models/operations/postoauthrevokeresponsebody.md) | :heavy_minus_sign: | Token revocation successful | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/postoauthrevokeresponsebody.md b/docs/models/operations/postoauthrevokeresponsebody.md new file mode 100644 index 0000000..c746644 --- /dev/null +++ b/docs/models/operations/postoauthrevokeresponsebody.md @@ -0,0 +1,10 @@ +# PostOAuthRevokeResponseBody + +Token revocation successful + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postoauthtokenresponse.md b/docs/models/operations/postoauthtokenresponse.md new file mode 100644 index 0000000..63f273d --- /dev/null +++ b/docs/models/operations/postoauthtokenresponse.md @@ -0,0 +1,9 @@ +# PostOAuthTokenResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.PostOAuthTokenResponseBody](../../models/operations/postoauthtokenresponsebody.md) | :heavy_minus_sign: | Token exchange successful | \ No newline at end of file diff --git a/docs/models/operations/postoauthtokenresponsebody.md b/docs/models/operations/postoauthtokenresponsebody.md new file mode 100644 index 0000000..4a32edb --- /dev/null +++ b/docs/models/operations/postoauthtokenresponsebody.md @@ -0,0 +1,14 @@ +# PostOAuthTokenResponseBody + +Token exchange successful + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `AccessToken` | *string* | :heavy_check_mark: | Access token for API requests | mid_access_token_abcdef123456789 | +| `TokenType` | [operations.TokenType](../../models/operations/tokentype.md) | :heavy_check_mark: | Token type, always 'Bearer' | Bearer | +| `ExpiresIn` | *float64* | :heavy_check_mark: | Token expiration time in seconds | 3600 | +| `RefreshToken` | *string* | :heavy_check_mark: | Refresh token for obtaining new access tokens | mid_refresh_token_abcdef123456789 | +| `Scope` | *string* | :heavy_check_mark: | Space-separated list of granted scopes | transactions.read invoices.read | \ No newline at end of file diff --git a/docs/models/operations/proxyfilerequest.md b/docs/models/operations/proxyfilerequest.md new file mode 100644 index 0000000..8bcfd79 --- /dev/null +++ b/docs/models/operations/proxyfilerequest.md @@ -0,0 +1,9 @@ +# ProxyFileRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `FilePath` | *string* | :heavy_check_mark: | Path to the file in storage. Can include or exclude 'vault/' prefix. | vault/documents/2024/invoice.pdf | +| `Fk` | *string* | :heavy_check_mark: | Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. | a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 | \ No newline at end of file diff --git a/docs/models/operations/proxyfileresponse.md b/docs/models/operations/proxyfileresponse.md new file mode 100644 index 0000000..6bdaaf9 --- /dev/null +++ b/docs/models/operations/proxyfileresponse.md @@ -0,0 +1,9 @@ +# ProxyFileResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | File content | \ No newline at end of file diff --git a/docs/models/operations/quickbooksoauthcallbackrequest.md b/docs/models/operations/quickbooksoauthcallbackrequest.md new file mode 100644 index 0000000..12c9f64 --- /dev/null +++ b/docs/models/operations/quickbooksoauthcallbackrequest.md @@ -0,0 +1,11 @@ +# QuickBooksOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from QuickBooks | +| `State` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `RealmID` | **string* | :heavy_minus_sign: | QuickBooks company/realm ID | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | \ No newline at end of file diff --git a/docs/models/operations/quickbooksoauthcallbackresponse.md b/docs/models/operations/quickbooksoauthcallbackresponse.md new file mode 100644 index 0000000..2e125cb --- /dev/null +++ b/docs/models/operations/quickbooksoauthcallbackresponse.md @@ -0,0 +1,9 @@ +# QuickBooksOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/requestbody.md b/docs/models/operations/requestbody.md index f93618d..283ba26 100644 --- a/docs/models/operations/requestbody.md +++ b/docs/models/operations/requestbody.md @@ -3,15 +3,15 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `Name` | *string* | :heavy_check_mark: | Name of the transaction. | -| `Amount` | *float64* | :heavy_check_mark: | Amount of the transaction. | -| `Currency` | *string* | :heavy_check_mark: | Currency of the transaction. | -| `Date` | *string* | :heavy_check_mark: | Date of the transaction (ISO 8601). | -| `BankAccountID` | *string* | :heavy_check_mark: | Bank account ID associated with the transaction. | -| `AssignedID` | **string* | :heavy_minus_sign: | Assigned user ID for the transaction. | -| `CategorySlug` | **string* | :heavy_minus_sign: | Category slug for the transaction. | -| `Note` | **string* | :heavy_minus_sign: | Note for the transaction. | -| `Internal` | **bool* | :heavy_minus_sign: | Whether the transaction is internal. | -| `Attachments` | [][operations.CreateTransactionsAttachment](../../models/operations/createtransactionsattachment.md) | :heavy_minus_sign: | Array of attachments for the transaction. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Name` | *string* | :heavy_check_mark: | Name of the transaction. | +| `Amount` | *float64* | :heavy_check_mark: | Amount of the transaction. | +| `Currency` | *string* | :heavy_check_mark: | Currency of the transaction. | +| `Date` | *string* | :heavy_check_mark: | Date of the transaction (ISO 8601). | +| `BankAccountID` | *string* | :heavy_check_mark: | Bank account ID associated with the transaction. | +| `AssignedID` | **string* | :heavy_minus_sign: | Assigned user ID for the transaction. | +| `CategorySlug` | **string* | :heavy_minus_sign: | Category slug for the transaction. | +| `Note` | **string* | :heavy_minus_sign: | Note for the transaction. | +| `Internal` | **bool* | :heavy_minus_sign: | Whether the transaction is internal. | +| `Attachments` | [][components.CreateTransactionAttachment](../../models/components/createtransactionattachment.md) | :heavy_minus_sign: | Array of attachments for the transaction. | \ No newline at end of file diff --git a/docs/models/operations/responsetype.md b/docs/models/operations/responsetype.md new file mode 100644 index 0000000..da92069 --- /dev/null +++ b/docs/models/operations/responsetype.md @@ -0,0 +1,10 @@ +# ResponseType + +OAuth response type, must be 'code' + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `ResponseTypeCode` | code | \ No newline at end of file diff --git a/docs/models/operations/scope.md b/docs/models/operations/scope.md new file mode 100644 index 0000000..98e7a06 --- /dev/null +++ b/docs/models/operations/scope.md @@ -0,0 +1,35 @@ +# Scope + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `ScopeBankAccountsRead` | bank-accounts.read | +| `ScopeBankAccountsWrite` | bank-accounts.write | +| `ScopeCustomersRead` | customers.read | +| `ScopeCustomersWrite` | customers.write | +| `ScopeDocumentsRead` | documents.read | +| `ScopeDocumentsWrite` | documents.write | +| `ScopeInboxRead` | inbox.read | +| `ScopeInboxWrite` | inbox.write | +| `ScopeInvoicesRead` | invoices.read | +| `ScopeInvoicesWrite` | invoices.write | +| `ScopeReportsRead` | reports.read | +| `ScopeSearchRead` | search.read | +| `ScopeTagsRead` | tags.read | +| `ScopeTagsWrite` | tags.write | +| `ScopeTeamsRead` | teams.read | +| `ScopeTeamsWrite` | teams.write | +| `ScopeTrackerEntriesRead` | tracker-entries.read | +| `ScopeTrackerEntriesWrite` | tracker-entries.write | +| `ScopeTrackerProjectsRead` | tracker-projects.read | +| `ScopeTrackerProjectsWrite` | tracker-projects.write | +| `ScopeTransactionsRead` | transactions.read | +| `ScopeTransactionsWrite` | transactions.write | +| `ScopeUsersRead` | users.read | +| `ScopeUsersWrite` | users.write | +| `ScopeNotificationsRead` | notifications.read | +| `ScopeNotificationsWrite` | notifications.write | +| `ScopeApisAll` | apis.all | +| `ScopeApisRead` | apis.read | \ No newline at end of file diff --git a/docs/models/operations/searchrequest.md b/docs/models/operations/searchrequest.md index 522161e..7d6ac11 100644 --- a/docs/models/operations/searchrequest.md +++ b/docs/models/operations/searchrequest.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | -| `SearchTerm` | **string* | :heavy_minus_sign: | N/A | Acme | -| `Language` | **string* | :heavy_minus_sign: | N/A | en | -| `Limit` | **float64* | :heavy_minus_sign: | N/A | 30 | -| `ItemsPerTableLimit` | **float64* | :heavy_minus_sign: | N/A | 5 | -| `RelevanceThreshold` | **float64* | :heavy_minus_sign: | N/A | 0.01 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `SearchTerm` | **string* | :heavy_minus_sign: | The term to search for across all data sources. | Acme | +| `Language` | **string* | :heavy_minus_sign: | Language code to use for search relevance and results. | en | +| `Limit` | **float64* | :heavy_minus_sign: | Maximum number of results to return. | 30 | +| `ItemsPerTableLimit` | **float64* | :heavy_minus_sign: | Maximum number of results to return per table/entity. | 5 | +| `RelevanceThreshold` | **float64* | :heavy_minus_sign: | Minimum relevance score threshold for including a result. | 0.01 | \ No newline at end of file diff --git a/docs/models/operations/searchresponse.md b/docs/models/operations/searchresponse.md index 61ba0be..9b5a375 100644 --- a/docs/models/operations/searchresponse.md +++ b/docs/models/operations/searchresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `ResponseBodies` | [][operations.SearchResponseBody](../../models/operations/searchresponsebody.md) | :heavy_minus_sign: | Search results. | [
{
"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a",
"type": "invoice",
"relevance": 0.92,
"created_at": "2024-06-01T00:00:00.000Z",
"data": {
"invoiceNumber": "INV-2024-001",
"customerName": "Acme Corporation",
"amount": 1500.75
}
}
] | \ No newline at end of file +| `ResponseBodies` | [][operations.SearchResponseBody](../../models/operations/searchresponsebody.md) | :heavy_minus_sign: | Search results. | [
{
"id": "b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a",
"type": "invoice",
"relevance": 0.92,
"created_at": "2024-06-01T00:00:00.000Z",
"data": {
"invoiceNumber": "INV-2024-001",
"customerName": "Acme Corporation",
"amount": 1500.75
}
}
] | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/size.md b/docs/models/operations/size.md new file mode 100644 index 0000000..38f2ce4 --- /dev/null +++ b/docs/models/operations/size.md @@ -0,0 +1,9 @@ +# Size + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `SizeA4` | a4 | +| `SizeLetter` | letter | \ No newline at end of file diff --git a/docs/models/operations/slackinteractionsresponse.md b/docs/models/operations/slackinteractionsresponse.md new file mode 100644 index 0000000..894525c --- /dev/null +++ b/docs/models/operations/slackinteractionsresponse.md @@ -0,0 +1,10 @@ +# SlackInteractionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.SlackInteractionsResponseBody](../../models/operations/slackinteractionsresponsebody.md) | :heavy_minus_sign: | Interaction handled successfully | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/slackinteractionsresponsebody.md b/docs/models/operations/slackinteractionsresponsebody.md new file mode 100644 index 0000000..bead0fd --- /dev/null +++ b/docs/models/operations/slackinteractionsresponsebody.md @@ -0,0 +1,10 @@ +# SlackInteractionsResponseBody + +Interaction handled successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Ok` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/slackoauthcallbackrequest.md b/docs/models/operations/slackoauthcallbackrequest.md new file mode 100644 index 0000000..c370100 --- /dev/null +++ b/docs/models/operations/slackoauthcallbackrequest.md @@ -0,0 +1,9 @@ +# SlackOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `Code` | *string* | :heavy_check_mark: | OAuth authorization code from Slack | +| `State` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | \ No newline at end of file diff --git a/docs/models/operations/slackoauthcallbackresponse.md b/docs/models/operations/slackoauthcallbackresponse.md new file mode 100644 index 0000000..dea58b5 --- /dev/null +++ b/docs/models/operations/slackoauthcallbackresponse.md @@ -0,0 +1,9 @@ +# SlackOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/slackwebhookresponse.md b/docs/models/operations/slackwebhookresponse.md new file mode 100644 index 0000000..6d4d989 --- /dev/null +++ b/docs/models/operations/slackwebhookresponse.md @@ -0,0 +1,10 @@ +# SlackWebhookResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.SlackWebhookResponseBody](../../models/operations/slackwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/slackwebhookresponsebody.md b/docs/models/operations/slackwebhookresponsebody.md new file mode 100644 index 0000000..6c62bb8 --- /dev/null +++ b/docs/models/operations/slackwebhookresponsebody.md @@ -0,0 +1,11 @@ +# SlackWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Challenge` | **string* | :heavy_minus_sign: | N/A | +| `Ok` | **bool* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/starttimerdata.md b/docs/models/operations/starttimerdata.md index 85cf3c9..9060606 100644 --- a/docs/models/operations/starttimerdata.md +++ b/docs/models/operations/starttimerdata.md @@ -9,7 +9,7 @@ | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the tracker entry was created in ISO 8601 format | 2024-04-15T09:00:00.000Z | | `Duration` | *float64* | :heavy_check_mark: | Duration of the timer entry in seconds. -1 indicates running, null for paused, positive number for completed | -1 | | `Start` | *string* | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format. Null for running timers. | 2024-04-15T17:00:00.000Z | | `TeamID` | *string* | :heavy_check_mark: | Unique identifier of the team that owns this tracker entry | team-1234 | | `Description` | *string* | :heavy_check_mark: | Description or notes for the tracker entry | Worked on implementing user authentication feature | | `Rate` | *float64* | :heavy_check_mark: | Hourly rate applied to this tracker entry | 75 | diff --git a/docs/models/operations/starttimerresponse.md b/docs/models/operations/starttimerresponse.md index 776a20c..b8ee4c2 100644 --- a/docs/models/operations/starttimerresponse.md +++ b/docs/models/operations/starttimerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.StartTimerResponseBody](../../models/operations/starttimerresponsebody.md) | :heavy_minus_sign: | Timer started successfully. | \ No newline at end of file +| `Object` | [*operations.StartTimerResponseBody](../../models/operations/starttimerresponsebody.md) | :heavy_minus_sign: | Timer started successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/status.md b/docs/models/operations/status.md new file mode 100644 index 0000000..8fa793e --- /dev/null +++ b/docs/models/operations/status.md @@ -0,0 +1,19 @@ +# Status + +Filter by notification status. Can be a single status or array of statuses. unread = new notifications, read = viewed but not dismissed, archived = dismissed from view + + +## Supported Types + +### ListNotificationsStatusEnum1 + +```go +status := operations.CreateStatusListNotificationsStatusEnum1(operations.ListNotificationsStatusEnum1{/* values here */}) +``` + +### + +```go +status := operations.CreateStatusArrayOfListNotificationsStatusEnum2([]operations.ListNotificationsStatusEnum2{/* values here */}) +``` + diff --git a/docs/models/operations/stoptimerdata.md b/docs/models/operations/stoptimerdata1.md similarity index 98% rename from docs/models/operations/stoptimerdata.md rename to docs/models/operations/stoptimerdata1.md index 1f3d816..b03bd06 100644 --- a/docs/models/operations/stoptimerdata.md +++ b/docs/models/operations/stoptimerdata1.md @@ -1,4 +1,4 @@ -# StopTimerData +# StopTimerData1 ## Fields @@ -9,7 +9,7 @@ | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the tracker entry was created in ISO 8601 format | 2024-04-15T09:00:00.000Z | | `Duration` | *float64* | :heavy_check_mark: | Duration of the timer entry in seconds. -1 indicates running, null for paused, positive number for completed | -1 | | `Start` | *string* | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Stop` | *string* | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format. Null for running timers. | 2024-04-15T17:00:00.000Z | | `TeamID` | *string* | :heavy_check_mark: | Unique identifier of the team that owns this tracker entry | team-1234 | | `Description` | *string* | :heavy_check_mark: | Description or notes for the tracker entry | Worked on implementing user authentication feature | | `Rate` | *float64* | :heavy_check_mark: | Hourly rate applied to this tracker entry | 75 | @@ -17,4 +17,4 @@ | `Billed` | *bool* | :heavy_check_mark: | Whether this tracker entry has been billed to the customer | false | | `Date` | *string* | :heavy_check_mark: | Date of the tracker entry in YYYY-MM-DD format | 2024-04-15 | | `User` | [operations.StopTimerUser](../../models/operations/stoptimeruser.md) | :heavy_check_mark: | User information for the person who created this tracker entry | | -| `Project` | [operations.StopTimerProject](../../models/operations/stoptimerproject.md) | :heavy_check_mark: | Project information associated with this tracker entry | | \ No newline at end of file +| `Project` | [operations.StopTimerProject1](../../models/operations/stoptimerproject1.md) | :heavy_check_mark: | Project information associated with this tracker entry | | \ No newline at end of file diff --git a/docs/models/operations/stoptimerdata2.md b/docs/models/operations/stoptimerdata2.md new file mode 100644 index 0000000..0471b43 --- /dev/null +++ b/docs/models/operations/stoptimerdata2.md @@ -0,0 +1,15 @@ +# StopTimerData2 + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | N/A | | +| `Discarded` | *bool* | :heavy_check_mark: | Always true for discarded timer entries (duration < 60s) | true | +| `Duration` | *float64* | :heavy_check_mark: | N/A | | +| `Project` | [*operations.StopTimerProject2](../../models/operations/stoptimerproject2.md) | :heavy_minus_sign: | N/A | | +| `TrackerProject` | [*operations.StopTimerTrackerProject](../../models/operations/stoptimertrackerproject.md) | :heavy_minus_sign: | N/A | | +| `Start` | *string* | :heavy_check_mark: | N/A | | +| `Stop` | *string* | :heavy_check_mark: | N/A | | +| `Description` | *string* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/stoptimerproject.md b/docs/models/operations/stoptimerproject1.md similarity index 99% rename from docs/models/operations/stoptimerproject.md rename to docs/models/operations/stoptimerproject1.md index 4e69be8..28f9af8 100644 --- a/docs/models/operations/stoptimerproject.md +++ b/docs/models/operations/stoptimerproject1.md @@ -1,4 +1,4 @@ -# StopTimerProject +# StopTimerProject1 Project information associated with this tracker entry diff --git a/docs/models/operations/trackerproject.md b/docs/models/operations/stoptimerproject2.md similarity index 94% rename from docs/models/operations/trackerproject.md rename to docs/models/operations/stoptimerproject2.md index 50de58c..126591d 100644 --- a/docs/models/operations/trackerproject.md +++ b/docs/models/operations/stoptimerproject2.md @@ -1,4 +1,4 @@ -# TrackerProject +# StopTimerProject2 ## Fields diff --git a/docs/models/operations/stoptimerresponse.md b/docs/models/operations/stoptimerresponse.md index 600b8ad..a2dfebb 100644 --- a/docs/models/operations/stoptimerresponse.md +++ b/docs/models/operations/stoptimerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.StopTimerResponseBody](../../models/operations/stoptimerresponsebody.md) | :heavy_minus_sign: | Timer stopped successfully. | \ No newline at end of file +| `Object` | [*operations.StopTimerResponseBody](../../models/operations/stoptimerresponsebody.md) | :heavy_minus_sign: | Timer stopped successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/stoptimerresponsebody.md b/docs/models/operations/stoptimerresponsebody.md index 4f0d47e..ea27563 100644 --- a/docs/models/operations/stoptimerresponsebody.md +++ b/docs/models/operations/stoptimerresponsebody.md @@ -5,6 +5,6 @@ Timer stopped successfully. ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `Data` | [operations.StopTimerData](../../models/operations/stoptimerdata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `Data` | [operations.Data](../../models/operations/data.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/stoptimertrackerproject.md b/docs/models/operations/stoptimertrackerproject.md new file mode 100644 index 0000000..4cba2d9 --- /dev/null +++ b/docs/models/operations/stoptimertrackerproject.md @@ -0,0 +1,9 @@ +# StopTimerTrackerProject + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | *string* | :heavy_check_mark: | N/A | +| `Name` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/stripeconnectcallbackrequest.md b/docs/models/operations/stripeconnectcallbackrequest.md new file mode 100644 index 0000000..15fd68d --- /dev/null +++ b/docs/models/operations/stripeconnectcallbackrequest.md @@ -0,0 +1,11 @@ +# StripeConnectCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from Stripe | +| `State` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `ErrorDescription` | **string* | :heavy_minus_sign: | OAuth error description | \ No newline at end of file diff --git a/docs/models/operations/stripeconnectcallbackresponse.md b/docs/models/operations/stripeconnectcallbackresponse.md new file mode 100644 index 0000000..87cb619 --- /dev/null +++ b/docs/models/operations/stripeconnectcallbackresponse.md @@ -0,0 +1,9 @@ +# StripeConnectCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getexpensesmetricsresponse.md b/docs/models/operations/stripewebhookresponse.md similarity index 77% rename from docs/models/operations/getexpensesmetricsresponse.md rename to docs/models/operations/stripewebhookresponse.md index ca77ace..3d87ea8 100644 --- a/docs/models/operations/getexpensesmetricsresponse.md +++ b/docs/models/operations/stripewebhookresponse.md @@ -1,4 +1,4 @@ -# GetExpensesMetricsResponse +# StripeWebhookResponse ## Fields @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `GetExpensesResponseSchema` | [*components.GetExpensesResponseSchema](../../models/components/getexpensesresponseschema.md) | :heavy_minus_sign: | Expense metrics for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.StripeWebhookResponseBody](../../models/operations/stripewebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/stripewebhookresponsebody.md b/docs/models/operations/stripewebhookresponsebody.md new file mode 100644 index 0000000..9d67844 --- /dev/null +++ b/docs/models/operations/stripewebhookresponsebody.md @@ -0,0 +1,10 @@ +# StripeWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Received` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/tab.md b/docs/models/operations/tab.md new file mode 100644 index 0000000..5ad519e --- /dev/null +++ b/docs/models/operations/tab.md @@ -0,0 +1,11 @@ +# Tab + +Tab filter: all or other + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `TabAll` | all | +| `TabOther` | other | \ No newline at end of file diff --git a/docs/models/operations/tellerwebhookresponse.md b/docs/models/operations/tellerwebhookresponse.md new file mode 100644 index 0000000..d42ff70 --- /dev/null +++ b/docs/models/operations/tellerwebhookresponse.md @@ -0,0 +1,9 @@ +# TellerWebhookResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.TellerWebhookResponseBody](../../models/operations/tellerwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/tellerwebhookresponsebody.md b/docs/models/operations/tellerwebhookresponsebody.md new file mode 100644 index 0000000..b0c52ed --- /dev/null +++ b/docs/models/operations/tellerwebhookresponsebody.md @@ -0,0 +1,10 @@ +# TellerWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/template.md b/docs/models/operations/template.md new file mode 100644 index 0000000..9ca05e5 --- /dev/null +++ b/docs/models/operations/template.md @@ -0,0 +1,54 @@ +# Template + +Invoice template details + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `CustomerLabel` | **string* | :heavy_minus_sign: | N/A | | +| `Title` | **string* | :heavy_minus_sign: | N/A | | +| `FromLabel` | **string* | :heavy_minus_sign: | N/A | | +| `InvoiceNoLabel` | **string* | :heavy_minus_sign: | N/A | | +| `IssueDateLabel` | **string* | :heavy_minus_sign: | N/A | | +| `DueDateLabel` | **string* | :heavy_minus_sign: | N/A | | +| `DescriptionLabel` | **string* | :heavy_minus_sign: | N/A | | +| `PriceLabel` | **string* | :heavy_minus_sign: | N/A | | +| `QuantityLabel` | **string* | :heavy_minus_sign: | N/A | | +| `TotalLabel` | **string* | :heavy_minus_sign: | N/A | | +| `TotalSummaryLabel` | **string* | :heavy_minus_sign: | N/A | | +| `VatLabel` | **string* | :heavy_minus_sign: | N/A | | +| `SubtotalLabel` | **string* | :heavy_minus_sign: | N/A | | +| `TaxLabel` | **string* | :heavy_minus_sign: | N/A | | +| `DiscountLabel` | **string* | :heavy_minus_sign: | N/A | | +| `Timezone` | **string* | :heavy_minus_sign: | N/A | | +| `PaymentLabel` | **string* | :heavy_minus_sign: | N/A | | +| `NoteLabel` | **string* | :heavy_minus_sign: | N/A | | +| `LogoURL` | **string* | :heavy_minus_sign: | N/A | | +| `Currency` | **string* | :heavy_minus_sign: | N/A | | +| `DateFormat` | **string* | :heavy_minus_sign: | N/A | | +| `IncludeVat` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeTax` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeDiscount` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeDecimals` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludePdf` | **bool* | :heavy_minus_sign: | N/A | | +| `SendCopy` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeUnits` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeQr` | **bool* | :heavy_minus_sign: | N/A | | +| `IncludeLineItemTax` | **bool* | :heavy_minus_sign: | N/A | | +| `LineItemTaxLabel` | **string* | :heavy_minus_sign: | N/A | | +| `TaxRate` | **float64* | :heavy_minus_sign: | N/A | | +| `VatRate` | **float64* | :heavy_minus_sign: | N/A | | +| `Size` | [*operations.Size](../../models/operations/size.md) | :heavy_minus_sign: | N/A | | +| `DeliveryType` | [*operations.TemplateDeliveryType](../../models/operations/templatedeliverytype.md) | :heavy_minus_sign: | N/A | | +| `Locale` | **string* | :heavy_minus_sign: | N/A | | +| `PaymentEnabled` | **bool* | :heavy_minus_sign: | N/A | | +| `PaymentTermsDays` | **float64* | :heavy_minus_sign: | N/A | | +| `EmailSubject` | **string* | :heavy_minus_sign: | N/A | | +| `EmailHeading` | **string* | :heavy_minus_sign: | N/A | | +| `EmailBody` | **string* | :heavy_minus_sign: | N/A | | +| `EmailButtonText` | **string* | :heavy_minus_sign: | N/A | | +| `PaymentDetails` | [*operations.TemplatePaymentDetails](../../models/operations/templatepaymentdetails.md) | :heavy_minus_sign: | Payment details in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "123 Main St, City, Country"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Visit our website: "
},
{
"type": "text",
"text": "https://acme.com",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://acme.com"
}
}
]
}
]
}
]
} | +| `FromDetails` | [*operations.TemplateFromDetails](../../models/operations/templatefromdetails.md) | :heavy_minus_sign: | Sender details in TipTap JSONContent format | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "123 Main St, City, Country"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Visit our website: "
},
{
"type": "text",
"text": "https://acme.com",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://acme.com"
}
}
]
}
]
}
]
} | +| `NoteDetails` | [*operations.TemplateNoteDetails](../../models/operations/templatenotedetails.md) | :heavy_minus_sign: | Default footer notes in TipTap JSONContent format for new invoices | {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Acme Inc",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "123 Main St, City, Country"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Visit our website: "
},
{
"type": "text",
"text": "https://acme.com",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://acme.com"
}
}
]
}
]
}
]
} | \ No newline at end of file diff --git a/docs/models/operations/templatedeliverytype.md b/docs/models/operations/templatedeliverytype.md new file mode 100644 index 0000000..9e6e08e --- /dev/null +++ b/docs/models/operations/templatedeliverytype.md @@ -0,0 +1,10 @@ +# TemplateDeliveryType + + +## Values + +| Name | Value | +| ----------------------------------- | ----------------------------------- | +| `TemplateDeliveryTypeCreate` | create | +| `TemplateDeliveryTypeCreateAndSend` | create_and_send | +| `TemplateDeliveryTypeScheduled` | scheduled | \ No newline at end of file diff --git a/docs/models/operations/templatefromdetails.md b/docs/models/operations/templatefromdetails.md new file mode 100644 index 0000000..a9f16b8 --- /dev/null +++ b/docs/models/operations/templatefromdetails.md @@ -0,0 +1,9 @@ +# TemplateFromDetails + +Sender details in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/templatenotedetails.md b/docs/models/operations/templatenotedetails.md new file mode 100644 index 0000000..b512498 --- /dev/null +++ b/docs/models/operations/templatenotedetails.md @@ -0,0 +1,9 @@ +# TemplateNoteDetails + +Default footer notes in TipTap JSONContent format for new invoices + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/templatepaymentdetails.md b/docs/models/operations/templatepaymentdetails.md new file mode 100644 index 0000000..d09b580 --- /dev/null +++ b/docs/models/operations/templatepaymentdetails.md @@ -0,0 +1,9 @@ +# TemplatePaymentDetails + +Payment details in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/tokentype.md b/docs/models/operations/tokentype.md new file mode 100644 index 0000000..0bfa3f8 --- /dev/null +++ b/docs/models/operations/tokentype.md @@ -0,0 +1,10 @@ +# TokenType + +Token type, always 'Bearer' + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `TokenTypeBearer` | Bearer | \ No newline at end of file diff --git a/docs/models/operations/tokentypehint.md b/docs/models/operations/tokentypehint.md new file mode 100644 index 0000000..ef7b5ce --- /dev/null +++ b/docs/models/operations/tokentypehint.md @@ -0,0 +1,11 @@ +# TokenTypeHint + +Hint about the token type + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `TokenTypeHintAccessToken` | access_token | +| `TokenTypeHintRefreshToken` | refresh_token | \ No newline at end of file diff --git a/docs/models/operations/topblock.md b/docs/models/operations/topblock.md new file mode 100644 index 0000000..140c3ba --- /dev/null +++ b/docs/models/operations/topblock.md @@ -0,0 +1,9 @@ +# TopBlock + +Custom content block to display at the top of the invoice in TipTap JSONContent format + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/updateallnotificationsstatusresponse.md b/docs/models/operations/updateallnotificationsstatusresponse.md new file mode 100644 index 0000000..5eda67a --- /dev/null +++ b/docs/models/operations/updateallnotificationsstatusresponse.md @@ -0,0 +1,10 @@ +# UpdateAllNotificationsStatusResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `UpdateAllNotificationsStatusResponseSchema` | [*components.UpdateAllNotificationsStatusResponseSchema](../../models/components/updateallnotificationsstatusresponseschema.md) | :heavy_minus_sign: | All notifications status updated successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatebankaccountrequest.md b/docs/models/operations/updatebankaccountrequest.md index 0c25f27..f57d060 100644 --- a/docs/models/operations/updatebankaccountrequest.md +++ b/docs/models/operations/updatebankaccountrequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | -| `RequestBody` | [*operations.UpdateBankAccountRequestBody](../../models/operations/updatebankaccountrequestbody.md) | :heavy_minus_sign: | N/A | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"enabled": true,
"balance": 1500.75,
"type": "depository"
} | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | +| `RequestBody` | [operations.UpdateBankAccountRequestBody](../../models/operations/updatebankaccountrequestbody.md) | :heavy_check_mark: | N/A | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"enabled": true,
"balance": 1500.75,
"type": "depository"
} | \ No newline at end of file diff --git a/docs/models/operations/updatebankaccountresponse.md b/docs/models/operations/updatebankaccountresponse.md index 6934541..eee6598 100644 --- a/docs/models/operations/updatebankaccountresponse.md +++ b/docs/models/operations/updatebankaccountresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | -| `Object` | [*operations.UpdateBankAccountResponseBody](../../models/operations/updatebankaccountresponsebody.md) | :heavy_minus_sign: | Bank account updated | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | \ No newline at end of file +| `Object` | [*operations.UpdateBankAccountResponseBody](../../models/operations/updatebankaccountresponsebody.md) | :heavy_minus_sign: | Bank account updated | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"currency": "USD",
"type": "depository",
"enabled": true,
"balance": 1500.75,
"manual": false
} | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | | \ No newline at end of file diff --git a/docs/models/operations/updatecurrentuserrequest.md b/docs/models/operations/updatecurrentuserrequest.md index 4f4165f..7dac2d1 100644 --- a/docs/models/operations/updatecurrentuserrequest.md +++ b/docs/models/operations/updatecurrentuserrequest.md @@ -6,7 +6,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `FullName` | **string* | :heavy_minus_sign: | Full name of the user. Must be between 2 and 32 characters | Jane Doe | -| `TeamID` | **string* | :heavy_minus_sign: | Unique identifier of the team the user belongs to | team-abc123 | | `Email` | **string* | :heavy_minus_sign: | Email address of the user | jane.doe@acme.com | | `AvatarURL` | **string* | :heavy_minus_sign: | URL to the user's avatar image. Must be hosted on midday.ai domain | https://cdn.midday.ai/avatars/jane-doe.jpg | | `Locale` | **string* | :heavy_minus_sign: | User's preferred locale for internationalization (language and region) | en-US | diff --git a/docs/models/operations/updatecurrentuserresponse.md b/docs/models/operations/updatecurrentuserresponse.md index 7796f9b..ee1745f 100644 --- a/docs/models/operations/updatecurrentuserresponse.md +++ b/docs/models/operations/updatecurrentuserresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateCurrentUserResponseBody](../../models/operations/updatecurrentuserresponsebody.md) | :heavy_minus_sign: | The updated user | \ No newline at end of file +| `Object` | [*operations.UpdateCurrentUserResponseBody](../../models/operations/updatecurrentuserresponsebody.md) | :heavy_minus_sign: | The updated user | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatecurrentuserresponsebody.md b/docs/models/operations/updatecurrentuserresponsebody.md index 247b479..cb629d7 100644 --- a/docs/models/operations/updatecurrentuserresponsebody.md +++ b/docs/models/operations/updatecurrentuserresponsebody.md @@ -5,16 +5,17 @@ The updated user ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | Unique identifier of the user | 123e4567-e89b-12d3-a456-426614174000 | -| `FullName` | *string* | :heavy_check_mark: | Full name of the user | Jane Doe | -| `Email` | *string* | :heavy_check_mark: | Email address of the user | jane.doe@acme.com | -| `AvatarURL` | *string* | :heavy_check_mark: | URL to the user's avatar image | https://cdn.midday.ai/avatars/jane-doe.jpg | -| `Locale` | *string* | :heavy_check_mark: | User's preferred locale for internationalization (language and region) | en-US | -| `WeekStartsOnMonday` | *bool* | :heavy_check_mark: | Whether the user's calendar week starts on Monday (true) or Sunday (false) | true | -| `Timezone` | *string* | :heavy_check_mark: | User's timezone identifier in IANA Time Zone Database format | America/New_York | -| `TimezoneAutoSync` | *bool* | :heavy_check_mark: | Whether to automatically sync timezone with browser timezone | true | -| `TimeFormat` | *float64* | :heavy_check_mark: | User's preferred time format: 12 for 12-hour format, 24 for 24-hour format | 24 | -| `DateFormat` | [operations.UpdateCurrentUserDateFormatResponse](../../models/operations/updatecurrentuserdateformatresponse.md) | :heavy_check_mark: | User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' | yyyy-MM-dd | -| `Team` | [operations.UpdateCurrentUserTeam](../../models/operations/updatecurrentuserteam.md) | :heavy_check_mark: | Team information that the user belongs to | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the user | 123e4567-e89b-12d3-a456-426614174000 | +| `FullName` | *string* | :heavy_check_mark: | Full name of the user | Jane Doe | +| `Email` | *string* | :heavy_check_mark: | Email address of the user | jane.doe@acme.com | +| `AvatarURL` | *string* | :heavy_check_mark: | URL to the user's avatar image | https://cdn.midday.ai/avatars/jane-doe.jpg | +| `Locale` | *string* | :heavy_check_mark: | User's preferred locale for internationalization (language and region) | en-US | +| `WeekStartsOnMonday` | *bool* | :heavy_check_mark: | Whether the user's calendar week starts on Monday (true) or Sunday (false) | true | +| `Timezone` | *string* | :heavy_check_mark: | User's timezone identifier in IANA Time Zone Database format | America/New_York | +| `TimezoneAutoSync` | *bool* | :heavy_check_mark: | Whether to automatically sync timezone with browser timezone | true | +| `TimeFormat` | *float64* | :heavy_check_mark: | User's preferred time format: 12 for 12-hour format, 24 for 24-hour format | 24 | +| `DateFormat` | [operations.UpdateCurrentUserDateFormatResponse](../../models/operations/updatecurrentuserdateformatresponse.md) | :heavy_check_mark: | User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' | yyyy-MM-dd | +| `FileKey` | *string* | :heavy_check_mark: | Team file key (JWT token) for proxy/download access to team files. This compact JWT token contains the team ID and is shared by all team members. Use this token as the `fk` query parameter when accessing file endpoints (proxy, download). The token is team-scoped and provides access to files belonging to the user's team. Returns null if the user has no team. | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZWFtSWQiOiIxMjM0NTY3OC05YWJjLWRlZmctMTIzNC01Njc4OTBhYmNkZWYifQ.signature | +| `Team` | [operations.UpdateCurrentUserTeam](../../models/operations/updatecurrentuserteam.md) | :heavy_check_mark: | Team information that the user belongs to | | \ No newline at end of file diff --git a/docs/models/operations/updatecustomerrequest.md b/docs/models/operations/updatecustomerrequest.md index a7411d4..3e3cf74 100644 --- a/docs/models/operations/updatecustomerrequest.md +++ b/docs/models/operations/updatecustomerrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | -| `RequestBody` | [*operations.UpdateCustomerRequestBody](../../models/operations/updatecustomerrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `RequestBody` | [operations.UpdateCustomerRequestBody](../../models/operations/updatecustomerrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatecustomerrequestbody.md b/docs/models/operations/updatecustomerrequestbody.md index c62cfb7..a1c433b 100644 --- a/docs/models/operations/updatecustomerrequestbody.md +++ b/docs/models/operations/updatecustomerrequestbody.md @@ -8,7 +8,7 @@ | `ID` | **string* | :heavy_minus_sign: | Unique identifier of the customer. Required for updates, omit for new customers | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | **string* | :heavy_minus_sign: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | **string* | :heavy_minus_sign: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Country` | **string* | :heavy_minus_sign: | Country name where the customer is located | United States | | `AddressLine1` | **string* | :heavy_minus_sign: | First line of the customer's address | 123 Main Street | | `AddressLine2` | **string* | :heavy_minus_sign: | Second line of the customer's address (suite, apartment, etc.) | Suite 400 | diff --git a/docs/models/operations/updatecustomerresponse.md b/docs/models/operations/updatecustomerresponse.md index cd2318a..5b8f5cb 100644 --- a/docs/models/operations/updatecustomerresponse.md +++ b/docs/models/operations/updatecustomerresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateCustomerResponseBody](../../models/operations/updatecustomerresponsebody.md) | :heavy_minus_sign: | Customer updated | \ No newline at end of file +| `Object` | [*operations.UpdateCustomerResponseBody](../../models/operations/updatecustomerresponsebody.md) | :heavy_minus_sign: | Customer updated | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatecustomerresponsebody.md b/docs/models/operations/updatecustomerresponsebody.md index 448fe60..4f026c3 100644 --- a/docs/models/operations/updatecustomerresponsebody.md +++ b/docs/models/operations/updatecustomerresponsebody.md @@ -10,7 +10,7 @@ Customer updated | `ID` | *string* | :heavy_check_mark: | Unique identifier of the customer | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `Name` | *string* | :heavy_check_mark: | Name of the customer or organization | Acme Corporation | | `Email` | *string* | :heavy_check_mark: | Primary email address of the customer | contact@acme.com | -| `BillingEmail` | *string* | :heavy_check_mark: | Billing email address of the customer | finance@acme.com | +| `BillingEmail` | *string* | :heavy_check_mark: | Billing email addresses of the customer (comma-separated for multiple) | finance@acme.com, accounting@acme.com | | `Phone` | *string* | :heavy_check_mark: | Primary phone number of the customer | +1-555-123-4567 | | `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | | `CreatedAt` | *string* | :heavy_check_mark: | Date and time when the customer was created in ISO 8601 format | 2024-05-01T12:34:56.789Z | @@ -27,4 +27,30 @@ Customer updated | `Contact` | *string* | :heavy_check_mark: | Primary contact person's name at the customer organization | John Smith | | `InvoiceCount` | *float64* | :heavy_check_mark: | Total number of invoices created for this customer | 12 | | `ProjectCount` | *float64* | :heavy_check_mark: | Total number of projects associated with this customer | 3 | -| `Tags` | [][operations.UpdateCustomerTagResponse](../../models/operations/updatecustomertagresponse.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | \ No newline at end of file +| `TotalRevenue` | **float64* | :heavy_minus_sign: | Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. | 15000.5 | +| `OutstandingAmount` | **float64* | :heavy_minus_sign: | Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. | 2500 | +| `LastInvoiceDate` | **string* | :heavy_minus_sign: | Date of the most recent invoice in ISO 8601 format. Only returned in list queries. | 2024-04-15 | +| `InvoiceCurrency` | **string* | :heavy_minus_sign: | Primary currency used in invoices for this customer. Only returned in list queries. | USD | +| `Tags` | [][operations.UpdateCustomerTagResponse](../../models/operations/updatecustomertagresponse.md) | :heavy_check_mark: | Array of tags associated with the customer for categorization | [
{
"id": "e7a9c1a2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
"name": "VIP"
},
{
"id": "f1b2c3d4-5678-4e7a-9c1a-2b7c1e24c2a4",
"name": "Enterprise"
}
] | +| `Description` | *string* | :heavy_check_mark: | AI-generated description of what the company does | A cloud-based project management platform for remote teams. | +| `Industry` | *string* | :heavy_check_mark: | Primary industry of the company | Software | +| `CompanyType` | *string* | :heavy_check_mark: | Business model type | SaaS | +| `EmployeeCount` | *string* | :heavy_check_mark: | Estimated number of employees | 51-200 | +| `FoundedYear` | *float64* | :heavy_check_mark: | Year the company was founded | 2018 | +| `EstimatedRevenue` | *string* | :heavy_check_mark: | Estimated annual revenue range | $10M-$50M | +| `FundingStage` | *string* | :heavy_check_mark: | Current funding stage | Series A | +| `TotalFunding` | *string* | :heavy_check_mark: | Total funding raised | $15M | +| `HeadquartersLocation` | *string* | :heavy_check_mark: | Company headquarters location | San Francisco, CA | +| `Timezone` | *string* | :heavy_check_mark: | IANA timezone of the company headquarters | America/Los_Angeles | +| `LinkedinURL` | *string* | :heavy_check_mark: | LinkedIn company page URL | https://linkedin.com/company/acme | +| `TwitterURL` | *string* | :heavy_check_mark: | Twitter/X profile URL | https://twitter.com/acme | +| `InstagramURL` | *string* | :heavy_check_mark: | Instagram profile URL | https://instagram.com/acme | +| `FacebookURL` | *string* | :heavy_check_mark: | Facebook page URL | https://facebook.com/acme | +| `LogoURL` | *string* | :heavy_check_mark: | URL to the company logo | https://example.com/logo.png | +| `CeoName` | *string* | :heavy_check_mark: | Name of the CEO or founder | Jane Smith | +| `FinanceContact` | *string* | :heavy_check_mark: | Name of the finance/AP contact for invoicing | John Doe | +| `FinanceContactEmail` | *string* | :heavy_check_mark: | Email of the finance/AP contact | finance@acme.com | +| `PrimaryLanguage` | *string* | :heavy_check_mark: | Primary business language (ISO 639-1 code) | en | +| `FiscalYearEnd` | *string* | :heavy_check_mark: | Month when the fiscal year ends | December | +| `EnrichmentStatus` | *string* | :heavy_check_mark: | Status of the enrichment process | completed | +| `EnrichedAt` | *string* | :heavy_check_mark: | When the customer was last enriched | 2024-05-01T12:34:56.789Z | \ No newline at end of file diff --git a/docs/models/operations/updateinboxitemresponse.md b/docs/models/operations/updateinboxitemresponse.md index 41c0777..379d13c 100644 --- a/docs/models/operations/updateinboxitemresponse.md +++ b/docs/models/operations/updateinboxitemresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateInboxItemResponseBody](../../models/operations/updateinboxitemresponsebody.md) | :heavy_minus_sign: | Update fields of an inbox item by its unique identifier for the authenticated team. | \ No newline at end of file +| `Object` | [*operations.UpdateInboxItemResponseBody](../../models/operations/updateinboxitemresponsebody.md) | :heavy_minus_sign: | Update fields of an inbox item by its unique identifier for the authenticated team. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updateinboxitemstatus.md b/docs/models/operations/updateinboxitemstatus.md index 1214a2e..c960b93 100644 --- a/docs/models/operations/updateinboxitemstatus.md +++ b/docs/models/operations/updateinboxitemstatus.md @@ -3,10 +3,14 @@ ## Values -| Name | Value | -| --------------------------------- | --------------------------------- | -| `UpdateInboxItemStatusNew` | new | -| `UpdateInboxItemStatusArchived` | archived | -| `UpdateInboxItemStatusProcessing` | processing | -| `UpdateInboxItemStatusDone` | done | -| `UpdateInboxItemStatusPending` | pending | \ No newline at end of file +| Name | Value | +| ------------------------------------- | ------------------------------------- | +| `UpdateInboxItemStatusNew` | new | +| `UpdateInboxItemStatusArchived` | archived | +| `UpdateInboxItemStatusProcessing` | processing | +| `UpdateInboxItemStatusDone` | done | +| `UpdateInboxItemStatusPending` | pending | +| `UpdateInboxItemStatusDeleted` | deleted | +| `UpdateInboxItemStatusAnalyzing` | analyzing | +| `UpdateInboxItemStatusSuggestedMatch` | suggested_match | +| `UpdateInboxItemStatusOther` | other | \ No newline at end of file diff --git a/docs/models/operations/updateinvoicecustomer.md b/docs/models/operations/updateinvoicecustomer.md new file mode 100644 index 0000000..35982f2 --- /dev/null +++ b/docs/models/operations/updateinvoicecustomer.md @@ -0,0 +1,13 @@ +# UpdateInvoiceCustomer + +Customer details + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | Unique identifier for the customer | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `Name` | *string* | :heavy_check_mark: | Name of the customer | Acme Corporation | +| `Website` | *string* | :heavy_check_mark: | Website URL of the customer | https://acme.com | +| `Email` | *string* | :heavy_check_mark: | Email address of the customer | info@acme.com | \ No newline at end of file diff --git a/docs/models/operations/updateinvoicerequest.md b/docs/models/operations/updateinvoicerequest.md new file mode 100644 index 0000000..a8f8de5 --- /dev/null +++ b/docs/models/operations/updateinvoicerequest.md @@ -0,0 +1,9 @@ +# UpdateInvoiceRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | N/A | +| `RequestBody` | [operations.UpdateInvoiceRequestBody](../../models/operations/updateinvoicerequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/updateinvoicerequestbody.md b/docs/models/operations/updateinvoicerequestbody.md new file mode 100644 index 0000000..5bde571 --- /dev/null +++ b/docs/models/operations/updateinvoicerequestbody.md @@ -0,0 +1,12 @@ +# UpdateInvoiceRequestBody + +Schema for updating an invoice + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `Status` | [*operations.UpdateInvoiceStatusRequest](../../models/operations/updateinvoicestatusrequest.md) | :heavy_minus_sign: | New status for the invoice | paid | +| `PaidAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Timestamp when the invoice was paid (ISO 8601) | 2024-06-15T12:00:00.000Z | +| `InternalNote` | **string* | :heavy_minus_sign: | Internal note for the invoice | Payment received via bank transfer | \ No newline at end of file diff --git a/docs/models/operations/updateinvoiceresponse.md b/docs/models/operations/updateinvoiceresponse.md new file mode 100644 index 0000000..45b54c2 --- /dev/null +++ b/docs/models/operations/updateinvoiceresponse.md @@ -0,0 +1,10 @@ +# UpdateInvoiceResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.UpdateInvoiceResponseBody](../../models/operations/updateinvoiceresponsebody.md) | :heavy_minus_sign: | Invoice updated successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updateinvoiceresponsebody.md b/docs/models/operations/updateinvoiceresponsebody.md new file mode 100644 index 0000000..eea44f6 --- /dev/null +++ b/docs/models/operations/updateinvoiceresponsebody.md @@ -0,0 +1,32 @@ +# UpdateInvoiceResponseBody + +Response after updating an invoice + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | Unique identifier for the invoice | b3b7e6e2-8c2a-4e2a-9b1a-2e4b5c6d7f8a | +| `Status` | [operations.UpdateInvoiceStatusResponse](../../models/operations/updateinvoicestatusresponse.md) | :heavy_check_mark: | Current status of the invoice | paid | +| `DueDate` | *string* | :heavy_check_mark: | Due date of the invoice in ISO 8601 format | 2024-06-30T23:59:59.000Z | +| `IssueDate` | *string* | :heavy_check_mark: | Issue date of the invoice in ISO 8601 format | 2024-06-01T00:00:00.000Z | +| `InvoiceNumber` | **string* | :heavy_minus_sign: | Invoice number as shown to the customer (auto-generated if not provided) | INV-2024-001 | +| `Amount` | *float64* | :heavy_check_mark: | Total amount of the invoice, or null if not yet calculated | 1500.75 | +| `Currency` | *string* | :heavy_check_mark: | Currency code (ISO 4217) for the invoice amount | USD | +| `Customer` | [operations.UpdateInvoiceCustomer](../../models/operations/updateinvoicecustomer.md) | :heavy_check_mark: | Customer details | | +| `PaidAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was paid (ISO 8601), or null if unpaid | 2024-06-15T12:00:00.000Z | +| `ReminderSentAt` | *string* | :heavy_check_mark: | Timestamp when a payment reminder was sent (ISO 8601), or null if never sent | 2024-06-10T09:00:00.000Z | +| `Note` | *string* | :heavy_check_mark: | Optional note attached to the invoice | Thank you for your business. | +| `Vat` | *float64* | :heavy_check_mark: | Value-added tax amount, or null if not applicable | 120 | +| `Tax` | *float64* | :heavy_check_mark: | Tax amount, or null if not applicable | 80 | +| `Discount` | *float64* | :heavy_check_mark: | Discount amount applied to the invoice, or null if none | 50 | +| `Subtotal` | *float64* | :heavy_check_mark: | Subtotal before taxes and discounts, or null if not calculated | 1400 | +| `ViewedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was viewed by the customer (ISO 8601), or null if never viewed | 2024-06-05T14:30:00.000Z | +| `CustomerName` | *string* | :heavy_check_mark: | Name of the customer as shown on the invoice, or null if not set | Acme Corporation | +| `SentTo` | *string* | :heavy_check_mark: | Email address to which the invoice was sent, or null if not sent | billing@acme.com | +| `SentAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was sent (ISO 8601), or null if not sent | 2024-06-02T08:00:00.000Z | +| `CreatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was created (ISO 8601) | 2024-06-01T07:00:00.000Z | +| `UpdatedAt` | *string* | :heavy_check_mark: | Timestamp when the invoice was last updated (ISO 8601) | 2024-06-15T10:00:00.000Z | +| `PdfURL` | *string* | :heavy_check_mark: | URL to download the invoice PDF, or null if not generated | https://app.midday.ai/api/download/invoice?token=eef58951-1682-4062-b010-425866032390 | +| `PreviewURL` | *string* | :heavy_check_mark: | URL to preview the invoice in the browser, or null if not generated | https://app.midday.ai/i/eef58951-1682-4062-b010-425866032390 | \ No newline at end of file diff --git a/docs/models/operations/updateinvoicestatusrequest.md b/docs/models/operations/updateinvoicestatusrequest.md new file mode 100644 index 0000000..c3ed00f --- /dev/null +++ b/docs/models/operations/updateinvoicestatusrequest.md @@ -0,0 +1,14 @@ +# UpdateInvoiceStatusRequest + +New status for the invoice + + +## Values + +| Name | Value | +| ------------------------------------- | ------------------------------------- | +| `UpdateInvoiceStatusRequestPaid` | paid | +| `UpdateInvoiceStatusRequestCanceled` | canceled | +| `UpdateInvoiceStatusRequestUnpaid` | unpaid | +| `UpdateInvoiceStatusRequestScheduled` | scheduled | +| `UpdateInvoiceStatusRequestDraft` | draft | \ No newline at end of file diff --git a/docs/models/operations/updateinvoicestatusresponse.md b/docs/models/operations/updateinvoicestatusresponse.md new file mode 100644 index 0000000..2e613e3 --- /dev/null +++ b/docs/models/operations/updateinvoicestatusresponse.md @@ -0,0 +1,15 @@ +# UpdateInvoiceStatusResponse + +Current status of the invoice + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `UpdateInvoiceStatusResponseDraft` | draft | +| `UpdateInvoiceStatusResponseOverdue` | overdue | +| `UpdateInvoiceStatusResponsePaid` | paid | +| `UpdateInvoiceStatusResponseUnpaid` | unpaid | +| `UpdateInvoiceStatusResponseCanceled` | canceled | +| `UpdateInvoiceStatusResponseScheduled` | scheduled | \ No newline at end of file diff --git a/docs/models/operations/updatenotificationstatusrequest.md b/docs/models/operations/updatenotificationstatusrequest.md new file mode 100644 index 0000000..11c6ae8 --- /dev/null +++ b/docs/models/operations/updatenotificationstatusrequest.md @@ -0,0 +1,9 @@ +# UpdateNotificationStatusRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `NotificationID` | *string* | :heavy_check_mark: | The ID of the notification to update | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `RequestBody` | [operations.UpdateNotificationStatusRequestBody](../../models/operations/updatenotificationstatusrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatenotificationstatusrequestbody.md b/docs/models/operations/updatenotificationstatusrequestbody.md new file mode 100644 index 0000000..77eb723 --- /dev/null +++ b/docs/models/operations/updatenotificationstatusrequestbody.md @@ -0,0 +1,8 @@ +# UpdateNotificationStatusRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `Status` | [operations.UpdateNotificationStatusStatus](../../models/operations/updatenotificationstatusstatus.md) | :heavy_check_mark: | The new status for the notification | read | \ No newline at end of file diff --git a/docs/models/operations/updatenotificationstatusresponse.md b/docs/models/operations/updatenotificationstatusresponse.md new file mode 100644 index 0000000..a0a9033 --- /dev/null +++ b/docs/models/operations/updatenotificationstatusresponse.md @@ -0,0 +1,10 @@ +# UpdateNotificationStatusResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `NotificationResponseSchema` | [*components.NotificationResponseSchema](../../models/components/notificationresponseschema.md) | :heavy_minus_sign: | Notification status updated successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatenotificationstatusstatus.md b/docs/models/operations/updatenotificationstatusstatus.md new file mode 100644 index 0000000..5c2f365 --- /dev/null +++ b/docs/models/operations/updatenotificationstatusstatus.md @@ -0,0 +1,12 @@ +# UpdateNotificationStatusStatus + +The new status for the notification + + +## Values + +| Name | Value | +| ---------------------------------------- | ---------------------------------------- | +| `UpdateNotificationStatusStatusUnread` | unread | +| `UpdateNotificationStatusStatusRead` | read | +| `UpdateNotificationStatusStatusArchived` | archived | \ No newline at end of file diff --git a/docs/models/operations/updatetagrequest.md b/docs/models/operations/updatetagrequest.md index 71c6c79..04382c9 100644 --- a/docs/models/operations/updatetagrequest.md +++ b/docs/models/operations/updatetagrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | -| `RequestBody` | [*operations.UpdateTagRequestBody](../../models/operations/updatetagrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | The ID of the tag to update. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | +| `RequestBody` | [operations.UpdateTagRequestBody](../../models/operations/updatetagrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatetagresponse.md b/docs/models/operations/updatetagresponse.md index d1835a1..8e0a309 100644 --- a/docs/models/operations/updatetagresponse.md +++ b/docs/models/operations/updatetagresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TagResponse` | [*components.TagResponse](../../models/components/tagresponse.md) | :heavy_minus_sign: | Tag updated | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `TagResponse` | [*components.TagResponse](../../models/components/tagresponse.md) | :heavy_minus_sign: | Tag updated | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updateteambyidrequest.md b/docs/models/operations/updateteambyidrequest.md index 8b97059..2ec314a 100644 --- a/docs/models/operations/updateteambyidrequest.md +++ b/docs/models/operations/updateteambyidrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | -| `RequestBody` | [*operations.UpdateTeamByIDRequestBody](../../models/operations/updateteambyidrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | +| `RequestBody` | [operations.UpdateTeamByIDRequestBody](../../models/operations/updateteambyidrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updateteambyidrequestbody.md b/docs/models/operations/updateteambyidrequestbody.md index 739aa3e..1aca7df 100644 --- a/docs/models/operations/updateteambyidrequestbody.md +++ b/docs/models/operations/updateteambyidrequestbody.md @@ -3,10 +3,14 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `Name` | **string* | :heavy_minus_sign: | Name of the team or organization. Must be between 2 and 32 characters | Acme Corporation | -| `Email` | **string* | :heavy_minus_sign: | Primary contact email address for the team | team@acme.com | -| `LogoURL` | **string* | :heavy_minus_sign: | URL to the team's logo image. Must be hosted on midday.ai domain | https://cdn.midday.ai/logos/acme-corp.png | -| `BaseCurrency` | **string* | :heavy_minus_sign: | Base currency for the team in ISO 4217 format (3-letter currency code) | USD | -| `CountryCode` | **string* | :heavy_minus_sign: | Country code for the team | US | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `Name` | **string* | :heavy_minus_sign: | Name of the team or organization. Must be between 2 and 32 characters | Acme Corporation | +| `Email` | **string* | :heavy_minus_sign: | Primary contact email address for the team | team@acme.com | +| `LogoURL` | **string* | :heavy_minus_sign: | URL to the team's logo image. Must be hosted on midday.ai domain | https://cdn.midday.ai/logos/acme-corp.png | +| `BaseCurrency` | **string* | :heavy_minus_sign: | Base currency for the team in ISO 4217 format (3-letter currency code) | USD | +| `CountryCode` | **string* | :heavy_minus_sign: | Country code for the team | US | +| `FiscalYearStartMonth` | **int64* | :heavy_minus_sign: | Month when the fiscal year starts (1-12). Null for trailing 12 months. Defaults based on country if not specified. | 4 | +| `ExportSettings` | [*operations.ExportSettings](../../models/operations/exportsettings.md) | :heavy_minus_sign: | Export settings for transactions | | +| `CompanyType` | [*operations.CompanyType](../../models/operations/companytype.md) | :heavy_minus_sign: | Type of company or team | solo_founder | +| `HeardAbout` | [*operations.HeardAbout](../../models/operations/heardabout.md) | :heavy_minus_sign: | How the user heard about the product | twitter | \ No newline at end of file diff --git a/docs/models/operations/updateteambyidresponse.md b/docs/models/operations/updateteambyidresponse.md index 96ef04c..66c6db7 100644 --- a/docs/models/operations/updateteambyidresponse.md +++ b/docs/models/operations/updateteambyidresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateTeamByIDResponseBody](../../models/operations/updateteambyidresponsebody.md) | :heavy_minus_sign: | Team updated | \ No newline at end of file +| `Object` | [*operations.UpdateTeamByIDResponseBody](../../models/operations/updateteambyidresponsebody.md) | :heavy_minus_sign: | Team updated | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatetrackerentryrequest.md b/docs/models/operations/updatetrackerentryrequest.md index 7aad248..8f03dd2 100644 --- a/docs/models/operations/updatetrackerentryrequest.md +++ b/docs/models/operations/updatetrackerentryrequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the tracker entry to delete | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | | `RequestBody` | [*operations.UpdateTrackerEntryRequestBody](../../models/operations/updatetrackerentryrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatetrackerentryrequestbody.md b/docs/models/operations/updatetrackerentryrequestbody.md index ecd54dd..4519f71 100644 --- a/docs/models/operations/updatetrackerentryrequestbody.md +++ b/docs/models/operations/updatetrackerentryrequestbody.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | -| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | -| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | -| `AssignedID` | *string* | :heavy_check_mark: | Unique identifier of the user assigned to this tracker entry | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | -| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | -| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | -| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Start` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Start time of the tracker entry in ISO 8601 format | 2024-04-15T09:00:00.000Z | +| `Stop` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Stop time of the tracker entry in ISO 8601 format | 2024-04-15T17:00:00.000Z | +| `Dates` | []*string* | :heavy_check_mark: | Array of dates for which to create tracker entries | [
"2024-04-15",
"2024-04-16"
] | +| `AssignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `ProjectID` | *string* | :heavy_check_mark: | Unique identifier of the project associated with this tracker entry | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `Description` | **string* | :heavy_minus_sign: | Optional description or notes for the tracker entry | Worked on implementing user authentication feature | +| `Duration` | *float64* | :heavy_check_mark: | Duration of the tracker entry in seconds | 28800 | \ No newline at end of file diff --git a/docs/models/operations/updatetrackerentryresponse.md b/docs/models/operations/updatetrackerentryresponse.md index 1bc9a6a..6a0f411 100644 --- a/docs/models/operations/updatetrackerentryresponse.md +++ b/docs/models/operations/updatetrackerentryresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateTrackerEntryResponseBody](../../models/operations/updatetrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry updated successfully. | \ No newline at end of file +| `Object` | [*operations.UpdateTrackerEntryResponseBody](../../models/operations/updatetrackerentryresponsebody.md) | :heavy_minus_sign: | Tracker entry updated successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatetrackerprojectrequest.md b/docs/models/operations/updatetrackerprojectrequest.md index b40e7e5..a8a91e3 100644 --- a/docs/models/operations/updatetrackerprojectrequest.md +++ b/docs/models/operations/updatetrackerprojectrequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | +| `ID` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | | `RequestBody` | [*operations.UpdateTrackerProjectRequestBody](../../models/operations/updatetrackerprojectrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updatetrackerprojectresponse.md b/docs/models/operations/updatetrackerprojectresponse.md index 4e88170..2caae18 100644 --- a/docs/models/operations/updatetrackerprojectresponse.md +++ b/docs/models/operations/updatetrackerprojectresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project updated successfully. | \ No newline at end of file +| `TrackerProjectResponse` | [*components.TrackerProjectResponse](../../models/components/trackerprojectresponse.md) | :heavy_minus_sign: | Tracker project updated successfully. | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionrequest.md b/docs/models/operations/updatetransactionrequest.md index 06225c1..0ebdb29 100644 --- a/docs/models/operations/updatetransactionrequest.md +++ b/docs/models/operations/updatetransactionrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `ID` | *string* | :heavy_check_mark: | N/A | -| `RequestBody` | [*operations.UpdateTransactionRequestBody](../../models/operations/updatetransactionrequestbody.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `ID` | *string* | :heavy_check_mark: | Transaction ID (UUID). | +| `RequestBody` | [operations.UpdateTransactionRequestBody](../../models/operations/updatetransactionrequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionrequestbody.md b/docs/models/operations/updatetransactionrequestbody.md index 46cbf48..feca3d7 100644 --- a/docs/models/operations/updatetransactionrequestbody.md +++ b/docs/models/operations/updatetransactionrequestbody.md @@ -3,12 +3,19 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `CategorySlug` | **string* | :heavy_minus_sign: | Category slug for the transaction. | -| `Status` | [*operations.UpdateTransactionStatus](../../models/operations/updatetransactionstatus.md) | :heavy_minus_sign: | Status of the transaction. | -| `Internal` | **bool* | :heavy_minus_sign: | Whether the transaction is internal. | -| `Recurring` | **bool* | :heavy_minus_sign: | Whether the transaction is recurring. | -| `Frequency` | [*operations.UpdateTransactionFrequency](../../models/operations/updatetransactionfrequency.md) | :heavy_minus_sign: | Recurring frequency of the transaction. | -| `Note` | **string* | :heavy_minus_sign: | Note for the transaction. | -| `AssignedID` | **string* | :heavy_minus_sign: | Assigned user ID for the transaction. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `Name` | **string* | :heavy_minus_sign: | Name/description of the transaction. | +| `Amount` | **float64* | :heavy_minus_sign: | Amount of the transaction. | +| `Currency` | **string* | :heavy_minus_sign: | Currency of the transaction. | +| `Date` | **string* | :heavy_minus_sign: | Date of the transaction (ISO 8601). | +| `BankAccountID` | **string* | :heavy_minus_sign: | Bank account ID associated with the transaction. | +| `CategorySlug` | **string* | :heavy_minus_sign: | Category slug for the transaction. | +| `Status` | [*operations.UpdateTransactionStatus](../../models/operations/updatetransactionstatus.md) | :heavy_minus_sign: | Status of the transaction. | +| `Internal` | **bool* | :heavy_minus_sign: | Whether the transaction is internal. | +| `Recurring` | **bool* | :heavy_minus_sign: | Whether the transaction is recurring. | +| `Frequency` | [*operations.UpdateTransactionFrequency](../../models/operations/updatetransactionfrequency.md) | :heavy_minus_sign: | Recurring frequency of the transaction. | +| `Note` | **string* | :heavy_minus_sign: | Note for the transaction. | +| `AssignedID` | **string* | :heavy_minus_sign: | Assigned user ID for the transaction. | +| `TaxRate` | **float64* | :heavy_minus_sign: | Tax rate as a percentage (e.g., 25 for 25% VAT). Only set when tax is calculated from a percentage. | +| `TaxAmount` | **float64* | :heavy_minus_sign: | Tax amount in the transaction currency. Always set when tax is present. | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionresponse.md b/docs/models/operations/updatetransactionresponse.md index d5891dc..d4d7b14 100644 --- a/docs/models/operations/updatetransactionresponse.md +++ b/docs/models/operations/updatetransactionresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction updated | \ No newline at end of file +| `TransactionResponse` | [*components.TransactionResponse](../../models/components/transactionresponse.md) | :heavy_minus_sign: | Transaction updated | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionsresponse.md b/docs/models/operations/updatetransactionsresponse.md index a38d40c..cdf03b3 100644 --- a/docs/models/operations/updatetransactionsresponse.md +++ b/docs/models/operations/updatetransactionsresponse.md @@ -6,4 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.UpdateTransactionsResponseBody](../../models/operations/updatetransactionsresponsebody.md) | :heavy_minus_sign: | Transactions updated | \ No newline at end of file +| `Object` | [*operations.UpdateTransactionsResponseBody](../../models/operations/updatetransactionsresponsebody.md) | :heavy_minus_sign: | Transactions updated | +| `ErrorResponse` | [*components.ErrorResponse](../../models/components/errorresponse.md) | :heavy_minus_sign: | An error occurred | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionsstatus.md b/docs/models/operations/updatetransactionsstatus.md index 575c82e..1953ed1 100644 --- a/docs/models/operations/updatetransactionsstatus.md +++ b/docs/models/operations/updatetransactionsstatus.md @@ -11,4 +11,5 @@ Status to set for the transactions. | `UpdateTransactionsStatusArchived` | archived | | `UpdateTransactionsStatusCompleted` | completed | | `UpdateTransactionsStatusPosted` | posted | -| `UpdateTransactionsStatusExcluded` | excluded | \ No newline at end of file +| `UpdateTransactionsStatusExcluded` | excluded | +| `UpdateTransactionsStatusExported` | exported | \ No newline at end of file diff --git a/docs/models/operations/updatetransactionstatus.md b/docs/models/operations/updatetransactionstatus.md index 619a0d8..dd5d45b 100644 --- a/docs/models/operations/updatetransactionstatus.md +++ b/docs/models/operations/updatetransactionstatus.md @@ -11,4 +11,5 @@ Status of the transaction. | `UpdateTransactionStatusArchived` | archived | | `UpdateTransactionStatusCompleted` | completed | | `UpdateTransactionStatusPosted` | posted | -| `UpdateTransactionStatusExcluded` | excluded | \ No newline at end of file +| `UpdateTransactionStatusExcluded` | excluded | +| `UpdateTransactionStatusExported` | exported | \ No newline at end of file diff --git a/docs/models/operations/whatsappwebhookresponse.md b/docs/models/operations/whatsappwebhookresponse.md new file mode 100644 index 0000000..9b510ef --- /dev/null +++ b/docs/models/operations/whatsappwebhookresponse.md @@ -0,0 +1,9 @@ +# WhatsappWebhookResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.WhatsappWebhookResponseBody](../../models/operations/whatsappwebhookresponsebody.md) | :heavy_minus_sign: | Webhook processed successfully | \ No newline at end of file diff --git a/docs/models/operations/whatsappwebhookresponsebody.md b/docs/models/operations/whatsappwebhookresponsebody.md new file mode 100644 index 0000000..07275ba --- /dev/null +++ b/docs/models/operations/whatsappwebhookresponsebody.md @@ -0,0 +1,10 @@ +# WhatsappWebhookResponseBody + +Webhook processed successfully + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/whatsappwebhookverifyrequest.md b/docs/models/operations/whatsappwebhookverifyrequest.md new file mode 100644 index 0000000..508b8fe --- /dev/null +++ b/docs/models/operations/whatsappwebhookverifyrequest.md @@ -0,0 +1,10 @@ +# WhatsappWebhookVerifyRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `HubMode` | *string* | :heavy_check_mark: | N/A | +| `HubVerifyToken` | *string* | :heavy_check_mark: | N/A | +| `HubChallenge` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/whatsappwebhookverifyresponse.md b/docs/models/operations/whatsappwebhookverifyresponse.md new file mode 100644 index 0000000..8c9e887 --- /dev/null +++ b/docs/models/operations/whatsappwebhookverifyresponse.md @@ -0,0 +1,9 @@ +# WhatsappWebhookVerifyResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Res` | **string* | :heavy_minus_sign: | Webhook verified successfully | \ No newline at end of file diff --git a/docs/models/operations/xerooauthcallbackrequest.md b/docs/models/operations/xerooauthcallbackrequest.md new file mode 100644 index 0000000..8ef23cd --- /dev/null +++ b/docs/models/operations/xerooauthcallbackrequest.md @@ -0,0 +1,10 @@ +# XeroOAuthCallbackRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | OAuth authorization code from Xero | +| `State` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `Error` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | \ No newline at end of file diff --git a/docs/models/operations/xerooauthcallbackresponse.md b/docs/models/operations/xerooauthcallbackresponse.md new file mode 100644 index 0000000..5558f6f --- /dev/null +++ b/docs/models/operations/xerooauthcallbackresponse.md @@ -0,0 +1,9 @@ +# XeroOAuthCallbackResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/bankaccounts/README.md b/docs/sdks/bankaccounts/README.md index d5062a9..9d3727b 100644 --- a/docs/sdks/bankaccounts/README.md +++ b/docs/sdks/bankaccounts/README.md @@ -3,6 +3,8 @@ ## Overview +Manage bank accounts + ### Available Operations * [List](#list) - List all bank accounts @@ -23,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -31,7 +35,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.BankAccounts.List(ctx, nil, nil) @@ -49,8 +55,8 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `enabled` | **bool* | :heavy_minus_sign: | N/A | -| `manual` | **bool* | :heavy_minus_sign: | N/A | +| `enabled` | **bool* | :heavy_minus_sign: | Whether the bank account is enabled. | +| `manual` | **bool* | :heavy_minus_sign: | Whether the bank account is a manual account. | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -75,6 +81,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -84,10 +92,12 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.BankAccounts.Create(ctx, &operations.CreateBankAccountRequest{ + res, err := s.BankAccounts.Create(ctx, operations.CreateBankAccountRequest{ Name: "Checking Account", Currency: middaygo.String("USD"), Manual: middaygo.Bool(false), @@ -131,6 +141,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -139,7 +151,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.BankAccounts.Get(ctx, "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc") @@ -157,7 +171,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -182,6 +196,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -190,7 +206,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.BankAccounts.Delete(ctx, "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc") @@ -208,7 +226,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -233,6 +251,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -242,10 +262,12 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.BankAccounts.Update(ctx, "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", &operations.UpdateBankAccountRequestBody{ + res, err := s.BankAccounts.Update(ctx, "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc", operations.UpdateBankAccountRequestBody{ ID: middaygo.String("b7e6c2a0-1f2d-4c3b-9a8e-123456789abc"), Name: middaygo.String("Checking Account"), Enabled: middaygo.Bool(true), @@ -266,8 +288,8 @@ func main() { | Parameter | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | -| `requestBody` | [*operations.UpdateBankAccountRequestBody](../../models/operations/updatebankaccountrequestbody.md) | :heavy_minus_sign: | N/A | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"enabled": true,
"balance": 1500.75,
"type": "depository"
} | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the bank account. | b7e6c2a0-1f2d-4c3b-9a8e-123456789abc | +| `requestBody` | [operations.UpdateBankAccountRequestBody](../../models/operations/updatebankaccountrequestbody.md) | :heavy_check_mark: | N/A | {
"id": "b7e6c2a0-1f2d-4c3b-9a8e-123456789abc",
"name": "Checking Account",
"enabled": true,
"balance": 1500.75,
"type": "depository"
} | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response diff --git a/docs/sdks/customers/README.md b/docs/sdks/customers/README.md index c2eef9b..35057b8 100644 --- a/docs/sdks/customers/README.md +++ b/docs/sdks/customers/README.md @@ -3,6 +3,8 @@ ## Overview +Manage customers + ### Available Operations * [List](#list) - List all customers @@ -23,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -31,7 +35,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Customers.List(ctx, middaygo.String("acme"), []string{ @@ -49,14 +55,14 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `q` | **string* | :heavy_minus_sign: | N/A | acme | -| `sort` | []*string* | :heavy_minus_sign: | N/A | [
"name",
"asc"
] | -| `cursor` | **string* | :heavy_minus_sign: | N/A | eyJpZCI6IjEyMyJ9 | -| `pageSize` | **float64* | :heavy_minus_sign: | N/A | 20 | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `q` | **string* | :heavy_minus_sign: | Search query string to filter customers by name, email, or other text fields | acme | +| `sort` | []*string* | :heavy_minus_sign: | Sort as [column, direction]. Columns: name, created_at, contact, email, invoices, projects, tags, industry, country, total_revenue, outstanding, last_invoice. Direction: asc or desc. | [
"name",
"asc"
] | +| `cursor` | **string* | :heavy_minus_sign: | Cursor for pagination, representing the last item from the previous page | eyJpZCI6IjEyMyJ9 | +| `pageSize` | **float64* | :heavy_minus_sign: | Number of customers to return per page (1-100) | 20 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -80,6 +86,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -89,14 +97,16 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Customers.Create(ctx, &operations.CreateCustomerRequest{ + res, err := s.Customers.Create(ctx, operations.CreateCustomerRequest{ ID: middaygo.String("b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4"), Name: "Acme Corporation", Email: "contact@acme.com", - BillingEmail: middaygo.String("finance@acme.com"), + BillingEmail: middaygo.String("finance@acme.com, accounting@acme.com"), Country: middaygo.String("United States"), AddressLine1: middaygo.String("123 Main Street"), AddressLine2: middaygo.String("Suite 400"), @@ -159,6 +169,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -167,7 +179,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Customers.Get(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4") @@ -185,7 +199,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -210,6 +224,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -218,7 +234,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Customers.Delete(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4") @@ -236,7 +254,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -261,6 +279,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -270,14 +290,16 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Customers.Update(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", &operations.UpdateCustomerRequestBody{ + res, err := s.Customers.Update(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", operations.UpdateCustomerRequestBody{ ID: middaygo.String("b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4"), Name: "Acme Corporation", Email: "contact@acme.com", - BillingEmail: middaygo.String("finance@acme.com"), + BillingEmail: middaygo.String("finance@acme.com, accounting@acme.com"), Country: middaygo.String("United States"), AddressLine1: middaygo.String("123 Main Street"), AddressLine2: middaygo.String("Suite 400"), @@ -312,12 +334,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | -| `requestBody` | [*operations.UpdateCustomerRequestBody](../../models/operations/updatecustomerrequestbody.md) | :heavy_minus_sign: | N/A | | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the customer to retrieve | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `requestBody` | [operations.UpdateCustomerRequestBody](../../models/operations/updatecustomerrequestbody.md) | :heavy_check_mark: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response diff --git a/docs/sdks/desktop/README.md b/docs/sdks/desktop/README.md new file mode 100644 index 0000000..cb2c16f --- /dev/null +++ b/docs/sdks/desktop/README.md @@ -0,0 +1,123 @@ +# Desktop +(*Desktop*) + +## Overview + +Desktop app endpoints + +### Available Operations + +* [CheckUpdate](#checkupdate) - Check for desktop app updates +* [DownloadUpdate](#downloadupdate) - Download desktop app update artifact + +## CheckUpdate + +Returns the latest desktop app version info in Tauri updater format. Download URLs are rewritten to proxy through this API. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Desktop.CheckUpdate(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CheckDesktopUpdateResponse](../../models/operations/checkdesktopupdateresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| apierrors.CheckDesktopUpdateBadGatewayError | 502 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DownloadUpdate + +Proxies the download of a desktop app update artifact from GitHub releases. Only URLs pointing to the midday-ai/midday repository are accepted. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Desktop.DownloadUpdate(ctx, "https://github.com/midday-ai/midday/releases/download/midday-v1.0.0/Midday.app.tar.gz") + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `url_` | *string* | :heavy_check_mark: | The artifact download URL to proxy | https://github.com/midday-ai/midday/releases/download/midday-v1.0.0/Midday.app.tar.gz | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.DownloadDesktopUpdateResponse](../../models/operations/downloaddesktopupdateresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| apierrors.DownloadDesktopUpdateBadRequestError | 400 | application/json | +| apierrors.DownloadDesktopUpdateBadGatewayError | 502 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/documents/README.md b/docs/sdks/documents/README.md index a07a3dc..26b1e8d 100644 --- a/docs/sdks/documents/README.md +++ b/docs/sdks/documents/README.md @@ -3,11 +3,14 @@ ## Overview +Manage documents + ### Available Operations * [List](#list) - List all documents * [Get](#get) - Retrieve a document * [Delete](#delete) - Delete a document +* [GetPreSignedURL](#getpresignedurl) - Generate pre-signed URL for document ## List @@ -21,6 +24,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -30,7 +35,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Documents.List(ctx, operations.ListDocumentsRequest{ @@ -41,6 +48,8 @@ func main() { "tag1", "tag2", }, + Start: middaygo.String("2024-01-01"), + End: middaygo.String("2024-12-31"), }) if err != nil { log.Fatal(err) @@ -81,6 +90,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -89,7 +100,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Documents.Get(ctx, middaygo.String("")) @@ -132,6 +145,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -140,7 +155,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Documents.Delete(ctx, "") @@ -169,4 +186,63 @@ func main() { | Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetPreSignedURL + +Generate a pre-signed URL for accessing a document. The URL is valid for 60 seconds and allows secure temporary access to the document file. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Documents.GetPreSignedURL(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", middaygo.Bool(true)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the document to generate a pre-signed URL for | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetDocumentPreSignedURLResponse](../../models/operations/getdocumentpresignedurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| apierrors.GetDocumentPreSignedURLBadRequestError | 400 | application/json | +| apierrors.GetDocumentPreSignedURLNotFoundError | 404 | application/json | +| apierrors.GetDocumentPreSignedURLInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/files/README.md b/docs/sdks/files/README.md new file mode 100644 index 0000000..e63a787 --- /dev/null +++ b/docs/sdks/files/README.md @@ -0,0 +1,196 @@ +# Files +(*Files*) + +## Overview + +File operations + +### Available Operations + +* [Proxy](#proxy) - Proxy file from storage +* [DownloadFile](#downloadfile) - Download file from vault +* [DownloadInvoice](#downloadinvoice) - Download invoice PDF + +## Proxy + +Proxies a file from storage. Requires team file key (fk) query parameter for access. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Files.Proxy(ctx, "vault/documents/2024/invoice.pdf", "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6") + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `filePath` | *string* | :heavy_check_mark: | Path to the file in storage. Can include or exclude 'vault/' prefix. | vault/documents/2024/invoice.pdf | +| `fk` | *string* | :heavy_check_mark: | Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. | a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.ProxyFileResponse](../../models/operations/proxyfileresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| apierrors.ProxyFileBadRequestError | 400 | application/json | +| apierrors.ProxyFileNotFoundError | 404 | application/json | +| apierrors.ProxyFileInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DownloadFile + +Downloads a file from the vault storage bucket. Requires team file key (fk) query parameter for access. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Files.DownloadFile(ctx, "vault/documents/2024/invoice.pdf", "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6", middaygo.String("invoice.pdf")) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `path` | *string* | :heavy_check_mark: | Path to the file in storage. Can include or exclude 'vault/' prefix. | vault/documents/2024/invoice.pdf | +| `fk` | *string* | :heavy_check_mark: | Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. | a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 | +| `filename` | **string* | :heavy_minus_sign: | Optional filename for the Content-Disposition header. | invoice.pdf | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.DownloadFileResponse](../../models/operations/downloadfileresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| apierrors.DownloadFileBadRequestError | 400 | application/json | +| apierrors.DownloadFileUnauthorizedError | 401 | application/json | +| apierrors.DownloadFileNotFoundError | 404 | application/json | +| apierrors.DownloadFileInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DownloadInvoice + +Downloads an invoice as a PDF. Can be accessed with an invoice ID (requires team file key via fk query parameter) or invoice token (public access). + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Files.DownloadInvoice(ctx, operations.DownloadInvoiceRequest{ + ID: middaygo.String("b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4"), + Fk: middaygo.String("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."), + Token: middaygo.String("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."), + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.DownloadInvoiceRequest](../../models/operations/downloadinvoicerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.DownloadInvoiceResponse](../../models/operations/downloadinvoiceresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| apierrors.DownloadInvoiceBadRequestError | 400 | application/json | +| apierrors.DownloadInvoiceUnauthorizedError | 401 | application/json | +| apierrors.DownloadInvoiceNotFoundError | 404 | application/json | +| apierrors.DownloadInvoiceInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/inbox/README.md b/docs/sdks/inbox/README.md index 156d9c3..47f56f0 100644 --- a/docs/sdks/inbox/README.md +++ b/docs/sdks/inbox/README.md @@ -3,12 +3,15 @@ ## Overview +Manage inbox items + ### Available Operations * [List](#list) - List all inbox items * [Get](#get) - Retrieve a inbox item * [Delete](#delete) - Delete a inbox item * [Update](#update) - Update a inbox item +* [GetPreSignedURL](#getpresignedurl) - Generate pre-signed URL for inbox attachment ## List @@ -22,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -31,7 +36,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Inbox.List(ctx, operations.ListInboxItemsRequest{}) @@ -74,6 +81,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -82,7 +91,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Inbox.Get(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4") @@ -100,7 +111,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the inbox item. | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -125,6 +136,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -133,7 +146,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Inbox.Delete(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4") @@ -151,7 +166,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the inbox item to delete. | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -176,6 +191,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -185,7 +202,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Inbox.Update(ctx, "", operations.UpdateInboxItemRequestBody{}) @@ -215,4 +234,63 @@ func main() { | Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetPreSignedURL + +Generate a pre-signed URL for accessing an inbox attachment. The URL is valid for 60 seconds and allows secure temporary access to the attachment file. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Inbox.GetPreSignedURL(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", middaygo.Bool(true)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the inbox item to generate a pre-signed URL for | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetInboxPreSignedURLResponse](../../models/operations/getinboxpresignedurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| apierrors.GetInboxPreSignedURLBadRequestError | 400 | application/json | +| apierrors.GetInboxPreSignedURLNotFoundError | 404 | application/json | +| apierrors.GetInboxPreSignedURLInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/integrations/README.md b/docs/sdks/integrations/README.md new file mode 100644 index 0000000..a432aae --- /dev/null +++ b/docs/sdks/integrations/README.md @@ -0,0 +1,803 @@ +# Integrations +(*Integrations*) + +## Overview + +Integration endpoints + +### Available Operations + +* [SlackOAuthCallback](#slackoauthcallback) - Slack OAuth callback +* [GetSlackInstallURL](#getslackinstallurl) - Get Slack install URL +* [SlackWebhook](#slackwebhook) - Slack webhook handler +* [SlackInteractions](#slackinteractions) - Slack interactions handler +* [GmailOAuthCallback](#gmailoauthcallback) - Gmail OAuth callback +* [GetGmailInstallURL](#getgmailinstallurl) - Get Gmail install URL +* [OutlookOAuthCallback](#outlookoauthcallback) - Outlook OAuth callback +* [GetOutlookInstallURL](#getoutlookinstallurl) - Get Outlook install URL +* [XeroOAuthCallback](#xerooauthcallback) - Xero OAuth callback +* [GetXeroInstallURL](#getxeroinstallurl) - Get Xero install URL +* [QuickBooksOAuthCallback](#quickbooksoauthcallback) - QuickBooks OAuth callback +* [GetQuickBooksInstallURL](#getquickbooksinstallurl) - Get QuickBooks install URL +* [FortnoxOAuthCallback](#fortnoxoauthcallback) - Fortnox OAuth callback +* [GetFortnoxInstallURL](#getfortnoxinstallurl) - Get Fortnox install URL + +## SlackOAuthCallback + +Handles OAuth callback from Slack after user authorization. Exchanges authorization code for access token and creates app integration. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.SlackOAuthCallback(ctx, "", "North Carolina") + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `code` | *string* | :heavy_check_mark: | OAuth authorization code from Slack | +| `state` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.SlackOAuthCallbackResponse](../../models/operations/slackoauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| apierrors.SlackOAuthCallbackBadRequestError | 400 | application/json | +| apierrors.SlackOAuthCallbackInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetSlackInstallURL + +Generates OAuth install URL for Slack integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetSlackInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetSlackInstallURLResponse](../../models/operations/getslackinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## SlackWebhook + +Handles incoming webhook events from Slack. Verifies request signature and processes events. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.SlackWebhook(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.SlackWebhookResponse](../../models/operations/slackwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## SlackInteractions + +Handles interactive component actions from Slack (button clicks, etc.) + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.SlackInteractions(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.SlackInteractionsResponse](../../models/operations/slackinteractionsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GmailOAuthCallback + +Handles OAuth callback from Google after user authorization. Exchanges authorization code for access token and creates inbox account. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GmailOAuthCallback(ctx, "Delaware", nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | Encrypted OAuth state parameter | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from Google | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GmailOAuthCallbackResponse](../../models/operations/gmailoauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| apierrors.GmailOAuthCallbackBadRequestError | 400 | application/json | +| apierrors.GmailOAuthCallbackInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetGmailInstallURL + +Generates OAuth install URL for Gmail integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetGmailInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetGmailInstallURLResponse](../../models/operations/getgmailinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## OutlookOAuthCallback + +Handles OAuth callback from Microsoft after user authorization. Exchanges authorization code for access token and creates inbox account. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.OutlookOAuthCallback(ctx, "New Hampshire", nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | Encrypted OAuth state parameter | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from Microsoft | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.OutlookOAuthCallbackResponse](../../models/operations/outlookoauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| apierrors.OutlookOAuthCallbackBadRequestError | 400 | application/json | +| apierrors.OutlookOAuthCallbackInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetOutlookInstallURL + +Generates OAuth install URL for Outlook integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetOutlookInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetOutlookInstallURLResponse](../../models/operations/getoutlookinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## XeroOAuthCallback + +Handles OAuth callback from Xero after user authorization. Exchanges authorization code for access token and creates app integration. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.XeroOAuthCallback(ctx, "Maryland", nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from Xero | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.XeroOAuthCallbackResponse](../../models/operations/xerooauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetXeroInstallURL + +Generates OAuth install URL for Xero integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetXeroInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetXeroInstallURLResponse](../../models/operations/getxeroinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## QuickBooksOAuthCallback + +Handles OAuth callback from QuickBooks after user authorization. Exchanges authorization code for access token and creates app integration. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.QuickBooksOAuthCallback(ctx, "Georgia", nil, nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from QuickBooks | +| `realmID` | **string* | :heavy_minus_sign: | QuickBooks company/realm ID | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.QuickBooksOAuthCallbackResponse](../../models/operations/quickbooksoauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetQuickBooksInstallURL + +Generates OAuth install URL for QuickBooks integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetQuickBooksInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetQuickBooksInstallURLResponse](../../models/operations/getquickbooksinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## FortnoxOAuthCallback + +Handles OAuth callback from Fortnox after user authorization. Exchanges authorization code for access token and creates app integration. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.FortnoxOAuthCallback(ctx, "South Dakota", nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from Fortnox | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.FortnoxOAuthCallbackResponse](../../models/operations/fortnoxoauthcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetFortnoxInstallURL + +Generates OAuth install URL for Fortnox integration. Requires authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Integrations.GetFortnoxInstallURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetFortnoxInstallURLResponse](../../models/operations/getfortnoxinstallurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/invoicepayments/README.md b/docs/sdks/invoicepayments/README.md new file mode 100644 index 0000000..7ac6b5d --- /dev/null +++ b/docs/sdks/invoicepayments/README.md @@ -0,0 +1,292 @@ +# InvoicePayments +(*InvoicePayments*) + +## Overview + +Invoice payment processing + +### Available Operations + +* [GetStripeConnectURL](#getstripeconnecturl) - Get Stripe Connect URL +* [StripeConnectCallback](#stripeconnectcallback) - Stripe Connect OAuth callback +* [DisconnectStripe](#disconnectstripe) - Disconnect Stripe account +* [CreateInvoicePaymentIntent](#createinvoicepaymentintent) - Create payment intent for invoice +* [GetStripeConnectStatus](#getstripeconnectstatus) - Get Stripe Connect status + +## GetStripeConnectURL + +Generates OAuth URL for Stripe Connect Standard integration. Allows teams to connect their Stripe account for accepting invoice payments. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.InvoicePayments.GetStripeConnectURL(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetStripeConnectURLResponse](../../models/operations/getstripeconnecturlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## StripeConnectCallback + +Handles OAuth callback from Stripe Connect after user authorization. Exchanges authorization code for connected account ID. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.InvoicePayments.StripeConnectCallback(ctx, "California", nil, nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `state` | *string* | :heavy_check_mark: | OAuth state parameter for CSRF protection | +| `code` | **string* | :heavy_minus_sign: | OAuth authorization code from Stripe | +| `error_` | **string* | :heavy_minus_sign: | OAuth error code if authorization failed | +| `errorDescription` | **string* | :heavy_minus_sign: | OAuth error description | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.StripeConnectCallbackResponse](../../models/operations/stripeconnectcallbackresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DisconnectStripe + +Disconnects the team's Stripe Connect account. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.InvoicePayments.DisconnectStripe(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.DisconnectStripeResponse](../../models/operations/disconnectstriperesponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## CreateInvoicePaymentIntent + +Creates a Stripe PaymentIntent for paying an invoice. This is a public endpoint that uses the invoice token for authentication. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.InvoicePayments.CreateInvoicePaymentIntent(ctx, operations.CreateInvoicePaymentIntentRequest{ + Token: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.CreateInvoicePaymentIntentRequest](../../models/operations/createinvoicepaymentintentrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateInvoicePaymentIntentResponse](../../models/operations/createinvoicepaymentintentresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetStripeConnectStatus + +Gets the current Stripe Connect status for the team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.InvoicePayments.GetStripeConnectStatus(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetStripeConnectStatusResponse](../../models/operations/getstripeconnectstatusresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/invoices/README.md b/docs/sdks/invoices/README.md index d6da7c3..475cd93 100644 --- a/docs/sdks/invoices/README.md +++ b/docs/sdks/invoices/README.md @@ -3,12 +3,16 @@ ## Overview +Manage invoices + ### Available Operations * [List](#list) - List all invoices -* [GetInvoicesPaymentStatus](#getinvoicespaymentstatus) - Payment status +* [Create](#create) - Create an invoice +* [PaymentStatus](#paymentstatus) - Payment status * [Summary](#summary) - Invoice summary * [Get](#get) - Retrieve a invoice +* [Update](#update) - Update an invoice * [Delete](#delete) - Delete a invoice ## List @@ -23,6 +27,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -32,13 +38,15 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Invoices.List(ctx, operations.ListInvoicesRequest{ Cursor: middaygo.String("25"), Sort: []string{ - "createdAt", + "created_at", "desc", }, PageSize: middaygo.Float64(25), @@ -53,6 +61,15 @@ func main() { "customer-uuid-1", "customer-uuid-2", }, + Ids: []string{ + "invoice-uuid-1", + "invoice-uuid-2", + }, + RecurringIds: []string{ + "recurring-uuid-1", + "recurring-uuid-2", + }, + Recurring: middaygo.Bool(true), }) if err != nil { log.Fatal(err) @@ -81,18 +98,147 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## GetInvoicesPaymentStatus +## Create + +Create an invoice for the authenticated team. The behavior depends on deliveryType: 'create' generates and finalizes the invoice immediately, 'create_and_send' also sends it to the customer, 'scheduled' schedules the invoice for automatic processing at the specified date. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/types" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Invoices.Create(ctx, operations.CreateInvoiceRequest{ + Template: operations.Template{ + CustomerLabel: middaygo.String("Bill To"), + Title: middaygo.String("Invoice"), + FromLabel: middaygo.String("From"), + InvoiceNoLabel: middaygo.String("Invoice #"), + IssueDateLabel: middaygo.String("Issue Date"), + DueDateLabel: middaygo.String("Due Date"), + DescriptionLabel: middaygo.String("Description"), + PriceLabel: middaygo.String("Rate"), + QuantityLabel: middaygo.String("Qty"), + TotalLabel: middaygo.String("Amount"), + TotalSummaryLabel: middaygo.String("Total"), + VatLabel: middaygo.String("VAT"), + TaxLabel: middaygo.String("Sales Tax"), + DiscountLabel: middaygo.String("Discount"), + Timezone: middaygo.String("America/Los_Angeles"), + PaymentLabel: middaygo.String("Payment Information"), + NoteLabel: middaygo.String("Notes"), + LogoURL: middaygo.String("https://example.com/logo.png"), + Currency: middaygo.String("USD"), + DateFormat: middaygo.String("MM/dd/yyyy"), + IncludeVat: middaygo.Bool(false), + IncludeTax: middaygo.Bool(true), + IncludeDiscount: middaygo.Bool(false), + IncludeDecimals: middaygo.Bool(true), + IncludePdf: middaygo.Bool(true), + SendCopy: middaygo.Bool(true), + IncludeUnits: middaygo.Bool(true), + IncludeQr: middaygo.Bool(false), + TaxRate: middaygo.Float64(8.5), + VatRate: middaygo.Float64(0), + Size: operations.SizeLetter.ToPointer(), + DeliveryType: operations.TemplateDeliveryTypeCreate.ToPointer(), + Locale: middaygo.String("en-US"), + PaymentDetails: &operations.TemplatePaymentDetails{}, + FromDetails: &operations.TemplateFromDetails{}, + }, + FromDetails: &operations.FromDetails{}, + CustomerID: "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + PaymentDetails: &operations.PaymentDetails{}, + NoteDetails: &operations.NoteDetails{}, + DueDate: types.MustNewTimeFromString("2024-07-15T23:59:59.000Z"), + IssueDate: types.MustNewTimeFromString("2024-06-15T00:00:00.000Z"), + InvoiceNumber: middaygo.String("INV-2024-001"), + LogoURL: middaygo.String("https://example.com/logo.png"), + Tax: middaygo.Float64(85), + TopBlock: &operations.TopBlock{}, + BottomBlock: &operations.BottomBlock{}, + Amount: middaygo.Float64(1085), + LineItems: []operations.LineItem{ + operations.LineItem{ + Quantity: middaygo.Float64(40), + Price: middaygo.Float64(75), + Tax: middaygo.Float64(8.5), + Name: &operations.Name{}, + }, + operations.LineItem{ + Quantity: middaygo.Float64(20), + Price: middaygo.Float64(50), + Tax: middaygo.Float64(8.5), + Name: &operations.Name{}, + }, + }, + DeliveryType: operations.DeliveryTypeCreate, + ScheduledAt: types.MustNewTimeFromString("2024-07-01T09:00:00.000Z"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.CreateInvoiceRequest](../../models/operations/createinvoicerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateInvoiceResponse](../../models/operations/createinvoiceresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| apierrors.CreateInvoiceBadRequestError | 400 | application/json | +| apierrors.CreateInvoiceNotFoundError | 404 | application/json | +| apierrors.ConflictError | 409 | application/json | +| apierrors.CreateInvoiceInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PaymentStatus Get payment status for the authenticated team. ### Example Usage - + ```go package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -101,10 +247,12 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Invoices.GetInvoicesPaymentStatus(ctx) + res, err := s.Invoices.PaymentStatus(ctx) if err != nil { log.Fatal(err) } @@ -123,7 +271,7 @@ func main() { ### Response -**[*operations.GetInvoicesPaymentStatusResponse](../../models/operations/getinvoicespaymentstatusresponse.md), error** +**[*operations.GetInvoicePaymentStatusResponse](../../models/operations/getinvoicepaymentstatusresponse.md), error** ### Errors @@ -143,6 +291,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -152,14 +302,19 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Invoices.Summary(ctx, operations.GetInvoiceSummaryStatusPaid.ToPointer()) + res, err := s.Invoices.Summary(ctx, []operations.GetInvoiceSummaryStatus{ + operations.GetInvoiceSummaryStatusDraft, + operations.GetInvoiceSummaryStatusUnpaid, + }) if err != nil { log.Fatal(err) } - if res.ResponseBodies != nil { + if res.Object != nil { // handle response } } @@ -167,11 +322,11 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `status` | [*operations.GetInvoiceSummaryStatus](../../models/operations/getinvoicesummarystatus.md) | :heavy_minus_sign: | Filter summary by invoice status | paid | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `statuses` | [][operations.GetInvoiceSummaryStatus](../../models/operations/getinvoicesummarystatus.md) | :heavy_minus_sign: | Filter summary by invoice statuses | [
"draft",
"unpaid"
] | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -195,6 +350,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -203,7 +360,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Invoices.Get(ctx, "") @@ -234,6 +393,68 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | +## Update + +Update an invoice by its unique identifier for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/types" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Invoices.Update(ctx, "", operations.UpdateInvoiceRequestBody{ + Status: operations.UpdateInvoiceStatusRequestPaid.ToPointer(), + PaidAt: types.MustNewTimeFromString("2024-06-15T12:00:00.000Z"), + InternalNote: middaygo.String("Payment received via bank transfer"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | *string* | :heavy_check_mark: | N/A | +| `requestBody` | [operations.UpdateInvoiceRequestBody](../../models/operations/updateinvoicerequestbody.md) | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.UpdateInvoiceResponse](../../models/operations/updateinvoiceresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + ## Delete Delete an invoice by its unique identifier for the authenticated team. Only invoices with status 'draft' or 'canceled' can be deleted directly. If the invoice is not in one of these statuses, update its status to 'canceled' before attempting deletion. @@ -246,6 +467,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -254,7 +477,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Invoices.Delete(ctx, "") diff --git a/docs/sdks/metrics/README.md b/docs/sdks/metrics/README.md deleted file mode 100644 index c019727..0000000 --- a/docs/sdks/metrics/README.md +++ /dev/null @@ -1,331 +0,0 @@ -# Metrics -(*Metrics*) - -## Overview - -### Available Operations - -* [Revenue](#revenue) - Revenue metrics -* [Profit](#profit) - Profit metrics -* [BurnRate](#burnrate) - Burn rate metrics -* [Runway](#runway) - Runway metrics -* [Expenses](#expenses) - Expense metrics -* [Spending](#spending) - Spending metrics - -## Revenue - -Revenue metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.Revenue(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.GetRevenueResponseSchema != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetRevenueMetricsResponse](../../models/operations/getrevenuemetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## Profit - -Profit metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.Profit(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.GetProfitResponseSchema != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetProfitMetricsResponse](../../models/operations/getprofitmetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## BurnRate - -Burn rate metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.BurnRate(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.GetBurnRateResponseSchemas != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetBurnRateMetricsResponse](../../models/operations/getburnratemetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## Runway - -Runway metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.Runway(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.GetRunwayResponseSchema != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetRunwayMetricsResponse](../../models/operations/getrunwaymetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## Expenses - -Expense metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.Expenses(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.GetExpensesResponseSchema != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetExpensesMetricsResponse](../../models/operations/getexpensesmetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## Spending - -Spending metrics for the authenticated team. - -### Example Usage - - -```go -package main - -import( - "context" - middaygo "github.com/midday-ai/midday-go" - "log" -) - -func main() { - ctx := context.Background() - - s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), - ) - - res, err := s.Metrics.Spending(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) - if err != nil { - log.Fatal(err) - } - if res.SpendingResultArray != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2023-01-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2023-12-31 | -| `currency` | **string* | :heavy_minus_sign: | N/A | USD | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.GetSpendingMetricsResponse](../../models/operations/getspendingmetricsresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/midday/README.md b/docs/sdks/midday/README.md index 3a77673..47aa05c 100644 --- a/docs/sdks/midday/README.md +++ b/docs/sdks/midday/README.md @@ -2,6 +2,6 @@ ## Overview -Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage, Financial Overview & your own Assistant. +Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage & Financial Overview. ### Available Operations diff --git a/docs/sdks/notifications/README.md b/docs/sdks/notifications/README.md new file mode 100644 index 0000000..979d812 --- /dev/null +++ b/docs/sdks/notifications/README.md @@ -0,0 +1,196 @@ +# Notifications +(*Notifications*) + +## Overview + +Manage notifications + +### Available Operations + +* [List](#list) - List all notifications +* [UpdateStatus](#updatestatus) - Update notification status +* [UpdateAllStatus](#updateallstatus) - Update status of all notifications + +## List + +Retrieve a list of notifications for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Notifications.List(ctx, operations.ListNotificationsRequest{ + Cursor: middaygo.String("20"), + PageSize: middaygo.Float64(20), + Status: middaygo.Pointer(operations.CreateStatusArrayOfListNotificationsStatusEnum2( + []operations.ListNotificationsStatusEnum2{ + operations.ListNotificationsStatusEnum2Unread, + operations.ListNotificationsStatusEnum2Read, + }, + )), + UserID: middaygo.String("a1b2c3d4-e5f6-7890-abcd-ef1234567890"), + Priority: middaygo.Int64(5), + MaxPriority: middaygo.Int64(3), + }) + if err != nil { + log.Fatal(err) + } + if res.NotificationsResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.ListNotificationsRequest](../../models/operations/listnotificationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ListNotificationsResponse](../../models/operations/listnotificationsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## UpdateStatus + +Update the status of a specific notification. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Notifications.UpdateStatus(ctx, "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", operations.UpdateNotificationStatusRequestBody{ + Status: operations.UpdateNotificationStatusStatusRead, + }) + if err != nil { + log.Fatal(err) + } + if res.NotificationResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `notificationID` | *string* | :heavy_check_mark: | The ID of the notification to update | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `requestBody` | [operations.UpdateNotificationStatusRequestBody](../../models/operations/updatenotificationstatusrequestbody.md) | :heavy_check_mark: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.UpdateNotificationStatusResponse](../../models/operations/updatenotificationstatusresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## UpdateAllStatus + +Update the status of all notifications for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Notifications.UpdateAllStatus(ctx, components.UpdateAllNotificationsStatusSchema{ + Status: components.UpdateAllNotificationsStatusSchemaStatusRead, + }) + if err != nil { + log.Fatal(err) + } + if res.UpdateAllNotificationsStatusResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [components.UpdateAllNotificationsStatusSchema](../../models/components/updateallnotificationsstatusschema.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.UpdateAllNotificationsStatusResponse](../../models/operations/updateallnotificationsstatusresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md new file mode 100644 index 0000000..f0b1f92 --- /dev/null +++ b/docs/sdks/oauth/README.md @@ -0,0 +1,346 @@ +# OAuth +(*OAuth*) + +## Overview + +OAuth authorization flow + +### Available Operations + +* [PostOAuthRegister](#postoauthregister) - Dynamic Client Registration +* [GetOAuthAuthorization](#getoauthauthorization) - OAuth Authorization Endpoint +* [PostOAuthAuthorization](#postoauthauthorization) - OAuth Authorization Decision +* [PostOAuthToken](#postoauthtoken) - OAuth Token Exchange +* [PostOAuthRevoke](#postoauthrevoke) - OAuth Token Revocation + +## PostOAuthRegister + +Register an OAuth client dynamically (RFC 7591). Used by MCP clients like ChatGPT and Claude. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.OAuth.PostOAuthRegister(ctx, operations.PostOAuthRegisterRequest{ + ClientName: "ChatGPT", + RedirectUris: []string{ + "https://chatgpt.com/connector/oauth/callback", + }, + GrantTypes: []string{ + "authorization_code", + "refresh_token", + }, + Scope: middaygo.String("transactions.read invoices.read"), + LogoURI: middaygo.String("https://example.com/logo.png"), + ClientURI: middaygo.String("https://example.com"), + ResponseTypes: []string{ + "code", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.TwoHundredApplicationJSONObject != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.PostOAuthRegisterRequest](../../models/operations/postoauthregisterrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PostOAuthRegisterResponse](../../models/operations/postoauthregisterresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| apierrors.OAuthErrorResponse | 400 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## GetOAuthAuthorization + +Initiate OAuth authorization flow and get consent screen information + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.OAuth.GetOAuthAuthorization(ctx, operations.GetOAuthAuthorizationRequest{ + ResponseType: operations.ResponseTypeCode, + ClientID: "mid_client_abcdef123456789", + RedirectURI: "https://myapp.com/callback", + Scope: "transactions.read invoices.read", + State: "abc123xyz789_secure-random-state-value", + CodeChallenge: middaygo.String("E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"), + CodeChallengeMethod: operations.CodeChallengeMethodS256.ToPointer(), + Resource: middaygo.String("https://api.midday.ai"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetOAuthAuthorizationRequest](../../models/operations/getoauthauthorizationrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetOAuthAuthorizationResponse](../../models/operations/getoauthauthorizationresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| apierrors.OAuthErrorResponse | 400 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PostOAuthAuthorization + +Process user's authorization decision (allow/deny) + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.OAuth.PostOAuthAuthorization(ctx, operations.PostOAuthAuthorizationRequest{ + ClientID: "mid_client_abcdef123456789", + Decision: operations.DecisionAllow, + Scopes: []operations.Scope{ + operations.ScopeTransactionsRead, + operations.ScopeInvoicesRead, + }, + RedirectURI: "https://myapp.com/callback", + State: middaygo.String("abc123xyz789_secure-random-state-value"), + CodeChallenge: middaygo.String("E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"), + TeamID: "123e4567-e89b-12d3-a456-426614174000", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.PostOAuthAuthorizationRequest](../../models/operations/postoauthauthorizationrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PostOAuthAuthorizationResponse](../../models/operations/postoauthauthorizationresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| apierrors.PostOAuthAuthorizationBadRequestError | 400 | application/json | +| apierrors.PostOAuthAuthorizationUnauthorizedError | 401 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PostOAuthToken + +Exchange authorization code for access token or refresh an access token + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.OAuth.PostOAuthToken(ctx, components.CreateOAuthTokenEndpointRequestOAuthTokenEndpointRequestRefreshToken( + components.OAuthTokenEndpointRequestRefreshToken{ + GrantType: components.GrantTypeRefreshTokenRefreshToken, + RefreshToken: "mid_rt_abcdef123456789", + ClientID: "mid_client_abcdef123456789", + ClientSecret: middaygo.String("mid_secret_abcdef123456789"), + Scope: middaygo.String("transactions.read invoices.read"), + }, + )) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [components.OAuthTokenEndpointRequest](../../models/components/oauthtokenendpointrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PostOAuthTokenResponse](../../models/operations/postoauthtokenresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| apierrors.OAuthErrorResponse | 400 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PostOAuthRevoke + +Revoke an access token or refresh token + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.OAuth.PostOAuthRevoke(ctx, operations.PostOAuthRevokeRequest{ + Token: "mid_access_token_abcdef123456789", + TokenTypeHint: operations.TokenTypeHintAccessToken.ToPointer(), + ClientID: "mid_client_abcdef123456789", + ClientSecret: middaygo.String("mid_secret_abcdef123456789"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.PostOAuthRevokeRequest](../../models/operations/postoauthrevokerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PostOAuthRevokeResponse](../../models/operations/postoauthrevokeresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md new file mode 100644 index 0000000..bb60e57 --- /dev/null +++ b/docs/sdks/reports/README.md @@ -0,0 +1,359 @@ +# Reports +(*Reports*) + +## Overview + +Financial reports + +### Available Operations + +* [Revenue](#revenue) - Revenue reports +* [Profit](#profit) - Profit reports +* [BurnRate](#burnrate) - Burn rate reports +* [Runway](#runway) - Runway reports +* [Expenses](#expenses) - Expense reports +* [Spending](#spending) - Spending reports + +## Revenue + +Revenue reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.Revenue(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD"), operations.GetRevenueReportsRevenueTypeNet.ToPointer()) + if err != nil { + log.Fatal(err) + } + if res.GetRevenueResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `to` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `revenueType` | [*operations.GetRevenueReportsRevenueType](../../models/operations/getrevenuereportsrevenuetype.md) | :heavy_minus_sign: | Type of revenue calculation | net | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetRevenueReportsResponse](../../models/operations/getrevenuereportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## Profit + +Profit reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.Profit(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD"), operations.GetProfitReportsRevenueTypeNet.ToPointer()) + if err != nil { + log.Fatal(err) + } + if res.GetProfitResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `to` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `revenueType` | [*operations.GetProfitReportsRevenueType](../../models/operations/getprofitreportsrevenuetype.md) | :heavy_minus_sign: | Type of revenue calculation | net | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetProfitReportsResponse](../../models/operations/getprofitreportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## BurnRate + +Burn rate reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.BurnRate(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) + if err != nil { + log.Fatal(err) + } + if res.GetBurnRateResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `to` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetBurnRateReportsResponse](../../models/operations/getburnratereportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## Runway + +Runway reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.Runway(ctx, middaygo.String("USD")) + if err != nil { + log.Fatal(err) + } + if res.GetRunwayResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetRunwayReportsResponse](../../models/operations/getrunwayreportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## Expenses + +Expense reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.Expenses(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) + if err != nil { + log.Fatal(err) + } + if res.GetExpensesResponseSchema != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `to` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetExpensesReportsResponse](../../models/operations/getexpensesreportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## Spending + +Spending reports for the authenticated team. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Reports.Spending(ctx, "2023-01-01", "2023-12-31", middaygo.String("USD")) + if err != nil { + log.Fatal(err) + } + if res.SpendingResultArray != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date (ISO 8601 format) | 2023-01-01 | +| `to` | *string* | :heavy_check_mark: | End date (ISO 8601 format) | 2023-12-31 | +| `currency` | **string* | :heavy_minus_sign: | Currency code (ISO 4217) | USD | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetSpendingReportsResponse](../../models/operations/getspendingreportsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 59c90d8..5b9a83b 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -3,6 +3,8 @@ ## Overview +Search endpoints + ### Available Operations * [Search](#search) - Search @@ -19,6 +21,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -28,7 +32,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Search.Search(ctx, operations.SearchRequest{ diff --git a/docs/sdks/tags/README.md b/docs/sdks/tags/README.md index ab340af..f6d40c2 100644 --- a/docs/sdks/tags/README.md +++ b/docs/sdks/tags/README.md @@ -3,6 +3,8 @@ ## Overview +Manage tags + ### Available Operations * [List](#list) - List all tags @@ -23,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -31,7 +35,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Tags.List(ctx) @@ -73,8 +79,9 @@ package main import( "context" - middaygo "github.com/midday-ai/midday-go" + "os" "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" "log" ) @@ -82,16 +89,18 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Tags.Create(ctx, &components.CreateTag{ + res, err := s.Tags.Create(ctx, components.CreateTag{ Name: "Important", }) if err != nil { log.Fatal(err) } - if res.TagsResponse != nil { + if res.TagResponse != nil { // handle response } } @@ -127,6 +136,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -135,7 +146,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Tags.Get(ctx, "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f") @@ -153,7 +166,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | +| `id` | *string* | :heavy_check_mark: | The UUID of the tag. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -178,6 +191,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -186,7 +201,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Tags.Delete(ctx, "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f") @@ -204,7 +221,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | +| `id` | *string* | :heavy_check_mark: | The UUID of the tag to delete. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -229,6 +246,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -238,10 +257,12 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Tags.Update(ctx, "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", &operations.UpdateTagRequestBody{ + res, err := s.Tags.Update(ctx, "b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f", operations.UpdateTagRequestBody{ Name: "Urgent", }) if err != nil { @@ -255,12 +276,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | -| `requestBody` | [*operations.UpdateTagRequestBody](../../models/operations/updatetagrequestbody.md) | :heavy_minus_sign: | N/A | | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `id` | *string* | :heavy_check_mark: | The ID of the tag to update. | b3b7c8e2-1f2a-4c3d-9e4f-5a6b7c8d9e0f | +| `requestBody` | [operations.UpdateTagRequestBody](../../models/operations/updatetagrequestbody.md) | :heavy_check_mark: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response diff --git a/docs/sdks/teams/README.md b/docs/sdks/teams/README.md index 54e96ad..3cb9f51 100644 --- a/docs/sdks/teams/README.md +++ b/docs/sdks/teams/README.md @@ -3,6 +3,8 @@ ## Overview +Manage teams + ### Available Operations * [List](#list) - List all teams @@ -22,6 +24,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -30,7 +34,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Teams.List(ctx) @@ -72,6 +78,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -80,7 +88,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Teams.Get(ctx, "123e4567-e89b-12d3-a456-426614174000") @@ -98,7 +108,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -123,6 +133,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -132,15 +144,20 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Teams.Update(ctx, "123e4567-e89b-12d3-a456-426614174000", &operations.UpdateTeamByIDRequestBody{ + res, err := s.Teams.Update(ctx, "123e4567-e89b-12d3-a456-426614174000", operations.UpdateTeamByIDRequestBody{ Name: middaygo.String("Acme Corporation"), Email: middaygo.String("team@acme.com"), LogoURL: middaygo.String("https://cdn.midday.ai/logos/acme-corp.png"), BaseCurrency: middaygo.String("USD"), CountryCode: middaygo.String("US"), + FiscalYearStartMonth: middaygo.Int64(4), + CompanyType: operations.CompanyTypeSoloFounder.ToPointer(), + HeardAbout: operations.HeardAboutTwitter.ToPointer(), }) if err != nil { log.Fatal(err) @@ -153,12 +170,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | -| `requestBody` | [*operations.UpdateTeamByIDRequestBody](../../models/operations/updateteambyidrequestbody.md) | :heavy_minus_sign: | N/A | | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | +| `requestBody` | [operations.UpdateTeamByIDRequestBody](../../models/operations/updateteambyidrequestbody.md) | :heavy_check_mark: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -182,6 +199,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -190,7 +209,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Teams.Members(ctx, "123e4567-e89b-12d3-a456-426614174000") @@ -208,7 +229,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | 123e4567-e89b-12d3-a456-426614174000 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the team | 123e4567-e89b-12d3-a456-426614174000 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response diff --git a/docs/sdks/trackerentries/README.md b/docs/sdks/trackerentries/README.md index cf68360..0d70446 100644 --- a/docs/sdks/trackerentries/README.md +++ b/docs/sdks/trackerentries/README.md @@ -3,6 +3,8 @@ ## Overview +Manage time tracker entries + ### Available Operations * [List](#list) - List all tracker entries @@ -23,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -31,7 +35,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerEntries.List(ctx, "2024-04-01", "2024-04-30", middaygo.String("b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2")) @@ -46,13 +52,13 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `from` | *string* | :heavy_check_mark: | N/A | 2024-04-01 | -| `to` | *string* | :heavy_check_mark: | N/A | 2024-04-30 | -| `projectID` | **string* | :heavy_minus_sign: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `from` | *string* | :heavy_check_mark: | Start date of the range (inclusive) in YYYY-MM-DD format | 2024-04-01 | +| `to` | *string* | :heavy_check_mark: | End date of the range (inclusive) in YYYY-MM-DD format | 2024-04-30 | +| `projectID` | **string* | :heavy_minus_sign: | Optional project ID to filter tracker entries by specific project | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -76,6 +82,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/types" "github.com/midday-ai/midday-go/models/operations" @@ -86,7 +94,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerEntries.Create(ctx, &operations.CreateTrackerEntryRequest{ @@ -140,6 +150,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/types" "github.com/midday-ai/midday-go/models/operations" @@ -150,7 +162,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerEntries.CreateBulk(ctx, &operations.CreateTrackerEntriesBulkRequest{ @@ -218,6 +232,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -226,7 +242,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerEntries.Delete(ctx, "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2") @@ -244,7 +262,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the tracker entry to delete | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -269,6 +287,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/types" "github.com/midday-ai/midday-go/models/operations" @@ -279,7 +299,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerEntries.Update(ctx, "b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2", &operations.UpdateTrackerEntryRequestBody{ @@ -308,7 +330,7 @@ func main() { | Parameter | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the tracker entry to delete | b3b6e2c2-1f2a-4e3b-9c1d-2a4b6e2c21f2 | | `requestBody` | [*operations.UpdateTrackerEntryRequestBody](../../models/operations/updatetrackerentryrequestbody.md) | :heavy_minus_sign: | N/A | | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | diff --git a/docs/sdks/trackerprojects/README.md b/docs/sdks/trackerprojects/README.md index 6c5c8aa..bb55ee2 100644 --- a/docs/sdks/trackerprojects/README.md +++ b/docs/sdks/trackerprojects/README.md @@ -3,6 +3,8 @@ ## Overview +Manage tracker projects + ### Available Operations * [List](#list) - List all tracker projects @@ -23,6 +25,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -32,7 +36,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerProjects.List(ctx, operations.ListTrackerProjectsRequest{ @@ -51,8 +57,8 @@ func main() { "tag-2", }, Sort: []string{ - "-createdAt", - "name", + "created_at", + "desc", }, }) if err != nil { @@ -94,6 +100,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -103,7 +111,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerProjects.Create(ctx, &operations.CreateTrackerProjectRequest{ @@ -149,6 +159,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -157,7 +169,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerProjects.Get(ctx, "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f") @@ -175,7 +189,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -200,6 +214,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -208,7 +224,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerProjects.Delete(ctx, "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f") @@ -226,7 +244,7 @@ func main() { | Parameter | Type | Required | Description | Example | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -251,6 +269,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -260,7 +280,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerProjects.Update(ctx, "b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f", &operations.UpdateTrackerProjectRequestBody{ @@ -297,7 +319,7 @@ func main() { | Parameter | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `id` | *string* | :heavy_check_mark: | N/A | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the project to retrieve | b7e6c8e2-1f2a-4c3b-9e2d-1a2b3c4d5e6f | | `requestBody` | [*operations.UpdateTrackerProjectRequestBody](../../models/operations/updatetrackerprojectrequestbody.md) | :heavy_minus_sign: | N/A | | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | diff --git a/docs/sdks/trackertimer/README.md b/docs/sdks/trackertimer/README.md index f923ec4..9676c1b 100644 --- a/docs/sdks/trackertimer/README.md +++ b/docs/sdks/trackertimer/README.md @@ -3,6 +3,8 @@ ## Overview +Timer operations + ### Available Operations * [StartTimer](#starttimer) - Start a timer @@ -22,6 +24,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/types" "github.com/midday-ai/midday-go/models/operations" @@ -32,7 +36,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerTimer.StartTimer(ctx, &operations.StartTimerRequest{ @@ -81,6 +87,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/types" "github.com/midday-ai/midday-go/models/operations" @@ -91,7 +99,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerTimer.StopTimer(ctx, &operations.StopTimerRequest{ @@ -138,6 +148,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -146,7 +158,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerTimer.GetCurrentTimer(ctx, middaygo.String("a1b2c3d4-e5f6-7890-abcd-ef1234567890")) @@ -161,11 +175,11 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `assignedID` | **string* | :heavy_minus_sign: | N/A | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `assignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -189,6 +203,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -197,7 +213,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.TrackerTimer.GetTimerStatus(ctx, middaygo.String("a1b2c3d4-e5f6-7890-abcd-ef1234567890")) @@ -212,11 +230,11 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `assignedID` | **string* | :heavy_minus_sign: | N/A | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `assignedID` | **string* | :heavy_minus_sign: | Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user | a1b2c3d4-e5f6-7890-abcd-ef1234567890 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response diff --git a/docs/sdks/transactions/README.md b/docs/sdks/transactions/README.md index 2ec9be7..7b5d42d 100644 --- a/docs/sdks/transactions/README.md +++ b/docs/sdks/transactions/README.md @@ -3,6 +3,8 @@ ## Overview +Manage transactions + ### Available Operations * [List](#list) - List all transactions @@ -10,6 +12,7 @@ * [Get](#get) - Retrieve a transaction * [Delete](#delete) - Delete a transaction * [Update](#update) - Update a transaction +* [GetAttachmentPreSignedURL](#getattachmentpresignedurl) - Generate pre-signed URL for transaction attachment * [CreateMany](#createmany) - Bulk create transactions * [DeleteMany](#deletemany) - Bulk delete transactions * [UpdateMany](#updatemany) - Bulk update transactions @@ -26,6 +29,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -35,7 +40,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Transactions.List(ctx, operations.ListTransactionsRequest{ @@ -64,9 +71,9 @@ func main() { "user-1", "user-2", }, - Statuses: []string{ - "pending", - "completed", + Statuses: []operations.ListTransactionsStatus{ + operations.ListTransactionsStatusInReview, + operations.ListTransactionsStatusExportError, }, Recurring: []string{ "monthly", @@ -82,6 +89,9 @@ func main() { "299.99", }, Type: operations.ListTransactionsTypeExpense.ToPointer(), + Manual: operations.ManualInclude.ToPointer(), + Exported: middaygo.Bool(false), + Fulfilled: middaygo.Bool(true), }) if err != nil { log.Fatal(err) @@ -122,7 +132,10 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" "log" ) @@ -130,10 +143,18 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.Create(ctx, nil) + res, err := s.Transactions.Create(ctx, operations.CreateTransactionRequest{ + Name: "", + Amount: 5744.12, + Currency: "Forint", + Date: "2024-01-12", + BankAccountID: "", + }) if err != nil { log.Fatal(err) } @@ -173,6 +194,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -181,7 +204,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Transactions.Get(ctx, "391723c9-de99-4039-b8e2-4fa5bbdf9480") @@ -199,7 +224,7 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | *string* | :heavy_check_mark: | N/A | +| `id` | *string* | :heavy_check_mark: | Transaction ID (UUID). | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -224,6 +249,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -232,7 +259,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Transactions.Delete(ctx, "92766ee2-a2bc-44aa-97af-6891695fc321") @@ -250,7 +279,7 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | *string* | :heavy_check_mark: | N/A | +| `id` | *string* | :heavy_check_mark: | Transaction ID (UUID). | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -275,7 +304,10 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" "log" ) @@ -283,10 +315,12 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.Update(ctx, "f0c1d0ef-5679-4c1b-9698-2c64e97e8c1d", nil) + res, err := s.Transactions.Update(ctx, "f0c1d0ef-5679-4c1b-9698-2c64e97e8c1d", operations.UpdateTransactionRequestBody{}) if err != nil { log.Fatal(err) } @@ -298,12 +332,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | *string* | :heavy_check_mark: | N/A | -| `requestBody` | [*operations.UpdateTransactionRequestBody](../../models/operations/updatetransactionrequestbody.md) | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | *string* | :heavy_check_mark: | Transaction ID (UUID). | +| `requestBody` | [operations.UpdateTransactionRequestBody](../../models/operations/updatetransactionrequestbody.md) | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -315,6 +349,66 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | +## GetAttachmentPreSignedURL + +Generate a pre-signed URL for accessing a transaction attachment. The URL is valid for 60 seconds and allows secure temporary access to the attachment file. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Transactions.GetAttachmentPreSignedURL(ctx, "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4", "a43dc3a5-6925-4d91-ac9c-4c1a34bdb388", middaygo.Bool(true)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `transactionID` | *string* | :heavy_check_mark: | Unique identifier of the transaction | b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4 | +| `attachmentID` | *string* | :heavy_check_mark: | Unique identifier of the attachment to generate a pre-signed URL for | a43dc3a5-6925-4d91-ac9c-4c1a34bdb388 | +| `download` | **bool* | :heavy_minus_sign: | Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. | true | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetTransactionAttachmentPreSignedURLResponse](../../models/operations/gettransactionattachmentpresignedurlresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| apierrors.GetTransactionAttachmentPreSignedURLBadRequestError | 400 | application/json | +| apierrors.GetTransactionAttachmentPreSignedURLNotFoundError | 404 | application/json | +| apierrors.GetTransactionAttachmentPreSignedURLInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + ## CreateMany Bulk create transactions for the authenticated team. @@ -327,7 +421,10 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" "log" ) @@ -335,10 +432,20 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.CreateMany(ctx, nil) + res, err := s.Transactions.CreateMany(ctx, []operations.RequestBody{ + operations.RequestBody{ + Name: "", + Amount: 5142.41, + Currency: "Gourde", + Date: "2024-03-22", + BankAccountID: "", + }, + }) if err != nil { log.Fatal(err) } @@ -378,6 +485,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -386,10 +495,16 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.DeleteMany(ctx, nil) + res, err := s.Transactions.DeleteMany(ctx, []string{ + "c0db9ee1-75c5-4621-84a2-0c38d2dc3106", + "e5581754-1917-44fa-a324-166437019d98", + "a8bccdfb-07ed-4359-8712-46b82316d8f9", + }) if err != nil { log.Fatal(err) } @@ -429,7 +544,10 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" + "github.com/midday-ai/midday-go/models/operations" "log" ) @@ -437,10 +555,18 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Transactions.UpdateMany(ctx, nil) + res, err := s.Transactions.UpdateMany(ctx, operations.UpdateTransactionsRequest{ + Ids: []string{ + "", + "", + "", + }, + }) if err != nil { log.Fatal(err) } diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md index bf2f1b2..9675211 100644 --- a/docs/sdks/users/README.md +++ b/docs/sdks/users/README.md @@ -3,6 +3,8 @@ ## Overview +Manage users + ### Available Operations * [Get](#get) - Retrieve the current user @@ -20,6 +22,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "log" ) @@ -28,7 +32,9 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) res, err := s.Users.Get(ctx) @@ -70,6 +76,8 @@ package main import( "context" + "os" + "github.com/midday-ai/midday-go/models/components" middaygo "github.com/midday-ai/midday-go" "github.com/midday-ai/midday-go/models/operations" "log" @@ -79,12 +87,13 @@ func main() { ctx := context.Background() s := middaygo.New( - middaygo.WithSecurity("MIDDAY_API_KEY"), + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), ) - res, err := s.Users.Update(ctx, &operations.UpdateCurrentUserRequest{ + res, err := s.Users.Update(ctx, operations.UpdateCurrentUserRequest{ FullName: middaygo.String("Jane Doe"), - TeamID: middaygo.String("team-abc123"), Email: middaygo.String("jane.doe@acme.com"), AvatarURL: middaygo.String("https://cdn.midday.ai/avatars/jane-doe.jpg"), Locale: middaygo.String("en-US"), diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md new file mode 100644 index 0000000..1c2e243 --- /dev/null +++ b/docs/sdks/webhooks/README.md @@ -0,0 +1,401 @@ +# Webhooks +(*Webhooks*) + +## Overview + +Webhook endpoints + +### Available Operations + +* [InboxWebhook](#inboxwebhook) - Inbox webhook +* [PlaidWebhook](#plaidwebhook) - Plaid webhook handler +* [PolarWebhook](#polarwebhook) - Polar webhook handler +* [StripeWebhook](#stripewebhook) - Stripe webhook handler +* [TellerWebhook](#tellerwebhook) - Teller webhook handler +* [WhatsappWebhookVerify](#whatsappwebhookverify) - WhatsApp webhook verification +* [WhatsappWebhook](#whatsappwebhook) - WhatsApp webhook + +## InboxWebhook + +Webhook endpoint for receiving inbox emails from Postmark + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.InboxWebhook(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [any](../../.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.InboxWebhookResponse](../../models/operations/inboxwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| apierrors.InboxWebhookBadRequestError | 400 | application/json | +| apierrors.InboxWebhookInternalServerError | 500 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PlaidWebhook + +Handles Plaid webhook events for transaction updates and item status changes. Verifies the Plaid-Verification JWT signature. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.PlaidWebhook(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PlaidWebhookResponse](../../models/operations/plaidwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## PolarWebhook + +Handles Polar webhook events for subscription changes. Verifies webhook signature and processes subscription events. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.PolarWebhook(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PolarWebhookResponse](../../models/operations/polarwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## StripeWebhook + +Handles Stripe webhook events for invoice payments. Verifies webhook signature and processes payment events. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.StripeWebhook(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.StripeWebhookResponse](../../models/operations/stripewebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## TellerWebhook + +Handles Teller webhook events for enrollment disconnections and transaction updates. + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.TellerWebhook(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.TellerWebhookResponse](../../models/operations/tellerwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## WhatsappWebhookVerify + +Verify webhook URL for WhatsApp Business API + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.WhatsappWebhookVerify(ctx, "", "", "") + if err != nil { + log.Fatal(err) + } + if res.Res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `hubMode` | *string* | :heavy_check_mark: | N/A | +| `hubVerifyToken` | *string* | :heavy_check_mark: | N/A | +| `hubChallenge` | *string* | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.WhatsappWebhookVerifyResponse](../../models/operations/whatsappwebhookverifyresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## WhatsappWebhook + +Receive messages, media, and button replies from WhatsApp Business API + +### Example Usage + + +```go +package main + +import( + "context" + "os" + "github.com/midday-ai/midday-go/models/components" + middaygo "github.com/midday-ai/midday-go" + "log" +) + +func main() { + ctx := context.Background() + + s := middaygo.New( + middaygo.WithSecurity(components.Security{ + Oauth2: middaygo.String(os.Getenv("MIDDAY_OAUTH2")), + }), + ) + + res, err := s.Webhooks.WhatsappWebhook(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [any](../../.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.WhatsappWebhookResponse](../../models/operations/whatsappwebhookresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/documents.go b/documents.go index f8032f7..a22d597 100644 --- a/documents.go +++ b/documents.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Documents - Manage documents type Documents struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,16 @@ func (s *Documents) List(ctx context.Context, request operations.ListDocumentsRe if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +121,7 @@ func (s *Documents) List(ctx context.Context, request operations.ListDocumentsRe httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -230,11 +237,26 @@ func (s *Documents) List(ctx context.Context, request operations.ListDocumentsRe } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -312,6 +334,16 @@ func (s *Documents) Get(ctx context.Context, id *string, opts ...operations.Opti if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -320,11 +352,7 @@ func (s *Documents) Get(ctx context.Context, id *string, opts ...operations.Opti httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -440,11 +468,26 @@ func (s *Documents) Get(ctx context.Context, id *string, opts ...operations.Opti } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -522,6 +565,16 @@ func (s *Documents) Delete(ctx context.Context, id string, opts ...operations.Op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -530,11 +583,7 @@ func (s *Documents) Delete(ctx context.Context, id string, opts ...operations.Op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -649,6 +698,317 @@ func (s *Documents) Delete(ctx context.Context, id string, opts ...operations.Op return nil, err } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// GetPreSignedURL - Generate pre-signed URL for document +// Generate a pre-signed URL for accessing a document. The URL is valid for 60 seconds and allows secure temporary access to the document file. +func (s *Documents) GetPreSignedURL(ctx context.Context, id string, download *bool, opts ...operations.Option) (*operations.GetDocumentPreSignedURLResponse, error) { + request := operations.GetDocumentPreSignedURLRequest{ + ID: id, + Download: download, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/documents/{id}/presigned-url", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getDocumentPreSignedUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetDocumentPreSignedURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetDocumentPreSignedURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetDocumentPreSignedURLBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetDocumentPreSignedURLNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetDocumentPreSignedURLInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { diff --git a/files.go b/files.go new file mode 100644 index 0000000..245eb66 --- /dev/null +++ b/files.go @@ -0,0 +1,943 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// Files - File operations +type Files struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newFiles(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Files { + return &Files{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// Proxy file from storage +// Proxies a file from storage. Requires team file key (fk) query parameter for access. +func (s *Files) Proxy(ctx context.Context, filePath string, fk string, opts ...operations.Option) (*operations.ProxyFileResponse, error) { + request := operations.ProxyFileRequest{ + FilePath: filePath, + Fk: fk, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/files/proxy") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "proxyFile", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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/octet-stream") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ProxyFileResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/octet-stream`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.ProxyFileBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.ProxyFileNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.ProxyFileInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DownloadFile - Download file from vault +// Downloads a file from the vault storage bucket. Requires team file key (fk) query parameter for access. +func (s *Files) DownloadFile(ctx context.Context, path string, fk string, filename *string, opts ...operations.Option) (*operations.DownloadFileResponse, error) { + request := operations.DownloadFileRequest{ + Path: path, + Filename: filename, + Fk: fk, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/files/download/file") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "downloadFile", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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/octet-stream") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DownloadFileResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/octet-stream`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadFileBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadFileUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadFileNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadFileInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DownloadInvoice - Download invoice PDF +// Downloads an invoice as a PDF. Can be accessed with an invoice ID (requires team file key via fk query parameter) or invoice token (public access). +func (s *Files) DownloadInvoice(ctx context.Context, request operations.DownloadInvoiceRequest, opts ...operations.Option) (*operations.DownloadInvoiceResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/files/download/invoice") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "downloadInvoice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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/pdf") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DownloadInvoiceResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/pdf`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadInvoiceBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadInvoiceUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadInvoiceNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.DownloadInvoiceInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/inbox.go b/inbox.go index a66c890..36b67df 100644 --- a/inbox.go +++ b/inbox.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Inbox - Manage inbox items type Inbox struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,16 @@ func (s *Inbox) List(ctx context.Context, request operations.ListInboxItemsReque if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +121,7 @@ func (s *Inbox) List(ctx context.Context, request operations.ListInboxItemsReque httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -230,11 +237,26 @@ func (s *Inbox) List(ctx context.Context, request operations.ListInboxItemsReque } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -312,6 +334,16 @@ func (s *Inbox) Get(ctx context.Context, id string, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -320,11 +352,7 @@ func (s *Inbox) Get(ctx context.Context, id string, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -440,11 +468,26 @@ func (s *Inbox) Get(ctx context.Context, id string, opts ...operations.Option) ( } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -522,6 +565,16 @@ func (s *Inbox) Delete(ctx context.Context, id string, opts ...operations.Option if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -530,11 +583,7 @@ func (s *Inbox) Delete(ctx context.Context, id string, opts ...operations.Option httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -650,11 +699,26 @@ func (s *Inbox) Delete(ctx context.Context, id string, opts ...operations.Option } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -740,6 +804,16 @@ func (s *Inbox) Update(ctx context.Context, id string, requestBody operations.Up if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -748,11 +822,7 @@ func (s *Inbox) Update(ctx context.Context, id string, requestBody operations.Up httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -867,6 +937,317 @@ func (s *Inbox) Update(ctx context.Context, id string, requestBody operations.Up return nil, err } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// GetPreSignedURL - Generate pre-signed URL for inbox attachment +// Generate a pre-signed URL for accessing an inbox attachment. The URL is valid for 60 seconds and allows secure temporary access to the attachment file. +func (s *Inbox) GetPreSignedURL(ctx context.Context, id string, download *bool, opts ...operations.Option) (*operations.GetInboxPreSignedURLResponse, error) { + request := operations.GetInboxPreSignedURLRequest{ + ID: id, + Download: download, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/inbox/{id}/presigned-url", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getInboxPreSignedUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetInboxPreSignedURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetInboxPreSignedURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetInboxPreSignedURLBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetInboxPreSignedURLNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetInboxPreSignedURLInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { diff --git a/integrations.go b/integrations.go new file mode 100644 index 0000000..5e1ace4 --- /dev/null +++ b/integrations.go @@ -0,0 +1,3157 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// Integrations - Integration endpoints +type Integrations struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newIntegrations(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Integrations { + return &Integrations{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// SlackOAuthCallback - Slack OAuth callback +// Handles OAuth callback from Slack after user authorization. Exchanges authorization code for access token and creates app integration. +func (s *Integrations) SlackOAuthCallback(ctx context.Context, code string, state string, opts ...operations.Option) (*operations.SlackOAuthCallbackResponse, error) { + request := operations.SlackOAuthCallbackRequest{ + Code: code, + State: state, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/slack/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "slackOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.SlackOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.SlackOAuthCallbackBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.SlackOAuthCallbackInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetSlackInstallURL - Get Slack install URL +// Generates OAuth install URL for Slack integration. Requires authentication. +func (s *Integrations) GetSlackInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetSlackInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/slack/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getSlackInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetSlackInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetSlackInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// SlackWebhook - Slack webhook handler +// Handles incoming webhook events from Slack. Verifies request signature and processes events. +func (s *Integrations) SlackWebhook(ctx context.Context, opts ...operations.Option) (*operations.SlackWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/slack/webhook") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "slackWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.SlackWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.SlackWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// SlackInteractions - Slack interactions handler +// Handles interactive component actions from Slack (button clicks, etc.) +func (s *Integrations) SlackInteractions(ctx context.Context, opts ...operations.Option) (*operations.SlackInteractionsResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/slack/interactions") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "slackInteractions", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.SlackInteractionsResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.SlackInteractionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// GmailOAuthCallback - Gmail OAuth callback +// Handles OAuth callback from Google after user authorization. Exchanges authorization code for access token and creates inbox account. +func (s *Integrations) GmailOAuthCallback(ctx context.Context, state string, code *string, error_ *string, opts ...operations.Option) (*operations.GmailOAuthCallbackResponse, error) { + request := operations.GmailOAuthCallbackRequest{ + Code: code, + State: state, + Error: error_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/gmail/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "gmailOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GmailOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GmailOAuthCallbackBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GmailOAuthCallbackInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetGmailInstallURL - Get Gmail install URL +// Generates OAuth install URL for Gmail integration. Requires authentication. +func (s *Integrations) GetGmailInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetGmailInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/gmail/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getGmailInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetGmailInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetGmailInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// OutlookOAuthCallback - Outlook OAuth callback +// Handles OAuth callback from Microsoft after user authorization. Exchanges authorization code for access token and creates inbox account. +func (s *Integrations) OutlookOAuthCallback(ctx context.Context, state string, code *string, error_ *string, opts ...operations.Option) (*operations.OutlookOAuthCallbackResponse, error) { + request := operations.OutlookOAuthCallbackRequest{ + Code: code, + State: state, + Error: error_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/outlook/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "outlookOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.OutlookOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.OutlookOAuthCallbackBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.OutlookOAuthCallbackInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetOutlookInstallURL - Get Outlook install URL +// Generates OAuth install URL for Outlook integration. Requires authentication. +func (s *Integrations) GetOutlookInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetOutlookInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/outlook/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getOutlookInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetOutlookInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetOutlookInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// XeroOAuthCallback - Xero OAuth callback +// Handles OAuth callback from Xero after user authorization. Exchanges authorization code for access token and creates app integration. +func (s *Integrations) XeroOAuthCallback(ctx context.Context, state string, code *string, error_ *string, opts ...operations.Option) (*operations.XeroOAuthCallbackResponse, error) { + request := operations.XeroOAuthCallbackRequest{ + Code: code, + State: state, + Error: error_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/xero/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "xeroOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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", "*/*") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.XeroOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetXeroInstallURL - Get Xero install URL +// Generates OAuth install URL for Xero integration. Requires authentication. +func (s *Integrations) GetXeroInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetXeroInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/xero/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getXeroInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetXeroInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetXeroInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// QuickBooksOAuthCallback - QuickBooks OAuth callback +// Handles OAuth callback from QuickBooks after user authorization. Exchanges authorization code for access token and creates app integration. +func (s *Integrations) QuickBooksOAuthCallback(ctx context.Context, state string, code *string, realmID *string, error_ *string, opts ...operations.Option) (*operations.QuickBooksOAuthCallbackResponse, error) { + request := operations.QuickBooksOAuthCallbackRequest{ + Code: code, + State: state, + RealmID: realmID, + Error: error_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/quickbooks/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "quickBooksOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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", "*/*") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.QuickBooksOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetQuickBooksInstallURL - Get QuickBooks install URL +// Generates OAuth install URL for QuickBooks integration. Requires authentication. +func (s *Integrations) GetQuickBooksInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetQuickBooksInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/quickbooks/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getQuickBooksInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetQuickBooksInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetQuickBooksInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// FortnoxOAuthCallback - Fortnox OAuth callback +// Handles OAuth callback from Fortnox after user authorization. Exchanges authorization code for access token and creates app integration. +func (s *Integrations) FortnoxOAuthCallback(ctx context.Context, state string, code *string, error_ *string, opts ...operations.Option) (*operations.FortnoxOAuthCallbackResponse, error) { + request := operations.FortnoxOAuthCallbackRequest{ + Code: code, + State: state, + Error: error_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/fortnox/oauth-callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "fortnoxOAuthCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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", "*/*") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.FortnoxOAuthCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetFortnoxInstallURL - Get Fortnox install URL +// Generates OAuth install URL for Fortnox integration. Requires authentication. +func (s *Integrations) GetFortnoxInstallURL(ctx context.Context, opts ...operations.Option) (*operations.GetFortnoxInstallURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/apps/fortnox/install-url") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getFortnoxInstallUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetFortnoxInstallURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetFortnoxInstallURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/invoicepayments.go b/invoicepayments.go new file mode 100644 index 0000000..0dd7407 --- /dev/null +++ b/invoicepayments.go @@ -0,0 +1,1107 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// InvoicePayments - Invoice payment processing +type InvoicePayments struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newInvoicePayments(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *InvoicePayments { + return &InvoicePayments{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// GetStripeConnectURL - Get Stripe Connect URL +// Generates OAuth URL for Stripe Connect Standard integration. Allows teams to connect their Stripe account for accepting invoice payments. +func (s *InvoicePayments) GetStripeConnectURL(ctx context.Context, opts ...operations.Option) (*operations.GetStripeConnectURLResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoice-payments/connect-stripe") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getStripeConnectUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetStripeConnectURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetStripeConnectURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// StripeConnectCallback - Stripe Connect OAuth callback +// Handles OAuth callback from Stripe Connect after user authorization. Exchanges authorization code for connected account ID. +func (s *InvoicePayments) StripeConnectCallback(ctx context.Context, state string, code *string, error_ *string, errorDescription *string, opts ...operations.Option) (*operations.StripeConnectCallbackResponse, error) { + request := operations.StripeConnectCallbackRequest{ + Code: code, + State: state, + Error: error_, + ErrorDescription: errorDescription, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoice-payments/connect-stripe/callback") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "stripeConnectCallback", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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", "*/*") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.StripeConnectCallbackResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 302: + res.Headers = httpRes.Header + + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DisconnectStripe - Disconnect Stripe account +// Disconnects the team's Stripe Connect account. +func (s *InvoicePayments) DisconnectStripe(ctx context.Context, opts ...operations.Option) (*operations.DisconnectStripeResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoice-payments/disconnect-stripe") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "disconnectStripe", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DisconnectStripeResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.DisconnectStripeResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// CreateInvoicePaymentIntent - Create payment intent for invoice +// Creates a Stripe PaymentIntent for paying an invoice. This is a public endpoint that uses the invoice token for authentication. +func (s *InvoicePayments) CreateInvoicePaymentIntent(ctx context.Context, request operations.CreateInvoicePaymentIntentRequest, opts ...operations.Option) (*operations.CreateInvoicePaymentIntentResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoice-payments/payment-intent") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createInvoicePaymentIntent", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateInvoicePaymentIntentResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.CreateInvoicePaymentIntentResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetStripeConnectStatus - Get Stripe Connect status +// Gets the current Stripe Connect status for the team. +func (s *InvoicePayments) GetStripeConnectStatus(ctx context.Context, opts ...operations.Option) (*operations.GetStripeConnectStatusResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoice-payments/stripe-status") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getStripeConnectStatus", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetStripeConnectStatusResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetStripeConnectStatusResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/invoices.go b/invoices.go index 26bff7f..90d60f1 100644 --- a/invoices.go +++ b/invoices.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Invoices - Manage invoices type Invoices struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,562 @@ func (s *Invoices) List(ctx context.Context, request operations.ListInvoicesRequ if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ListInvoicesResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.ListInvoicesResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// Create an invoice +// Create an invoice for the authenticated team. The behavior depends on deliveryType: 'create' generates and finalizes the invoice immediately, 'create_and_send' also sends it to the customer, 'scheduled' schedules the invoice for automatic processing at the specified date. +func (s *Invoices) Create(ctx context.Context, request operations.CreateInvoiceRequest, opts ...operations.Option) (*operations.CreateInvoiceResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoices") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createInvoice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "409", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateInvoiceResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.CreateInvoiceResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.CreateInvoiceBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.CreateInvoiceNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 409: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.ConflictError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.CreateInvoiceInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PaymentStatus - Payment status +// Get payment status for the authenticated team. +func (s *Invoices) PaymentStatus(ctx context.Context, opts ...operations.Option) (*operations.GetInvoicePaymentStatusResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/invoices/payment-status") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getInvoicePaymentStatus", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +667,7 @@ func (s *Invoices) List(ctx context.Context, request operations.ListInvoicesRequ httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -188,7 +741,7 @@ func (s *Invoices) List(ctx context.Context, request operations.ListInvoicesRequ } } - res := &operations.ListInvoicesResponse{ + res := &operations.GetInvoicePaymentStatusResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -204,7 +757,7 @@ func (s *Invoices) List(ctx context.Context, request operations.ListInvoicesRequ return nil, err } - var out operations.ListInvoicesResponseBody + var out operations.GetInvoicePaymentStatusResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -230,20 +783,39 @@ func (s *Invoices) List(ctx context.Context, request operations.ListInvoicesRequ } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// GetInvoicesPaymentStatus - Payment status -// Get payment status for the authenticated team. -func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operations.Option) (*operations.GetInvoicesPaymentStatusResponse, error) { +// Summary - Invoice summary +// Get summary of invoices for the authenticated team. +func (s *Invoices) Summary(ctx context.Context, statuses []operations.GetInvoiceSummaryStatus, opts ...operations.Option) (*operations.GetInvoiceSummaryResponse, error) { + request := operations.GetInvoiceSummaryRequest{ + Statuses: statuses, + } + o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -262,7 +834,7 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/invoices/payment-status") + opURL, err := url.JoinPath(baseURL, "/invoices/summary") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -272,7 +844,7 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "get_/invoices/payment-status", + OperationID: "getInvoiceSummary", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -295,6 +867,10 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati req.Header.Set("Accept", "application/json") 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) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -308,6 +884,16 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -316,11 +902,7 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -394,7 +976,7 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati } } - res := &operations.GetInvoicesPaymentStatusResponse{ + res := &operations.GetInvoiceSummaryResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -410,7 +992,7 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati return nil, err } - var out operations.GetInvoicesPaymentStatusResponseBody + var out operations.GetInvoiceSummaryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -436,22 +1018,37 @@ func (s *Invoices) GetInvoicesPaymentStatus(ctx context.Context, opts ...operati } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Summary - Invoice summary -// Get summary of invoices for the authenticated team. -func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSummaryStatus, opts ...operations.Option) (*operations.GetInvoiceSummaryResponse, error) { - request := operations.GetInvoiceSummaryRequest{ - Status: status, +// Get - Retrieve a invoice +// Retrieve a invoice by its unique identifier for the authenticated team. +func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option) (*operations.GetInvoiceByIDResponse, error) { + request := operations.GetInvoiceByIDRequest{ + ID: id, } o := operations.Options{} @@ -472,7 +1069,7 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/invoices/summary") + opURL, err := utils.GenerateURL(ctx, baseURL, "/invoices/{id}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -482,7 +1079,7 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getInvoiceSummary", + OperationID: "getInvoiceById", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -505,10 +1102,6 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum req.Header.Set("Accept", "application/json") 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) - } - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -522,6 +1115,16 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -530,11 +1133,7 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -608,7 +1207,7 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum } } - res := &operations.GetInvoiceSummaryResponse{ + res := &operations.GetInvoiceByIDResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -624,12 +1223,12 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum return nil, err } - var out []operations.GetInvoiceSummaryResponseBody + var out operations.GetInvoiceByIDResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ResponseBodies = out + res.Object = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -650,22 +1249,38 @@ func (s *Invoices) Summary(ctx context.Context, status *operations.GetInvoiceSum } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Get - Retrieve a invoice -// Retrieve a invoice by its unique identifier for the authenticated team. -func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option) (*operations.GetInvoiceByIDResponse, error) { - request := operations.GetInvoiceByIDRequest{ - ID: id, +// Update an invoice +// Update an invoice by its unique identifier for the authenticated team. +func (s *Invoices) Update(ctx context.Context, id string, requestBody operations.UpdateInvoiceRequestBody, opts ...operations.Option) (*operations.UpdateInvoiceResponse, error) { + request := operations.UpdateInvoiceRequest{ + ID: id, + RequestBody: requestBody, } o := operations.Options{} @@ -696,10 +1311,14 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getInvoiceById", + OperationID: "updateInvoice", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -712,12 +1331,15 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + 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) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err @@ -732,6 +1354,16 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -740,11 +1372,7 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -818,7 +1446,7 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option } } - res := &operations.GetInvoiceByIDResponse{ + res := &operations.UpdateInvoiceResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -834,7 +1462,7 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option return nil, err } - var out operations.GetInvoiceByIDResponseBody + var out operations.UpdateInvoiceResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -860,11 +1488,26 @@ func (s *Invoices) Get(ctx context.Context, id string, opts ...operations.Option } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -942,6 +1585,16 @@ func (s *Invoices) Delete(ctx context.Context, id string, opts ...operations.Opt if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -950,11 +1603,7 @@ func (s *Invoices) Delete(ctx context.Context, id string, opts ...operations.Opt httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1070,11 +1719,26 @@ func (s *Invoices) Delete(ctx context.Context, id string, opts ...operations.Opt } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/midday.go b/midday.go index 4dbfd69..14eeb9a 100644 --- a/midday.go +++ b/midday.go @@ -48,25 +48,51 @@ 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 } -// Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage, Financial Overview & your own Assistant. +// Midday API: Midday is a platform for Invoicing, Time tracking, File reconciliation, Storage & Financial Overview. type Midday struct { - SDKVersion string + SDKVersion string + // OAuth authorization flow + OAuth *OAuth + // Webhook endpoints + Webhooks *Webhooks + // File operations + Files *Files + // Integration endpoints + Integrations *Integrations + // Invoice payment processing + InvoicePayments *InvoicePayments + // Desktop app endpoints + Desktop *Desktop + // Manage notifications + Notifications *Notifications + // Manage transactions Transactions *Transactions - Teams *Teams - Users *Users - Customers *Customers + // Manage teams + Teams *Teams + // Manage users + Users *Users + // Manage customers + Customers *Customers + // Manage bank accounts BankAccounts *BankAccounts - Tags *Tags - Documents *Documents - Inbox *Inbox - Invoices *Invoices - // Search - // Search across all data, invoices, documents, customers, transactions, and more. - Search *Search - Metrics *Metrics + // Manage tags + Tags *Tags + // Manage documents + Documents *Documents + // Manage inbox items + Inbox *Inbox + // Manage invoices + Invoices *Invoices + // Search endpoints + Search *Search + // Financial reports + Reports *Reports + // Manage tracker projects TrackerProjects *TrackerProjects - TrackerEntries *TrackerEntries - TrackerTimer *TrackerTimer + // Manage time tracker entries + TrackerEntries *TrackerEntries + // Timer operations + TrackerTimer *TrackerTimer sdkConfiguration config.SDKConfiguration hooks *hooks.Hooks @@ -111,10 +137,9 @@ func WithClient(client HTTPClient) SDKOption { } // WithSecurity configures the SDK to use the provided security details -func WithSecurity(token string) SDKOption { +func WithSecurity(security components.Security) SDKOption { return func(sdk *Midday) { - security := components.Security{Token: &token} - sdk.sdkConfiguration.Security = utils.AsSecuritySource(&security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) } } @@ -143,9 +168,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *Midday { sdk := &Midday{ - SDKVersion: "0.1.0", + SDKVersion: "0.2.0", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.1.0 2.686.7 0.0.1 github.com/midday-ai/midday-go", + UserAgent: "speakeasy-sdk/go 0.2.0 2.686.7 0.0.1 github.com/midday-ai/midday-go", ServerList: ServerList, }, hooks: hooks.New(), @@ -168,6 +193,13 @@ func New(opts ...SDKOption) *Midday { sdk.sdkConfiguration = sdk.hooks.SDKInit(sdk.sdkConfiguration) + sdk.OAuth = newOAuth(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Webhooks = newWebhooks(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Files = newFiles(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Integrations = newIntegrations(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.InvoicePayments = newInvoicePayments(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Desktop = newDesktop(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Notifications = newNotifications(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Transactions = newTransactions(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Teams = newTeams(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Users = newUsers(sdk, sdk.sdkConfiguration, sdk.hooks) @@ -178,7 +210,7 @@ func New(opts ...SDKOption) *Midday { sdk.Inbox = newInbox(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Invoices = newInvoices(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Search = newSearch(sdk, sdk.sdkConfiguration, sdk.hooks) - sdk.Metrics = newMetrics(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Reports = newReports(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.TrackerProjects = newTrackerProjects(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.TrackerEntries = newTrackerEntries(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.TrackerTimer = newTrackerTimer(sdk, sdk.sdkConfiguration, sdk.hooks) diff --git a/models/apierrors/checkdesktopupdate.go b/models/apierrors/checkdesktopupdate.go new file mode 100644 index 0000000..00bec60 --- /dev/null +++ b/models/apierrors/checkdesktopupdate.go @@ -0,0 +1,21 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// CheckDesktopUpdateBadGatewayError - Failed to fetch update info from upstream +type CheckDesktopUpdateBadGatewayError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &CheckDesktopUpdateBadGatewayError{} + +func (e *CheckDesktopUpdateBadGatewayError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/createinvoice.go b/models/apierrors/createinvoice.go new file mode 100644 index 0000000..59736f5 --- /dev/null +++ b/models/apierrors/createinvoice.go @@ -0,0 +1,64 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// CreateInvoiceInternalServerError - Internal server error. +type CreateInvoiceInternalServerError struct { + // Error message + Message string `json:"message"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &CreateInvoiceInternalServerError{} + +func (e *CreateInvoiceInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// ConflictError - Conflict. Invoice number already exists. +type ConflictError struct { + // Error message about the conflict + Message string `json:"message"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ConflictError{} + +func (e *ConflictError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// CreateInvoiceNotFoundError - Customer not found. +type CreateInvoiceNotFoundError struct { + // Error message + Message string `json:"message"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &CreateInvoiceNotFoundError{} + +func (e *CreateInvoiceNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// CreateInvoiceBadRequestError - Bad request. Invalid input data or validation errors. +type CreateInvoiceBadRequestError struct { + // Error message describing the validation failure + Message string `json:"message"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &CreateInvoiceBadRequestError{} + +func (e *CreateInvoiceBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/downloaddesktopupdate.go b/models/apierrors/downloaddesktopupdate.go new file mode 100644 index 0000000..04ffd80 --- /dev/null +++ b/models/apierrors/downloaddesktopupdate.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// DownloadDesktopUpdateBadGatewayError - Failed to download artifact from upstream +type DownloadDesktopUpdateBadGatewayError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadDesktopUpdateBadGatewayError{} + +func (e *DownloadDesktopUpdateBadGatewayError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadDesktopUpdateBadRequestError - Invalid download URL +type DownloadDesktopUpdateBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadDesktopUpdateBadRequestError{} + +func (e *DownloadDesktopUpdateBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/downloadfile.go b/models/apierrors/downloadfile.go new file mode 100644 index 0000000..4ab1561 --- /dev/null +++ b/models/apierrors/downloadfile.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// DownloadFileInternalServerError - Internal server error +type DownloadFileInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadFileInternalServerError{} + +func (e *DownloadFileInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadFileNotFoundError - Not found +type DownloadFileNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadFileNotFoundError{} + +func (e *DownloadFileNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadFileUnauthorizedError - Unauthorized +type DownloadFileUnauthorizedError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadFileUnauthorizedError{} + +func (e *DownloadFileUnauthorizedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadFileBadRequestError - Bad request +type DownloadFileBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadFileBadRequestError{} + +func (e *DownloadFileBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/downloadinvoice.go b/models/apierrors/downloadinvoice.go new file mode 100644 index 0000000..8ee8880 --- /dev/null +++ b/models/apierrors/downloadinvoice.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// DownloadInvoiceInternalServerError - Internal server error +type DownloadInvoiceInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadInvoiceInternalServerError{} + +func (e *DownloadInvoiceInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadInvoiceNotFoundError - Not found +type DownloadInvoiceNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadInvoiceNotFoundError{} + +func (e *DownloadInvoiceNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadInvoiceUnauthorizedError - Unauthorized +type DownloadInvoiceUnauthorizedError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadInvoiceUnauthorizedError{} + +func (e *DownloadInvoiceUnauthorizedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// DownloadInvoiceBadRequestError - Bad request +type DownloadInvoiceBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &DownloadInvoiceBadRequestError{} + +func (e *DownloadInvoiceBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/getdocumentpresignedurl.go b/models/apierrors/getdocumentpresignedurl.go new file mode 100644 index 0000000..a724894 --- /dev/null +++ b/models/apierrors/getdocumentpresignedurl.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// GetDocumentPreSignedURLInternalServerError - Internal server error - Failed to generate pre-signed URL +type GetDocumentPreSignedURLInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetDocumentPreSignedURLInternalServerError{} + +func (e *GetDocumentPreSignedURLInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetDocumentPreSignedURLNotFoundError - Document not found +type GetDocumentPreSignedURLNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetDocumentPreSignedURLNotFoundError{} + +func (e *GetDocumentPreSignedURLNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetDocumentPreSignedURLBadRequestError - Bad request - Document file path not available +type GetDocumentPreSignedURLBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetDocumentPreSignedURLBadRequestError{} + +func (e *GetDocumentPreSignedURLBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/getinboxpresignedurl.go b/models/apierrors/getinboxpresignedurl.go new file mode 100644 index 0000000..41e7213 --- /dev/null +++ b/models/apierrors/getinboxpresignedurl.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// GetInboxPreSignedURLInternalServerError - Internal server error - Failed to generate pre-signed URL +type GetInboxPreSignedURLInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetInboxPreSignedURLInternalServerError{} + +func (e *GetInboxPreSignedURLInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetInboxPreSignedURLNotFoundError - Inbox item not found +type GetInboxPreSignedURLNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetInboxPreSignedURLNotFoundError{} + +func (e *GetInboxPreSignedURLNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetInboxPreSignedURLBadRequestError - Bad request - Attachment file path not available +type GetInboxPreSignedURLBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetInboxPreSignedURLBadRequestError{} + +func (e *GetInboxPreSignedURLBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/gettransactionattachmentpresignedurl.go b/models/apierrors/gettransactionattachmentpresignedurl.go new file mode 100644 index 0000000..1f57cea --- /dev/null +++ b/models/apierrors/gettransactionattachmentpresignedurl.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// GetTransactionAttachmentPreSignedURLInternalServerError - Internal server error - Failed to generate pre-signed URL +type GetTransactionAttachmentPreSignedURLInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetTransactionAttachmentPreSignedURLInternalServerError{} + +func (e *GetTransactionAttachmentPreSignedURLInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetTransactionAttachmentPreSignedURLNotFoundError - Transaction or attachment not found +type GetTransactionAttachmentPreSignedURLNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetTransactionAttachmentPreSignedURLNotFoundError{} + +func (e *GetTransactionAttachmentPreSignedURLNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GetTransactionAttachmentPreSignedURLBadRequestError - Bad request - Attachment file path not available +type GetTransactionAttachmentPreSignedURLBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GetTransactionAttachmentPreSignedURLBadRequestError{} + +func (e *GetTransactionAttachmentPreSignedURLBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/gmailoauthcallback.go b/models/apierrors/gmailoauthcallback.go new file mode 100644 index 0000000..ae7ae3e --- /dev/null +++ b/models/apierrors/gmailoauthcallback.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// GmailOAuthCallbackInternalServerError - Failed to process OAuth callback +type GmailOAuthCallbackInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GmailOAuthCallbackInternalServerError{} + +func (e *GmailOAuthCallbackInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// GmailOAuthCallbackBadRequestError - Invalid request parameters +type GmailOAuthCallbackBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GmailOAuthCallbackBadRequestError{} + +func (e *GmailOAuthCallbackBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/inboxwebhook.go b/models/apierrors/inboxwebhook.go new file mode 100644 index 0000000..ab9043a --- /dev/null +++ b/models/apierrors/inboxwebhook.go @@ -0,0 +1,36 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" +) + +// InboxWebhookInternalServerError - Internal server error +type InboxWebhookInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &InboxWebhookInternalServerError{} + +func (e *InboxWebhookInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// InboxWebhookBadRequestError - Invalid request +type InboxWebhookBadRequestError struct { + Error_ string `json:"error"` + Errors []operations.Error `json:"errors,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &InboxWebhookBadRequestError{} + +func (e *InboxWebhookBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/oautherrorresponse.go b/models/apierrors/oautherrorresponse.go new file mode 100644 index 0000000..cf5e4d5 --- /dev/null +++ b/models/apierrors/oautherrorresponse.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +type OAuthErrorResponse struct { + // Error code + Error_ string `json:"error"` + // Human-readable error description + ErrorDescription *string `json:"error_description,omitempty"` + // URI to a human-readable error page + ErrorURI *string `json:"error_uri,omitempty"` + // Opaque state parameter from the original request + State *string `json:"state,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &OAuthErrorResponse{} + +func (e *OAuthErrorResponse) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/outlookoauthcallback.go b/models/apierrors/outlookoauthcallback.go new file mode 100644 index 0000000..3190bf7 --- /dev/null +++ b/models/apierrors/outlookoauthcallback.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// OutlookOAuthCallbackInternalServerError - Failed to process OAuth callback +type OutlookOAuthCallbackInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &OutlookOAuthCallbackInternalServerError{} + +func (e *OutlookOAuthCallbackInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// OutlookOAuthCallbackBadRequestError - Invalid request parameters +type OutlookOAuthCallbackBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &OutlookOAuthCallbackBadRequestError{} + +func (e *OutlookOAuthCallbackBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/postoauthauthorization.go b/models/apierrors/postoauthauthorization.go new file mode 100644 index 0000000..7f71819 --- /dev/null +++ b/models/apierrors/postoauthauthorization.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// PostOAuthAuthorizationUnauthorizedError - Unauthorized +type PostOAuthAuthorizationUnauthorizedError struct { + RedirectURL string `json:"redirect_url"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &PostOAuthAuthorizationUnauthorizedError{} + +func (e *PostOAuthAuthorizationUnauthorizedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// PostOAuthAuthorizationBadRequestError - Invalid request +type PostOAuthAuthorizationBadRequestError struct { + RedirectURL string `json:"redirect_url"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &PostOAuthAuthorizationBadRequestError{} + +func (e *PostOAuthAuthorizationBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/proxyfile.go b/models/apierrors/proxyfile.go new file mode 100644 index 0000000..1aa3351 --- /dev/null +++ b/models/apierrors/proxyfile.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// ProxyFileInternalServerError - Internal server error +type ProxyFileInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ProxyFileInternalServerError{} + +func (e *ProxyFileInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// ProxyFileNotFoundError - Not found +type ProxyFileNotFoundError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ProxyFileNotFoundError{} + +func (e *ProxyFileNotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// ProxyFileBadRequestError - Bad request +type ProxyFileBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ProxyFileBadRequestError{} + +func (e *ProxyFileBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/apierrors/slackoauthcallback.go b/models/apierrors/slackoauthcallback.go new file mode 100644 index 0000000..a806096 --- /dev/null +++ b/models/apierrors/slackoauthcallback.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apierrors + +import ( + "encoding/json" + "github.com/midday-ai/midday-go/models/components" +) + +// SlackOAuthCallbackInternalServerError - Failed to process OAuth callback +type SlackOAuthCallbackInternalServerError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &SlackOAuthCallbackInternalServerError{} + +func (e *SlackOAuthCallbackInternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +// SlackOAuthCallbackBadRequestError - Invalid request parameters +type SlackOAuthCallbackBadRequestError struct { + Error_ string `json:"error"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &SlackOAuthCallbackBadRequestError{} + +func (e *SlackOAuthCallbackBadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/components/getburnrateresponseschema.go b/models/components/burnrateitem.go similarity index 67% rename from models/components/getburnrateresponseschema.go rename to models/components/burnrateitem.go index 2e798a7..2fbdf37 100644 --- a/models/components/getburnrateresponseschema.go +++ b/models/components/burnrateitem.go @@ -2,7 +2,7 @@ package components -type GetBurnRateResponseSchema struct { +type BurnRateItem struct { // Date for the burn rate value Date string `json:"date"` // Burn rate value for the given date @@ -11,21 +11,21 @@ type GetBurnRateResponseSchema struct { Currency string `json:"currency"` } -func (o *GetBurnRateResponseSchema) GetDate() string { +func (o *BurnRateItem) GetDate() string { if o == nil { return "" } return o.Date } -func (o *GetBurnRateResponseSchema) GetValue() float64 { +func (o *BurnRateItem) GetValue() float64 { if o == nil { return 0.0 } return o.Value } -func (o *GetBurnRateResponseSchema) GetCurrency() string { +func (o *BurnRateItem) GetCurrency() string { if o == nil { return "" } diff --git a/models/components/createtransactionattachment.go b/models/components/createtransactionattachment.go new file mode 100644 index 0000000..a673abc --- /dev/null +++ b/models/components/createtransactionattachment.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CreateTransactionAttachment struct { + // Path(s) of the attachment file(s). + Path []string `json:"path"` + // Name of the attachment file. + Name string `json:"name"` + // Size of the attachment file in bytes. + Size float64 `json:"size"` + // MIME type of the attachment file. + Type string `json:"type"` +} + +func (o *CreateTransactionAttachment) GetPath() []string { + if o == nil { + return []string{} + } + return o.Path +} + +func (o *CreateTransactionAttachment) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateTransactionAttachment) GetSize() float64 { + if o == nil { + return 0.0 + } + return o.Size +} + +func (o *CreateTransactionAttachment) GetType() string { + if o == nil { + return "" + } + return o.Type +} diff --git a/models/components/errorresponse.go b/models/components/errorresponse.go new file mode 100644 index 0000000..6b4f7f7 --- /dev/null +++ b/models/components/errorresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ErrorResponse struct { + // Error message + Error string `json:"error"` + // HTTP status code + Code *int64 `json:"code,omitempty"` +} + +func (o *ErrorResponse) GetError() string { + if o == nil { + return "" + } + return o.Error +} + +func (o *ErrorResponse) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} diff --git a/models/components/notificationresponseschema.go b/models/components/notificationresponseschema.go new file mode 100644 index 0000000..52acb86 --- /dev/null +++ b/models/components/notificationresponseschema.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type NotificationResponseSchema struct { + Data NotificationSchema `json:"data"` +} + +func (o *NotificationResponseSchema) GetData() NotificationSchema { + if o == nil { + return NotificationSchema{} + } + return o.Data +} diff --git a/models/components/notificationschema.go b/models/components/notificationschema.go new file mode 100644 index 0000000..186c95c --- /dev/null +++ b/models/components/notificationschema.go @@ -0,0 +1,158 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// Source of the notification +type Source string + +const ( + SourceSystem Source = "system" + SourceUser Source = "user" +) + +func (e Source) ToPointer() *Source { + return &e +} +func (e *Source) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "system": + fallthrough + case "user": + *e = Source(v) + return nil + default: + return fmt.Errorf("invalid value for Source: %v", v) + } +} + +// NotificationSchemaStatus - Current status of the notification +type NotificationSchemaStatus string + +const ( + NotificationSchemaStatusUnread NotificationSchemaStatus = "unread" + NotificationSchemaStatusRead NotificationSchemaStatus = "read" + NotificationSchemaStatusArchived NotificationSchemaStatus = "archived" +) + +func (e NotificationSchemaStatus) ToPointer() *NotificationSchemaStatus { + return &e +} +func (e *NotificationSchemaStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "unread": + fallthrough + case "read": + fallthrough + case "archived": + *e = NotificationSchemaStatus(v) + return nil + default: + return fmt.Errorf("invalid value for NotificationSchemaStatus: %v", v) + } +} + +type NotificationSchema struct { + // Unique identifier of the notification + ID string `json:"id"` + // ISO timestamp when the notification was created + CreatedAt string `json:"createdAt"` + // Unique identifier of the team + TeamID string `json:"teamId"` + // Unique identifier of the user (if applicable) + UserID *string `json:"userId"` + // Type of notification + Type string `json:"type"` + // Priority level of the notification (1-3 = user notifications, 4-10 = system) + Priority int64 `json:"priority"` + // Source of the notification + Source Source `json:"source"` + // Current status of the notification + Status NotificationSchemaStatus `json:"status"` + // Additional metadata for the notification + Metadata map[string]any `json:"metadata"` + // ISO timestamp when the notification was last used by the system + LastUsedAt *string `json:"lastUsedAt"` +} + +func (o *NotificationSchema) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *NotificationSchema) GetCreatedAt() string { + if o == nil { + return "" + } + return o.CreatedAt +} + +func (o *NotificationSchema) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *NotificationSchema) GetUserID() *string { + if o == nil { + return nil + } + return o.UserID +} + +func (o *NotificationSchema) GetType() string { + if o == nil { + return "" + } + return o.Type +} + +func (o *NotificationSchema) GetPriority() int64 { + if o == nil { + return 0 + } + return o.Priority +} + +func (o *NotificationSchema) GetSource() Source { + if o == nil { + return Source("") + } + return o.Source +} + +func (o *NotificationSchema) GetStatus() NotificationSchemaStatus { + if o == nil { + return NotificationSchemaStatus("") + } + return o.Status +} + +func (o *NotificationSchema) GetMetadata() map[string]any { + if o == nil { + return map[string]any{} + } + return o.Metadata +} + +func (o *NotificationSchema) GetLastUsedAt() *string { + if o == nil { + return nil + } + return o.LastUsedAt +} diff --git a/models/components/notificationsresponseschema.go b/models/components/notificationsresponseschema.go new file mode 100644 index 0000000..abdabfa --- /dev/null +++ b/models/components/notificationsresponseschema.go @@ -0,0 +1,55 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NotificationsResponseSchemaMeta - Pagination metadata +type NotificationsResponseSchemaMeta struct { + // Cursor for pagination (null if no more pages) + Cursor *string `json:"cursor"` + // Whether there are previous pages available + HasPreviousPage bool `json:"hasPreviousPage"` + // Whether there are more pages available + HasNextPage bool `json:"hasNextPage"` +} + +func (o *NotificationsResponseSchemaMeta) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +func (o *NotificationsResponseSchemaMeta) GetHasPreviousPage() bool { + if o == nil { + return false + } + return o.HasPreviousPage +} + +func (o *NotificationsResponseSchemaMeta) GetHasNextPage() bool { + if o == nil { + return false + } + return o.HasNextPage +} + +type NotificationsResponseSchema struct { + // Array of notifications + Data []NotificationSchema `json:"data"` + // Pagination metadata + Meta NotificationsResponseSchemaMeta `json:"meta"` +} + +func (o *NotificationsResponseSchema) GetData() []NotificationSchema { + if o == nil { + return []NotificationSchema{} + } + return o.Data +} + +func (o *NotificationsResponseSchema) GetMeta() NotificationsResponseSchemaMeta { + if o == nil { + return NotificationsResponseSchemaMeta{} + } + return o.Meta +} diff --git a/models/components/oauthtokenendpointrequest.go b/models/components/oauthtokenendpointrequest.go new file mode 100644 index 0000000..bd63da0 --- /dev/null +++ b/models/components/oauthtokenendpointrequest.go @@ -0,0 +1,226 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" +) + +// GrantTypeRefreshToken - OAuth grant type, must be 'refresh_token' +type GrantTypeRefreshToken string + +const ( + GrantTypeRefreshTokenRefreshToken GrantTypeRefreshToken = "refresh_token" +) + +func (e GrantTypeRefreshToken) ToPointer() *GrantTypeRefreshToken { + return &e +} +func (e *GrantTypeRefreshToken) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "refresh_token": + *e = GrantTypeRefreshToken(v) + return nil + default: + return fmt.Errorf("invalid value for GrantTypeRefreshToken: %v", v) + } +} + +type OAuthTokenEndpointRequestRefreshToken struct { + // OAuth grant type, must be 'refresh_token' + GrantType GrantTypeRefreshToken `json:"grant_type" form:"name=grant_type"` + // Refresh token received from token endpoint + RefreshToken string `json:"refresh_token" form:"name=refresh_token"` + // Client ID of the OAuth application + ClientID string `json:"client_id" form:"name=client_id"` + // Client secret of the OAuth application (required for confidential clients) + ClientSecret *string `json:"client_secret,omitempty" form:"name=client_secret"` + // Space-separated list of requested scopes (optional) + Scope *string `json:"scope,omitempty" form:"name=scope"` +} + +func (o *OAuthTokenEndpointRequestRefreshToken) GetGrantType() GrantTypeRefreshToken { + if o == nil { + return GrantTypeRefreshToken("") + } + return o.GrantType +} + +func (o *OAuthTokenEndpointRequestRefreshToken) GetRefreshToken() string { + if o == nil { + return "" + } + return o.RefreshToken +} + +func (o *OAuthTokenEndpointRequestRefreshToken) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *OAuthTokenEndpointRequestRefreshToken) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +func (o *OAuthTokenEndpointRequestRefreshToken) GetScope() *string { + if o == nil { + return nil + } + return o.Scope +} + +// GrantTypeAuthorizationCode - OAuth grant type, must be 'authorization_code' +type GrantTypeAuthorizationCode string + +const ( + GrantTypeAuthorizationCodeAuthorizationCode GrantTypeAuthorizationCode = "authorization_code" +) + +func (e GrantTypeAuthorizationCode) ToPointer() *GrantTypeAuthorizationCode { + return &e +} +func (e *GrantTypeAuthorizationCode) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "authorization_code": + *e = GrantTypeAuthorizationCode(v) + return nil + default: + return fmt.Errorf("invalid value for GrantTypeAuthorizationCode: %v", v) + } +} + +type OAuthTokenEndpointRequestAuthorizationCode struct { + // OAuth grant type, must be 'authorization_code' + GrantType GrantTypeAuthorizationCode `json:"grant_type" form:"name=grant_type"` + // Authorization code received from authorization endpoint + Code string `json:"code" form:"name=code"` + // Redirect URI used in authorization request + RedirectURI string `json:"redirect_uri" form:"name=redirect_uri"` + // Client ID of the OAuth application + ClientID string `json:"client_id" form:"name=client_id"` + // Client secret of the OAuth application (required for confidential clients) + ClientSecret *string `json:"client_secret,omitempty" form:"name=client_secret"` + // Code verifier for PKCE (required for public clients using PKCE) + CodeVerifier *string `json:"code_verifier,omitempty" form:"name=code_verifier"` +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetGrantType() GrantTypeAuthorizationCode { + if o == nil { + return GrantTypeAuthorizationCode("") + } + return o.GrantType +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetRedirectURI() string { + if o == nil { + return "" + } + return o.RedirectURI +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +func (o *OAuthTokenEndpointRequestAuthorizationCode) GetCodeVerifier() *string { + if o == nil { + return nil + } + return o.CodeVerifier +} + +type OAuthTokenEndpointRequestType string + +const ( + OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestAuthorizationCode OAuthTokenEndpointRequestType = "OAuthTokenEndpointRequest_AuthorizationCode" + OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestRefreshToken OAuthTokenEndpointRequestType = "OAuthTokenEndpointRequest_RefreshToken" +) + +type OAuthTokenEndpointRequest struct { + OAuthTokenEndpointRequestAuthorizationCode *OAuthTokenEndpointRequestAuthorizationCode `queryParam:"inline"` + OAuthTokenEndpointRequestRefreshToken *OAuthTokenEndpointRequestRefreshToken `queryParam:"inline"` + + Type OAuthTokenEndpointRequestType +} + +func CreateOAuthTokenEndpointRequestOAuthTokenEndpointRequestAuthorizationCode(oAuthTokenEndpointRequestAuthorizationCode OAuthTokenEndpointRequestAuthorizationCode) OAuthTokenEndpointRequest { + typ := OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestAuthorizationCode + + return OAuthTokenEndpointRequest{ + OAuthTokenEndpointRequestAuthorizationCode: &oAuthTokenEndpointRequestAuthorizationCode, + Type: typ, + } +} + +func CreateOAuthTokenEndpointRequestOAuthTokenEndpointRequestRefreshToken(oAuthTokenEndpointRequestRefreshToken OAuthTokenEndpointRequestRefreshToken) OAuthTokenEndpointRequest { + typ := OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestRefreshToken + + return OAuthTokenEndpointRequest{ + OAuthTokenEndpointRequestRefreshToken: &oAuthTokenEndpointRequestRefreshToken, + Type: typ, + } +} + +func (u *OAuthTokenEndpointRequest) UnmarshalJSON(data []byte) error { + + var oAuthTokenEndpointRequestRefreshToken OAuthTokenEndpointRequestRefreshToken = OAuthTokenEndpointRequestRefreshToken{} + if err := utils.UnmarshalJSON(data, &oAuthTokenEndpointRequestRefreshToken, "", true, true); err == nil { + u.OAuthTokenEndpointRequestRefreshToken = &oAuthTokenEndpointRequestRefreshToken + u.Type = OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestRefreshToken + return nil + } + + var oAuthTokenEndpointRequestAuthorizationCode OAuthTokenEndpointRequestAuthorizationCode = OAuthTokenEndpointRequestAuthorizationCode{} + if err := utils.UnmarshalJSON(data, &oAuthTokenEndpointRequestAuthorizationCode, "", true, true); err == nil { + u.OAuthTokenEndpointRequestAuthorizationCode = &oAuthTokenEndpointRequestAuthorizationCode + u.Type = OAuthTokenEndpointRequestTypeOAuthTokenEndpointRequestAuthorizationCode + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for OAuthTokenEndpointRequest", string(data)) +} + +func (u OAuthTokenEndpointRequest) MarshalJSON() ([]byte, error) { + if u.OAuthTokenEndpointRequestAuthorizationCode != nil { + return utils.MarshalJSON(u.OAuthTokenEndpointRequestAuthorizationCode, "", true) + } + + if u.OAuthTokenEndpointRequestRefreshToken != nil { + return utils.MarshalJSON(u.OAuthTokenEndpointRequestRefreshToken, "", true) + } + + return nil, errors.New("could not marshal union type OAuthTokenEndpointRequest: all fields are null") +} diff --git a/models/components/security.go b/models/components/security.go index eb58bf8..21c4ad4 100644 --- a/models/components/security.go +++ b/models/components/security.go @@ -3,7 +3,15 @@ package components type Security struct { - Token *string `security:"scheme,type=http,subtype=bearer,name=Authorization,env=midday_token"` + Oauth2 *string `security:"scheme,type=oauth2,name=Authorization,env=midday_oauth2"` + Token *string `security:"scheme,type=http,subtype=bearer,name=Authorization,env=midday_token"` +} + +func (o *Security) GetOauth2() *string { + if o == nil { + return nil + } + return o.Oauth2 } func (o *Security) GetToken() *string { diff --git a/models/components/transactionresponse.go b/models/components/transactionresponse.go index 1208411..e4bb69f 100644 --- a/models/components/transactionresponse.go +++ b/models/components/transactionresponse.go @@ -60,7 +60,7 @@ func (o *Category) GetSlug() string { return o.Slug } -// Connection - Bank connection information associated with the account +// Connection - Bank connection information associated with the account. Null for manual accounts. type Connection struct { // Unique identifier of the bank connection ID string `json:"id"` @@ -91,7 +91,7 @@ func (o *Connection) GetLogoURL() *string { return o.LogoURL } -// Account - Bank account information associated with the transaction +// Account - Bank account information associated with the transaction. Null when no account is linked. type Account struct { // Unique identifier of the bank account ID string `json:"id"` @@ -99,8 +99,8 @@ type Account struct { Name string `json:"name"` // Currency of the bank account in ISO 4217 format Currency string `json:"currency"` - // Bank connection information associated with the account - Connection Connection `json:"connection"` + // Bank connection information associated with the account. Null for manual accounts. + Connection *Connection `json:"connection"` } func (o *Account) GetID() string { @@ -124,9 +124,9 @@ func (o *Account) GetCurrency() string { return o.Currency } -func (o *Account) GetConnection() Connection { +func (o *Account) GetConnection() *Connection { if o == nil { - return Connection{} + return nil } return o.Connection } @@ -235,8 +235,8 @@ type TransactionResponse struct { IsFulfilled bool `json:"isFulfilled"` // Optional note or memo attached to the transaction Note *string `json:"note"` - // Bank account information associated with the transaction - Account Account `json:"account"` + // Bank account information associated with the transaction. Null when no account is linked. + Account *Account `json:"account"` // Array of tags associated with the transaction for categorization and filtering Tags []TransactionResponseTag `json:"tags"` // Array of file attachments associated with the transaction (receipts, invoices, etc.) @@ -362,9 +362,9 @@ func (o *TransactionResponse) GetNote() *string { return o.Note } -func (o *TransactionResponse) GetAccount() Account { +func (o *TransactionResponse) GetAccount() *Account { if o == nil { - return Account{} + return nil } return o.Account } diff --git a/models/components/updateallnotificationsstatusresponseschema.go b/models/components/updateallnotificationsstatusresponseschema.go new file mode 100644 index 0000000..14d078b --- /dev/null +++ b/models/components/updateallnotificationsstatusresponseschema.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type UpdateAllNotificationsStatusResponseSchema struct { + // Array of updated notifications + Data []NotificationSchema `json:"data"` +} + +func (o *UpdateAllNotificationsStatusResponseSchema) GetData() []NotificationSchema { + if o == nil { + return []NotificationSchema{} + } + return o.Data +} diff --git a/models/components/updateallnotificationsstatusschema.go b/models/components/updateallnotificationsstatusschema.go new file mode 100644 index 0000000..781e81b --- /dev/null +++ b/models/components/updateallnotificationsstatusschema.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// UpdateAllNotificationsStatusSchemaStatus - The new status to apply to all notifications for the authenticated user +type UpdateAllNotificationsStatusSchemaStatus string + +const ( + UpdateAllNotificationsStatusSchemaStatusUnread UpdateAllNotificationsStatusSchemaStatus = "unread" + UpdateAllNotificationsStatusSchemaStatusRead UpdateAllNotificationsStatusSchemaStatus = "read" + UpdateAllNotificationsStatusSchemaStatusArchived UpdateAllNotificationsStatusSchemaStatus = "archived" +) + +func (e UpdateAllNotificationsStatusSchemaStatus) ToPointer() *UpdateAllNotificationsStatusSchemaStatus { + return &e +} +func (e *UpdateAllNotificationsStatusSchemaStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "unread": + fallthrough + case "read": + fallthrough + case "archived": + *e = UpdateAllNotificationsStatusSchemaStatus(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateAllNotificationsStatusSchemaStatus: %v", v) + } +} + +type UpdateAllNotificationsStatusSchema struct { + // The new status to apply to all notifications for the authenticated user + Status UpdateAllNotificationsStatusSchemaStatus `json:"status"` +} + +func (o *UpdateAllNotificationsStatusSchema) GetStatus() UpdateAllNotificationsStatusSchemaStatus { + if o == nil { + return UpdateAllNotificationsStatusSchemaStatus("") + } + return o.Status +} diff --git a/models/operations/checkdesktopupdate.go b/models/operations/checkdesktopupdate.go new file mode 100644 index 0000000..030d6c9 --- /dev/null +++ b/models/operations/checkdesktopupdate.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type Platforms struct { + Signature string `json:"signature"` + URL string `json:"url"` +} + +func (o *Platforms) GetSignature() string { + if o == nil { + return "" + } + return o.Signature +} + +func (o *Platforms) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +// CheckDesktopUpdateResponseBody - Update manifest in Tauri updater format +type CheckDesktopUpdateResponseBody struct { + Version string `json:"version"` + Notes *string `json:"notes,omitempty"` + PubDate *string `json:"pub_date,omitempty"` + Platforms map[string]Platforms `json:"platforms"` +} + +func (o *CheckDesktopUpdateResponseBody) GetVersion() string { + if o == nil { + return "" + } + return o.Version +} + +func (o *CheckDesktopUpdateResponseBody) GetNotes() *string { + if o == nil { + return nil + } + return o.Notes +} + +func (o *CheckDesktopUpdateResponseBody) GetPubDate() *string { + if o == nil { + return nil + } + return o.PubDate +} + +func (o *CheckDesktopUpdateResponseBody) GetPlatforms() map[string]Platforms { + if o == nil { + return map[string]Platforms{} + } + return o.Platforms +} + +type CheckDesktopUpdateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Update manifest in Tauri updater format + Object *CheckDesktopUpdateResponseBody +} + +func (o *CheckDesktopUpdateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CheckDesktopUpdateResponse) GetObject() *CheckDesktopUpdateResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/createbankaccount.go b/models/operations/createbankaccount.go index afb1415..f403f4b 100644 --- a/models/operations/createbankaccount.go +++ b/models/operations/createbankaccount.go @@ -108,6 +108,8 @@ type CreateBankAccountResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Bank account created Object *CreateBankAccountResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateBankAccountResponse) GetHTTPMeta() components.HTTPMetadata { @@ -123,3 +125,10 @@ func (o *CreateBankAccountResponse) GetObject() *CreateBankAccountResponseBody { } return o.Object } + +func (o *CreateBankAccountResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createcustomer.go b/models/operations/createcustomer.go index fdcbb77..574ea97 100644 --- a/models/operations/createcustomer.go +++ b/models/operations/createcustomer.go @@ -34,7 +34,7 @@ type CreateCustomerRequest struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail,omitempty"` // Country name where the customer is located Country *string `json:"country,omitempty"` @@ -212,7 +212,7 @@ type CreateCustomerResponseBody struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail"` // Primary phone number of the customer Phone *string `json:"phone"` @@ -246,8 +246,60 @@ type CreateCustomerResponseBody struct { InvoiceCount float64 `json:"invoiceCount"` // Total number of projects associated with this customer ProjectCount float64 `json:"projectCount"` + // Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. + TotalRevenue *float64 `json:"totalRevenue,omitempty"` + // Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. + OutstandingAmount *float64 `json:"outstandingAmount,omitempty"` + // Date of the most recent invoice in ISO 8601 format. Only returned in list queries. + LastInvoiceDate *string `json:"lastInvoiceDate,omitempty"` + // Primary currency used in invoices for this customer. Only returned in list queries. + InvoiceCurrency *string `json:"invoiceCurrency,omitempty"` // Array of tags associated with the customer for categorization Tags []CreateCustomerTagResponse `json:"tags"` + // AI-generated description of what the company does + Description *string `json:"description"` + // Primary industry of the company + Industry *string `json:"industry"` + // Business model type + CompanyType *string `json:"companyType"` + // Estimated number of employees + EmployeeCount *string `json:"employeeCount"` + // Year the company was founded + FoundedYear *float64 `json:"foundedYear"` + // Estimated annual revenue range + EstimatedRevenue *string `json:"estimatedRevenue"` + // Current funding stage + FundingStage *string `json:"fundingStage"` + // Total funding raised + TotalFunding *string `json:"totalFunding"` + // Company headquarters location + HeadquartersLocation *string `json:"headquartersLocation"` + // IANA timezone of the company headquarters + Timezone *string `json:"timezone"` + // LinkedIn company page URL + LinkedinURL *string `json:"linkedinUrl"` + // Twitter/X profile URL + TwitterURL *string `json:"twitterUrl"` + // Instagram profile URL + InstagramURL *string `json:"instagramUrl"` + // Facebook page URL + FacebookURL *string `json:"facebookUrl"` + // URL to the company logo + LogoURL *string `json:"logoUrl"` + // Name of the CEO or founder + CeoName *string `json:"ceoName"` + // Name of the finance/AP contact for invoicing + FinanceContact *string `json:"financeContact"` + // Email of the finance/AP contact + FinanceContactEmail *string `json:"financeContactEmail"` + // Primary business language (ISO 639-1 code) + PrimaryLanguage *string `json:"primaryLanguage"` + // Month when the fiscal year ends + FiscalYearEnd *string `json:"fiscalYearEnd"` + // Status of the enrichment process + EnrichmentStatus *string `json:"enrichmentStatus"` + // When the customer was last enriched + EnrichedAt *string `json:"enrichedAt"` } func (o *CreateCustomerResponseBody) GetID() string { @@ -390,6 +442,34 @@ func (o *CreateCustomerResponseBody) GetProjectCount() float64 { return o.ProjectCount } +func (o *CreateCustomerResponseBody) GetTotalRevenue() *float64 { + if o == nil { + return nil + } + return o.TotalRevenue +} + +func (o *CreateCustomerResponseBody) GetOutstandingAmount() *float64 { + if o == nil { + return nil + } + return o.OutstandingAmount +} + +func (o *CreateCustomerResponseBody) GetLastInvoiceDate() *string { + if o == nil { + return nil + } + return o.LastInvoiceDate +} + +func (o *CreateCustomerResponseBody) GetInvoiceCurrency() *string { + if o == nil { + return nil + } + return o.InvoiceCurrency +} + func (o *CreateCustomerResponseBody) GetTags() []CreateCustomerTagResponse { if o == nil { return []CreateCustomerTagResponse{} @@ -397,10 +477,166 @@ func (o *CreateCustomerResponseBody) GetTags() []CreateCustomerTagResponse { return o.Tags } +func (o *CreateCustomerResponseBody) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *CreateCustomerResponseBody) GetIndustry() *string { + if o == nil { + return nil + } + return o.Industry +} + +func (o *CreateCustomerResponseBody) GetCompanyType() *string { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *CreateCustomerResponseBody) GetEmployeeCount() *string { + if o == nil { + return nil + } + return o.EmployeeCount +} + +func (o *CreateCustomerResponseBody) GetFoundedYear() *float64 { + if o == nil { + return nil + } + return o.FoundedYear +} + +func (o *CreateCustomerResponseBody) GetEstimatedRevenue() *string { + if o == nil { + return nil + } + return o.EstimatedRevenue +} + +func (o *CreateCustomerResponseBody) GetFundingStage() *string { + if o == nil { + return nil + } + return o.FundingStage +} + +func (o *CreateCustomerResponseBody) GetTotalFunding() *string { + if o == nil { + return nil + } + return o.TotalFunding +} + +func (o *CreateCustomerResponseBody) GetHeadquartersLocation() *string { + if o == nil { + return nil + } + return o.HeadquartersLocation +} + +func (o *CreateCustomerResponseBody) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *CreateCustomerResponseBody) GetLinkedinURL() *string { + if o == nil { + return nil + } + return o.LinkedinURL +} + +func (o *CreateCustomerResponseBody) GetTwitterURL() *string { + if o == nil { + return nil + } + return o.TwitterURL +} + +func (o *CreateCustomerResponseBody) GetInstagramURL() *string { + if o == nil { + return nil + } + return o.InstagramURL +} + +func (o *CreateCustomerResponseBody) GetFacebookURL() *string { + if o == nil { + return nil + } + return o.FacebookURL +} + +func (o *CreateCustomerResponseBody) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *CreateCustomerResponseBody) GetCeoName() *string { + if o == nil { + return nil + } + return o.CeoName +} + +func (o *CreateCustomerResponseBody) GetFinanceContact() *string { + if o == nil { + return nil + } + return o.FinanceContact +} + +func (o *CreateCustomerResponseBody) GetFinanceContactEmail() *string { + if o == nil { + return nil + } + return o.FinanceContactEmail +} + +func (o *CreateCustomerResponseBody) GetPrimaryLanguage() *string { + if o == nil { + return nil + } + return o.PrimaryLanguage +} + +func (o *CreateCustomerResponseBody) GetFiscalYearEnd() *string { + if o == nil { + return nil + } + return o.FiscalYearEnd +} + +func (o *CreateCustomerResponseBody) GetEnrichmentStatus() *string { + if o == nil { + return nil + } + return o.EnrichmentStatus +} + +func (o *CreateCustomerResponseBody) GetEnrichedAt() *string { + if o == nil { + return nil + } + return o.EnrichedAt +} + type CreateCustomerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Customer created Object *CreateCustomerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateCustomerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -416,3 +652,10 @@ func (o *CreateCustomerResponse) GetObject() *CreateCustomerResponseBody { } return o.Object } + +func (o *CreateCustomerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createinvoice.go b/models/operations/createinvoice.go new file mode 100644 index 0000000..ef23400 --- /dev/null +++ b/models/operations/createinvoice.go @@ -0,0 +1,862 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "time" +) + +type Size string + +const ( + SizeA4 Size = "a4" + SizeLetter Size = "letter" +) + +func (e Size) ToPointer() *Size { + return &e +} +func (e *Size) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "a4": + fallthrough + case "letter": + *e = Size(v) + return nil + default: + return fmt.Errorf("invalid value for Size: %v", v) + } +} + +type TemplateDeliveryType string + +const ( + TemplateDeliveryTypeCreate TemplateDeliveryType = "create" + TemplateDeliveryTypeCreateAndSend TemplateDeliveryType = "create_and_send" + TemplateDeliveryTypeScheduled TemplateDeliveryType = "scheduled" +) + +func (e TemplateDeliveryType) ToPointer() *TemplateDeliveryType { + return &e +} +func (e *TemplateDeliveryType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "create": + fallthrough + case "create_and_send": + fallthrough + case "scheduled": + *e = TemplateDeliveryType(v) + return nil + default: + return fmt.Errorf("invalid value for TemplateDeliveryType: %v", v) + } +} + +// TemplatePaymentDetails - Payment details in TipTap JSONContent format +type TemplatePaymentDetails struct { +} + +// TemplateFromDetails - Sender details in TipTap JSONContent format +type TemplateFromDetails struct { +} + +// TemplateNoteDetails - Default footer notes in TipTap JSONContent format for new invoices +type TemplateNoteDetails struct { +} + +// Template - Invoice template details +type Template struct { + CustomerLabel *string `json:"customerLabel,omitempty"` + Title *string `json:"title,omitempty"` + FromLabel *string `json:"fromLabel,omitempty"` + InvoiceNoLabel *string `json:"invoiceNoLabel,omitempty"` + IssueDateLabel *string `json:"issueDateLabel,omitempty"` + DueDateLabel *string `json:"dueDateLabel,omitempty"` + DescriptionLabel *string `json:"descriptionLabel,omitempty"` + PriceLabel *string `json:"priceLabel,omitempty"` + QuantityLabel *string `json:"quantityLabel,omitempty"` + TotalLabel *string `json:"totalLabel,omitempty"` + TotalSummaryLabel *string `json:"totalSummaryLabel,omitempty"` + VatLabel *string `json:"vatLabel,omitempty"` + SubtotalLabel *string `json:"subtotalLabel,omitempty"` + TaxLabel *string `json:"taxLabel,omitempty"` + DiscountLabel *string `json:"discountLabel,omitempty"` + Timezone *string `json:"timezone,omitempty"` + PaymentLabel *string `json:"paymentLabel,omitempty"` + NoteLabel *string `json:"noteLabel,omitempty"` + LogoURL *string `json:"logoUrl,omitempty"` + Currency *string `json:"currency,omitempty"` + DateFormat *string `json:"dateFormat,omitempty"` + IncludeVat *bool `json:"includeVat,omitempty"` + IncludeTax *bool `json:"includeTax,omitempty"` + IncludeDiscount *bool `json:"includeDiscount,omitempty"` + IncludeDecimals *bool `json:"includeDecimals,omitempty"` + IncludePdf *bool `json:"includePdf,omitempty"` + SendCopy *bool `json:"sendCopy,omitempty"` + IncludeUnits *bool `json:"includeUnits,omitempty"` + IncludeQr *bool `json:"includeQr,omitempty"` + IncludeLineItemTax *bool `json:"includeLineItemTax,omitempty"` + LineItemTaxLabel *string `json:"lineItemTaxLabel,omitempty"` + TaxRate *float64 `json:"taxRate,omitempty"` + VatRate *float64 `json:"vatRate,omitempty"` + Size *Size `json:"size,omitempty"` + DeliveryType *TemplateDeliveryType `json:"deliveryType,omitempty"` + Locale *string `json:"locale,omitempty"` + PaymentEnabled *bool `json:"paymentEnabled,omitempty"` + PaymentTermsDays *float64 `json:"paymentTermsDays,omitempty"` + EmailSubject *string `json:"emailSubject,omitempty"` + EmailHeading *string `json:"emailHeading,omitempty"` + EmailBody *string `json:"emailBody,omitempty"` + EmailButtonText *string `json:"emailButtonText,omitempty"` + // Payment details in TipTap JSONContent format + PaymentDetails *TemplatePaymentDetails `json:"paymentDetails,omitempty"` + // Sender details in TipTap JSONContent format + FromDetails *TemplateFromDetails `json:"fromDetails,omitempty"` + // Default footer notes in TipTap JSONContent format for new invoices + NoteDetails *TemplateNoteDetails `json:"noteDetails,omitempty"` +} + +func (o *Template) GetCustomerLabel() *string { + if o == nil { + return nil + } + return o.CustomerLabel +} + +func (o *Template) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *Template) GetFromLabel() *string { + if o == nil { + return nil + } + return o.FromLabel +} + +func (o *Template) GetInvoiceNoLabel() *string { + if o == nil { + return nil + } + return o.InvoiceNoLabel +} + +func (o *Template) GetIssueDateLabel() *string { + if o == nil { + return nil + } + return o.IssueDateLabel +} + +func (o *Template) GetDueDateLabel() *string { + if o == nil { + return nil + } + return o.DueDateLabel +} + +func (o *Template) GetDescriptionLabel() *string { + if o == nil { + return nil + } + return o.DescriptionLabel +} + +func (o *Template) GetPriceLabel() *string { + if o == nil { + return nil + } + return o.PriceLabel +} + +func (o *Template) GetQuantityLabel() *string { + if o == nil { + return nil + } + return o.QuantityLabel +} + +func (o *Template) GetTotalLabel() *string { + if o == nil { + return nil + } + return o.TotalLabel +} + +func (o *Template) GetTotalSummaryLabel() *string { + if o == nil { + return nil + } + return o.TotalSummaryLabel +} + +func (o *Template) GetVatLabel() *string { + if o == nil { + return nil + } + return o.VatLabel +} + +func (o *Template) GetSubtotalLabel() *string { + if o == nil { + return nil + } + return o.SubtotalLabel +} + +func (o *Template) GetTaxLabel() *string { + if o == nil { + return nil + } + return o.TaxLabel +} + +func (o *Template) GetDiscountLabel() *string { + if o == nil { + return nil + } + return o.DiscountLabel +} + +func (o *Template) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *Template) GetPaymentLabel() *string { + if o == nil { + return nil + } + return o.PaymentLabel +} + +func (o *Template) GetNoteLabel() *string { + if o == nil { + return nil + } + return o.NoteLabel +} + +func (o *Template) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *Template) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *Template) GetDateFormat() *string { + if o == nil { + return nil + } + return o.DateFormat +} + +func (o *Template) GetIncludeVat() *bool { + if o == nil { + return nil + } + return o.IncludeVat +} + +func (o *Template) GetIncludeTax() *bool { + if o == nil { + return nil + } + return o.IncludeTax +} + +func (o *Template) GetIncludeDiscount() *bool { + if o == nil { + return nil + } + return o.IncludeDiscount +} + +func (o *Template) GetIncludeDecimals() *bool { + if o == nil { + return nil + } + return o.IncludeDecimals +} + +func (o *Template) GetIncludePdf() *bool { + if o == nil { + return nil + } + return o.IncludePdf +} + +func (o *Template) GetSendCopy() *bool { + if o == nil { + return nil + } + return o.SendCopy +} + +func (o *Template) GetIncludeUnits() *bool { + if o == nil { + return nil + } + return o.IncludeUnits +} + +func (o *Template) GetIncludeQr() *bool { + if o == nil { + return nil + } + return o.IncludeQr +} + +func (o *Template) GetIncludeLineItemTax() *bool { + if o == nil { + return nil + } + return o.IncludeLineItemTax +} + +func (o *Template) GetLineItemTaxLabel() *string { + if o == nil { + return nil + } + return o.LineItemTaxLabel +} + +func (o *Template) GetTaxRate() *float64 { + if o == nil { + return nil + } + return o.TaxRate +} + +func (o *Template) GetVatRate() *float64 { + if o == nil { + return nil + } + return o.VatRate +} + +func (o *Template) GetSize() *Size { + if o == nil { + return nil + } + return o.Size +} + +func (o *Template) GetDeliveryType() *TemplateDeliveryType { + if o == nil { + return nil + } + return o.DeliveryType +} + +func (o *Template) GetLocale() *string { + if o == nil { + return nil + } + return o.Locale +} + +func (o *Template) GetPaymentEnabled() *bool { + if o == nil { + return nil + } + return o.PaymentEnabled +} + +func (o *Template) GetPaymentTermsDays() *float64 { + if o == nil { + return nil + } + return o.PaymentTermsDays +} + +func (o *Template) GetEmailSubject() *string { + if o == nil { + return nil + } + return o.EmailSubject +} + +func (o *Template) GetEmailHeading() *string { + if o == nil { + return nil + } + return o.EmailHeading +} + +func (o *Template) GetEmailBody() *string { + if o == nil { + return nil + } + return o.EmailBody +} + +func (o *Template) GetEmailButtonText() *string { + if o == nil { + return nil + } + return o.EmailButtonText +} + +func (o *Template) GetPaymentDetails() *TemplatePaymentDetails { + if o == nil { + return nil + } + return o.PaymentDetails +} + +func (o *Template) GetFromDetails() *TemplateFromDetails { + if o == nil { + return nil + } + return o.FromDetails +} + +func (o *Template) GetNoteDetails() *TemplateNoteDetails { + if o == nil { + return nil + } + return o.NoteDetails +} + +// FromDetails - Sender details in TipTap JSONContent format +type FromDetails struct { +} + +// PaymentDetails - Payment details in TipTap JSONContent format +type PaymentDetails struct { +} + +// NoteDetails - Additional notes for the invoice in TipTap JSONContent format +type NoteDetails struct { +} + +// TopBlock - Custom content block to display at the top of the invoice in TipTap JSONContent format +type TopBlock struct { +} + +// BottomBlock - Custom content block to display at the bottom of the invoice in TipTap JSONContent format +type BottomBlock struct { +} + +// Name - Line item description in TipTap JSONContent format +type Name struct { +} + +type LineItem struct { + Quantity *float64 `json:"quantity,omitempty"` + Unit *string `json:"unit,omitempty"` + Price *float64 `json:"price,omitempty"` + Vat *float64 `json:"vat,omitempty"` + Tax *float64 `json:"tax,omitempty"` + TaxRate *float64 `json:"taxRate,omitempty"` + // Line item description in TipTap JSONContent format + Name *Name `json:"name,omitempty"` + // Optional reference to a saved product + ProductID *string `json:"productId,omitempty"` +} + +func (o *LineItem) GetQuantity() *float64 { + if o == nil { + return nil + } + return o.Quantity +} + +func (o *LineItem) GetUnit() *string { + if o == nil { + return nil + } + return o.Unit +} + +func (o *LineItem) GetPrice() *float64 { + if o == nil { + return nil + } + return o.Price +} + +func (o *LineItem) GetVat() *float64 { + if o == nil { + return nil + } + return o.Vat +} + +func (o *LineItem) GetTax() *float64 { + if o == nil { + return nil + } + return o.Tax +} + +func (o *LineItem) GetTaxRate() *float64 { + if o == nil { + return nil + } + return o.TaxRate +} + +func (o *LineItem) GetName() *Name { + if o == nil { + return nil + } + return o.Name +} + +func (o *LineItem) GetProductID() *string { + if o == nil { + return nil + } + return o.ProductID +} + +// DeliveryType - How the invoice should be processed: 'create' - finalize immediately, 'create_and_send' - finalize and send to customer, 'scheduled' - schedule for automatic processing at specified date +type DeliveryType string + +const ( + DeliveryTypeCreate DeliveryType = "create" + DeliveryTypeCreateAndSend DeliveryType = "create_and_send" + DeliveryTypeScheduled DeliveryType = "scheduled" +) + +func (e DeliveryType) ToPointer() *DeliveryType { + return &e +} +func (e *DeliveryType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "create": + fallthrough + case "create_and_send": + fallthrough + case "scheduled": + *e = DeliveryType(v) + return nil + default: + return fmt.Errorf("invalid value for DeliveryType: %v", v) + } +} + +// CreateInvoiceRequest - Schema for creating an invoice. The deliveryType determines if it stays as a draft, gets finalized immediately, or gets scheduled for later processing. +type CreateInvoiceRequest struct { + // Invoice template details + Template Template `json:"template"` + // Sender details in TipTap JSONContent format + FromDetails *FromDetails `json:"fromDetails,omitempty"` + // Unique identifier for the customer (required) + CustomerID string `json:"customerId"` + // Payment details in TipTap JSONContent format + PaymentDetails *PaymentDetails `json:"paymentDetails,omitempty"` + // Additional notes for the invoice in TipTap JSONContent format + NoteDetails *NoteDetails `json:"noteDetails,omitempty"` + // Due date of the invoice in ISO 8601 format. Defaults to issue date + payment terms (30 days) if not provided. + DueDate *time.Time `json:"dueDate,omitempty"` + // Issue date of the invoice in ISO 8601 format. Defaults to current date if not provided. + IssueDate *time.Time `json:"issueDate,omitempty"` + // Invoice number as shown to the customer (auto-generated if not provided) + InvoiceNumber *string `json:"invoiceNumber,omitempty"` + // URL of the logo to display on the invoice + LogoURL *string `json:"logoUrl,omitempty"` + // VAT amount for the invoice + Vat *float64 `json:"vat,omitempty"` + // Tax amount for the invoice + Tax *float64 `json:"tax,omitempty"` + // Discount applied to the invoice + Discount *float64 `json:"discount,omitempty"` + // Custom content block to display at the top of the invoice in TipTap JSONContent format + TopBlock *TopBlock `json:"topBlock,omitempty"` + // Custom content block to display at the bottom of the invoice in TipTap JSONContent format + BottomBlock *BottomBlock `json:"bottomBlock,omitempty"` + // Total amount of the invoice + Amount *float64 `json:"amount,omitempty"` + // List of line items for the invoice + LineItems []LineItem `json:"lineItems,omitempty"` + // How the invoice should be processed: 'create' - finalize immediately, 'create_and_send' - finalize and send to customer, 'scheduled' - schedule for automatic processing at specified date + DeliveryType DeliveryType `json:"deliveryType"` + // Scheduled date of the invoice in ISO 8601 format with timezone offset (e.g., Z or +00:00). Required when deliveryType is 'scheduled'. Must be in the future. + ScheduledAt *time.Time `json:"scheduledAt,omitempty"` +} + +func (c CreateInvoiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateInvoiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateInvoiceRequest) GetTemplate() Template { + if o == nil { + return Template{} + } + return o.Template +} + +func (o *CreateInvoiceRequest) GetFromDetails() *FromDetails { + if o == nil { + return nil + } + return o.FromDetails +} + +func (o *CreateInvoiceRequest) GetCustomerID() string { + if o == nil { + return "" + } + return o.CustomerID +} + +func (o *CreateInvoiceRequest) GetPaymentDetails() *PaymentDetails { + if o == nil { + return nil + } + return o.PaymentDetails +} + +func (o *CreateInvoiceRequest) GetNoteDetails() *NoteDetails { + if o == nil { + return nil + } + return o.NoteDetails +} + +func (o *CreateInvoiceRequest) GetDueDate() *time.Time { + if o == nil { + return nil + } + return o.DueDate +} + +func (o *CreateInvoiceRequest) GetIssueDate() *time.Time { + if o == nil { + return nil + } + return o.IssueDate +} + +func (o *CreateInvoiceRequest) GetInvoiceNumber() *string { + if o == nil { + return nil + } + return o.InvoiceNumber +} + +func (o *CreateInvoiceRequest) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *CreateInvoiceRequest) GetVat() *float64 { + if o == nil { + return nil + } + return o.Vat +} + +func (o *CreateInvoiceRequest) GetTax() *float64 { + if o == nil { + return nil + } + return o.Tax +} + +func (o *CreateInvoiceRequest) GetDiscount() *float64 { + if o == nil { + return nil + } + return o.Discount +} + +func (o *CreateInvoiceRequest) GetTopBlock() *TopBlock { + if o == nil { + return nil + } + return o.TopBlock +} + +func (o *CreateInvoiceRequest) GetBottomBlock() *BottomBlock { + if o == nil { + return nil + } + return o.BottomBlock +} + +func (o *CreateInvoiceRequest) GetAmount() *float64 { + if o == nil { + return nil + } + return o.Amount +} + +func (o *CreateInvoiceRequest) GetLineItems() []LineItem { + if o == nil { + return nil + } + return o.LineItems +} + +func (o *CreateInvoiceRequest) GetDeliveryType() DeliveryType { + if o == nil { + return DeliveryType("") + } + return o.DeliveryType +} + +func (o *CreateInvoiceRequest) GetScheduledAt() *time.Time { + if o == nil { + return nil + } + return o.ScheduledAt +} + +// CreateInvoiceStatus - Current status of the invoice +type CreateInvoiceStatus string + +const ( + CreateInvoiceStatusDraft CreateInvoiceStatus = "draft" + CreateInvoiceStatusOverdue CreateInvoiceStatus = "overdue" + CreateInvoiceStatusPaid CreateInvoiceStatus = "paid" + CreateInvoiceStatusUnpaid CreateInvoiceStatus = "unpaid" + CreateInvoiceStatusCanceled CreateInvoiceStatus = "canceled" + CreateInvoiceStatusScheduled CreateInvoiceStatus = "scheduled" +) + +func (e CreateInvoiceStatus) ToPointer() *CreateInvoiceStatus { + return &e +} +func (e *CreateInvoiceStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "draft": + fallthrough + case "overdue": + fallthrough + case "paid": + fallthrough + case "unpaid": + fallthrough + case "canceled": + fallthrough + case "scheduled": + *e = CreateInvoiceStatus(v) + return nil + default: + return fmt.Errorf("invalid value for CreateInvoiceStatus: %v", v) + } +} + +// CreateInvoiceResponseBody - Response after creating a draft invoice +type CreateInvoiceResponseBody struct { + // Unique identifier for the draft invoice + ID string `json:"id"` + // Current status of the invoice + Status CreateInvoiceStatus `json:"status"` + // Timestamp when the invoice was created (ISO 8601) + CreatedAt string `json:"createdAt"` + // Timestamp when the invoice was last updated (ISO 8601) + UpdatedAt string `json:"updatedAt"` + // Direct URL to download the invoice PDF + PdfURL *string `json:"pdfUrl"` + // Direct URL to preview the invoice in browser + PreviewURL *string `json:"previewUrl"` +} + +func (o *CreateInvoiceResponseBody) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateInvoiceResponseBody) GetStatus() CreateInvoiceStatus { + if o == nil { + return CreateInvoiceStatus("") + } + return o.Status +} + +func (o *CreateInvoiceResponseBody) GetCreatedAt() string { + if o == nil { + return "" + } + return o.CreatedAt +} + +func (o *CreateInvoiceResponseBody) GetUpdatedAt() string { + if o == nil { + return "" + } + return o.UpdatedAt +} + +func (o *CreateInvoiceResponseBody) GetPdfURL() *string { + if o == nil { + return nil + } + return o.PdfURL +} + +func (o *CreateInvoiceResponseBody) GetPreviewURL() *string { + if o == nil { + return nil + } + return o.PreviewURL +} + +type CreateInvoiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Invoice created successfully. Status depends on deliveryType: 'scheduled' for scheduled invoices, 'unpaid' for create/create_and_send. + Object *CreateInvoiceResponseBody +} + +func (o *CreateInvoiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateInvoiceResponse) GetObject() *CreateInvoiceResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/createinvoicepaymentintent.go b/models/operations/createinvoicepaymentintent.go new file mode 100644 index 0000000..46a72b0 --- /dev/null +++ b/models/operations/createinvoicepaymentintent.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type CreateInvoicePaymentIntentRequest struct { + // Invoice token for authentication + Token string `json:"token"` +} + +func (o *CreateInvoicePaymentIntentRequest) GetToken() string { + if o == nil { + return "" + } + return o.Token +} + +// CreateInvoicePaymentIntentResponseBody - Payment intent created +type CreateInvoicePaymentIntentResponseBody struct { + ClientSecret string `json:"clientSecret"` + Amount float64 `json:"amount"` + Currency string `json:"currency"` + StripeAccountID string `json:"stripeAccountId"` +} + +func (o *CreateInvoicePaymentIntentResponseBody) GetClientSecret() string { + if o == nil { + return "" + } + return o.ClientSecret +} + +func (o *CreateInvoicePaymentIntentResponseBody) GetAmount() float64 { + if o == nil { + return 0.0 + } + return o.Amount +} + +func (o *CreateInvoicePaymentIntentResponseBody) GetCurrency() string { + if o == nil { + return "" + } + return o.Currency +} + +func (o *CreateInvoicePaymentIntentResponseBody) GetStripeAccountID() string { + if o == nil { + return "" + } + return o.StripeAccountID +} + +type CreateInvoicePaymentIntentResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Payment intent created + Object *CreateInvoicePaymentIntentResponseBody +} + +func (o *CreateInvoicePaymentIntentResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateInvoicePaymentIntentResponse) GetObject() *CreateInvoicePaymentIntentResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/createtag.go b/models/operations/createtag.go index 9dadf6b..c4e626f 100644 --- a/models/operations/createtag.go +++ b/models/operations/createtag.go @@ -9,7 +9,9 @@ import ( type CreateTagResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tag created - TagsResponse *components.TagsResponse + TagResponse *components.TagResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTagResponse) GetHTTPMeta() components.HTTPMetadata { @@ -19,9 +21,16 @@ func (o *CreateTagResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *CreateTagResponse) GetTagsResponse() *components.TagsResponse { +func (o *CreateTagResponse) GetTagResponse() *components.TagResponse { if o == nil { return nil } - return o.TagsResponse + return o.TagResponse +} + +func (o *CreateTagResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse } diff --git a/models/operations/createtrackerentriesbulk.go b/models/operations/createtrackerentriesbulk.go index fb66acf..2c9f6bf 100644 --- a/models/operations/createtrackerentriesbulk.go +++ b/models/operations/createtrackerentriesbulk.go @@ -15,8 +15,8 @@ type Entry struct { Stop time.Time `json:"stop"` // Array of dates for which to create tracker entries Dates []string `json:"dates"` - // Unique identifier of the user assigned to this tracker entry - AssignedID *string `json:"assignedId"` + // Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user + AssignedID *string `json:"assignedId,omitempty"` // Unique identifier of the project associated with this tracker entry ProjectID string `json:"projectId"` // Optional description or notes for the tracker entry @@ -381,6 +381,8 @@ type CreateTrackerEntriesBulkResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker entries created successfully. Object *CreateTrackerEntriesBulkResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTrackerEntriesBulkResponse) GetHTTPMeta() components.HTTPMetadata { @@ -396,3 +398,10 @@ func (o *CreateTrackerEntriesBulkResponse) GetObject() *CreateTrackerEntriesBulk } return o.Object } + +func (o *CreateTrackerEntriesBulkResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createtrackerentry.go b/models/operations/createtrackerentry.go index f2bb38e..a78e61e 100644 --- a/models/operations/createtrackerentry.go +++ b/models/operations/createtrackerentry.go @@ -15,8 +15,8 @@ type CreateTrackerEntryRequest struct { Stop time.Time `json:"stop"` // Array of dates for which to create tracker entries Dates []string `json:"dates"` - // Unique identifier of the user assigned to this tracker entry - AssignedID *string `json:"assignedId"` + // Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user + AssignedID *string `json:"assignedId,omitempty"` // Unique identifier of the project associated with this tracker entry ProjectID string `json:"projectId"` // Optional description or notes for the tracker entry @@ -369,6 +369,8 @@ type CreateTrackerEntryResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker entry created successfully. Object *CreateTrackerEntryResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTrackerEntryResponse) GetHTTPMeta() components.HTTPMetadata { @@ -384,3 +386,10 @@ func (o *CreateTrackerEntryResponse) GetObject() *CreateTrackerEntryResponseBody } return o.Object } + +func (o *CreateTrackerEntryResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createtrackerproject.go b/models/operations/createtrackerproject.go index 69465a9..064882e 100644 --- a/models/operations/createtrackerproject.go +++ b/models/operations/createtrackerproject.go @@ -157,6 +157,8 @@ type CreateTrackerProjectResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker project created successfully. TrackerProjectResponse *components.TrackerProjectResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTrackerProjectResponse) GetHTTPMeta() components.HTTPMetadata { @@ -172,3 +174,10 @@ func (o *CreateTrackerProjectResponse) GetTrackerProjectResponse() *components.T } return o.TrackerProjectResponse } + +func (o *CreateTrackerProjectResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createtransaction.go b/models/operations/createtransaction.go index b9981a0..a074ae3 100644 --- a/models/operations/createtransaction.go +++ b/models/operations/createtransaction.go @@ -6,45 +6,6 @@ import ( "github.com/midday-ai/midday-go/models/components" ) -type CreateTransactionAttachment struct { - // Path(s) of the attachment file(s). - Path []string `json:"path"` - // Name of the attachment file. - Name string `json:"name"` - // Size of the attachment file in bytes. - Size float64 `json:"size"` - // MIME type of the attachment file. - Type string `json:"type"` -} - -func (o *CreateTransactionAttachment) GetPath() []string { - if o == nil { - return []string{} - } - return o.Path -} - -func (o *CreateTransactionAttachment) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *CreateTransactionAttachment) GetSize() float64 { - if o == nil { - return 0.0 - } - return o.Size -} - -func (o *CreateTransactionAttachment) GetType() string { - if o == nil { - return "" - } - return o.Type -} - type CreateTransactionRequest struct { // Name of the transaction. Name string `json:"name"` @@ -65,7 +26,7 @@ type CreateTransactionRequest struct { // Whether the transaction is internal. Internal *bool `json:"internal,omitempty"` // Array of attachments for the transaction. - Attachments []CreateTransactionAttachment `json:"attachments,omitempty"` + Attachments []components.CreateTransactionAttachment `json:"attachments,omitempty"` } func (o *CreateTransactionRequest) GetName() string { @@ -131,7 +92,7 @@ func (o *CreateTransactionRequest) GetInternal() *bool { return o.Internal } -func (o *CreateTransactionRequest) GetAttachments() []CreateTransactionAttachment { +func (o *CreateTransactionRequest) GetAttachments() []components.CreateTransactionAttachment { if o == nil { return nil } @@ -142,6 +103,8 @@ type CreateTransactionResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transaction created TransactionResponse *components.TransactionResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTransactionResponse) GetHTTPMeta() components.HTTPMetadata { @@ -157,3 +120,10 @@ func (o *CreateTransactionResponse) GetTransactionResponse() *components.Transac } return o.TransactionResponse } + +func (o *CreateTransactionResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/createtransactions.go b/models/operations/createtransactions.go index a882fa4..77a819a 100644 --- a/models/operations/createtransactions.go +++ b/models/operations/createtransactions.go @@ -6,45 +6,6 @@ import ( "github.com/midday-ai/midday-go/models/components" ) -type CreateTransactionsAttachment struct { - // Path(s) of the attachment file(s). - Path []string `json:"path"` - // Name of the attachment file. - Name string `json:"name"` - // Size of the attachment file in bytes. - Size float64 `json:"size"` - // MIME type of the attachment file. - Type string `json:"type"` -} - -func (o *CreateTransactionsAttachment) GetPath() []string { - if o == nil { - return []string{} - } - return o.Path -} - -func (o *CreateTransactionsAttachment) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *CreateTransactionsAttachment) GetSize() float64 { - if o == nil { - return 0.0 - } - return o.Size -} - -func (o *CreateTransactionsAttachment) GetType() string { - if o == nil { - return "" - } - return o.Type -} - type RequestBody struct { // Name of the transaction. Name string `json:"name"` @@ -65,7 +26,7 @@ type RequestBody struct { // Whether the transaction is internal. Internal *bool `json:"internal,omitempty"` // Array of attachments for the transaction. - Attachments []CreateTransactionsAttachment `json:"attachments,omitempty"` + Attachments []components.CreateTransactionAttachment `json:"attachments,omitempty"` } func (o *RequestBody) GetName() string { @@ -131,7 +92,7 @@ func (o *RequestBody) GetInternal() *bool { return o.Internal } -func (o *RequestBody) GetAttachments() []CreateTransactionsAttachment { +func (o *RequestBody) GetAttachments() []components.CreateTransactionAttachment { if o == nil { return nil } @@ -142,6 +103,8 @@ type CreateTransactionsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transactions created TransactionResponses []components.TransactionResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *CreateTransactionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -157,3 +120,10 @@ func (o *CreateTransactionsResponse) GetTransactionResponses() []components.Tran } return o.TransactionResponses } + +func (o *CreateTransactionsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletebankaccount.go b/models/operations/deletebankaccount.go index e5e6eac..29fe91e 100644 --- a/models/operations/deletebankaccount.go +++ b/models/operations/deletebankaccount.go @@ -7,6 +7,7 @@ import ( ) type DeleteBankAccountRequest struct { + // The unique identifier of the bank account. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -88,6 +89,8 @@ type DeleteBankAccountResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Bank account deleted Object *DeleteBankAccountResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteBankAccountResponse) GetHTTPMeta() components.HTTPMetadata { @@ -103,3 +106,10 @@ func (o *DeleteBankAccountResponse) GetObject() *DeleteBankAccountResponseBody { } return o.Object } + +func (o *DeleteBankAccountResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletecustomer.go b/models/operations/deletecustomer.go index bdcb7d3..1cda7c5 100644 --- a/models/operations/deletecustomer.go +++ b/models/operations/deletecustomer.go @@ -7,6 +7,7 @@ import ( ) type DeleteCustomerRequest struct { + // Unique identifier of the customer to retrieve ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -46,7 +47,7 @@ type DeleteCustomerResponseBody struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail"` // Primary phone number of the customer Phone *string `json:"phone"` @@ -80,8 +81,60 @@ type DeleteCustomerResponseBody struct { InvoiceCount float64 `json:"invoiceCount"` // Total number of projects associated with this customer ProjectCount float64 `json:"projectCount"` + // Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. + TotalRevenue *float64 `json:"totalRevenue,omitempty"` + // Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. + OutstandingAmount *float64 `json:"outstandingAmount,omitempty"` + // Date of the most recent invoice in ISO 8601 format. Only returned in list queries. + LastInvoiceDate *string `json:"lastInvoiceDate,omitempty"` + // Primary currency used in invoices for this customer. Only returned in list queries. + InvoiceCurrency *string `json:"invoiceCurrency,omitempty"` // Array of tags associated with the customer for categorization Tags []DeleteCustomerTag `json:"tags"` + // AI-generated description of what the company does + Description *string `json:"description"` + // Primary industry of the company + Industry *string `json:"industry"` + // Business model type + CompanyType *string `json:"companyType"` + // Estimated number of employees + EmployeeCount *string `json:"employeeCount"` + // Year the company was founded + FoundedYear *float64 `json:"foundedYear"` + // Estimated annual revenue range + EstimatedRevenue *string `json:"estimatedRevenue"` + // Current funding stage + FundingStage *string `json:"fundingStage"` + // Total funding raised + TotalFunding *string `json:"totalFunding"` + // Company headquarters location + HeadquartersLocation *string `json:"headquartersLocation"` + // IANA timezone of the company headquarters + Timezone *string `json:"timezone"` + // LinkedIn company page URL + LinkedinURL *string `json:"linkedinUrl"` + // Twitter/X profile URL + TwitterURL *string `json:"twitterUrl"` + // Instagram profile URL + InstagramURL *string `json:"instagramUrl"` + // Facebook page URL + FacebookURL *string `json:"facebookUrl"` + // URL to the company logo + LogoURL *string `json:"logoUrl"` + // Name of the CEO or founder + CeoName *string `json:"ceoName"` + // Name of the finance/AP contact for invoicing + FinanceContact *string `json:"financeContact"` + // Email of the finance/AP contact + FinanceContactEmail *string `json:"financeContactEmail"` + // Primary business language (ISO 639-1 code) + PrimaryLanguage *string `json:"primaryLanguage"` + // Month when the fiscal year ends + FiscalYearEnd *string `json:"fiscalYearEnd"` + // Status of the enrichment process + EnrichmentStatus *string `json:"enrichmentStatus"` + // When the customer was last enriched + EnrichedAt *string `json:"enrichedAt"` } func (o *DeleteCustomerResponseBody) GetID() string { @@ -224,6 +277,34 @@ func (o *DeleteCustomerResponseBody) GetProjectCount() float64 { return o.ProjectCount } +func (o *DeleteCustomerResponseBody) GetTotalRevenue() *float64 { + if o == nil { + return nil + } + return o.TotalRevenue +} + +func (o *DeleteCustomerResponseBody) GetOutstandingAmount() *float64 { + if o == nil { + return nil + } + return o.OutstandingAmount +} + +func (o *DeleteCustomerResponseBody) GetLastInvoiceDate() *string { + if o == nil { + return nil + } + return o.LastInvoiceDate +} + +func (o *DeleteCustomerResponseBody) GetInvoiceCurrency() *string { + if o == nil { + return nil + } + return o.InvoiceCurrency +} + func (o *DeleteCustomerResponseBody) GetTags() []DeleteCustomerTag { if o == nil { return []DeleteCustomerTag{} @@ -231,10 +312,166 @@ func (o *DeleteCustomerResponseBody) GetTags() []DeleteCustomerTag { return o.Tags } +func (o *DeleteCustomerResponseBody) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *DeleteCustomerResponseBody) GetIndustry() *string { + if o == nil { + return nil + } + return o.Industry +} + +func (o *DeleteCustomerResponseBody) GetCompanyType() *string { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *DeleteCustomerResponseBody) GetEmployeeCount() *string { + if o == nil { + return nil + } + return o.EmployeeCount +} + +func (o *DeleteCustomerResponseBody) GetFoundedYear() *float64 { + if o == nil { + return nil + } + return o.FoundedYear +} + +func (o *DeleteCustomerResponseBody) GetEstimatedRevenue() *string { + if o == nil { + return nil + } + return o.EstimatedRevenue +} + +func (o *DeleteCustomerResponseBody) GetFundingStage() *string { + if o == nil { + return nil + } + return o.FundingStage +} + +func (o *DeleteCustomerResponseBody) GetTotalFunding() *string { + if o == nil { + return nil + } + return o.TotalFunding +} + +func (o *DeleteCustomerResponseBody) GetHeadquartersLocation() *string { + if o == nil { + return nil + } + return o.HeadquartersLocation +} + +func (o *DeleteCustomerResponseBody) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *DeleteCustomerResponseBody) GetLinkedinURL() *string { + if o == nil { + return nil + } + return o.LinkedinURL +} + +func (o *DeleteCustomerResponseBody) GetTwitterURL() *string { + if o == nil { + return nil + } + return o.TwitterURL +} + +func (o *DeleteCustomerResponseBody) GetInstagramURL() *string { + if o == nil { + return nil + } + return o.InstagramURL +} + +func (o *DeleteCustomerResponseBody) GetFacebookURL() *string { + if o == nil { + return nil + } + return o.FacebookURL +} + +func (o *DeleteCustomerResponseBody) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *DeleteCustomerResponseBody) GetCeoName() *string { + if o == nil { + return nil + } + return o.CeoName +} + +func (o *DeleteCustomerResponseBody) GetFinanceContact() *string { + if o == nil { + return nil + } + return o.FinanceContact +} + +func (o *DeleteCustomerResponseBody) GetFinanceContactEmail() *string { + if o == nil { + return nil + } + return o.FinanceContactEmail +} + +func (o *DeleteCustomerResponseBody) GetPrimaryLanguage() *string { + if o == nil { + return nil + } + return o.PrimaryLanguage +} + +func (o *DeleteCustomerResponseBody) GetFiscalYearEnd() *string { + if o == nil { + return nil + } + return o.FiscalYearEnd +} + +func (o *DeleteCustomerResponseBody) GetEnrichmentStatus() *string { + if o == nil { + return nil + } + return o.EnrichmentStatus +} + +func (o *DeleteCustomerResponseBody) GetEnrichedAt() *string { + if o == nil { + return nil + } + return o.EnrichedAt +} + type DeleteCustomerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Customer deleted Object *DeleteCustomerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteCustomerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -250,3 +487,10 @@ func (o *DeleteCustomerResponse) GetObject() *DeleteCustomerResponseBody { } return o.Object } + +func (o *DeleteCustomerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletedocument.go b/models/operations/deletedocument.go index b780d7c..9f38df6 100644 --- a/models/operations/deletedocument.go +++ b/models/operations/deletedocument.go @@ -33,6 +33,8 @@ type DeleteDocumentResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Document deleted successfully Object *DeleteDocumentResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteDocumentResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,3 +50,10 @@ func (o *DeleteDocumentResponse) GetObject() *DeleteDocumentResponseBody { } return o.Object } + +func (o *DeleteDocumentResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deleteinboxitem.go b/models/operations/deleteinboxitem.go index 0794d28..08c6d27 100644 --- a/models/operations/deleteinboxitem.go +++ b/models/operations/deleteinboxitem.go @@ -7,6 +7,7 @@ import ( ) type DeleteInboxItemRequest struct { + // The unique identifier of the inbox item to delete. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -34,6 +35,8 @@ type DeleteInboxItemResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Delete a inbox item by its ID. Object *DeleteInboxItemResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteInboxItemResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,3 +52,10 @@ func (o *DeleteInboxItemResponse) GetObject() *DeleteInboxItemResponseBody { } return o.Object } + +func (o *DeleteInboxItemResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deleteinvoice.go b/models/operations/deleteinvoice.go index ebdd1aa..ead5bca 100644 --- a/models/operations/deleteinvoice.go +++ b/models/operations/deleteinvoice.go @@ -34,6 +34,8 @@ type DeleteInvoiceResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Delete a invoice by its unique identifier for the authenticated team. Object *DeleteInvoiceResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteInvoiceResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,3 +51,10 @@ func (o *DeleteInvoiceResponse) GetObject() *DeleteInvoiceResponseBody { } return o.Object } + +func (o *DeleteInvoiceResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletetag.go b/models/operations/deletetag.go index 5778e4a..7bf5545 100644 --- a/models/operations/deletetag.go +++ b/models/operations/deletetag.go @@ -7,6 +7,7 @@ import ( ) type DeleteTagRequest struct { + // The UUID of the tag to delete. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -19,6 +20,8 @@ func (o *DeleteTagRequest) GetID() string { type DeleteTagResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteTagResponse) GetHTTPMeta() components.HTTPMetadata { @@ -27,3 +30,10 @@ func (o *DeleteTagResponse) GetHTTPMeta() components.HTTPMetadata { } return o.HTTPMeta } + +func (o *DeleteTagResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletetrackerentry.go b/models/operations/deletetrackerentry.go index dabb118..6a0d979 100644 --- a/models/operations/deletetrackerentry.go +++ b/models/operations/deletetrackerentry.go @@ -7,6 +7,7 @@ import ( ) type DeleteTrackerEntryRequest struct { + // Unique identifier of the tracker entry to delete ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -34,6 +35,8 @@ type DeleteTrackerEntryResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker entry deleted successfully. Object *DeleteTrackerEntryResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteTrackerEntryResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,3 +52,10 @@ func (o *DeleteTrackerEntryResponse) GetObject() *DeleteTrackerEntryResponseBody } return o.Object } + +func (o *DeleteTrackerEntryResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletetrackerproject.go b/models/operations/deletetrackerproject.go index 1f21f1a..21874ae 100644 --- a/models/operations/deletetrackerproject.go +++ b/models/operations/deletetrackerproject.go @@ -7,6 +7,7 @@ import ( ) type DeleteTrackerProjectRequest struct { + // Unique identifier of the project to retrieve ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -34,6 +35,8 @@ type DeleteTrackerProjectResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker project deleted successfully. Object *DeleteTrackerProjectResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteTrackerProjectResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,3 +52,10 @@ func (o *DeleteTrackerProjectResponse) GetObject() *DeleteTrackerProjectResponse } return o.Object } + +func (o *DeleteTrackerProjectResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletetransaction.go b/models/operations/deletetransaction.go index d44145b..985216d 100644 --- a/models/operations/deletetransaction.go +++ b/models/operations/deletetransaction.go @@ -7,6 +7,7 @@ import ( ) type DeleteTransactionRequest struct { + // Transaction ID (UUID). ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -34,6 +35,8 @@ type DeleteTransactionResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transaction deleted Object *DeleteTransactionResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteTransactionResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,3 +52,10 @@ func (o *DeleteTransactionResponse) GetObject() *DeleteTransactionResponseBody { } return o.Object } + +func (o *DeleteTransactionResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/deletetransactions.go b/models/operations/deletetransactions.go index 1c45346..597d909 100644 --- a/models/operations/deletetransactions.go +++ b/models/operations/deletetransactions.go @@ -22,6 +22,8 @@ type DeleteTransactionsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transactions deleted ResponseBodies []DeleteTransactionsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *DeleteTransactionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -37,3 +39,10 @@ func (o *DeleteTransactionsResponse) GetResponseBodies() []DeleteTransactionsRes } return o.ResponseBodies } + +func (o *DeleteTransactionsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/disconnectstripe.go b/models/operations/disconnectstripe.go new file mode 100644 index 0000000..8907889 --- /dev/null +++ b/models/operations/disconnectstripe.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// DisconnectStripeResponseBody - Successfully disconnected +type DisconnectStripeResponseBody struct { + Success bool `json:"success"` +} + +func (o *DisconnectStripeResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type DisconnectStripeResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully disconnected + Object *DisconnectStripeResponseBody +} + +func (o *DisconnectStripeResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *DisconnectStripeResponse) GetObject() *DisconnectStripeResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/downloaddesktopupdate.go b/models/operations/downloaddesktopupdate.go new file mode 100644 index 0000000..333497b --- /dev/null +++ b/models/operations/downloaddesktopupdate.go @@ -0,0 +1,41 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" + "io" +) + +type DownloadDesktopUpdateRequest struct { + // The artifact download URL to proxy + URL string `queryParam:"style=form,explode=true,name=url"` +} + +func (o *DownloadDesktopUpdateRequest) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type DownloadDesktopUpdateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Update artifact binary + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser +} + +func (o *DownloadDesktopUpdateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *DownloadDesktopUpdateResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} diff --git a/models/operations/downloadfile.go b/models/operations/downloadfile.go new file mode 100644 index 0000000..ac3e3f2 --- /dev/null +++ b/models/operations/downloadfile.go @@ -0,0 +1,59 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" + "io" +) + +type DownloadFileRequest struct { + // Path to the file in storage. Can include or exclude 'vault/' prefix. + Path string `queryParam:"style=form,explode=true,name=path"` + // Optional filename for the Content-Disposition header. + Filename *string `queryParam:"style=form,explode=true,name=filename"` + // Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. + Fk string `queryParam:"style=form,explode=true,name=fk"` +} + +func (o *DownloadFileRequest) GetPath() string { + if o == nil { + return "" + } + return o.Path +} + +func (o *DownloadFileRequest) GetFilename() *string { + if o == nil { + return nil + } + return o.Filename +} + +func (o *DownloadFileRequest) GetFk() string { + if o == nil { + return "" + } + return o.Fk +} + +type DownloadFileResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // File content + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser +} + +func (o *DownloadFileResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *DownloadFileResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} diff --git a/models/operations/downloadinvoice.go b/models/operations/downloadinvoice.go new file mode 100644 index 0000000..80cf8e1 --- /dev/null +++ b/models/operations/downloadinvoice.go @@ -0,0 +1,118 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "io" +) + +// DownloadInvoiceType - Type of document to download. Use 'receipt' to download a receipt for paid invoices. +type DownloadInvoiceType string + +const ( + DownloadInvoiceTypeInvoice DownloadInvoiceType = "invoice" + DownloadInvoiceTypeReceipt DownloadInvoiceType = "receipt" +) + +func (e DownloadInvoiceType) ToPointer() *DownloadInvoiceType { + return &e +} +func (e *DownloadInvoiceType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "invoice": + fallthrough + case "receipt": + *e = DownloadInvoiceType(v) + return nil + default: + return fmt.Errorf("invalid value for DownloadInvoiceType: %v", v) + } +} + +type DownloadInvoiceRequest struct { + // Invoice ID (UUID). Requires team file key (fk) query parameter for authentication. + ID *string `queryParam:"style=form,explode=true,name=id"` + // Team file key for authenticated invoice access. Required when using invoice ID. This key is returned in the user data response (GET /users/me) as the `fileKey` field. + Fk *string `queryParam:"style=form,explode=true,name=fk"` + // Invoice access token for public access. When used alone (without id), allows public access to the invoice. + Token *string `queryParam:"style=form,explode=true,name=token"` + // If true, the PDF will be displayed inline. If false, it will be downloaded. + Preview *bool `default:"false" queryParam:"style=form,explode=true,name=preview"` + // Type of document to download. Use 'receipt' to download a receipt for paid invoices. + Type *DownloadInvoiceType `default:"invoice" queryParam:"style=form,explode=true,name=type"` +} + +func (d DownloadInvoiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DownloadInvoiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DownloadInvoiceRequest) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *DownloadInvoiceRequest) GetFk() *string { + if o == nil { + return nil + } + return o.Fk +} + +func (o *DownloadInvoiceRequest) GetToken() *string { + if o == nil { + return nil + } + return o.Token +} + +func (o *DownloadInvoiceRequest) GetPreview() *bool { + if o == nil { + return nil + } + return o.Preview +} + +func (o *DownloadInvoiceRequest) GetType() *DownloadInvoiceType { + if o == nil { + return nil + } + return o.Type +} + +type DownloadInvoiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Invoice PDF + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser +} + +func (o *DownloadInvoiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *DownloadInvoiceResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} diff --git a/models/operations/fortnoxoauthcallback.go b/models/operations/fortnoxoauthcallback.go new file mode 100644 index 0000000..b7b225d --- /dev/null +++ b/models/operations/fortnoxoauthcallback.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type FortnoxOAuthCallbackRequest struct { + // OAuth authorization code from Fortnox + Code *string `queryParam:"style=form,explode=true,name=code"` + // OAuth state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` +} + +func (o *FortnoxOAuthCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *FortnoxOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *FortnoxOAuthCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +type FortnoxOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *FortnoxOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *FortnoxOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/getbankaccountbyid.go b/models/operations/getbankaccountbyid.go index b53feb1..9030148 100644 --- a/models/operations/getbankaccountbyid.go +++ b/models/operations/getbankaccountbyid.go @@ -7,6 +7,7 @@ import ( ) type GetBankAccountByIDRequest struct { + // The unique identifier of the bank account. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -88,6 +89,8 @@ type GetBankAccountByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Bank account details Object *GetBankAccountByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetBankAccountByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -103,3 +106,10 @@ func (o *GetBankAccountByIDResponse) GetObject() *GetBankAccountByIDResponseBody } return o.Object } + +func (o *GetBankAccountByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getburnratemetrics.go b/models/operations/getburnratemetrics.go deleted file mode 100644 index 29287e2..0000000 --- a/models/operations/getburnratemetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetBurnRateMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetBurnRateMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetBurnRateMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetBurnRateMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetBurnRateMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Burn rate metrics for the authenticated team. - GetBurnRateResponseSchemas []components.GetBurnRateResponseSchema -} - -func (o *GetBurnRateMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetBurnRateMetricsResponse) GetGetBurnRateResponseSchemas() []components.GetBurnRateResponseSchema { - if o == nil { - return nil - } - return o.GetBurnRateResponseSchemas -} diff --git a/models/operations/getburnratereports.go b/models/operations/getburnratereports.go new file mode 100644 index 0000000..312f742 --- /dev/null +++ b/models/operations/getburnratereports.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type GetBurnRateReportsRequest struct { + // Start date (ISO 8601 format) + From string `queryParam:"style=form,explode=true,name=from"` + // End date (ISO 8601 format) + To string `queryParam:"style=form,explode=true,name=to"` + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` +} + +func (o *GetBurnRateReportsRequest) GetFrom() string { + if o == nil { + return "" + } + return o.From +} + +func (o *GetBurnRateReportsRequest) GetTo() string { + if o == nil { + return "" + } + return o.To +} + +func (o *GetBurnRateReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +type GetBurnRateReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Burn rate reports for the authenticated team. + GetBurnRateResponseSchema []components.BurnRateItem + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetBurnRateReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetBurnRateReportsResponse) GetGetBurnRateResponseSchema() []components.BurnRateItem { + if o == nil { + return nil + } + return o.GetBurnRateResponseSchema +} + +func (o *GetBurnRateReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getcurrenttimer.go b/models/operations/getcurrenttimer.go index 33410a1..f9a57d0 100644 --- a/models/operations/getcurrenttimer.go +++ b/models/operations/getcurrenttimer.go @@ -7,6 +7,7 @@ import ( ) type GetCurrentTimerRequest struct { + // Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user AssignedID *string `queryParam:"style=form,explode=true,name=assignedId"` } @@ -173,8 +174,8 @@ type GetCurrentTimerData struct { Duration *float64 `json:"duration"` // Start time of the tracker entry in ISO 8601 format Start string `json:"start"` - // Stop time of the tracker entry in ISO 8601 format - Stop string `json:"stop"` + // Stop time of the tracker entry in ISO 8601 format. Null for running timers. + Stop *string `json:"stop"` // Unique identifier of the team that owns this tracker entry TeamID string `json:"teamId"` // Description or notes for the tracker entry @@ -221,9 +222,9 @@ func (o *GetCurrentTimerData) GetStart() string { return o.Start } -func (o *GetCurrentTimerData) GetStop() string { +func (o *GetCurrentTimerData) GetStop() *string { if o == nil { - return "" + return nil } return o.Stop } @@ -300,6 +301,8 @@ type GetCurrentTimerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Current timer retrieved successfully. Object *GetCurrentTimerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetCurrentTimerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -315,3 +318,10 @@ func (o *GetCurrentTimerResponse) GetObject() *GetCurrentTimerResponseBody { } return o.Object } + +func (o *GetCurrentTimerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getcurrentuser.go b/models/operations/getcurrentuser.go index 2cd892d..5bc0953 100644 --- a/models/operations/getcurrentuser.go +++ b/models/operations/getcurrentuser.go @@ -48,7 +48,7 @@ type GetCurrentUserTeam struct { // Name of the team or organization Name string `json:"name"` // URL to the team's logo image - LogoURL string `json:"logoUrl"` + LogoURL *string `json:"logoUrl"` // Current subscription plan of the team Plan string `json:"plan"` } @@ -67,9 +67,9 @@ func (o *GetCurrentUserTeam) GetName() string { return o.Name } -func (o *GetCurrentUserTeam) GetLogoURL() string { +func (o *GetCurrentUserTeam) GetLogoURL() *string { if o == nil { - return "" + return nil } return o.LogoURL } @@ -103,6 +103,8 @@ type GetCurrentUserResponseBody struct { TimeFormat *float64 `json:"timeFormat"` // User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' DateFormat *GetCurrentUserDateFormat `json:"dateFormat"` + // Team file key (JWT token) for proxy/download access to team files. This compact JWT token contains the team ID and is shared by all team members. Use this token as the `fk` query parameter when accessing file endpoints (proxy, download). The token is team-scoped and provides access to files belonging to the user's team. Returns null if the user has no team. + FileKey *string `json:"fileKey"` // Team information that the user belongs to Team *GetCurrentUserTeam `json:"team"` } @@ -177,6 +179,13 @@ func (o *GetCurrentUserResponseBody) GetDateFormat() *GetCurrentUserDateFormat { return o.DateFormat } +func (o *GetCurrentUserResponseBody) GetFileKey() *string { + if o == nil { + return nil + } + return o.FileKey +} + func (o *GetCurrentUserResponseBody) GetTeam() *GetCurrentUserTeam { if o == nil { return nil @@ -188,6 +197,8 @@ type GetCurrentUserResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve the current user for the authenticated team. Object *GetCurrentUserResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetCurrentUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -203,3 +214,10 @@ func (o *GetCurrentUserResponse) GetObject() *GetCurrentUserResponseBody { } return o.Object } + +func (o *GetCurrentUserResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getcustomerbyid.go b/models/operations/getcustomerbyid.go index 416d9c8..90dce53 100644 --- a/models/operations/getcustomerbyid.go +++ b/models/operations/getcustomerbyid.go @@ -7,6 +7,7 @@ import ( ) type GetCustomerByIDRequest struct { + // Unique identifier of the customer to retrieve ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -46,7 +47,7 @@ type GetCustomerByIDResponseBody struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail"` // Primary phone number of the customer Phone *string `json:"phone"` @@ -80,8 +81,60 @@ type GetCustomerByIDResponseBody struct { InvoiceCount float64 `json:"invoiceCount"` // Total number of projects associated with this customer ProjectCount float64 `json:"projectCount"` + // Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. + TotalRevenue *float64 `json:"totalRevenue,omitempty"` + // Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. + OutstandingAmount *float64 `json:"outstandingAmount,omitempty"` + // Date of the most recent invoice in ISO 8601 format. Only returned in list queries. + LastInvoiceDate *string `json:"lastInvoiceDate,omitempty"` + // Primary currency used in invoices for this customer. Only returned in list queries. + InvoiceCurrency *string `json:"invoiceCurrency,omitempty"` // Array of tags associated with the customer for categorization Tags []GetCustomerByIDTag `json:"tags"` + // AI-generated description of what the company does + Description *string `json:"description"` + // Primary industry of the company + Industry *string `json:"industry"` + // Business model type + CompanyType *string `json:"companyType"` + // Estimated number of employees + EmployeeCount *string `json:"employeeCount"` + // Year the company was founded + FoundedYear *float64 `json:"foundedYear"` + // Estimated annual revenue range + EstimatedRevenue *string `json:"estimatedRevenue"` + // Current funding stage + FundingStage *string `json:"fundingStage"` + // Total funding raised + TotalFunding *string `json:"totalFunding"` + // Company headquarters location + HeadquartersLocation *string `json:"headquartersLocation"` + // IANA timezone of the company headquarters + Timezone *string `json:"timezone"` + // LinkedIn company page URL + LinkedinURL *string `json:"linkedinUrl"` + // Twitter/X profile URL + TwitterURL *string `json:"twitterUrl"` + // Instagram profile URL + InstagramURL *string `json:"instagramUrl"` + // Facebook page URL + FacebookURL *string `json:"facebookUrl"` + // URL to the company logo + LogoURL *string `json:"logoUrl"` + // Name of the CEO or founder + CeoName *string `json:"ceoName"` + // Name of the finance/AP contact for invoicing + FinanceContact *string `json:"financeContact"` + // Email of the finance/AP contact + FinanceContactEmail *string `json:"financeContactEmail"` + // Primary business language (ISO 639-1 code) + PrimaryLanguage *string `json:"primaryLanguage"` + // Month when the fiscal year ends + FiscalYearEnd *string `json:"fiscalYearEnd"` + // Status of the enrichment process + EnrichmentStatus *string `json:"enrichmentStatus"` + // When the customer was last enriched + EnrichedAt *string `json:"enrichedAt"` } func (o *GetCustomerByIDResponseBody) GetID() string { @@ -224,6 +277,34 @@ func (o *GetCustomerByIDResponseBody) GetProjectCount() float64 { return o.ProjectCount } +func (o *GetCustomerByIDResponseBody) GetTotalRevenue() *float64 { + if o == nil { + return nil + } + return o.TotalRevenue +} + +func (o *GetCustomerByIDResponseBody) GetOutstandingAmount() *float64 { + if o == nil { + return nil + } + return o.OutstandingAmount +} + +func (o *GetCustomerByIDResponseBody) GetLastInvoiceDate() *string { + if o == nil { + return nil + } + return o.LastInvoiceDate +} + +func (o *GetCustomerByIDResponseBody) GetInvoiceCurrency() *string { + if o == nil { + return nil + } + return o.InvoiceCurrency +} + func (o *GetCustomerByIDResponseBody) GetTags() []GetCustomerByIDTag { if o == nil { return []GetCustomerByIDTag{} @@ -231,10 +312,166 @@ func (o *GetCustomerByIDResponseBody) GetTags() []GetCustomerByIDTag { return o.Tags } +func (o *GetCustomerByIDResponseBody) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *GetCustomerByIDResponseBody) GetIndustry() *string { + if o == nil { + return nil + } + return o.Industry +} + +func (o *GetCustomerByIDResponseBody) GetCompanyType() *string { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *GetCustomerByIDResponseBody) GetEmployeeCount() *string { + if o == nil { + return nil + } + return o.EmployeeCount +} + +func (o *GetCustomerByIDResponseBody) GetFoundedYear() *float64 { + if o == nil { + return nil + } + return o.FoundedYear +} + +func (o *GetCustomerByIDResponseBody) GetEstimatedRevenue() *string { + if o == nil { + return nil + } + return o.EstimatedRevenue +} + +func (o *GetCustomerByIDResponseBody) GetFundingStage() *string { + if o == nil { + return nil + } + return o.FundingStage +} + +func (o *GetCustomerByIDResponseBody) GetTotalFunding() *string { + if o == nil { + return nil + } + return o.TotalFunding +} + +func (o *GetCustomerByIDResponseBody) GetHeadquartersLocation() *string { + if o == nil { + return nil + } + return o.HeadquartersLocation +} + +func (o *GetCustomerByIDResponseBody) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *GetCustomerByIDResponseBody) GetLinkedinURL() *string { + if o == nil { + return nil + } + return o.LinkedinURL +} + +func (o *GetCustomerByIDResponseBody) GetTwitterURL() *string { + if o == nil { + return nil + } + return o.TwitterURL +} + +func (o *GetCustomerByIDResponseBody) GetInstagramURL() *string { + if o == nil { + return nil + } + return o.InstagramURL +} + +func (o *GetCustomerByIDResponseBody) GetFacebookURL() *string { + if o == nil { + return nil + } + return o.FacebookURL +} + +func (o *GetCustomerByIDResponseBody) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *GetCustomerByIDResponseBody) GetCeoName() *string { + if o == nil { + return nil + } + return o.CeoName +} + +func (o *GetCustomerByIDResponseBody) GetFinanceContact() *string { + if o == nil { + return nil + } + return o.FinanceContact +} + +func (o *GetCustomerByIDResponseBody) GetFinanceContactEmail() *string { + if o == nil { + return nil + } + return o.FinanceContactEmail +} + +func (o *GetCustomerByIDResponseBody) GetPrimaryLanguage() *string { + if o == nil { + return nil + } + return o.PrimaryLanguage +} + +func (o *GetCustomerByIDResponseBody) GetFiscalYearEnd() *string { + if o == nil { + return nil + } + return o.FiscalYearEnd +} + +func (o *GetCustomerByIDResponseBody) GetEnrichmentStatus() *string { + if o == nil { + return nil + } + return o.EnrichmentStatus +} + +func (o *GetCustomerByIDResponseBody) GetEnrichedAt() *string { + if o == nil { + return nil + } + return o.EnrichedAt +} + type GetCustomerByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a customer by ID for the authenticated team. Object *GetCustomerByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetCustomerByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -250,3 +487,10 @@ func (o *GetCustomerByIDResponse) GetObject() *GetCustomerByIDResponseBody { } return o.Object } + +func (o *GetCustomerByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getdocumentbyid.go b/models/operations/getdocumentbyid.go index b4e695c..437082a 100644 --- a/models/operations/getdocumentbyid.go +++ b/models/operations/getdocumentbyid.go @@ -110,6 +110,8 @@ type GetDocumentByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a document by its unique identifier Object *GetDocumentByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetDocumentByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -125,3 +127,10 @@ func (o *GetDocumentByIDResponse) GetObject() *GetDocumentByIDResponseBody { } return o.Object } + +func (o *GetDocumentByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getdocumentpresignedurl.go b/models/operations/getdocumentpresignedurl.go new file mode 100644 index 0000000..440070e --- /dev/null +++ b/models/operations/getdocumentpresignedurl.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "time" +) + +type GetDocumentPreSignedURLRequest struct { + // Unique identifier of the document to generate a pre-signed URL for + ID string `pathParam:"style=simple,explode=false,name=id"` + // Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. + Download *bool `queryParam:"style=form,explode=true,name=download"` +} + +func (o *GetDocumentPreSignedURLRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GetDocumentPreSignedURLRequest) GetDownload() *bool { + if o == nil { + return nil + } + return o.Download +} + +// GetDocumentPreSignedURLResponseBody - Pre-signed URL generated successfully +type GetDocumentPreSignedURLResponseBody struct { + // Pre-signed URL for accessing the document, valid for 60 seconds + URL string `json:"url"` + // ISO 8601 timestamp when the URL expires + ExpiresAt time.Time `json:"expiresAt"` + // Original filename of the document + FileName *string `json:"fileName"` +} + +func (g GetDocumentPreSignedURLResponseBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetDocumentPreSignedURLResponseBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetDocumentPreSignedURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +func (o *GetDocumentPreSignedURLResponseBody) GetExpiresAt() time.Time { + if o == nil { + return time.Time{} + } + return o.ExpiresAt +} + +func (o *GetDocumentPreSignedURLResponseBody) GetFileName() *string { + if o == nil { + return nil + } + return o.FileName +} + +type GetDocumentPreSignedURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Pre-signed URL generated successfully + Object *GetDocumentPreSignedURLResponseBody +} + +func (o *GetDocumentPreSignedURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetDocumentPreSignedURLResponse) GetObject() *GetDocumentPreSignedURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getexpensesmetrics.go b/models/operations/getexpensesmetrics.go deleted file mode 100644 index c26cc88..0000000 --- a/models/operations/getexpensesmetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetExpensesMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetExpensesMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetExpensesMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetExpensesMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetExpensesMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Expense metrics for the authenticated team. - GetExpensesResponseSchema *components.GetExpensesResponseSchema -} - -func (o *GetExpensesMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetExpensesMetricsResponse) GetGetExpensesResponseSchema() *components.GetExpensesResponseSchema { - if o == nil { - return nil - } - return o.GetExpensesResponseSchema -} diff --git a/models/operations/getexpensesreports.go b/models/operations/getexpensesreports.go new file mode 100644 index 0000000..6c92f44 --- /dev/null +++ b/models/operations/getexpensesreports.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type GetExpensesReportsRequest struct { + // Start date (ISO 8601 format) + From string `queryParam:"style=form,explode=true,name=from"` + // End date (ISO 8601 format) + To string `queryParam:"style=form,explode=true,name=to"` + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` +} + +func (o *GetExpensesReportsRequest) GetFrom() string { + if o == nil { + return "" + } + return o.From +} + +func (o *GetExpensesReportsRequest) GetTo() string { + if o == nil { + return "" + } + return o.To +} + +func (o *GetExpensesReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +type GetExpensesReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Expense reports for the authenticated team. + GetExpensesResponseSchema *components.GetExpensesResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetExpensesReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetExpensesReportsResponse) GetGetExpensesResponseSchema() *components.GetExpensesResponseSchema { + if o == nil { + return nil + } + return o.GetExpensesResponseSchema +} + +func (o *GetExpensesReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getfortnoxinstallurl.go b/models/operations/getfortnoxinstallurl.go new file mode 100644 index 0000000..ee2d4f2 --- /dev/null +++ b/models/operations/getfortnoxinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetFortnoxInstallURLResponseBody - Fortnox install URL +type GetFortnoxInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetFortnoxInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetFortnoxInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Fortnox install URL + Object *GetFortnoxInstallURLResponseBody +} + +func (o *GetFortnoxInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetFortnoxInstallURLResponse) GetObject() *GetFortnoxInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getgmailinstallurl.go b/models/operations/getgmailinstallurl.go new file mode 100644 index 0000000..cd76726 --- /dev/null +++ b/models/operations/getgmailinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetGmailInstallURLResponseBody - Gmail install URL +type GetGmailInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetGmailInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetGmailInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Gmail install URL + Object *GetGmailInstallURLResponseBody +} + +func (o *GetGmailInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetGmailInstallURLResponse) GetObject() *GetGmailInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getinboxitembyid.go b/models/operations/getinboxitembyid.go index 4bfb11d..f79c48c 100644 --- a/models/operations/getinboxitembyid.go +++ b/models/operations/getinboxitembyid.go @@ -7,6 +7,7 @@ import ( ) type GetInboxItemByIDRequest struct { + // The unique identifier of the inbox item. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -191,6 +192,8 @@ type GetInboxItemByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve an inbox item by its ID. Object *GetInboxItemByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetInboxItemByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -206,3 +209,10 @@ func (o *GetInboxItemByIDResponse) GetObject() *GetInboxItemByIDResponseBody { } return o.Object } + +func (o *GetInboxItemByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getinboxpresignedurl.go b/models/operations/getinboxpresignedurl.go new file mode 100644 index 0000000..82a12d3 --- /dev/null +++ b/models/operations/getinboxpresignedurl.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "time" +) + +type GetInboxPreSignedURLRequest struct { + // Unique identifier of the inbox item to generate a pre-signed URL for + ID string `pathParam:"style=simple,explode=false,name=id"` + // Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. + Download *bool `queryParam:"style=form,explode=true,name=download"` +} + +func (o *GetInboxPreSignedURLRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GetInboxPreSignedURLRequest) GetDownload() *bool { + if o == nil { + return nil + } + return o.Download +} + +// GetInboxPreSignedURLResponseBody - Pre-signed URL generated successfully +type GetInboxPreSignedURLResponseBody struct { + // Pre-signed URL for accessing the inbox attachment, valid for 60 seconds + URL string `json:"url"` + // ISO 8601 timestamp when the URL expires + ExpiresAt time.Time `json:"expiresAt"` + // Original filename of the inbox attachment + FileName *string `json:"fileName"` +} + +func (g GetInboxPreSignedURLResponseBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetInboxPreSignedURLResponseBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetInboxPreSignedURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +func (o *GetInboxPreSignedURLResponseBody) GetExpiresAt() time.Time { + if o == nil { + return time.Time{} + } + return o.ExpiresAt +} + +func (o *GetInboxPreSignedURLResponseBody) GetFileName() *string { + if o == nil { + return nil + } + return o.FileName +} + +type GetInboxPreSignedURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Pre-signed URL generated successfully + Object *GetInboxPreSignedURLResponseBody +} + +func (o *GetInboxPreSignedURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetInboxPreSignedURLResponse) GetObject() *GetInboxPreSignedURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getinvoicebyid.go b/models/operations/getinvoicebyid.go index 28718c4..7b947cd 100644 --- a/models/operations/getinvoicebyid.go +++ b/models/operations/getinvoicebyid.go @@ -108,14 +108,14 @@ type GetInvoiceByIDResponseBody struct { DueDate string `json:"dueDate"` // Issue date of the invoice in ISO 8601 format IssueDate string `json:"issueDate"` - // Invoice number as shown to the customer - InvoiceNumber string `json:"invoiceNumber"` - // Total amount of the invoice - Amount float64 `json:"amount"` + // Invoice number as shown to the customer (auto-generated if not provided) + InvoiceNumber *string `json:"invoiceNumber,omitempty"` + // Total amount of the invoice, or null if not yet calculated + Amount *float64 `json:"amount"` // Currency code (ISO 4217) for the invoice amount - Currency string `json:"currency"` + Currency *string `json:"currency"` // Customer details - Customer GetInvoiceByIDCustomer `json:"customer"` + Customer *GetInvoiceByIDCustomer `json:"customer"` // Timestamp when the invoice was paid (ISO 8601), or null if unpaid PaidAt *string `json:"paidAt"` // Timestamp when a payment reminder was sent (ISO 8601), or null if never sent @@ -142,6 +142,10 @@ type GetInvoiceByIDResponseBody struct { CreatedAt string `json:"createdAt"` // Timestamp when the invoice was last updated (ISO 8601) UpdatedAt string `json:"updatedAt"` + // URL to download the invoice PDF, or null if not generated + PdfURL *string `json:"pdfUrl"` + // URL to preview the invoice in the browser, or null if not generated + PreviewURL *string `json:"previewUrl"` } func (o *GetInvoiceByIDResponseBody) GetID() string { @@ -172,30 +176,30 @@ func (o *GetInvoiceByIDResponseBody) GetIssueDate() string { return o.IssueDate } -func (o *GetInvoiceByIDResponseBody) GetInvoiceNumber() string { +func (o *GetInvoiceByIDResponseBody) GetInvoiceNumber() *string { if o == nil { - return "" + return nil } return o.InvoiceNumber } -func (o *GetInvoiceByIDResponseBody) GetAmount() float64 { +func (o *GetInvoiceByIDResponseBody) GetAmount() *float64 { if o == nil { - return 0.0 + return nil } return o.Amount } -func (o *GetInvoiceByIDResponseBody) GetCurrency() string { +func (o *GetInvoiceByIDResponseBody) GetCurrency() *string { if o == nil { - return "" + return nil } return o.Currency } -func (o *GetInvoiceByIDResponseBody) GetCustomer() GetInvoiceByIDCustomer { +func (o *GetInvoiceByIDResponseBody) GetCustomer() *GetInvoiceByIDCustomer { if o == nil { - return GetInvoiceByIDCustomer{} + return nil } return o.Customer } @@ -291,10 +295,26 @@ func (o *GetInvoiceByIDResponseBody) GetUpdatedAt() string { return o.UpdatedAt } +func (o *GetInvoiceByIDResponseBody) GetPdfURL() *string { + if o == nil { + return nil + } + return o.PdfURL +} + +func (o *GetInvoiceByIDResponseBody) GetPreviewURL() *string { + if o == nil { + return nil + } + return o.PreviewURL +} + type GetInvoiceByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a invoice by its unique identifier for the authenticated team. Object *GetInvoiceByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetInvoiceByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -310,3 +330,10 @@ func (o *GetInvoiceByIDResponse) GetObject() *GetInvoiceByIDResponseBody { } return o.Object } + +func (o *GetInvoiceByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getinvoicepaymentstatus.go b/models/operations/getinvoicepaymentstatus.go new file mode 100644 index 0000000..151ca79 --- /dev/null +++ b/models/operations/getinvoicepaymentstatus.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetInvoicePaymentStatusResponseBody - Payment status for the authenticated team. +type GetInvoicePaymentStatusResponseBody struct { + // Score associated with the invoice payment status + Score float64 `json:"score"` + // The payment status of the invoice + PaymentStatus string `json:"paymentStatus"` +} + +func (o *GetInvoicePaymentStatusResponseBody) GetScore() float64 { + if o == nil { + return 0.0 + } + return o.Score +} + +func (o *GetInvoicePaymentStatusResponseBody) GetPaymentStatus() string { + if o == nil { + return "" + } + return o.PaymentStatus +} + +type GetInvoicePaymentStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Payment status for the authenticated team. + Object *GetInvoicePaymentStatusResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetInvoicePaymentStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetInvoicePaymentStatusResponse) GetObject() *GetInvoicePaymentStatusResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *GetInvoicePaymentStatusResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getinvoicespaymentstatus.go b/models/operations/getinvoicespaymentstatus.go deleted file mode 100644 index ce9d6ee..0000000 --- a/models/operations/getinvoicespaymentstatus.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -// GetInvoicesPaymentStatusResponseBody - Payment status for the authenticated team. -type GetInvoicesPaymentStatusResponseBody struct { - // Score associated with the invoice payment status - Score float64 `json:"score"` - // The payment status of the invoice - PaymentStatus string `json:"paymentStatus"` -} - -func (o *GetInvoicesPaymentStatusResponseBody) GetScore() float64 { - if o == nil { - return 0.0 - } - return o.Score -} - -func (o *GetInvoicesPaymentStatusResponseBody) GetPaymentStatus() string { - if o == nil { - return "" - } - return o.PaymentStatus -} - -type GetInvoicesPaymentStatusResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Payment status for the authenticated team. - Object *GetInvoicesPaymentStatusResponseBody -} - -func (o *GetInvoicesPaymentStatusResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetInvoicesPaymentStatusResponse) GetObject() *GetInvoicesPaymentStatusResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/models/operations/getinvoicesummary.go b/models/operations/getinvoicesummary.go index 2a6d2be..17377c4 100644 --- a/models/operations/getinvoicesummary.go +++ b/models/operations/getinvoicesummary.go @@ -8,15 +8,15 @@ import ( "github.com/midday-ai/midday-go/models/components" ) -// GetInvoiceSummaryStatus - Filter summary by invoice status type GetInvoiceSummaryStatus string const ( - GetInvoiceSummaryStatusDraft GetInvoiceSummaryStatus = "draft" - GetInvoiceSummaryStatusOverdue GetInvoiceSummaryStatus = "overdue" - GetInvoiceSummaryStatusPaid GetInvoiceSummaryStatus = "paid" - GetInvoiceSummaryStatusUnpaid GetInvoiceSummaryStatus = "unpaid" - GetInvoiceSummaryStatusCanceled GetInvoiceSummaryStatus = "canceled" + GetInvoiceSummaryStatusDraft GetInvoiceSummaryStatus = "draft" + GetInvoiceSummaryStatusOverdue GetInvoiceSummaryStatus = "overdue" + GetInvoiceSummaryStatusPaid GetInvoiceSummaryStatus = "paid" + GetInvoiceSummaryStatusUnpaid GetInvoiceSummaryStatus = "unpaid" + GetInvoiceSummaryStatusCanceled GetInvoiceSummaryStatus = "canceled" + GetInvoiceSummaryStatusScheduled GetInvoiceSummaryStatus = "scheduled" ) func (e GetInvoiceSummaryStatus) ToPointer() *GetInvoiceSummaryStatus { @@ -37,6 +37,8 @@ func (e *GetInvoiceSummaryStatus) UnmarshalJSON(data []byte) error { case "unpaid": fallthrough case "canceled": + fallthrough + case "scheduled": *e = GetInvoiceSummaryStatus(v) return nil default: @@ -45,24 +47,66 @@ func (e *GetInvoiceSummaryStatus) UnmarshalJSON(data []byte) error { } type GetInvoiceSummaryRequest struct { - // Filter summary by invoice status - Status *GetInvoiceSummaryStatus `queryParam:"style=form,explode=true,name=status"` + // Filter summary by invoice statuses + Statuses []GetInvoiceSummaryStatus `queryParam:"style=form,explode=true,name=statuses"` } -func (o *GetInvoiceSummaryRequest) GetStatus() *GetInvoiceSummaryStatus { +func (o *GetInvoiceSummaryRequest) GetStatuses() []GetInvoiceSummaryStatus { if o == nil { return nil } - return o.Status + return o.Statuses +} + +type Breakdown struct { + // Original currency of the invoices + Currency string `json:"currency"` + // Total amount in original currency + OriginalAmount float64 `json:"originalAmount"` + // Amount converted to base currency + ConvertedAmount float64 `json:"convertedAmount"` + // Number of invoices in this currency + Count float64 `json:"count"` +} + +func (o *Breakdown) GetCurrency() string { + if o == nil { + return "" + } + return o.Currency } +func (o *Breakdown) GetOriginalAmount() float64 { + if o == nil { + return 0.0 + } + return o.OriginalAmount +} + +func (o *Breakdown) GetConvertedAmount() float64 { + if o == nil { + return 0.0 + } + return o.ConvertedAmount +} + +func (o *Breakdown) GetCount() float64 { + if o == nil { + return 0.0 + } + return o.Count +} + +// GetInvoiceSummaryResponseBody - Invoice summary object containing total amount converted to team's base currency and total invoice count. type GetInvoiceSummaryResponseBody struct { - // Currency of the invoice + // Base currency of the team Currency string `json:"currency"` - // Total amount of the invoice + // Total amount of all invoices converted to base currency TotalAmount float64 `json:"totalAmount"` - // Number of invoices for this currency + // Total number of invoices InvoiceCount float64 `json:"invoiceCount"` + // Currency breakdown when multiple currencies are involved + Breakdown []Breakdown `json:"breakdown,omitempty"` } func (o *GetInvoiceSummaryResponseBody) GetCurrency() string { @@ -86,10 +130,19 @@ func (o *GetInvoiceSummaryResponseBody) GetInvoiceCount() float64 { return o.InvoiceCount } +func (o *GetInvoiceSummaryResponseBody) GetBreakdown() []Breakdown { + if o == nil { + return nil + } + return o.Breakdown +} + type GetInvoiceSummaryResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Summary of invoices for the authenticated team. - ResponseBodies []GetInvoiceSummaryResponseBody + Object *GetInvoiceSummaryResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetInvoiceSummaryResponse) GetHTTPMeta() components.HTTPMetadata { @@ -99,9 +152,16 @@ func (o *GetInvoiceSummaryResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *GetInvoiceSummaryResponse) GetResponseBodies() []GetInvoiceSummaryResponseBody { +func (o *GetInvoiceSummaryResponse) GetObject() *GetInvoiceSummaryResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *GetInvoiceSummaryResponse) GetErrorResponse() *components.ErrorResponse { if o == nil { return nil } - return o.ResponseBodies + return o.ErrorResponse } diff --git a/models/operations/getoauthauthorization.go b/models/operations/getoauthauthorization.go new file mode 100644 index 0000000..963c34c --- /dev/null +++ b/models/operations/getoauthauthorization.go @@ -0,0 +1,315 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/models/components" +) + +// ResponseType - OAuth response type, must be 'code' +type ResponseType string + +const ( + ResponseTypeCode ResponseType = "code" +) + +func (e ResponseType) ToPointer() *ResponseType { + return &e +} +func (e *ResponseType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "code": + *e = ResponseType(v) + return nil + default: + return fmt.Errorf("invalid value for ResponseType: %v", v) + } +} + +// CodeChallengeMethod - Code challenge method, must be S256 +type CodeChallengeMethod string + +const ( + CodeChallengeMethodS256 CodeChallengeMethod = "S256" +) + +func (e CodeChallengeMethod) ToPointer() *CodeChallengeMethod { + return &e +} +func (e *CodeChallengeMethod) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "S256": + *e = CodeChallengeMethod(v) + return nil + default: + return fmt.Errorf("invalid value for CodeChallengeMethod: %v", v) + } +} + +type GetOAuthAuthorizationRequest struct { + // OAuth response type, must be 'code' + ResponseType ResponseType `queryParam:"style=form,explode=true,name=response_type"` + // Client ID of the OAuth application + ClientID string `queryParam:"style=form,explode=true,name=client_id"` + // Redirect URI for OAuth callback + RedirectURI string `queryParam:"style=form,explode=true,name=redirect_uri"` + // Space-separated list of requested scopes + Scope string `queryParam:"style=form,explode=true,name=scope"` + // Opaque state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` + // Code challenge for PKCE (S256) + CodeChallenge *string `queryParam:"style=form,explode=true,name=code_challenge"` + // Code challenge method, must be S256 + CodeChallengeMethod *CodeChallengeMethod `queryParam:"style=form,explode=true,name=code_challenge_method"` + // Resource parameter per RFC 9728 — identifies the MCP server + Resource *string `queryParam:"style=form,explode=true,name=resource"` +} + +func (o *GetOAuthAuthorizationRequest) GetResponseType() ResponseType { + if o == nil { + return ResponseType("") + } + return o.ResponseType +} + +func (o *GetOAuthAuthorizationRequest) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *GetOAuthAuthorizationRequest) GetRedirectURI() string { + if o == nil { + return "" + } + return o.RedirectURI +} + +func (o *GetOAuthAuthorizationRequest) GetScope() string { + if o == nil { + return "" + } + return o.Scope +} + +func (o *GetOAuthAuthorizationRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *GetOAuthAuthorizationRequest) GetCodeChallenge() *string { + if o == nil { + return nil + } + return o.CodeChallenge +} + +func (o *GetOAuthAuthorizationRequest) GetCodeChallengeMethod() *CodeChallengeMethod { + if o == nil { + return nil + } + return o.CodeChallengeMethod +} + +func (o *GetOAuthAuthorizationRequest) GetResource() *string { + if o == nil { + return nil + } + return o.Resource +} + +// GetOAuthAuthorizationStatus - Application verification status +type GetOAuthAuthorizationStatus string + +const ( + GetOAuthAuthorizationStatusDraft GetOAuthAuthorizationStatus = "draft" + GetOAuthAuthorizationStatusPending GetOAuthAuthorizationStatus = "pending" + GetOAuthAuthorizationStatusApproved GetOAuthAuthorizationStatus = "approved" + GetOAuthAuthorizationStatusRejected GetOAuthAuthorizationStatus = "rejected" +) + +func (e GetOAuthAuthorizationStatus) ToPointer() *GetOAuthAuthorizationStatus { + return &e +} +func (e *GetOAuthAuthorizationStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "draft": + fallthrough + case "pending": + fallthrough + case "approved": + fallthrough + case "rejected": + *e = GetOAuthAuthorizationStatus(v) + return nil + default: + return fmt.Errorf("invalid value for GetOAuthAuthorizationStatus: %v", v) + } +} + +// GetOAuthAuthorizationResponseBody - Application information for consent screen +type GetOAuthAuthorizationResponseBody struct { + // Application ID + ID string `json:"id"` + // Application name + Name string `json:"name"` + // Application description + Description *string `json:"description"` + // Application overview + Overview *string `json:"overview"` + // The person or company developing this application + DeveloperName *string `json:"developerName"` + // Application logo URL + LogoURL *string `json:"logoUrl"` + // Application website + Website *string `json:"website"` + // An optional URL for installing the application + InstallURL *string `json:"installUrl"` + // Up to 4 screenshots that will be displayed on the apps page + Screenshots []string `json:"screenshots"` + // Client ID + ClientID string `json:"clientId"` + // Requested scopes + Scopes []string `json:"scopes"` + // Redirect URI + RedirectURI string `json:"redirectUri"` + // Opaque state parameter + State *string `json:"state,omitempty"` + // Application verification status + Status GetOAuthAuthorizationStatus `json:"status"` +} + +func (o *GetOAuthAuthorizationResponseBody) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GetOAuthAuthorizationResponseBody) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *GetOAuthAuthorizationResponseBody) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *GetOAuthAuthorizationResponseBody) GetOverview() *string { + if o == nil { + return nil + } + return o.Overview +} + +func (o *GetOAuthAuthorizationResponseBody) GetDeveloperName() *string { + if o == nil { + return nil + } + return o.DeveloperName +} + +func (o *GetOAuthAuthorizationResponseBody) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *GetOAuthAuthorizationResponseBody) GetWebsite() *string { + if o == nil { + return nil + } + return o.Website +} + +func (o *GetOAuthAuthorizationResponseBody) GetInstallURL() *string { + if o == nil { + return nil + } + return o.InstallURL +} + +func (o *GetOAuthAuthorizationResponseBody) GetScreenshots() []string { + if o == nil { + return []string{} + } + return o.Screenshots +} + +func (o *GetOAuthAuthorizationResponseBody) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *GetOAuthAuthorizationResponseBody) GetScopes() []string { + if o == nil { + return []string{} + } + return o.Scopes +} + +func (o *GetOAuthAuthorizationResponseBody) GetRedirectURI() string { + if o == nil { + return "" + } + return o.RedirectURI +} + +func (o *GetOAuthAuthorizationResponseBody) GetState() *string { + if o == nil { + return nil + } + return o.State +} + +func (o *GetOAuthAuthorizationResponseBody) GetStatus() GetOAuthAuthorizationStatus { + if o == nil { + return GetOAuthAuthorizationStatus("") + } + return o.Status +} + +type GetOAuthAuthorizationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Application information for consent screen + Object *GetOAuthAuthorizationResponseBody +} + +func (o *GetOAuthAuthorizationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetOAuthAuthorizationResponse) GetObject() *GetOAuthAuthorizationResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getoutlookinstallurl.go b/models/operations/getoutlookinstallurl.go new file mode 100644 index 0000000..0d68cc1 --- /dev/null +++ b/models/operations/getoutlookinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetOutlookInstallURLResponseBody - Outlook install URL +type GetOutlookInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetOutlookInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetOutlookInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Outlook install URL + Object *GetOutlookInstallURLResponseBody +} + +func (o *GetOutlookInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetOutlookInstallURLResponse) GetObject() *GetOutlookInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getprofitmetrics.go b/models/operations/getprofitmetrics.go deleted file mode 100644 index 3372698..0000000 --- a/models/operations/getprofitmetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetProfitMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetProfitMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetProfitMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetProfitMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetProfitMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Profit metrics for the authenticated team. - GetProfitResponseSchema *components.GetProfitResponseSchema -} - -func (o *GetProfitMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetProfitMetricsResponse) GetGetProfitResponseSchema() *components.GetProfitResponseSchema { - if o == nil { - return nil - } - return o.GetProfitResponseSchema -} diff --git a/models/operations/getprofitreports.go b/models/operations/getprofitreports.go new file mode 100644 index 0000000..e317bdb --- /dev/null +++ b/models/operations/getprofitreports.go @@ -0,0 +1,116 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" +) + +// GetProfitReportsRevenueType - Type of revenue calculation +type GetProfitReportsRevenueType string + +const ( + GetProfitReportsRevenueTypeGross GetProfitReportsRevenueType = "gross" + GetProfitReportsRevenueTypeNet GetProfitReportsRevenueType = "net" +) + +func (e GetProfitReportsRevenueType) ToPointer() *GetProfitReportsRevenueType { + return &e +} +func (e *GetProfitReportsRevenueType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "gross": + fallthrough + case "net": + *e = GetProfitReportsRevenueType(v) + return nil + default: + return fmt.Errorf("invalid value for GetProfitReportsRevenueType: %v", v) + } +} + +type GetProfitReportsRequest struct { + // Start date (ISO 8601 format) + From string `queryParam:"style=form,explode=true,name=from"` + // End date (ISO 8601 format) + To string `queryParam:"style=form,explode=true,name=to"` + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` + // Type of revenue calculation + RevenueType *GetProfitReportsRevenueType `default:"net" queryParam:"style=form,explode=true,name=revenueType"` +} + +func (g GetProfitReportsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetProfitReportsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetProfitReportsRequest) GetFrom() string { + if o == nil { + return "" + } + return o.From +} + +func (o *GetProfitReportsRequest) GetTo() string { + if o == nil { + return "" + } + return o.To +} + +func (o *GetProfitReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *GetProfitReportsRequest) GetRevenueType() *GetProfitReportsRevenueType { + if o == nil { + return nil + } + return o.RevenueType +} + +type GetProfitReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Profit reports for the authenticated team. + GetProfitResponseSchema *components.GetProfitResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetProfitReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetProfitReportsResponse) GetGetProfitResponseSchema() *components.GetProfitResponseSchema { + if o == nil { + return nil + } + return o.GetProfitResponseSchema +} + +func (o *GetProfitReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getquickbooksinstallurl.go b/models/operations/getquickbooksinstallurl.go new file mode 100644 index 0000000..1ee9356 --- /dev/null +++ b/models/operations/getquickbooksinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetQuickBooksInstallURLResponseBody - QuickBooks install URL +type GetQuickBooksInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetQuickBooksInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetQuickBooksInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // QuickBooks install URL + Object *GetQuickBooksInstallURLResponseBody +} + +func (o *GetQuickBooksInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetQuickBooksInstallURLResponse) GetObject() *GetQuickBooksInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getrevenuemetrics.go b/models/operations/getrevenuemetrics.go deleted file mode 100644 index 4b3a5ff..0000000 --- a/models/operations/getrevenuemetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetRevenueMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetRevenueMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetRevenueMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetRevenueMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetRevenueMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Revenue metrics for the authenticated team. - GetRevenueResponseSchema *components.GetRevenueResponseSchema -} - -func (o *GetRevenueMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetRevenueMetricsResponse) GetGetRevenueResponseSchema() *components.GetRevenueResponseSchema { - if o == nil { - return nil - } - return o.GetRevenueResponseSchema -} diff --git a/models/operations/getrevenuereports.go b/models/operations/getrevenuereports.go new file mode 100644 index 0000000..eddcf10 --- /dev/null +++ b/models/operations/getrevenuereports.go @@ -0,0 +1,116 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" +) + +// GetRevenueReportsRevenueType - Type of revenue calculation +type GetRevenueReportsRevenueType string + +const ( + GetRevenueReportsRevenueTypeGross GetRevenueReportsRevenueType = "gross" + GetRevenueReportsRevenueTypeNet GetRevenueReportsRevenueType = "net" +) + +func (e GetRevenueReportsRevenueType) ToPointer() *GetRevenueReportsRevenueType { + return &e +} +func (e *GetRevenueReportsRevenueType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "gross": + fallthrough + case "net": + *e = GetRevenueReportsRevenueType(v) + return nil + default: + return fmt.Errorf("invalid value for GetRevenueReportsRevenueType: %v", v) + } +} + +type GetRevenueReportsRequest struct { + // Start date (ISO 8601 format) + From string `queryParam:"style=form,explode=true,name=from"` + // End date (ISO 8601 format) + To string `queryParam:"style=form,explode=true,name=to"` + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` + // Type of revenue calculation + RevenueType *GetRevenueReportsRevenueType `default:"net" queryParam:"style=form,explode=true,name=revenueType"` +} + +func (g GetRevenueReportsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetRevenueReportsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetRevenueReportsRequest) GetFrom() string { + if o == nil { + return "" + } + return o.From +} + +func (o *GetRevenueReportsRequest) GetTo() string { + if o == nil { + return "" + } + return o.To +} + +func (o *GetRevenueReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *GetRevenueReportsRequest) GetRevenueType() *GetRevenueReportsRevenueType { + if o == nil { + return nil + } + return o.RevenueType +} + +type GetRevenueReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Revenue reports for the authenticated team. + GetRevenueResponseSchema *components.GetRevenueResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetRevenueReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetRevenueReportsResponse) GetGetRevenueResponseSchema() *components.GetRevenueResponseSchema { + if o == nil { + return nil + } + return o.GetRevenueResponseSchema +} + +func (o *GetRevenueReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getrunwaymetrics.go b/models/operations/getrunwaymetrics.go deleted file mode 100644 index 8396a5f..0000000 --- a/models/operations/getrunwaymetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetRunwayMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetRunwayMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetRunwayMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetRunwayMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetRunwayMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Runway metrics for the authenticated team. - GetRunwayResponseSchema *float64 -} - -func (o *GetRunwayMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetRunwayMetricsResponse) GetGetRunwayResponseSchema() *float64 { - if o == nil { - return nil - } - return o.GetRunwayResponseSchema -} diff --git a/models/operations/getrunwayreports.go b/models/operations/getrunwayreports.go new file mode 100644 index 0000000..d341ed4 --- /dev/null +++ b/models/operations/getrunwayreports.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type GetRunwayReportsRequest struct { + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` +} + +func (o *GetRunwayReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +type GetRunwayReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Runway reports for the authenticated team. + GetRunwayResponseSchema *float64 + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetRunwayReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetRunwayReportsResponse) GetGetRunwayResponseSchema() *float64 { + if o == nil { + return nil + } + return o.GetRunwayResponseSchema +} + +func (o *GetRunwayReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getslackinstallurl.go b/models/operations/getslackinstallurl.go new file mode 100644 index 0000000..3492099 --- /dev/null +++ b/models/operations/getslackinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetSlackInstallURLResponseBody - Slack install URL +type GetSlackInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetSlackInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetSlackInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Slack install URL + Object *GetSlackInstallURLResponseBody +} + +func (o *GetSlackInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSlackInstallURLResponse) GetObject() *GetSlackInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getspendingmetrics.go b/models/operations/getspendingmetrics.go deleted file mode 100644 index 0a38327..0000000 --- a/models/operations/getspendingmetrics.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/midday-ai/midday-go/models/components" -) - -type GetSpendingMetricsRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` - Currency *string `queryParam:"style=form,explode=true,name=currency"` -} - -func (o *GetSpendingMetricsRequest) GetFrom() string { - if o == nil { - return "" - } - return o.From -} - -func (o *GetSpendingMetricsRequest) GetTo() string { - if o == nil { - return "" - } - return o.To -} - -func (o *GetSpendingMetricsRequest) GetCurrency() *string { - if o == nil { - return nil - } - return o.Currency -} - -type GetSpendingMetricsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Spending metrics for the authenticated team. - SpendingResultArray []components.SpendingResultArray -} - -func (o *GetSpendingMetricsResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *GetSpendingMetricsResponse) GetSpendingResultArray() []components.SpendingResultArray { - if o == nil { - return nil - } - return o.SpendingResultArray -} diff --git a/models/operations/getspendingreports.go b/models/operations/getspendingreports.go new file mode 100644 index 0000000..363d62e --- /dev/null +++ b/models/operations/getspendingreports.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type GetSpendingReportsRequest struct { + // Start date (ISO 8601 format) + From string `queryParam:"style=form,explode=true,name=from"` + // End date (ISO 8601 format) + To string `queryParam:"style=form,explode=true,name=to"` + // Currency code (ISO 4217) + Currency *string `queryParam:"style=form,explode=true,name=currency"` +} + +func (o *GetSpendingReportsRequest) GetFrom() string { + if o == nil { + return "" + } + return o.From +} + +func (o *GetSpendingReportsRequest) GetTo() string { + if o == nil { + return "" + } + return o.To +} + +func (o *GetSpendingReportsRequest) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +type GetSpendingReportsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Spending reports for the authenticated team. + SpendingResultArray []components.SpendingResultArray + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *GetSpendingReportsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSpendingReportsResponse) GetSpendingResultArray() []components.SpendingResultArray { + if o == nil { + return nil + } + return o.SpendingResultArray +} + +func (o *GetSpendingReportsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getstripeconnectstatus.go b/models/operations/getstripeconnectstatus.go new file mode 100644 index 0000000..a308497 --- /dev/null +++ b/models/operations/getstripeconnectstatus.go @@ -0,0 +1,55 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetStripeConnectStatusResponseBody - Stripe Connect status +type GetStripeConnectStatusResponseBody struct { + Connected bool `json:"connected"` + Status *string `json:"status"` + StripeAccountID *string `json:"stripeAccountId"` +} + +func (o *GetStripeConnectStatusResponseBody) GetConnected() bool { + if o == nil { + return false + } + return o.Connected +} + +func (o *GetStripeConnectStatusResponseBody) GetStatus() *string { + if o == nil { + return nil + } + return o.Status +} + +func (o *GetStripeConnectStatusResponseBody) GetStripeAccountID() *string { + if o == nil { + return nil + } + return o.StripeAccountID +} + +type GetStripeConnectStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Stripe Connect status + Object *GetStripeConnectStatusResponseBody +} + +func (o *GetStripeConnectStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetStripeConnectStatusResponse) GetObject() *GetStripeConnectStatusResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getstripeconnecturl.go b/models/operations/getstripeconnecturl.go new file mode 100644 index 0000000..1f2f6fc --- /dev/null +++ b/models/operations/getstripeconnecturl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetStripeConnectURLResponseBody - Stripe Connect OAuth URL +type GetStripeConnectURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetStripeConnectURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetStripeConnectURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Stripe Connect OAuth URL + Object *GetStripeConnectURLResponseBody +} + +func (o *GetStripeConnectURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetStripeConnectURLResponse) GetObject() *GetStripeConnectURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/gettagbyid.go b/models/operations/gettagbyid.go index 723f646..83fe2c6 100644 --- a/models/operations/gettagbyid.go +++ b/models/operations/gettagbyid.go @@ -7,6 +7,7 @@ import ( ) type GetTagByIDRequest struct { + // The UUID of the tag. ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -21,6 +22,8 @@ type GetTagByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a tag by ID for the authenticated team. TagResponse *components.TagResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetTagByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -36,3 +39,10 @@ func (o *GetTagByIDResponse) GetTagResponse() *components.TagResponse { } return o.TagResponse } + +func (o *GetTagByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getteambyid.go b/models/operations/getteambyid.go index 3e992ac..f3bb856 100644 --- a/models/operations/getteambyid.go +++ b/models/operations/getteambyid.go @@ -9,6 +9,7 @@ import ( ) type GetTeamByIDRequest struct { + // Unique identifier of the team ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -93,6 +94,8 @@ type GetTeamByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Team details Object *GetTeamByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetTeamByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -108,3 +111,10 @@ func (o *GetTeamByIDResponse) GetObject() *GetTeamByIDResponseBody { } return o.Object } + +func (o *GetTeamByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/gettimerstatus.go b/models/operations/gettimerstatus.go index bbf74ac..1ad9766 100644 --- a/models/operations/gettimerstatus.go +++ b/models/operations/gettimerstatus.go @@ -7,6 +7,7 @@ import ( ) type GetTimerStatusRequest struct { + // Unique identifier of the user whose current timer should be retrieved. If not provided, will use the authenticated user AssignedID *string `queryParam:"style=form,explode=true,name=assignedId"` } @@ -17,19 +18,19 @@ func (o *GetTimerStatusRequest) GetAssignedID() *string { return o.AssignedID } -type TrackerProject struct { +type GetTimerStatusTrackerProject struct { ID string `json:"id"` Name string `json:"name"` } -func (o *TrackerProject) GetID() string { +func (o *GetTimerStatusTrackerProject) GetID() string { if o == nil { return "" } return o.ID } -func (o *TrackerProject) GetName() string { +func (o *GetTimerStatusTrackerProject) GetName() string { if o == nil { return "" } @@ -38,11 +39,11 @@ func (o *TrackerProject) GetName() string { // CurrentEntry - Current running timer details, null if not running type CurrentEntry struct { - ID string `json:"id"` - Start *string `json:"start"` - Description *string `json:"description"` - ProjectID string `json:"projectId"` - TrackerProject TrackerProject `json:"trackerProject"` + ID string `json:"id"` + Start *string `json:"start"` + Description *string `json:"description"` + ProjectID string `json:"projectId"` + TrackerProject GetTimerStatusTrackerProject `json:"trackerProject"` } func (o *CurrentEntry) GetID() string { @@ -73,9 +74,9 @@ func (o *CurrentEntry) GetProjectID() string { return o.ProjectID } -func (o *CurrentEntry) GetTrackerProject() TrackerProject { +func (o *CurrentEntry) GetTrackerProject() GetTimerStatusTrackerProject { if o == nil { - return TrackerProject{} + return GetTimerStatusTrackerProject{} } return o.TrackerProject } @@ -126,6 +127,8 @@ type GetTimerStatusResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Timer status retrieved successfully. Object *GetTimerStatusResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetTimerStatusResponse) GetHTTPMeta() components.HTTPMetadata { @@ -141,3 +144,10 @@ func (o *GetTimerStatusResponse) GetObject() *GetTimerStatusResponseBody { } return o.Object } + +func (o *GetTimerStatusResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/gettrackerprojectbyid.go b/models/operations/gettrackerprojectbyid.go index e8ddf3e..e953dff 100644 --- a/models/operations/gettrackerprojectbyid.go +++ b/models/operations/gettrackerprojectbyid.go @@ -7,6 +7,7 @@ import ( ) type GetTrackerProjectByIDRequest struct { + // Unique identifier of the project to retrieve ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -21,6 +22,8 @@ type GetTrackerProjectByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker project by ID for the authenticated team. TrackerProjectResponse *components.TrackerProjectResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetTrackerProjectByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -36,3 +39,10 @@ func (o *GetTrackerProjectByIDResponse) GetTrackerProjectResponse() *components. } return o.TrackerProjectResponse } + +func (o *GetTrackerProjectByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/gettransactionattachmentpresignedurl.go b/models/operations/gettransactionattachmentpresignedurl.go new file mode 100644 index 0000000..64a0033 --- /dev/null +++ b/models/operations/gettransactionattachmentpresignedurl.go @@ -0,0 +1,101 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "time" +) + +type GetTransactionAttachmentPreSignedURLRequest struct { + // Unique identifier of the transaction + TransactionID string `pathParam:"style=simple,explode=false,name=transactionId"` + // Unique identifier of the attachment to generate a pre-signed URL for + AttachmentID string `pathParam:"style=simple,explode=false,name=attachmentId"` + // Whether to force download the file. If true, the file will be downloaded. If false or omitted, the file will be displayed in the browser if possible. + Download *bool `queryParam:"style=form,explode=true,name=download"` +} + +func (o *GetTransactionAttachmentPreSignedURLRequest) GetTransactionID() string { + if o == nil { + return "" + } + return o.TransactionID +} + +func (o *GetTransactionAttachmentPreSignedURLRequest) GetAttachmentID() string { + if o == nil { + return "" + } + return o.AttachmentID +} + +func (o *GetTransactionAttachmentPreSignedURLRequest) GetDownload() *bool { + if o == nil { + return nil + } + return o.Download +} + +// GetTransactionAttachmentPreSignedURLResponseBody - Pre-signed URL generated successfully +type GetTransactionAttachmentPreSignedURLResponseBody struct { + // Pre-signed URL for accessing the attachment, valid for 60 seconds + URL string `json:"url"` + // ISO 8601 timestamp when the URL expires + ExpiresAt time.Time `json:"expiresAt"` + // Original filename of the attachment + FileName *string `json:"fileName"` +} + +func (g GetTransactionAttachmentPreSignedURLResponseBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetTransactionAttachmentPreSignedURLResponseBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetTransactionAttachmentPreSignedURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +func (o *GetTransactionAttachmentPreSignedURLResponseBody) GetExpiresAt() time.Time { + if o == nil { + return time.Time{} + } + return o.ExpiresAt +} + +func (o *GetTransactionAttachmentPreSignedURLResponseBody) GetFileName() *string { + if o == nil { + return nil + } + return o.FileName +} + +type GetTransactionAttachmentPreSignedURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Pre-signed URL generated successfully + Object *GetTransactionAttachmentPreSignedURLResponseBody +} + +func (o *GetTransactionAttachmentPreSignedURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTransactionAttachmentPreSignedURLResponse) GetObject() *GetTransactionAttachmentPreSignedURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/gettransactionbyid.go b/models/operations/gettransactionbyid.go index 8bdd85e..11f199d 100644 --- a/models/operations/gettransactionbyid.go +++ b/models/operations/gettransactionbyid.go @@ -7,6 +7,7 @@ import ( ) type GetTransactionByIDRequest struct { + // Transaction ID (UUID). ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -21,6 +22,8 @@ type GetTransactionByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transaction details TransactionResponse *components.TransactionResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *GetTransactionByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -36,3 +39,10 @@ func (o *GetTransactionByIDResponse) GetTransactionResponse() *components.Transa } return o.TransactionResponse } + +func (o *GetTransactionByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/getxeroinstallurl.go b/models/operations/getxeroinstallurl.go new file mode 100644 index 0000000..6ceadca --- /dev/null +++ b/models/operations/getxeroinstallurl.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// GetXeroInstallURLResponseBody - Xero install URL +type GetXeroInstallURLResponseBody struct { + URL string `json:"url"` +} + +func (o *GetXeroInstallURLResponseBody) GetURL() string { + if o == nil { + return "" + } + return o.URL +} + +type GetXeroInstallURLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Xero install URL + Object *GetXeroInstallURLResponseBody +} + +func (o *GetXeroInstallURLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetXeroInstallURLResponse) GetObject() *GetXeroInstallURLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/gmailoauthcallback.go b/models/operations/gmailoauthcallback.go new file mode 100644 index 0000000..938171c --- /dev/null +++ b/models/operations/gmailoauthcallback.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type GmailOAuthCallbackRequest struct { + // OAuth authorization code from Google + Code *string `queryParam:"style=form,explode=true,name=code"` + // Encrypted OAuth state parameter + State string `queryParam:"style=form,explode=true,name=state"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` +} + +func (o *GmailOAuthCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *GmailOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *GmailOAuthCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +type GmailOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *GmailOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GmailOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/inboxwebhook.go b/models/operations/inboxwebhook.go new file mode 100644 index 0000000..ccb4035 --- /dev/null +++ b/models/operations/inboxwebhook.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type Error struct { + Path string `json:"path"` + Message string `json:"message"` +} + +func (o *Error) GetPath() string { + if o == nil { + return "" + } + return o.Path +} + +func (o *Error) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} + +// InboxWebhookResponseBody - Webhook processed successfully +type InboxWebhookResponseBody struct { + Success bool `json:"success"` +} + +func (o *InboxWebhookResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type InboxWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *InboxWebhookResponseBody +} + +func (o *InboxWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *InboxWebhookResponse) GetObject() *InboxWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/listbankaccounts.go b/models/operations/listbankaccounts.go index b39b0f2..850b318 100644 --- a/models/operations/listbankaccounts.go +++ b/models/operations/listbankaccounts.go @@ -7,8 +7,10 @@ import ( ) type ListBankAccountsRequest struct { + // Whether the bank account is enabled. Enabled *bool `queryParam:"style=form,explode=true,name=enabled"` - Manual *bool `queryParam:"style=form,explode=true,name=manual"` + // Whether the bank account is a manual account. + Manual *bool `queryParam:"style=form,explode=true,name=manual"` } func (o *ListBankAccountsRequest) GetEnabled() *bool { @@ -109,6 +111,8 @@ type ListBankAccountsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of bank accounts Object *ListBankAccountsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListBankAccountsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -124,3 +128,10 @@ func (o *ListBankAccountsResponse) GetObject() *ListBankAccountsResponseBody { } return o.Object } + +func (o *ListBankAccountsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listcustomers.go b/models/operations/listcustomers.go index 36c036a..aedd719 100644 --- a/models/operations/listcustomers.go +++ b/models/operations/listcustomers.go @@ -7,9 +7,13 @@ import ( ) type ListCustomersRequest struct { - Q *string `queryParam:"style=form,explode=true,name=q"` - Sort []string `queryParam:"style=form,explode=true,name=sort"` - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Search query string to filter customers by name, email, or other text fields + Q *string `queryParam:"style=form,explode=true,name=q"` + // Sort as [column, direction]. Columns: name, created_at, contact, email, invoices, projects, tags, industry, country, total_revenue, outstanding, last_invoice. Direction: asc or desc. + Sort []string `queryParam:"style=form,explode=true,name=sort"` + // Cursor for pagination, representing the last item from the previous page + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Number of customers to return per page (1-100) PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` } @@ -100,7 +104,7 @@ type ListCustomersData struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail"` // Primary phone number of the customer Phone *string `json:"phone"` @@ -134,8 +138,60 @@ type ListCustomersData struct { InvoiceCount float64 `json:"invoiceCount"` // Total number of projects associated with this customer ProjectCount float64 `json:"projectCount"` + // Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. + TotalRevenue *float64 `json:"totalRevenue,omitempty"` + // Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. + OutstandingAmount *float64 `json:"outstandingAmount,omitempty"` + // Date of the most recent invoice in ISO 8601 format. Only returned in list queries. + LastInvoiceDate *string `json:"lastInvoiceDate,omitempty"` + // Primary currency used in invoices for this customer. Only returned in list queries. + InvoiceCurrency *string `json:"invoiceCurrency,omitempty"` // Array of tags associated with the customer for categorization Tags []ListCustomersTag `json:"tags"` + // AI-generated description of what the company does + Description *string `json:"description"` + // Primary industry of the company + Industry *string `json:"industry"` + // Business model type + CompanyType *string `json:"companyType"` + // Estimated number of employees + EmployeeCount *string `json:"employeeCount"` + // Year the company was founded + FoundedYear *float64 `json:"foundedYear"` + // Estimated annual revenue range + EstimatedRevenue *string `json:"estimatedRevenue"` + // Current funding stage + FundingStage *string `json:"fundingStage"` + // Total funding raised + TotalFunding *string `json:"totalFunding"` + // Company headquarters location + HeadquartersLocation *string `json:"headquartersLocation"` + // IANA timezone of the company headquarters + Timezone *string `json:"timezone"` + // LinkedIn company page URL + LinkedinURL *string `json:"linkedinUrl"` + // Twitter/X profile URL + TwitterURL *string `json:"twitterUrl"` + // Instagram profile URL + InstagramURL *string `json:"instagramUrl"` + // Facebook page URL + FacebookURL *string `json:"facebookUrl"` + // URL to the company logo + LogoURL *string `json:"logoUrl"` + // Name of the CEO or founder + CeoName *string `json:"ceoName"` + // Name of the finance/AP contact for invoicing + FinanceContact *string `json:"financeContact"` + // Email of the finance/AP contact + FinanceContactEmail *string `json:"financeContactEmail"` + // Primary business language (ISO 639-1 code) + PrimaryLanguage *string `json:"primaryLanguage"` + // Month when the fiscal year ends + FiscalYearEnd *string `json:"fiscalYearEnd"` + // Status of the enrichment process + EnrichmentStatus *string `json:"enrichmentStatus"` + // When the customer was last enriched + EnrichedAt *string `json:"enrichedAt"` } func (o *ListCustomersData) GetID() string { @@ -278,6 +334,34 @@ func (o *ListCustomersData) GetProjectCount() float64 { return o.ProjectCount } +func (o *ListCustomersData) GetTotalRevenue() *float64 { + if o == nil { + return nil + } + return o.TotalRevenue +} + +func (o *ListCustomersData) GetOutstandingAmount() *float64 { + if o == nil { + return nil + } + return o.OutstandingAmount +} + +func (o *ListCustomersData) GetLastInvoiceDate() *string { + if o == nil { + return nil + } + return o.LastInvoiceDate +} + +func (o *ListCustomersData) GetInvoiceCurrency() *string { + if o == nil { + return nil + } + return o.InvoiceCurrency +} + func (o *ListCustomersData) GetTags() []ListCustomersTag { if o == nil { return []ListCustomersTag{} @@ -285,6 +369,160 @@ func (o *ListCustomersData) GetTags() []ListCustomersTag { return o.Tags } +func (o *ListCustomersData) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *ListCustomersData) GetIndustry() *string { + if o == nil { + return nil + } + return o.Industry +} + +func (o *ListCustomersData) GetCompanyType() *string { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *ListCustomersData) GetEmployeeCount() *string { + if o == nil { + return nil + } + return o.EmployeeCount +} + +func (o *ListCustomersData) GetFoundedYear() *float64 { + if o == nil { + return nil + } + return o.FoundedYear +} + +func (o *ListCustomersData) GetEstimatedRevenue() *string { + if o == nil { + return nil + } + return o.EstimatedRevenue +} + +func (o *ListCustomersData) GetFundingStage() *string { + if o == nil { + return nil + } + return o.FundingStage +} + +func (o *ListCustomersData) GetTotalFunding() *string { + if o == nil { + return nil + } + return o.TotalFunding +} + +func (o *ListCustomersData) GetHeadquartersLocation() *string { + if o == nil { + return nil + } + return o.HeadquartersLocation +} + +func (o *ListCustomersData) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *ListCustomersData) GetLinkedinURL() *string { + if o == nil { + return nil + } + return o.LinkedinURL +} + +func (o *ListCustomersData) GetTwitterURL() *string { + if o == nil { + return nil + } + return o.TwitterURL +} + +func (o *ListCustomersData) GetInstagramURL() *string { + if o == nil { + return nil + } + return o.InstagramURL +} + +func (o *ListCustomersData) GetFacebookURL() *string { + if o == nil { + return nil + } + return o.FacebookURL +} + +func (o *ListCustomersData) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *ListCustomersData) GetCeoName() *string { + if o == nil { + return nil + } + return o.CeoName +} + +func (o *ListCustomersData) GetFinanceContact() *string { + if o == nil { + return nil + } + return o.FinanceContact +} + +func (o *ListCustomersData) GetFinanceContactEmail() *string { + if o == nil { + return nil + } + return o.FinanceContactEmail +} + +func (o *ListCustomersData) GetPrimaryLanguage() *string { + if o == nil { + return nil + } + return o.PrimaryLanguage +} + +func (o *ListCustomersData) GetFiscalYearEnd() *string { + if o == nil { + return nil + } + return o.FiscalYearEnd +} + +func (o *ListCustomersData) GetEnrichmentStatus() *string { + if o == nil { + return nil + } + return o.EnrichmentStatus +} + +func (o *ListCustomersData) GetEnrichedAt() *string { + if o == nil { + return nil + } + return o.EnrichedAt +} + // ListCustomersResponseBody - Retrieve a list of customers for the authenticated team. type ListCustomersResponseBody struct { // Pagination metadata for the customers response @@ -311,6 +549,8 @@ type ListCustomersResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of customers for the authenticated team. Object *ListCustomersResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListCustomersResponse) GetHTTPMeta() components.HTTPMetadata { @@ -326,3 +566,10 @@ func (o *ListCustomersResponse) GetObject() *ListCustomersResponseBody { } return o.Object } + +func (o *ListCustomersResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listdocuments.go b/models/operations/listdocuments.go index df9d4e7..82466d3 100644 --- a/models/operations/listdocuments.go +++ b/models/operations/listdocuments.go @@ -7,11 +7,20 @@ import ( ) type ListDocumentsRequest struct { - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` - Sort []string `queryParam:"style=form,explode=true,name=sort"` + // A cursor for pagination. Pass the value returned from the previous response to get the next page. + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Sort as [column, direction]. Currently documents are sorted by created date descending. + Sort []string `queryParam:"style=form,explode=true,name=sort"` + // Number of documents to return per page. PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` - Q *string `queryParam:"style=form,explode=true,name=q"` - Tags []string `queryParam:"style=form,explode=true,name=tags"` + // Search query string to filter documents by text. + Q *string `queryParam:"style=form,explode=true,name=q"` + // Array of tag IDs to filter documents by tags. + Tags []string `queryParam:"style=form,explode=true,name=tags"` + // Start date for filtering documents (ISO 8601 date). + Start *string `queryParam:"style=form,explode=true,name=start"` + // End date for filtering documents (ISO 8601 date). + End *string `queryParam:"style=form,explode=true,name=end"` } func (o *ListDocumentsRequest) GetCursor() *string { @@ -49,6 +58,20 @@ func (o *ListDocumentsRequest) GetTags() []string { return o.Tags } +func (o *ListDocumentsRequest) GetStart() *string { + if o == nil { + return nil + } + return o.Start +} + +func (o *ListDocumentsRequest) GetEnd() *string { + if o == nil { + return nil + } + return o.End +} + // ListDocumentsMeta - Pagination metadata for the documents list. type ListDocumentsMeta struct { // Cursor for pagination. @@ -195,6 +218,8 @@ type ListDocumentsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of documents for the authenticated team. Object *ListDocumentsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListDocumentsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -210,3 +235,10 @@ func (o *ListDocumentsResponse) GetObject() *ListDocumentsResponseBody { } return o.Object } + +func (o *ListDocumentsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listinboxitems.go b/models/operations/listinboxitems.go index 64b4ee1..cf6fcb1 100644 --- a/models/operations/listinboxitems.go +++ b/models/operations/listinboxitems.go @@ -8,11 +8,15 @@ import ( "github.com/midday-ai/midday-go/models/components" ) +// ListInboxItemsStatus - Filter by processing status: done (processed), pending (awaiting action), suggested_match (auto-matched), no_match (unmatched), other type ListInboxItemsStatus string const ( - ListInboxItemsStatusDone ListInboxItemsStatus = "done" - ListInboxItemsStatusPending ListInboxItemsStatus = "pending" + ListInboxItemsStatusDone ListInboxItemsStatus = "done" + ListInboxItemsStatusPending ListInboxItemsStatus = "pending" + ListInboxItemsStatusSuggestedMatch ListInboxItemsStatus = "suggested_match" + ListInboxItemsStatusNoMatch ListInboxItemsStatus = "no_match" + ListInboxItemsStatusOther ListInboxItemsStatus = "other" ) func (e ListInboxItemsStatus) ToPointer() *ListInboxItemsStatus { @@ -27,6 +31,12 @@ func (e *ListInboxItemsStatus) UnmarshalJSON(data []byte) error { case "done": fallthrough case "pending": + fallthrough + case "suggested_match": + fallthrough + case "no_match": + fallthrough + case "other": *e = ListInboxItemsStatus(v) return nil default: @@ -34,12 +44,48 @@ func (e *ListInboxItemsStatus) UnmarshalJSON(data []byte) error { } } +// Tab filter: all or other +type Tab string + +const ( + TabAll Tab = "all" + TabOther Tab = "other" +) + +func (e Tab) ToPointer() *Tab { + return &e +} +func (e *Tab) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "all": + fallthrough + case "other": + *e = Tab(v) + return nil + default: + return fmt.Errorf("invalid value for Tab: %v", v) + } +} + type ListInboxItemsRequest struct { - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` - Order *string `queryParam:"style=form,explode=true,name=order"` - PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` - Q *string `queryParam:"style=form,explode=true,name=q"` - Status *ListInboxItemsStatus `queryParam:"style=form,explode=true,name=status"` + // Pagination cursor from previous response + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Sort direction: asc or desc + Order *string `queryParam:"style=form,explode=true,name=order"` + // Sort field. Valid values: alphabetical, document_date. Defaults to created date. + Sort *string `queryParam:"style=form,explode=true,name=sort"` + // Number of items per page (1-100) + PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` + // Search query to filter inbox items + Q *string `queryParam:"style=form,explode=true,name=q"` + // Filter by processing status: done (processed), pending (awaiting action), suggested_match (auto-matched), no_match (unmatched), other + Status *ListInboxItemsStatus `queryParam:"style=form,explode=true,name=status"` + // Tab filter: all or other + Tab *Tab `queryParam:"style=form,explode=true,name=tab"` } func (o *ListInboxItemsRequest) GetCursor() *string { @@ -56,6 +102,13 @@ func (o *ListInboxItemsRequest) GetOrder() *string { return o.Order } +func (o *ListInboxItemsRequest) GetSort() *string { + if o == nil { + return nil + } + return o.Sort +} + func (o *ListInboxItemsRequest) GetPageSize() *float64 { if o == nil { return nil @@ -77,6 +130,13 @@ func (o *ListInboxItemsRequest) GetStatus() *ListInboxItemsStatus { return o.Status } +func (o *ListInboxItemsRequest) GetTab() *Tab { + if o == nil { + return nil + } + return o.Tab +} + // ListInboxItemsMeta - Pagination metadata for the inbox list response. type ListInboxItemsMeta struct { // A cursor for pagination, representing the last item from the previous page. @@ -304,6 +364,8 @@ type ListInboxItemsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of inbox items for the authenticated team. Object *ListInboxItemsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListInboxItemsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -319,3 +381,10 @@ func (o *ListInboxItemsResponse) GetObject() *ListInboxItemsResponseBody { } return o.Object } + +func (o *ListInboxItemsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listinvoices.go b/models/operations/listinvoices.go index 6d9275a..99c1042 100644 --- a/models/operations/listinvoices.go +++ b/models/operations/listinvoices.go @@ -9,14 +9,28 @@ import ( ) type ListInvoicesRequest struct { - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` - Sort []string `queryParam:"style=form,explode=true,name=sort"` - PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` - Q *string `queryParam:"style=form,explode=true,name=q"` - Start *string `queryParam:"style=form,explode=true,name=start"` - End *string `queryParam:"style=form,explode=true,name=end"` - Statuses []string `queryParam:"style=form,explode=true,name=statuses"` + // A cursor for pagination, representing the last item from the previous page. + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Sort as [column, direction]. Columns: created_at, due_date, issue_date, amount, status, customer, invoice_number. Direction: asc or desc. + Sort []string `queryParam:"style=form,explode=true,name=sort"` + // Number of invoices to return per page (1-100). + PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` + // Search query string to filter invoices by text. + Q *string `queryParam:"style=form,explode=true,name=q"` + // Start date (inclusive) for filtering invoices, in ISO 8601 format. + Start *string `queryParam:"style=form,explode=true,name=start"` + // End date (inclusive) for filtering invoices, in ISO 8601 format. + End *string `queryParam:"style=form,explode=true,name=end"` + // List of invoice statuses to filter by (e.g., 'paid', 'unpaid', 'overdue'). + Statuses []string `queryParam:"style=form,explode=true,name=statuses"` + // List of customer IDs to filter invoices. Customers []string `queryParam:"style=form,explode=true,name=customers"` + // List of invoice IDs to filter by. + Ids []string `queryParam:"style=form,explode=true,name=ids"` + // List of recurring series IDs to filter invoices by (shows all invoices from these series). + RecurringIds []string `queryParam:"style=form,explode=true,name=recurringIds"` + // Filter by recurring status. true = only recurring invoices, false = only non-recurring invoices. + Recurring *bool `queryParam:"style=form,explode=true,name=recurring"` } func (o *ListInvoicesRequest) GetCursor() *string { @@ -75,6 +89,27 @@ func (o *ListInvoicesRequest) GetCustomers() []string { return o.Customers } +func (o *ListInvoicesRequest) GetIds() []string { + if o == nil { + return nil + } + return o.Ids +} + +func (o *ListInvoicesRequest) GetRecurringIds() []string { + if o == nil { + return nil + } + return o.RecurringIds +} + +func (o *ListInvoicesRequest) GetRecurring() *bool { + if o == nil { + return nil + } + return o.Recurring +} + // ListInvoicesMeta - Pagination metadata type ListInvoicesMeta struct { // Cursor for pagination; null if there is no next page @@ -195,14 +230,14 @@ type ListInvoicesData struct { DueDate string `json:"dueDate"` // Issue date of the invoice in ISO 8601 format IssueDate string `json:"issueDate"` - // Invoice number as shown to the customer - InvoiceNumber string `json:"invoiceNumber"` - // Total amount of the invoice - Amount float64 `json:"amount"` + // Invoice number as shown to the customer (auto-generated if not provided) + InvoiceNumber *string `json:"invoiceNumber,omitempty"` + // Total amount of the invoice, or null if not yet calculated + Amount *float64 `json:"amount"` // Currency code (ISO 4217) for the invoice amount - Currency string `json:"currency"` + Currency *string `json:"currency"` // Customer details - Customer ListInvoicesCustomer `json:"customer"` + Customer *ListInvoicesCustomer `json:"customer"` // Timestamp when the invoice was paid (ISO 8601), or null if unpaid PaidAt *string `json:"paidAt"` // Timestamp when a payment reminder was sent (ISO 8601), or null if never sent @@ -229,6 +264,10 @@ type ListInvoicesData struct { CreatedAt string `json:"createdAt"` // Timestamp when the invoice was last updated (ISO 8601) UpdatedAt string `json:"updatedAt"` + // URL to download the invoice PDF, or null if not generated + PdfURL *string `json:"pdfUrl"` + // URL to preview the invoice in the browser, or null if not generated + PreviewURL *string `json:"previewUrl"` } func (o *ListInvoicesData) GetID() string { @@ -259,30 +298,30 @@ func (o *ListInvoicesData) GetIssueDate() string { return o.IssueDate } -func (o *ListInvoicesData) GetInvoiceNumber() string { +func (o *ListInvoicesData) GetInvoiceNumber() *string { if o == nil { - return "" + return nil } return o.InvoiceNumber } -func (o *ListInvoicesData) GetAmount() float64 { +func (o *ListInvoicesData) GetAmount() *float64 { if o == nil { - return 0.0 + return nil } return o.Amount } -func (o *ListInvoicesData) GetCurrency() string { +func (o *ListInvoicesData) GetCurrency() *string { if o == nil { - return "" + return nil } return o.Currency } -func (o *ListInvoicesData) GetCustomer() ListInvoicesCustomer { +func (o *ListInvoicesData) GetCustomer() *ListInvoicesCustomer { if o == nil { - return ListInvoicesCustomer{} + return nil } return o.Customer } @@ -378,6 +417,20 @@ func (o *ListInvoicesData) GetUpdatedAt() string { return o.UpdatedAt } +func (o *ListInvoicesData) GetPdfURL() *string { + if o == nil { + return nil + } + return o.PdfURL +} + +func (o *ListInvoicesData) GetPreviewURL() *string { + if o == nil { + return nil + } + return o.PreviewURL +} + // ListInvoicesResponseBody - Response containing a list of invoices and pagination metadata type ListInvoicesResponseBody struct { // Pagination metadata @@ -404,6 +457,8 @@ type ListInvoicesResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // A list of invoices for the authenticated team. Object *ListInvoicesResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListInvoicesResponse) GetHTTPMeta() components.HTTPMetadata { @@ -419,3 +474,10 @@ func (o *ListInvoicesResponse) GetObject() *ListInvoicesResponseBody { } return o.Object } + +func (o *ListInvoicesResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listnotifications.go b/models/operations/listnotifications.go new file mode 100644 index 0000000..0ae79fb --- /dev/null +++ b/models/operations/listnotifications.go @@ -0,0 +1,219 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "errors" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" +) + +type ListNotificationsStatusEnum2 string + +const ( + ListNotificationsStatusEnum2Unread ListNotificationsStatusEnum2 = "unread" + ListNotificationsStatusEnum2Read ListNotificationsStatusEnum2 = "read" + ListNotificationsStatusEnum2Archived ListNotificationsStatusEnum2 = "archived" +) + +func (e ListNotificationsStatusEnum2) ToPointer() *ListNotificationsStatusEnum2 { + return &e +} +func (e *ListNotificationsStatusEnum2) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "unread": + fallthrough + case "read": + fallthrough + case "archived": + *e = ListNotificationsStatusEnum2(v) + return nil + default: + return fmt.Errorf("invalid value for ListNotificationsStatusEnum2: %v", v) + } +} + +type ListNotificationsStatusEnum1 string + +const ( + ListNotificationsStatusEnum1Unread ListNotificationsStatusEnum1 = "unread" + ListNotificationsStatusEnum1Read ListNotificationsStatusEnum1 = "read" + ListNotificationsStatusEnum1Archived ListNotificationsStatusEnum1 = "archived" +) + +func (e ListNotificationsStatusEnum1) ToPointer() *ListNotificationsStatusEnum1 { + return &e +} +func (e *ListNotificationsStatusEnum1) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "unread": + fallthrough + case "read": + fallthrough + case "archived": + *e = ListNotificationsStatusEnum1(v) + return nil + default: + return fmt.Errorf("invalid value for ListNotificationsStatusEnum1: %v", v) + } +} + +type StatusType string + +const ( + StatusTypeListNotificationsStatusEnum1 StatusType = "listNotifications_status_enum_1" + StatusTypeArrayOfListNotificationsStatusEnum2 StatusType = "arrayOfListNotificationsStatusEnum2" +) + +// Status - Filter by notification status. Can be a single status or array of statuses. unread = new notifications, read = viewed but not dismissed, archived = dismissed from view +type Status struct { + ListNotificationsStatusEnum1 *ListNotificationsStatusEnum1 `queryParam:"inline"` + ArrayOfListNotificationsStatusEnum2 []ListNotificationsStatusEnum2 `queryParam:"inline"` + + Type StatusType +} + +func CreateStatusListNotificationsStatusEnum1(listNotificationsStatusEnum1 ListNotificationsStatusEnum1) Status { + typ := StatusTypeListNotificationsStatusEnum1 + + return Status{ + ListNotificationsStatusEnum1: &listNotificationsStatusEnum1, + Type: typ, + } +} + +func CreateStatusArrayOfListNotificationsStatusEnum2(arrayOfListNotificationsStatusEnum2 []ListNotificationsStatusEnum2) Status { + typ := StatusTypeArrayOfListNotificationsStatusEnum2 + + return Status{ + ArrayOfListNotificationsStatusEnum2: arrayOfListNotificationsStatusEnum2, + Type: typ, + } +} + +func (u *Status) UnmarshalJSON(data []byte) error { + + var listNotificationsStatusEnum1 ListNotificationsStatusEnum1 = ListNotificationsStatusEnum1("") + if err := utils.UnmarshalJSON(data, &listNotificationsStatusEnum1, "", true, true); err == nil { + u.ListNotificationsStatusEnum1 = &listNotificationsStatusEnum1 + u.Type = StatusTypeListNotificationsStatusEnum1 + return nil + } + + var arrayOfListNotificationsStatusEnum2 []ListNotificationsStatusEnum2 = []ListNotificationsStatusEnum2{} + if err := utils.UnmarshalJSON(data, &arrayOfListNotificationsStatusEnum2, "", true, true); err == nil { + u.ArrayOfListNotificationsStatusEnum2 = arrayOfListNotificationsStatusEnum2 + u.Type = StatusTypeArrayOfListNotificationsStatusEnum2 + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Status", string(data)) +} + +func (u Status) MarshalJSON() ([]byte, error) { + if u.ListNotificationsStatusEnum1 != nil { + return utils.MarshalJSON(u.ListNotificationsStatusEnum1, "", true) + } + + if u.ArrayOfListNotificationsStatusEnum2 != nil { + return utils.MarshalJSON(u.ArrayOfListNotificationsStatusEnum2, "", true) + } + + return nil, errors.New("could not marshal union type Status: all fields are null") +} + +type ListNotificationsRequest struct { + // Cursor for pagination, representing the last item from the previous page + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Number of notifications to return per page (1-100) + PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` + // Filter by notification status. Can be a single status or array of statuses. unread = new notifications, read = viewed but not dismissed, archived = dismissed from view + Status *Status `queryParam:"style=form,explode=true,name=status"` + // Filter notifications by specific user ID + UserID *string `queryParam:"style=form,explode=true,name=userId"` + // Filter notifications by priority level (1-10) + Priority *int64 `queryParam:"style=form,explode=true,name=priority"` + // Filter notifications by maximum priority level (priority <= maxPriority). Use 3 for user-facing notifications only. + MaxPriority *int64 `queryParam:"style=form,explode=true,name=maxPriority"` +} + +func (o *ListNotificationsRequest) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +func (o *ListNotificationsRequest) GetPageSize() *float64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListNotificationsRequest) GetStatus() *Status { + if o == nil { + return nil + } + return o.Status +} + +func (o *ListNotificationsRequest) GetUserID() *string { + if o == nil { + return nil + } + return o.UserID +} + +func (o *ListNotificationsRequest) GetPriority() *int64 { + if o == nil { + return nil + } + return o.Priority +} + +func (o *ListNotificationsRequest) GetMaxPriority() *int64 { + if o == nil { + return nil + } + return o.MaxPriority +} + +type ListNotificationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Retrieve a list of notifications for the authenticated team. + NotificationsResponseSchema *components.NotificationsResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *ListNotificationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListNotificationsResponse) GetNotificationsResponseSchema() *components.NotificationsResponseSchema { + if o == nil { + return nil + } + return o.NotificationsResponseSchema +} + +func (o *ListNotificationsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listtags.go b/models/operations/listtags.go index 3f1e7e5..09f365b 100644 --- a/models/operations/listtags.go +++ b/models/operations/listtags.go @@ -10,6 +10,8 @@ type ListTagsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of tags for the authenticated team. TagsResponse *components.TagsResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTagsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -25,3 +27,10 @@ func (o *ListTagsResponse) GetTagsResponse() *components.TagsResponse { } return o.TagsResponse } + +func (o *ListTagsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listteammembers.go b/models/operations/listteammembers.go index 4997ba5..cf2dd03 100644 --- a/models/operations/listteammembers.go +++ b/models/operations/listteammembers.go @@ -9,6 +9,7 @@ import ( ) type ListTeamMembersRequest struct { + // Unique identifier of the team ID string `pathParam:"style=simple,explode=false,name=id"` } @@ -102,6 +103,8 @@ type ListTeamMembersResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Team members Object *ListTeamMembersResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTeamMembersResponse) GetHTTPMeta() components.HTTPMetadata { @@ -117,3 +120,10 @@ func (o *ListTeamMembersResponse) GetObject() *ListTeamMembersResponseBody { } return o.Object } + +func (o *ListTeamMembersResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listteams.go b/models/operations/listteams.go index 7c7c9ec..782e403 100644 --- a/models/operations/listteams.go +++ b/models/operations/listteams.go @@ -94,6 +94,8 @@ type ListTeamsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of teams for the authenticated user. Object *ListTeamsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTeamsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -109,3 +111,10 @@ func (o *ListTeamsResponse) GetObject() *ListTeamsResponseBody { } return o.Object } + +func (o *ListTeamsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listtrackerentries.go b/models/operations/listtrackerentries.go index 61edf7e..1c3183c 100644 --- a/models/operations/listtrackerentries.go +++ b/models/operations/listtrackerentries.go @@ -7,8 +7,11 @@ import ( ) type ListTrackerEntriesRequest struct { - From string `queryParam:"style=form,explode=true,name=from"` - To string `queryParam:"style=form,explode=true,name=to"` + // Start date of the range (inclusive) in YYYY-MM-DD format + From string `queryParam:"style=form,explode=true,name=from"` + // End date of the range (inclusive) in YYYY-MM-DD format + To string `queryParam:"style=form,explode=true,name=to"` + // Optional project ID to filter tracker entries by specific project ProjectID *string `queryParam:"style=form,explode=true,name=projectId"` } @@ -366,6 +369,8 @@ type ListTrackerEntriesResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // List all tracker entries for the authenticated team. Object *ListTrackerEntriesResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTrackerEntriesResponse) GetHTTPMeta() components.HTTPMetadata { @@ -381,3 +386,10 @@ func (o *ListTrackerEntriesResponse) GetObject() *ListTrackerEntriesResponseBody } return o.Object } + +func (o *ListTrackerEntriesResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listtrackerprojects.go b/models/operations/listtrackerprojects.go index 3829c7c..aa18777 100644 --- a/models/operations/listtrackerprojects.go +++ b/models/operations/listtrackerprojects.go @@ -36,16 +36,24 @@ func (e *ListTrackerProjectsStatus) UnmarshalJSON(data []byte) error { } type ListTrackerProjectsRequest struct { - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Cursor for pagination, representing the last item from the previous page + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Number of projects to return per page (1-100) PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` - Q *string `queryParam:"style=form,explode=true,name=q"` - Start *string `queryParam:"style=form,explode=true,name=start"` - End *string `queryParam:"style=form,explode=true,name=end"` + // Search query string to filter projects by name or description + Q *string `queryParam:"style=form,explode=true,name=q"` + // Start date for filtering projects by creation date in YYYY-MM-DD format + Start *string `queryParam:"style=form,explode=true,name=start"` + // End date for filtering projects by creation date in YYYY-MM-DD format + End *string `queryParam:"style=form,explode=true,name=end"` // Filter projects by status - Status *ListTrackerProjectsStatus `queryParam:"style=form,explode=true,name=status"` - Customers []string `queryParam:"style=form,explode=true,name=customers"` - Tags []string `queryParam:"style=form,explode=true,name=tags"` - Sort []string `queryParam:"style=form,explode=true,name=sort"` + Status *ListTrackerProjectsStatus `queryParam:"style=form,explode=true,name=status"` + // Array of customer IDs to filter projects by specific customers + Customers []string `queryParam:"style=form,explode=true,name=customers"` + // Array of tag IDs to filter projects by specific tags + Tags []string `queryParam:"style=form,explode=true,name=tags"` + // Sort as [column, direction]. Columns: name, created_at, time, amount, assigned, customer, tags. Direction: asc or desc. + Sort []string `queryParam:"style=form,explode=true,name=sort"` } func (o *ListTrackerProjectsRequest) GetCursor() *string { @@ -115,6 +123,8 @@ type ListTrackerProjectsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // List all tracker projects for the authenticated team. TrackerProjectsResponse *components.TrackerProjectsResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTrackerProjectsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -130,3 +140,10 @@ func (o *ListTrackerProjectsResponse) GetTrackerProjectsResponse() *components.T } return o.TrackerProjectsResponse } + +func (o *ListTrackerProjectsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/listtransactions.go b/models/operations/listtransactions.go index 596b0f6..9681983 100644 --- a/models/operations/listtransactions.go +++ b/models/operations/listtransactions.go @@ -8,6 +8,47 @@ import ( "github.com/midday-ai/midday-go/models/components" ) +type ListTransactionsStatus string + +const ( + ListTransactionsStatusBlank ListTransactionsStatus = "blank" + ListTransactionsStatusReceiptMatch ListTransactionsStatus = "receipt_match" + ListTransactionsStatusInReview ListTransactionsStatus = "in_review" + ListTransactionsStatusExportError ListTransactionsStatus = "export_error" + ListTransactionsStatusExported ListTransactionsStatus = "exported" + ListTransactionsStatusExcluded ListTransactionsStatus = "excluded" + ListTransactionsStatusArchived ListTransactionsStatus = "archived" +) + +func (e ListTransactionsStatus) ToPointer() *ListTransactionsStatus { + return &e +} +func (e *ListTransactionsStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "blank": + fallthrough + case "receipt_match": + fallthrough + case "in_review": + fallthrough + case "export_error": + fallthrough + case "exported": + fallthrough + case "excluded": + fallthrough + case "archived": + *e = ListTransactionsStatus(v) + return nil + default: + return fmt.Errorf("invalid value for ListTransactionsStatus: %v", v) + } +} + // Attachments - Filter transactions based on attachment presence. 'include' returns only transactions with attachments, 'exclude' returns only transactions without attachments type Attachments string @@ -35,7 +76,7 @@ func (e *Attachments) UnmarshalJSON(data []byte) error { } } -// ListTransactionsType - Transaction type to filter by. 'income' for money received, 'expense' for money spent +// ListTransactionsType - Filter by transaction type. 'income' for money received, 'expense' for money spent type ListTransactionsType string const ( @@ -62,25 +103,72 @@ func (e *ListTransactionsType) UnmarshalJSON(data []byte) error { } } +// Manual - Filter transactions based on whether they were manually imported. 'include' returns only manual transactions, 'exclude' returns only non-manual transactions +type Manual string + +const ( + ManualInclude Manual = "include" + ManualExclude Manual = "exclude" +) + +func (e Manual) ToPointer() *Manual { + return &e +} +func (e *Manual) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "include": + fallthrough + case "exclude": + *e = Manual(v) + return nil + default: + return fmt.Errorf("invalid value for Manual: %v", v) + } +} + type ListTransactionsRequest struct { - Cursor *string `queryParam:"style=form,explode=true,name=cursor"` - Sort []string `queryParam:"style=form,explode=true,name=sort"` - PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` - Q *string `queryParam:"style=form,explode=true,name=q"` + // Cursor for pagination, representing the last item from the previous page + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // Sort as [column, direction]. Columns: date, amount, name, status, attachment, assigned, bank_account, category, tags, counterparty. Direction: asc or desc. + Sort []string `queryParam:"style=form,explode=true,name=sort"` + // Number of transactions to return per page (1-10000) + PageSize *float64 `queryParam:"style=form,explode=true,name=pageSize"` + // Search query string to filter transactions by name, description, or other text fields + Q *string `queryParam:"style=form,explode=true,name=q"` + // Array of category slugs to filter transactions by specific categories Categories []string `queryParam:"style=form,explode=true,name=categories"` - Tags []string `queryParam:"style=form,explode=true,name=tags"` - Start *string `queryParam:"style=form,explode=true,name=start"` - End *string `queryParam:"style=form,explode=true,name=end"` - Accounts []string `queryParam:"style=form,explode=true,name=accounts"` - Assignees []string `queryParam:"style=form,explode=true,name=assignees"` - Statuses []string `queryParam:"style=form,explode=true,name=statuses"` - Recurring []string `queryParam:"style=form,explode=true,name=recurring"` + // Array of tag IDs to filter transactions by specific tags + Tags []string `queryParam:"style=form,explode=true,name=tags"` + // Start date (inclusive) for filtering transactions in ISO 8601 format + Start *string `queryParam:"style=form,explode=true,name=start"` + // End date (inclusive) for filtering transactions in ISO 8601 format + End *string `queryParam:"style=form,explode=true,name=end"` + // Array of bank account IDs to filter transactions by specific accounts + Accounts []string `queryParam:"style=form,explode=true,name=accounts"` + // Array of user IDs to filter transactions by assigned users + Assignees []string `queryParam:"style=form,explode=true,name=assignees"` + // Array of transaction list status filters. Supported UI filters: 'blank', 'receipt_match', 'in_review', 'export_error', 'exported', 'excluded', 'archived' + Statuses []ListTransactionsStatus `queryParam:"style=form,explode=true,name=statuses"` + // Array of recurring frequency values to filter by. Available frequencies: 'weekly', 'monthly', 'annually', 'irregular' + Recurring []string `queryParam:"style=form,explode=true,name=recurring"` // Filter transactions based on attachment presence. 'include' returns only transactions with attachments, 'exclude' returns only transactions without attachments Attachments *Attachments `queryParam:"style=form,explode=true,name=attachments"` - AmountRange []*float64 `queryParam:"style=form,explode=true,name=amountRange"` - Amount []string `queryParam:"style=form,explode=true,name=amount"` - // Transaction type to filter by. 'income' for money received, 'expense' for money spent + // Amount range as [min, max] to filter transactions by monetary value + AmountRange []*float64 `queryParam:"style=form,explode=true,name=amountRange"` + // Array of specific amounts (as strings) to filter transactions by exact values + Amount []string `queryParam:"style=form,explode=true,name=amount"` + // Filter by transaction type. 'income' for money received, 'expense' for money spent Type *ListTransactionsType `queryParam:"style=form,explode=true,name=type"` + // Filter transactions based on whether they were manually imported. 'include' returns only manual transactions, 'exclude' returns only non-manual transactions + Manual *Manual `queryParam:"style=form,explode=true,name=manual"` + // Filter by export status. true = only exported transactions, false = only NOT exported transactions, undefined = no filter + Exported *bool `queryParam:"style=form,explode=true,name=exported"` + // Filter by fulfillment status. true = transactions ready for review (has attachments OR status=completed), false = not ready, undefined = no filter + Fulfilled *bool `queryParam:"style=form,explode=true,name=fulfilled"` } func (o *ListTransactionsRequest) GetCursor() *string { @@ -153,7 +241,7 @@ func (o *ListTransactionsRequest) GetAssignees() []string { return o.Assignees } -func (o *ListTransactionsRequest) GetStatuses() []string { +func (o *ListTransactionsRequest) GetStatuses() []ListTransactionsStatus { if o == nil { return nil } @@ -195,6 +283,27 @@ func (o *ListTransactionsRequest) GetType() *ListTransactionsType { return o.Type } +func (o *ListTransactionsRequest) GetManual() *Manual { + if o == nil { + return nil + } + return o.Manual +} + +func (o *ListTransactionsRequest) GetExported() *bool { + if o == nil { + return nil + } + return o.Exported +} + +func (o *ListTransactionsRequest) GetFulfilled() *bool { + if o == nil { + return nil + } + return o.Fulfilled +} + // ListTransactionsMeta - Pagination metadata for the transactions response type ListTransactionsMeta struct { // Cursor for the next page of results, undefined if no more pages @@ -252,6 +361,8 @@ type ListTransactionsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Retrieve a list of transactions for the authenticated team. Object *ListTransactionsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *ListTransactionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -267,3 +378,10 @@ func (o *ListTransactionsResponse) GetObject() *ListTransactionsResponseBody { } return o.Object } + +func (o *ListTransactionsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/options.go b/models/operations/options.go index 33acc55..cd21c57 100644 --- a/models/operations/options.go +++ b/models/operations/options.go @@ -21,8 +21,11 @@ const ( type AcceptHeaderEnum string const ( - AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" - AcceptHeaderEnumWildcardRootWildcard AcceptHeaderEnum = "*/*" + AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" + AcceptHeaderEnumTextPlain AcceptHeaderEnum = "text/plain" + AcceptHeaderEnumApplicationOctetStream AcceptHeaderEnum = "application/octet-stream" + AcceptHeaderEnumApplicationPdf AcceptHeaderEnum = "application/pdf" + AcceptHeaderEnumWildcardRootWildcard AcceptHeaderEnum = "*/*" ) func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { diff --git a/models/operations/outlookoauthcallback.go b/models/operations/outlookoauthcallback.go new file mode 100644 index 0000000..8072564 --- /dev/null +++ b/models/operations/outlookoauthcallback.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type OutlookOAuthCallbackRequest struct { + // OAuth authorization code from Microsoft + Code *string `queryParam:"style=form,explode=true,name=code"` + // Encrypted OAuth state parameter + State string `queryParam:"style=form,explode=true,name=state"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` +} + +func (o *OutlookOAuthCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *OutlookOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *OutlookOAuthCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +type OutlookOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *OutlookOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *OutlookOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/plaidwebhook.go b/models/operations/plaidwebhook.go new file mode 100644 index 0000000..ab27aca --- /dev/null +++ b/models/operations/plaidwebhook.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// PlaidWebhookResponseBody - Webhook processed successfully +type PlaidWebhookResponseBody struct { + Success bool `json:"success"` +} + +func (o *PlaidWebhookResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type PlaidWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *PlaidWebhookResponseBody +} + +func (o *PlaidWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PlaidWebhookResponse) GetObject() *PlaidWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/polarwebhook.go b/models/operations/polarwebhook.go new file mode 100644 index 0000000..457d7b0 --- /dev/null +++ b/models/operations/polarwebhook.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// PolarWebhookResponseBody - Webhook processed successfully +type PolarWebhookResponseBody struct { + Received bool `json:"received"` +} + +func (o *PolarWebhookResponseBody) GetReceived() bool { + if o == nil { + return false + } + return o.Received +} + +type PolarWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *PolarWebhookResponseBody +} + +func (o *PolarWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PolarWebhookResponse) GetObject() *PolarWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/postoauthauthorization.go b/models/operations/postoauthauthorization.go new file mode 100644 index 0000000..bd5b18b --- /dev/null +++ b/models/operations/postoauthauthorization.go @@ -0,0 +1,238 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/models/components" +) + +// Decision - User's authorization decision +type Decision string + +const ( + DecisionAllow Decision = "allow" + DecisionDeny Decision = "deny" +) + +func (e Decision) ToPointer() *Decision { + return &e +} +func (e *Decision) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "allow": + fallthrough + case "deny": + *e = Decision(v) + return nil + default: + return fmt.Errorf("invalid value for Decision: %v", v) + } +} + +type Scope string + +const ( + ScopeBankAccountsRead Scope = "bank-accounts.read" + ScopeBankAccountsWrite Scope = "bank-accounts.write" + ScopeCustomersRead Scope = "customers.read" + ScopeCustomersWrite Scope = "customers.write" + ScopeDocumentsRead Scope = "documents.read" + ScopeDocumentsWrite Scope = "documents.write" + ScopeInboxRead Scope = "inbox.read" + ScopeInboxWrite Scope = "inbox.write" + ScopeInvoicesRead Scope = "invoices.read" + ScopeInvoicesWrite Scope = "invoices.write" + ScopeReportsRead Scope = "reports.read" + ScopeSearchRead Scope = "search.read" + ScopeTagsRead Scope = "tags.read" + ScopeTagsWrite Scope = "tags.write" + ScopeTeamsRead Scope = "teams.read" + ScopeTeamsWrite Scope = "teams.write" + ScopeTrackerEntriesRead Scope = "tracker-entries.read" + ScopeTrackerEntriesWrite Scope = "tracker-entries.write" + ScopeTrackerProjectsRead Scope = "tracker-projects.read" + ScopeTrackerProjectsWrite Scope = "tracker-projects.write" + ScopeTransactionsRead Scope = "transactions.read" + ScopeTransactionsWrite Scope = "transactions.write" + ScopeUsersRead Scope = "users.read" + ScopeUsersWrite Scope = "users.write" + ScopeNotificationsRead Scope = "notifications.read" + ScopeNotificationsWrite Scope = "notifications.write" + ScopeApisAll Scope = "apis.all" + ScopeApisRead Scope = "apis.read" +) + +func (e Scope) ToPointer() *Scope { + return &e +} +func (e *Scope) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "bank-accounts.read": + fallthrough + case "bank-accounts.write": + fallthrough + case "customers.read": + fallthrough + case "customers.write": + fallthrough + case "documents.read": + fallthrough + case "documents.write": + fallthrough + case "inbox.read": + fallthrough + case "inbox.write": + fallthrough + case "invoices.read": + fallthrough + case "invoices.write": + fallthrough + case "reports.read": + fallthrough + case "search.read": + fallthrough + case "tags.read": + fallthrough + case "tags.write": + fallthrough + case "teams.read": + fallthrough + case "teams.write": + fallthrough + case "tracker-entries.read": + fallthrough + case "tracker-entries.write": + fallthrough + case "tracker-projects.read": + fallthrough + case "tracker-projects.write": + fallthrough + case "transactions.read": + fallthrough + case "transactions.write": + fallthrough + case "users.read": + fallthrough + case "users.write": + fallthrough + case "notifications.read": + fallthrough + case "notifications.write": + fallthrough + case "apis.all": + fallthrough + case "apis.read": + *e = Scope(v) + return nil + default: + return fmt.Errorf("invalid value for Scope: %v", v) + } +} + +type PostOAuthAuthorizationRequest struct { + // Client ID of the OAuth application + ClientID string `json:"client_id"` + // User's authorization decision + Decision Decision `json:"decision"` + // Scopes the user has approved + Scopes []Scope `json:"scopes"` + // Redirect URI for OAuth callback + RedirectURI string `json:"redirect_uri"` + // Opaque state parameter for CSRF protection + State *string `json:"state,omitempty"` + // Code challenge for PKCE (S256 method assumed) + CodeChallenge *string `json:"code_challenge,omitempty"` + // Team ID to authorize the application for + TeamID string `json:"teamId"` +} + +func (o *PostOAuthAuthorizationRequest) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *PostOAuthAuthorizationRequest) GetDecision() Decision { + if o == nil { + return Decision("") + } + return o.Decision +} + +func (o *PostOAuthAuthorizationRequest) GetScopes() []Scope { + if o == nil { + return []Scope{} + } + return o.Scopes +} + +func (o *PostOAuthAuthorizationRequest) GetRedirectURI() string { + if o == nil { + return "" + } + return o.RedirectURI +} + +func (o *PostOAuthAuthorizationRequest) GetState() *string { + if o == nil { + return nil + } + return o.State +} + +func (o *PostOAuthAuthorizationRequest) GetCodeChallenge() *string { + if o == nil { + return nil + } + return o.CodeChallenge +} + +func (o *PostOAuthAuthorizationRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +// PostOAuthAuthorizationResponseBody - Authorization decision processed, returns redirect URL +type PostOAuthAuthorizationResponseBody struct { + RedirectURL string `json:"redirect_url"` +} + +func (o *PostOAuthAuthorizationResponseBody) GetRedirectURL() string { + if o == nil { + return "" + } + return o.RedirectURL +} + +type PostOAuthAuthorizationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Authorization decision processed, returns redirect URL + Object *PostOAuthAuthorizationResponseBody +} + +func (o *PostOAuthAuthorizationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostOAuthAuthorizationResponse) GetObject() *PostOAuthAuthorizationResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/postoauthregister.go b/models/operations/postoauthregister.go new file mode 100644 index 0000000..7e98d46 --- /dev/null +++ b/models/operations/postoauthregister.go @@ -0,0 +1,239 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" +) + +type PostOAuthRegisterRequest struct { + // Human-readable name of the client + ClientName string `json:"client_name"` + // Array of redirect URIs + RedirectUris []string `json:"redirect_uris"` + // Requested grant types + GrantTypes []string `json:"grant_types,omitempty"` + // Token endpoint authentication method + TokenEndpointAuthMethod *string `default:"none" json:"token_endpoint_auth_method"` + // Space-separated requested scopes + Scope *string `json:"scope,omitempty"` + // URL of the client logo + LogoURI *string `json:"logo_uri,omitempty"` + // URL of the client homepage + ClientURI *string `json:"client_uri,omitempty"` + // Requested response types + ResponseTypes []string `json:"response_types,omitempty"` +} + +func (p PostOAuthRegisterRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PostOAuthRegisterRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PostOAuthRegisterRequest) GetClientName() string { + if o == nil { + return "" + } + return o.ClientName +} + +func (o *PostOAuthRegisterRequest) GetRedirectUris() []string { + if o == nil { + return []string{} + } + return o.RedirectUris +} + +func (o *PostOAuthRegisterRequest) GetGrantTypes() []string { + if o == nil { + return nil + } + return o.GrantTypes +} + +func (o *PostOAuthRegisterRequest) GetTokenEndpointAuthMethod() *string { + if o == nil { + return nil + } + return o.TokenEndpointAuthMethod +} + +func (o *PostOAuthRegisterRequest) GetScope() *string { + if o == nil { + return nil + } + return o.Scope +} + +func (o *PostOAuthRegisterRequest) GetLogoURI() *string { + if o == nil { + return nil + } + return o.LogoURI +} + +func (o *PostOAuthRegisterRequest) GetClientURI() *string { + if o == nil { + return nil + } + return o.ClientURI +} + +func (o *PostOAuthRegisterRequest) GetResponseTypes() []string { + if o == nil { + return nil + } + return o.ResponseTypes +} + +// PostOAuthRegisterResponseBody2 - Client registered successfully +type PostOAuthRegisterResponseBody2 struct { + // Assigned client ID + ClientID string `json:"client_id"` + // Human-readable name of the client + ClientName string `json:"client_name"` + // Registered redirect URIs + RedirectUris []string `json:"redirect_uris"` + // Granted grant types + GrantTypes []string `json:"grant_types"` + // Token endpoint authentication method + TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"` + // Supported response types + ResponseTypes []string `json:"response_types"` +} + +func (o *PostOAuthRegisterResponseBody2) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *PostOAuthRegisterResponseBody2) GetClientName() string { + if o == nil { + return "" + } + return o.ClientName +} + +func (o *PostOAuthRegisterResponseBody2) GetRedirectUris() []string { + if o == nil { + return []string{} + } + return o.RedirectUris +} + +func (o *PostOAuthRegisterResponseBody2) GetGrantTypes() []string { + if o == nil { + return []string{} + } + return o.GrantTypes +} + +func (o *PostOAuthRegisterResponseBody2) GetTokenEndpointAuthMethod() string { + if o == nil { + return "" + } + return o.TokenEndpointAuthMethod +} + +func (o *PostOAuthRegisterResponseBody2) GetResponseTypes() []string { + if o == nil { + return []string{} + } + return o.ResponseTypes +} + +// PostOAuthRegisterResponseBody1 - Existing client returned (deduplicated) +type PostOAuthRegisterResponseBody1 struct { + // Assigned client ID + ClientID string `json:"client_id"` + // Human-readable name of the client + ClientName string `json:"client_name"` + // Registered redirect URIs + RedirectUris []string `json:"redirect_uris"` + // Granted grant types + GrantTypes []string `json:"grant_types"` + // Token endpoint authentication method + TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"` + // Supported response types + ResponseTypes []string `json:"response_types"` +} + +func (o *PostOAuthRegisterResponseBody1) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *PostOAuthRegisterResponseBody1) GetClientName() string { + if o == nil { + return "" + } + return o.ClientName +} + +func (o *PostOAuthRegisterResponseBody1) GetRedirectUris() []string { + if o == nil { + return []string{} + } + return o.RedirectUris +} + +func (o *PostOAuthRegisterResponseBody1) GetGrantTypes() []string { + if o == nil { + return []string{} + } + return o.GrantTypes +} + +func (o *PostOAuthRegisterResponseBody1) GetTokenEndpointAuthMethod() string { + if o == nil { + return "" + } + return o.TokenEndpointAuthMethod +} + +func (o *PostOAuthRegisterResponseBody1) GetResponseTypes() []string { + if o == nil { + return []string{} + } + return o.ResponseTypes +} + +type PostOAuthRegisterResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Existing client returned (deduplicated) + TwoHundredApplicationJSONObject *PostOAuthRegisterResponseBody1 + // Client registered successfully + TwoHundredAndOneApplicationJSONObject *PostOAuthRegisterResponseBody2 +} + +func (o *PostOAuthRegisterResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostOAuthRegisterResponse) GetTwoHundredApplicationJSONObject() *PostOAuthRegisterResponseBody1 { + if o == nil { + return nil + } + return o.TwoHundredApplicationJSONObject +} + +func (o *PostOAuthRegisterResponse) GetTwoHundredAndOneApplicationJSONObject() *PostOAuthRegisterResponseBody2 { + if o == nil { + return nil + } + return o.TwoHundredAndOneApplicationJSONObject +} diff --git a/models/operations/postoauthrevoke.go b/models/operations/postoauthrevoke.go new file mode 100644 index 0000000..b3468c3 --- /dev/null +++ b/models/operations/postoauthrevoke.go @@ -0,0 +1,116 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/models/components" +) + +// TokenTypeHint - Hint about the token type +type TokenTypeHint string + +const ( + TokenTypeHintAccessToken TokenTypeHint = "access_token" + TokenTypeHintRefreshToken TokenTypeHint = "refresh_token" +) + +func (e TokenTypeHint) ToPointer() *TokenTypeHint { + return &e +} +func (e *TokenTypeHint) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "access_token": + fallthrough + case "refresh_token": + *e = TokenTypeHint(v) + return nil + default: + return fmt.Errorf("invalid value for TokenTypeHint: %v", v) + } +} + +type PostOAuthRevokeRequest struct { + // Token to revoke (access token or refresh token) + Token string `json:"token"` + // Hint about the token type + TokenTypeHint *TokenTypeHint `json:"token_type_hint,omitempty"` + // Client ID of the OAuth application + ClientID string `json:"client_id"` + // Client secret of the OAuth application (required for confidential clients) + ClientSecret *string `json:"client_secret,omitempty"` +} + +func (o *PostOAuthRevokeRequest) GetToken() string { + if o == nil { + return "" + } + return o.Token +} + +func (o *PostOAuthRevokeRequest) GetTokenTypeHint() *TokenTypeHint { + if o == nil { + return nil + } + return o.TokenTypeHint +} + +func (o *PostOAuthRevokeRequest) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *PostOAuthRevokeRequest) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +// PostOAuthRevokeResponseBody - Token revocation successful +type PostOAuthRevokeResponseBody struct { + Success bool `json:"success"` +} + +func (o *PostOAuthRevokeResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type PostOAuthRevokeResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Token revocation successful + Object *PostOAuthRevokeResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *PostOAuthRevokeResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostOAuthRevokeResponse) GetObject() *PostOAuthRevokeResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *PostOAuthRevokeResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/postoauthtoken.go b/models/operations/postoauthtoken.go new file mode 100644 index 0000000..be52b4e --- /dev/null +++ b/models/operations/postoauthtoken.go @@ -0,0 +1,102 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/models/components" +) + +// TokenType - Token type, always 'Bearer' +type TokenType string + +const ( + TokenTypeBearer TokenType = "Bearer" +) + +func (e TokenType) ToPointer() *TokenType { + return &e +} +func (e *TokenType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Bearer": + *e = TokenType(v) + return nil + default: + return fmt.Errorf("invalid value for TokenType: %v", v) + } +} + +// PostOAuthTokenResponseBody - Token exchange successful +type PostOAuthTokenResponseBody struct { + // Access token for API requests + AccessToken string `json:"access_token"` + // Token type, always 'Bearer' + TokenType TokenType `json:"token_type"` + // Token expiration time in seconds + ExpiresIn float64 `json:"expires_in"` + // Refresh token for obtaining new access tokens + RefreshToken string `json:"refresh_token"` + // Space-separated list of granted scopes + Scope string `json:"scope"` +} + +func (o *PostOAuthTokenResponseBody) GetAccessToken() string { + if o == nil { + return "" + } + return o.AccessToken +} + +func (o *PostOAuthTokenResponseBody) GetTokenType() TokenType { + if o == nil { + return TokenType("") + } + return o.TokenType +} + +func (o *PostOAuthTokenResponseBody) GetExpiresIn() float64 { + if o == nil { + return 0.0 + } + return o.ExpiresIn +} + +func (o *PostOAuthTokenResponseBody) GetRefreshToken() string { + if o == nil { + return "" + } + return o.RefreshToken +} + +func (o *PostOAuthTokenResponseBody) GetScope() string { + if o == nil { + return "" + } + return o.Scope +} + +type PostOAuthTokenResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Token exchange successful + Object *PostOAuthTokenResponseBody +} + +func (o *PostOAuthTokenResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostOAuthTokenResponse) GetObject() *PostOAuthTokenResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/proxyfile.go b/models/operations/proxyfile.go new file mode 100644 index 0000000..4465b70 --- /dev/null +++ b/models/operations/proxyfile.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" + "io" +) + +type ProxyFileRequest struct { + // Path to the file in storage. Can include or exclude 'vault/' prefix. + FilePath string `queryParam:"style=form,explode=true,name=filePath"` + // Team file key for proxy/download access to team files. This key is returned in the user data response (GET /users/me) as the `fileKey` field. It is team-scoped and deterministic - all members of the same team share the same file key. Use this key to authenticate file access requests. + Fk string `queryParam:"style=form,explode=true,name=fk"` +} + +func (o *ProxyFileRequest) GetFilePath() string { + if o == nil { + return "" + } + return o.FilePath +} + +func (o *ProxyFileRequest) GetFk() string { + if o == nil { + return "" + } + return o.Fk +} + +type ProxyFileResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // File content + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser +} + +func (o *ProxyFileResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ProxyFileResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} diff --git a/models/operations/quickbooksoauthcallback.go b/models/operations/quickbooksoauthcallback.go new file mode 100644 index 0000000..20079b1 --- /dev/null +++ b/models/operations/quickbooksoauthcallback.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type QuickBooksOAuthCallbackRequest struct { + // OAuth authorization code from QuickBooks + Code *string `queryParam:"style=form,explode=true,name=code"` + // OAuth state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` + // QuickBooks company/realm ID + RealmID *string `queryParam:"style=form,explode=true,name=realmId"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` +} + +func (o *QuickBooksOAuthCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *QuickBooksOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *QuickBooksOAuthCallbackRequest) GetRealmID() *string { + if o == nil { + return nil + } + return o.RealmID +} + +func (o *QuickBooksOAuthCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +type QuickBooksOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *QuickBooksOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *QuickBooksOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/search.go b/models/operations/search.go index 7e5e242..2758f60 100644 --- a/models/operations/search.go +++ b/models/operations/search.go @@ -8,10 +8,15 @@ import ( ) type SearchRequest struct { - SearchTerm *string `queryParam:"style=form,explode=true,name=searchTerm"` - Language *string `queryParam:"style=form,explode=true,name=language"` - Limit *float64 `default:"30" queryParam:"style=form,explode=true,name=limit"` + // The term to search for across all data sources. + SearchTerm *string `queryParam:"style=form,explode=true,name=searchTerm"` + // Language code to use for search relevance and results. + Language *string `queryParam:"style=form,explode=true,name=language"` + // Maximum number of results to return. + Limit *float64 `default:"30" queryParam:"style=form,explode=true,name=limit"` + // Maximum number of results to return per table/entity. ItemsPerTableLimit *float64 `default:"5" queryParam:"style=form,explode=true,name=itemsPerTableLimit"` + // Minimum relevance score threshold for including a result. RelevanceThreshold *float64 `default:"0.01" queryParam:"style=form,explode=true,name=relevanceThreshold"` } @@ -113,6 +118,8 @@ type SearchResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Search results. ResponseBodies []SearchResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *SearchResponse) GetHTTPMeta() components.HTTPMetadata { @@ -128,3 +135,10 @@ func (o *SearchResponse) GetResponseBodies() []SearchResponseBody { } return o.ResponseBodies } + +func (o *SearchResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/slackinteractions.go b/models/operations/slackinteractions.go new file mode 100644 index 0000000..7b1d606 --- /dev/null +++ b/models/operations/slackinteractions.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// SlackInteractionsResponseBody - Interaction handled successfully +type SlackInteractionsResponseBody struct { + Ok bool `json:"ok"` +} + +func (o *SlackInteractionsResponseBody) GetOk() bool { + if o == nil { + return false + } + return o.Ok +} + +type SlackInteractionsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Interaction handled successfully + Object *SlackInteractionsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *SlackInteractionsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *SlackInteractionsResponse) GetObject() *SlackInteractionsResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *SlackInteractionsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/slackoauthcallback.go b/models/operations/slackoauthcallback.go new file mode 100644 index 0000000..533f15f --- /dev/null +++ b/models/operations/slackoauthcallback.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type SlackOAuthCallbackRequest struct { + // OAuth authorization code from Slack + Code string `queryParam:"style=form,explode=true,name=code"` + // OAuth state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` +} + +func (o *SlackOAuthCallbackRequest) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *SlackOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +type SlackOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *SlackOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *SlackOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/slackwebhook.go b/models/operations/slackwebhook.go new file mode 100644 index 0000000..3846e36 --- /dev/null +++ b/models/operations/slackwebhook.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// SlackWebhookResponseBody - Webhook processed successfully +type SlackWebhookResponseBody struct { + Challenge *string `json:"challenge,omitempty"` + Ok *bool `json:"ok,omitempty"` +} + +func (o *SlackWebhookResponseBody) GetChallenge() *string { + if o == nil { + return nil + } + return o.Challenge +} + +func (o *SlackWebhookResponseBody) GetOk() *bool { + if o == nil { + return nil + } + return o.Ok +} + +type SlackWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *SlackWebhookResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *SlackWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *SlackWebhookResponse) GetObject() *SlackWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *SlackWebhookResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/starttimer.go b/models/operations/starttimer.go index 891e03c..e28c70d 100644 --- a/models/operations/starttimer.go +++ b/models/operations/starttimer.go @@ -223,8 +223,8 @@ type StartTimerData struct { Duration *float64 `json:"duration"` // Start time of the tracker entry in ISO 8601 format Start string `json:"start"` - // Stop time of the tracker entry in ISO 8601 format - Stop string `json:"stop"` + // Stop time of the tracker entry in ISO 8601 format. Null for running timers. + Stop *string `json:"stop"` // Unique identifier of the team that owns this tracker entry TeamID string `json:"teamId"` // Description or notes for the tracker entry @@ -271,9 +271,9 @@ func (o *StartTimerData) GetStart() string { return o.Start } -func (o *StartTimerData) GetStop() string { +func (o *StartTimerData) GetStop() *string { if o == nil { - return "" + return nil } return o.Stop } @@ -350,6 +350,8 @@ type StartTimerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Timer started successfully. Object *StartTimerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *StartTimerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -365,3 +367,10 @@ func (o *StartTimerResponse) GetObject() *StartTimerResponseBody { } return o.Object } + +func (o *StartTimerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/stoptimer.go b/models/operations/stoptimer.go index 3e79ae7..f510e87 100644 --- a/models/operations/stoptimer.go +++ b/models/operations/stoptimer.go @@ -3,6 +3,8 @@ package operations import ( + "errors" + "fmt" "github.com/midday-ai/midday-go/internal/utils" "github.com/midday-ai/midday-go/models/components" "time" @@ -49,6 +51,112 @@ func (o *StopTimerRequest) GetStop() *time.Time { return o.Stop } +type StopTimerProject2 struct { + ID string `json:"id"` + Name string `json:"name"` +} + +func (o *StopTimerProject2) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *StopTimerProject2) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +type StopTimerTrackerProject struct { + ID string `json:"id"` + Name string `json:"name"` +} + +func (o *StopTimerTrackerProject) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *StopTimerTrackerProject) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +type StopTimerData2 struct { + ID string `json:"id"` + // Always true for discarded timer entries (duration < 60s) + Discarded bool `json:"discarded"` + Duration float64 `json:"duration"` + Project *StopTimerProject2 `json:"project,omitempty"` + TrackerProject *StopTimerTrackerProject `json:"trackerProject,omitempty"` + Start *string `json:"start"` + Stop *string `json:"stop"` + Description *string `json:"description"` +} + +func (o *StopTimerData2) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *StopTimerData2) GetDiscarded() bool { + if o == nil { + return false + } + return o.Discarded +} + +func (o *StopTimerData2) GetDuration() float64 { + if o == nil { + return 0.0 + } + return o.Duration +} + +func (o *StopTimerData2) GetProject() *StopTimerProject2 { + if o == nil { + return nil + } + return o.Project +} + +func (o *StopTimerData2) GetTrackerProject() *StopTimerTrackerProject { + if o == nil { + return nil + } + return o.TrackerProject +} + +func (o *StopTimerData2) GetStart() *string { + if o == nil { + return nil + } + return o.Start +} + +func (o *StopTimerData2) GetStop() *string { + if o == nil { + return nil + } + return o.Stop +} + +func (o *StopTimerData2) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + // StopTimerUser - User information for the person who created this tracker entry type StopTimerUser struct { // Unique identifier of the user @@ -102,8 +210,8 @@ func (o *StopTimerCustomer) GetName() string { return o.Name } -// StopTimerProject - Project information associated with this tracker entry -type StopTimerProject struct { +// StopTimerProject1 - Project information associated with this tracker entry +type StopTimerProject1 struct { // Unique identifier of the project ID string `json:"id"` // Date and time when the project was created in ISO 8601 format @@ -126,77 +234,77 @@ type StopTimerProject struct { Customer *StopTimerCustomer `json:"customer"` } -func (o *StopTimerProject) GetID() string { +func (o *StopTimerProject1) GetID() string { if o == nil { return "" } return o.ID } -func (o *StopTimerProject) GetCreatedAt() string { +func (o *StopTimerProject1) GetCreatedAt() string { if o == nil { return "" } return o.CreatedAt } -func (o *StopTimerProject) GetRate() *float64 { +func (o *StopTimerProject1) GetRate() *float64 { if o == nil { return nil } return o.Rate } -func (o *StopTimerProject) GetCurrency() *string { +func (o *StopTimerProject1) GetCurrency() *string { if o == nil { return nil } return o.Currency } -func (o *StopTimerProject) GetStatus() string { +func (o *StopTimerProject1) GetStatus() string { if o == nil { return "" } return o.Status } -func (o *StopTimerProject) GetDescription() *string { +func (o *StopTimerProject1) GetDescription() *string { if o == nil { return nil } return o.Description } -func (o *StopTimerProject) GetName() string { +func (o *StopTimerProject1) GetName() string { if o == nil { return "" } return o.Name } -func (o *StopTimerProject) GetBillable() *bool { +func (o *StopTimerProject1) GetBillable() *bool { if o == nil { return nil } return o.Billable } -func (o *StopTimerProject) GetEstimate() *float64 { +func (o *StopTimerProject1) GetEstimate() *float64 { if o == nil { return nil } return o.Estimate } -func (o *StopTimerProject) GetCustomer() *StopTimerCustomer { +func (o *StopTimerProject1) GetCustomer() *StopTimerCustomer { if o == nil { return nil } return o.Customer } -type StopTimerData struct { +type StopTimerData1 struct { // Unique identifier of the tracker entry ID string `json:"id"` // Date and time when the tracker entry was created in ISO 8601 format @@ -205,8 +313,8 @@ type StopTimerData struct { Duration *float64 `json:"duration"` // Start time of the tracker entry in ISO 8601 format Start string `json:"start"` - // Stop time of the tracker entry in ISO 8601 format - Stop string `json:"stop"` + // Stop time of the tracker entry in ISO 8601 format. Null for running timers. + Stop *string `json:"stop"` // Unique identifier of the team that owns this tracker entry TeamID string `json:"teamId"` // Description or notes for the tracker entry @@ -222,108 +330,171 @@ type StopTimerData struct { // User information for the person who created this tracker entry User StopTimerUser `json:"user"` // Project information associated with this tracker entry - Project StopTimerProject `json:"project"` + Project StopTimerProject1 `json:"project"` } -func (o *StopTimerData) GetID() string { +func (o *StopTimerData1) GetID() string { if o == nil { return "" } return o.ID } -func (o *StopTimerData) GetCreatedAt() string { +func (o *StopTimerData1) GetCreatedAt() string { if o == nil { return "" } return o.CreatedAt } -func (o *StopTimerData) GetDuration() *float64 { +func (o *StopTimerData1) GetDuration() *float64 { if o == nil { return nil } return o.Duration } -func (o *StopTimerData) GetStart() string { +func (o *StopTimerData1) GetStart() string { if o == nil { return "" } return o.Start } -func (o *StopTimerData) GetStop() string { +func (o *StopTimerData1) GetStop() *string { if o == nil { - return "" + return nil } return o.Stop } -func (o *StopTimerData) GetTeamID() string { +func (o *StopTimerData1) GetTeamID() string { if o == nil { return "" } return o.TeamID } -func (o *StopTimerData) GetDescription() *string { +func (o *StopTimerData1) GetDescription() *string { if o == nil { return nil } return o.Description } -func (o *StopTimerData) GetRate() *float64 { +func (o *StopTimerData1) GetRate() *float64 { if o == nil { return nil } return o.Rate } -func (o *StopTimerData) GetCurrency() *string { +func (o *StopTimerData1) GetCurrency() *string { if o == nil { return nil } return o.Currency } -func (o *StopTimerData) GetBilled() bool { +func (o *StopTimerData1) GetBilled() bool { if o == nil { return false } return o.Billed } -func (o *StopTimerData) GetDate() string { +func (o *StopTimerData1) GetDate() string { if o == nil { return "" } return o.Date } -func (o *StopTimerData) GetUser() StopTimerUser { +func (o *StopTimerData1) GetUser() StopTimerUser { if o == nil { return StopTimerUser{} } return o.User } -func (o *StopTimerData) GetProject() StopTimerProject { +func (o *StopTimerData1) GetProject() StopTimerProject1 { if o == nil { - return StopTimerProject{} + return StopTimerProject1{} } return o.Project } +type DataType string + +const ( + DataTypeStopTimerData1 DataType = "stopTimer_data_1" + DataTypeStopTimerData2 DataType = "stopTimer_data_2" +) + +type Data struct { + StopTimerData1 *StopTimerData1 `queryParam:"inline"` + StopTimerData2 *StopTimerData2 `queryParam:"inline"` + + Type DataType +} + +func CreateDataStopTimerData1(stopTimerData1 StopTimerData1) Data { + typ := DataTypeStopTimerData1 + + return Data{ + StopTimerData1: &stopTimerData1, + Type: typ, + } +} + +func CreateDataStopTimerData2(stopTimerData2 StopTimerData2) Data { + typ := DataTypeStopTimerData2 + + return Data{ + StopTimerData2: &stopTimerData2, + Type: typ, + } +} + +func (u *Data) UnmarshalJSON(data []byte) error { + + var stopTimerData2 StopTimerData2 = StopTimerData2{} + if err := utils.UnmarshalJSON(data, &stopTimerData2, "", true, true); err == nil { + u.StopTimerData2 = &stopTimerData2 + u.Type = DataTypeStopTimerData2 + return nil + } + + var stopTimerData1 StopTimerData1 = StopTimerData1{} + if err := utils.UnmarshalJSON(data, &stopTimerData1, "", true, true); err == nil { + u.StopTimerData1 = &stopTimerData1 + u.Type = DataTypeStopTimerData1 + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Data", string(data)) +} + +func (u Data) MarshalJSON() ([]byte, error) { + if u.StopTimerData1 != nil { + return utils.MarshalJSON(u.StopTimerData1, "", true) + } + + if u.StopTimerData2 != nil { + return utils.MarshalJSON(u.StopTimerData2, "", true) + } + + return nil, errors.New("could not marshal union type Data: all fields are null") +} + // StopTimerResponseBody - Timer stopped successfully. type StopTimerResponseBody struct { - Data StopTimerData `json:"data"` + Data Data `json:"data"` } -func (o *StopTimerResponseBody) GetData() StopTimerData { +func (o *StopTimerResponseBody) GetData() Data { if o == nil { - return StopTimerData{} + return Data{} } return o.Data } @@ -332,6 +503,8 @@ type StopTimerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Timer stopped successfully. Object *StopTimerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *StopTimerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -347,3 +520,10 @@ func (o *StopTimerResponse) GetObject() *StopTimerResponseBody { } return o.Object } + +func (o *StopTimerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/stripeconnectcallback.go b/models/operations/stripeconnectcallback.go new file mode 100644 index 0000000..449d410 --- /dev/null +++ b/models/operations/stripeconnectcallback.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type StripeConnectCallbackRequest struct { + // OAuth authorization code from Stripe + Code *string `queryParam:"style=form,explode=true,name=code"` + // OAuth state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` + // OAuth error description + ErrorDescription *string `queryParam:"style=form,explode=true,name=error_description"` +} + +func (o *StripeConnectCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *StripeConnectCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *StripeConnectCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *StripeConnectCallbackRequest) GetErrorDescription() *string { + if o == nil { + return nil + } + return o.ErrorDescription +} + +type StripeConnectCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *StripeConnectCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *StripeConnectCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/stripewebhook.go b/models/operations/stripewebhook.go new file mode 100644 index 0000000..d4c8723 --- /dev/null +++ b/models/operations/stripewebhook.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// StripeWebhookResponseBody - Webhook processed successfully +type StripeWebhookResponseBody struct { + Received bool `json:"received"` +} + +func (o *StripeWebhookResponseBody) GetReceived() bool { + if o == nil { + return false + } + return o.Received +} + +type StripeWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *StripeWebhookResponseBody +} + +func (o *StripeWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *StripeWebhookResponse) GetObject() *StripeWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/tellerwebhook.go b/models/operations/tellerwebhook.go new file mode 100644 index 0000000..33dfca0 --- /dev/null +++ b/models/operations/tellerwebhook.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// TellerWebhookResponseBody - Webhook processed successfully +type TellerWebhookResponseBody struct { + Success bool `json:"success"` +} + +func (o *TellerWebhookResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type TellerWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *TellerWebhookResponseBody +} + +func (o *TellerWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *TellerWebhookResponse) GetObject() *TellerWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/updateallnotificationsstatus.go b/models/operations/updateallnotificationsstatus.go new file mode 100644 index 0000000..50783d4 --- /dev/null +++ b/models/operations/updateallnotificationsstatus.go @@ -0,0 +1,36 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type UpdateAllNotificationsStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // All notifications status updated successfully. + UpdateAllNotificationsStatusResponseSchema *components.UpdateAllNotificationsStatusResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *UpdateAllNotificationsStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateAllNotificationsStatusResponse) GetUpdateAllNotificationsStatusResponseSchema() *components.UpdateAllNotificationsStatusResponseSchema { + if o == nil { + return nil + } + return o.UpdateAllNotificationsStatusResponseSchema +} + +func (o *UpdateAllNotificationsStatusResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatebankaccount.go b/models/operations/updatebankaccount.go index 3703992..ebe0633 100644 --- a/models/operations/updatebankaccount.go +++ b/models/operations/updatebankaccount.go @@ -103,8 +103,9 @@ func (o *UpdateBankAccountRequestBody) GetType() *UpdateBankAccountType { } type UpdateBankAccountRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - RequestBody *UpdateBankAccountRequestBody `request:"mediaType=application/json"` + // The unique identifier of the bank account. + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateBankAccountRequestBody `request:"mediaType=application/json"` } func (o *UpdateBankAccountRequest) GetID() string { @@ -114,9 +115,9 @@ func (o *UpdateBankAccountRequest) GetID() string { return o.ID } -func (o *UpdateBankAccountRequest) GetRequestBody() *UpdateBankAccountRequestBody { +func (o *UpdateBankAccountRequest) GetRequestBody() UpdateBankAccountRequestBody { if o == nil { - return nil + return UpdateBankAccountRequestBody{} } return o.RequestBody } @@ -192,6 +193,8 @@ type UpdateBankAccountResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Bank account updated Object *UpdateBankAccountResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateBankAccountResponse) GetHTTPMeta() components.HTTPMetadata { @@ -207,3 +210,10 @@ func (o *UpdateBankAccountResponse) GetObject() *UpdateBankAccountResponseBody { } return o.Object } + +func (o *UpdateBankAccountResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatecurrentuser.go b/models/operations/updatecurrentuser.go index cc12429..e45b227 100644 --- a/models/operations/updatecurrentuser.go +++ b/models/operations/updatecurrentuser.go @@ -44,8 +44,6 @@ func (e *DateFormatRequest) UnmarshalJSON(data []byte) error { type UpdateCurrentUserRequest struct { // Full name of the user. Must be between 2 and 32 characters FullName *string `json:"fullName,omitempty"` - // Unique identifier of the team the user belongs to - TeamID *string `json:"teamId,omitempty"` // Email address of the user Email *string `json:"email,omitempty"` // URL to the user's avatar image. Must be hosted on midday.ai domain @@ -71,13 +69,6 @@ func (o *UpdateCurrentUserRequest) GetFullName() *string { return o.FullName } -func (o *UpdateCurrentUserRequest) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - func (o *UpdateCurrentUserRequest) GetEmail() *string { if o == nil { return nil @@ -174,7 +165,7 @@ type UpdateCurrentUserTeam struct { // Name of the team or organization Name string `json:"name"` // URL to the team's logo image - LogoURL string `json:"logoUrl"` + LogoURL *string `json:"logoUrl"` // Current subscription plan of the team Plan string `json:"plan"` } @@ -193,9 +184,9 @@ func (o *UpdateCurrentUserTeam) GetName() string { return o.Name } -func (o *UpdateCurrentUserTeam) GetLogoURL() string { +func (o *UpdateCurrentUserTeam) GetLogoURL() *string { if o == nil { - return "" + return nil } return o.LogoURL } @@ -229,6 +220,8 @@ type UpdateCurrentUserResponseBody struct { TimeFormat *float64 `json:"timeFormat"` // User's preferred date format. Available options: 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy' DateFormat *UpdateCurrentUserDateFormatResponse `json:"dateFormat"` + // Team file key (JWT token) for proxy/download access to team files. This compact JWT token contains the team ID and is shared by all team members. Use this token as the `fk` query parameter when accessing file endpoints (proxy, download). The token is team-scoped and provides access to files belonging to the user's team. Returns null if the user has no team. + FileKey *string `json:"fileKey"` // Team information that the user belongs to Team *UpdateCurrentUserTeam `json:"team"` } @@ -303,6 +296,13 @@ func (o *UpdateCurrentUserResponseBody) GetDateFormat() *UpdateCurrentUserDateFo return o.DateFormat } +func (o *UpdateCurrentUserResponseBody) GetFileKey() *string { + if o == nil { + return nil + } + return o.FileKey +} + func (o *UpdateCurrentUserResponseBody) GetTeam() *UpdateCurrentUserTeam { if o == nil { return nil @@ -314,6 +314,8 @@ type UpdateCurrentUserResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // The updated user Object *UpdateCurrentUserResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateCurrentUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -329,3 +331,10 @@ func (o *UpdateCurrentUserResponse) GetObject() *UpdateCurrentUserResponseBody { } return o.Object } + +func (o *UpdateCurrentUserResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatecustomer.go b/models/operations/updatecustomer.go index 18d7064..88f022c 100644 --- a/models/operations/updatecustomer.go +++ b/models/operations/updatecustomer.go @@ -34,7 +34,7 @@ type UpdateCustomerRequestBody struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail,omitempty"` // Country name where the customer is located Country *string `json:"country,omitempty"` @@ -184,8 +184,9 @@ func (o *UpdateCustomerRequestBody) GetTags() []UpdateCustomerTagRequest { } type UpdateCustomerRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - RequestBody *UpdateCustomerRequestBody `request:"mediaType=application/json"` + // Unique identifier of the customer to retrieve + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateCustomerRequestBody `request:"mediaType=application/json"` } func (o *UpdateCustomerRequest) GetID() string { @@ -195,9 +196,9 @@ func (o *UpdateCustomerRequest) GetID() string { return o.ID } -func (o *UpdateCustomerRequest) GetRequestBody() *UpdateCustomerRequestBody { +func (o *UpdateCustomerRequest) GetRequestBody() UpdateCustomerRequestBody { if o == nil { - return nil + return UpdateCustomerRequestBody{} } return o.RequestBody } @@ -231,7 +232,7 @@ type UpdateCustomerResponseBody struct { Name string `json:"name"` // Primary email address of the customer Email string `json:"email"` - // Billing email address of the customer + // Billing email addresses of the customer (comma-separated for multiple) BillingEmail *string `json:"billingEmail"` // Primary phone number of the customer Phone *string `json:"phone"` @@ -265,8 +266,60 @@ type UpdateCustomerResponseBody struct { InvoiceCount float64 `json:"invoiceCount"` // Total number of projects associated with this customer ProjectCount float64 `json:"projectCount"` + // Total revenue from paid invoices for this customer (in invoice currency). Only returned in list queries. + TotalRevenue *float64 `json:"totalRevenue,omitempty"` + // Total outstanding amount from unpaid/overdue invoices (in invoice currency). Only returned in list queries. + OutstandingAmount *float64 `json:"outstandingAmount,omitempty"` + // Date of the most recent invoice in ISO 8601 format. Only returned in list queries. + LastInvoiceDate *string `json:"lastInvoiceDate,omitempty"` + // Primary currency used in invoices for this customer. Only returned in list queries. + InvoiceCurrency *string `json:"invoiceCurrency,omitempty"` // Array of tags associated with the customer for categorization Tags []UpdateCustomerTagResponse `json:"tags"` + // AI-generated description of what the company does + Description *string `json:"description"` + // Primary industry of the company + Industry *string `json:"industry"` + // Business model type + CompanyType *string `json:"companyType"` + // Estimated number of employees + EmployeeCount *string `json:"employeeCount"` + // Year the company was founded + FoundedYear *float64 `json:"foundedYear"` + // Estimated annual revenue range + EstimatedRevenue *string `json:"estimatedRevenue"` + // Current funding stage + FundingStage *string `json:"fundingStage"` + // Total funding raised + TotalFunding *string `json:"totalFunding"` + // Company headquarters location + HeadquartersLocation *string `json:"headquartersLocation"` + // IANA timezone of the company headquarters + Timezone *string `json:"timezone"` + // LinkedIn company page URL + LinkedinURL *string `json:"linkedinUrl"` + // Twitter/X profile URL + TwitterURL *string `json:"twitterUrl"` + // Instagram profile URL + InstagramURL *string `json:"instagramUrl"` + // Facebook page URL + FacebookURL *string `json:"facebookUrl"` + // URL to the company logo + LogoURL *string `json:"logoUrl"` + // Name of the CEO or founder + CeoName *string `json:"ceoName"` + // Name of the finance/AP contact for invoicing + FinanceContact *string `json:"financeContact"` + // Email of the finance/AP contact + FinanceContactEmail *string `json:"financeContactEmail"` + // Primary business language (ISO 639-1 code) + PrimaryLanguage *string `json:"primaryLanguage"` + // Month when the fiscal year ends + FiscalYearEnd *string `json:"fiscalYearEnd"` + // Status of the enrichment process + EnrichmentStatus *string `json:"enrichmentStatus"` + // When the customer was last enriched + EnrichedAt *string `json:"enrichedAt"` } func (o *UpdateCustomerResponseBody) GetID() string { @@ -409,6 +462,34 @@ func (o *UpdateCustomerResponseBody) GetProjectCount() float64 { return o.ProjectCount } +func (o *UpdateCustomerResponseBody) GetTotalRevenue() *float64 { + if o == nil { + return nil + } + return o.TotalRevenue +} + +func (o *UpdateCustomerResponseBody) GetOutstandingAmount() *float64 { + if o == nil { + return nil + } + return o.OutstandingAmount +} + +func (o *UpdateCustomerResponseBody) GetLastInvoiceDate() *string { + if o == nil { + return nil + } + return o.LastInvoiceDate +} + +func (o *UpdateCustomerResponseBody) GetInvoiceCurrency() *string { + if o == nil { + return nil + } + return o.InvoiceCurrency +} + func (o *UpdateCustomerResponseBody) GetTags() []UpdateCustomerTagResponse { if o == nil { return []UpdateCustomerTagResponse{} @@ -416,10 +497,166 @@ func (o *UpdateCustomerResponseBody) GetTags() []UpdateCustomerTagResponse { return o.Tags } +func (o *UpdateCustomerResponseBody) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *UpdateCustomerResponseBody) GetIndustry() *string { + if o == nil { + return nil + } + return o.Industry +} + +func (o *UpdateCustomerResponseBody) GetCompanyType() *string { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *UpdateCustomerResponseBody) GetEmployeeCount() *string { + if o == nil { + return nil + } + return o.EmployeeCount +} + +func (o *UpdateCustomerResponseBody) GetFoundedYear() *float64 { + if o == nil { + return nil + } + return o.FoundedYear +} + +func (o *UpdateCustomerResponseBody) GetEstimatedRevenue() *string { + if o == nil { + return nil + } + return o.EstimatedRevenue +} + +func (o *UpdateCustomerResponseBody) GetFundingStage() *string { + if o == nil { + return nil + } + return o.FundingStage +} + +func (o *UpdateCustomerResponseBody) GetTotalFunding() *string { + if o == nil { + return nil + } + return o.TotalFunding +} + +func (o *UpdateCustomerResponseBody) GetHeadquartersLocation() *string { + if o == nil { + return nil + } + return o.HeadquartersLocation +} + +func (o *UpdateCustomerResponseBody) GetTimezone() *string { + if o == nil { + return nil + } + return o.Timezone +} + +func (o *UpdateCustomerResponseBody) GetLinkedinURL() *string { + if o == nil { + return nil + } + return o.LinkedinURL +} + +func (o *UpdateCustomerResponseBody) GetTwitterURL() *string { + if o == nil { + return nil + } + return o.TwitterURL +} + +func (o *UpdateCustomerResponseBody) GetInstagramURL() *string { + if o == nil { + return nil + } + return o.InstagramURL +} + +func (o *UpdateCustomerResponseBody) GetFacebookURL() *string { + if o == nil { + return nil + } + return o.FacebookURL +} + +func (o *UpdateCustomerResponseBody) GetLogoURL() *string { + if o == nil { + return nil + } + return o.LogoURL +} + +func (o *UpdateCustomerResponseBody) GetCeoName() *string { + if o == nil { + return nil + } + return o.CeoName +} + +func (o *UpdateCustomerResponseBody) GetFinanceContact() *string { + if o == nil { + return nil + } + return o.FinanceContact +} + +func (o *UpdateCustomerResponseBody) GetFinanceContactEmail() *string { + if o == nil { + return nil + } + return o.FinanceContactEmail +} + +func (o *UpdateCustomerResponseBody) GetPrimaryLanguage() *string { + if o == nil { + return nil + } + return o.PrimaryLanguage +} + +func (o *UpdateCustomerResponseBody) GetFiscalYearEnd() *string { + if o == nil { + return nil + } + return o.FiscalYearEnd +} + +func (o *UpdateCustomerResponseBody) GetEnrichmentStatus() *string { + if o == nil { + return nil + } + return o.EnrichmentStatus +} + +func (o *UpdateCustomerResponseBody) GetEnrichedAt() *string { + if o == nil { + return nil + } + return o.EnrichedAt +} + type UpdateCustomerResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Customer updated Object *UpdateCustomerResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateCustomerResponse) GetHTTPMeta() components.HTTPMetadata { @@ -435,3 +672,10 @@ func (o *UpdateCustomerResponse) GetObject() *UpdateCustomerResponseBody { } return o.Object } + +func (o *UpdateCustomerResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updateinboxitem.go b/models/operations/updateinboxitem.go index 7f4423e..47f5f25 100644 --- a/models/operations/updateinboxitem.go +++ b/models/operations/updateinboxitem.go @@ -11,11 +11,15 @@ import ( type UpdateInboxItemStatus string const ( - UpdateInboxItemStatusNew UpdateInboxItemStatus = "new" - UpdateInboxItemStatusArchived UpdateInboxItemStatus = "archived" - UpdateInboxItemStatusProcessing UpdateInboxItemStatus = "processing" - UpdateInboxItemStatusDone UpdateInboxItemStatus = "done" - UpdateInboxItemStatusPending UpdateInboxItemStatus = "pending" + UpdateInboxItemStatusNew UpdateInboxItemStatus = "new" + UpdateInboxItemStatusArchived UpdateInboxItemStatus = "archived" + UpdateInboxItemStatusProcessing UpdateInboxItemStatus = "processing" + UpdateInboxItemStatusDone UpdateInboxItemStatus = "done" + UpdateInboxItemStatusPending UpdateInboxItemStatus = "pending" + UpdateInboxItemStatusDeleted UpdateInboxItemStatus = "deleted" + UpdateInboxItemStatusAnalyzing UpdateInboxItemStatus = "analyzing" + UpdateInboxItemStatusSuggestedMatch UpdateInboxItemStatus = "suggested_match" + UpdateInboxItemStatusOther UpdateInboxItemStatus = "other" ) func (e UpdateInboxItemStatus) ToPointer() *UpdateInboxItemStatus { @@ -36,6 +40,14 @@ func (e *UpdateInboxItemStatus) UnmarshalJSON(data []byte) error { case "done": fallthrough case "pending": + fallthrough + case "deleted": + fallthrough + case "analyzing": + fallthrough + case "suggested_match": + fallthrough + case "other": *e = UpdateInboxItemStatus(v) return nil default: @@ -271,6 +283,8 @@ type UpdateInboxItemResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Update fields of an inbox item by its unique identifier for the authenticated team. Object *UpdateInboxItemResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateInboxItemResponse) GetHTTPMeta() components.HTTPMetadata { @@ -286,3 +300,10 @@ func (o *UpdateInboxItemResponse) GetObject() *UpdateInboxItemResponseBody { } return o.Object } + +func (o *UpdateInboxItemResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updateinvoice.go b/models/operations/updateinvoice.go new file mode 100644 index 0000000..5fc2830 --- /dev/null +++ b/models/operations/updateinvoice.go @@ -0,0 +1,427 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/components" + "time" +) + +// UpdateInvoiceStatusRequest - New status for the invoice +type UpdateInvoiceStatusRequest string + +const ( + UpdateInvoiceStatusRequestPaid UpdateInvoiceStatusRequest = "paid" + UpdateInvoiceStatusRequestCanceled UpdateInvoiceStatusRequest = "canceled" + UpdateInvoiceStatusRequestUnpaid UpdateInvoiceStatusRequest = "unpaid" + UpdateInvoiceStatusRequestScheduled UpdateInvoiceStatusRequest = "scheduled" + UpdateInvoiceStatusRequestDraft UpdateInvoiceStatusRequest = "draft" +) + +func (e UpdateInvoiceStatusRequest) ToPointer() *UpdateInvoiceStatusRequest { + return &e +} +func (e *UpdateInvoiceStatusRequest) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "paid": + fallthrough + case "canceled": + fallthrough + case "unpaid": + fallthrough + case "scheduled": + fallthrough + case "draft": + *e = UpdateInvoiceStatusRequest(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateInvoiceStatusRequest: %v", v) + } +} + +// UpdateInvoiceRequestBody - Schema for updating an invoice +type UpdateInvoiceRequestBody struct { + // New status for the invoice + Status *UpdateInvoiceStatusRequest `json:"status,omitempty"` + // Timestamp when the invoice was paid (ISO 8601) + PaidAt *time.Time `json:"paidAt,omitempty"` + // Internal note for the invoice + InternalNote *string `json:"internalNote,omitempty"` +} + +func (u UpdateInvoiceRequestBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateInvoiceRequestBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + return err + } + return nil +} + +func (o *UpdateInvoiceRequestBody) GetStatus() *UpdateInvoiceStatusRequest { + if o == nil { + return nil + } + return o.Status +} + +func (o *UpdateInvoiceRequestBody) GetPaidAt() *time.Time { + if o == nil { + return nil + } + return o.PaidAt +} + +func (o *UpdateInvoiceRequestBody) GetInternalNote() *string { + if o == nil { + return nil + } + return o.InternalNote +} + +type UpdateInvoiceRequest struct { + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateInvoiceRequestBody `request:"mediaType=application/json"` +} + +func (o *UpdateInvoiceRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *UpdateInvoiceRequest) GetRequestBody() UpdateInvoiceRequestBody { + if o == nil { + return UpdateInvoiceRequestBody{} + } + return o.RequestBody +} + +// UpdateInvoiceStatusResponse - Current status of the invoice +type UpdateInvoiceStatusResponse string + +const ( + UpdateInvoiceStatusResponseDraft UpdateInvoiceStatusResponse = "draft" + UpdateInvoiceStatusResponseOverdue UpdateInvoiceStatusResponse = "overdue" + UpdateInvoiceStatusResponsePaid UpdateInvoiceStatusResponse = "paid" + UpdateInvoiceStatusResponseUnpaid UpdateInvoiceStatusResponse = "unpaid" + UpdateInvoiceStatusResponseCanceled UpdateInvoiceStatusResponse = "canceled" + UpdateInvoiceStatusResponseScheduled UpdateInvoiceStatusResponse = "scheduled" +) + +func (e UpdateInvoiceStatusResponse) ToPointer() *UpdateInvoiceStatusResponse { + return &e +} +func (e *UpdateInvoiceStatusResponse) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "draft": + fallthrough + case "overdue": + fallthrough + case "paid": + fallthrough + case "unpaid": + fallthrough + case "canceled": + fallthrough + case "scheduled": + *e = UpdateInvoiceStatusResponse(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateInvoiceStatusResponse: %v", v) + } +} + +// UpdateInvoiceCustomer - Customer details +type UpdateInvoiceCustomer struct { + // Unique identifier for the customer + ID string `json:"id"` + // Name of the customer + Name string `json:"name"` + // Website URL of the customer + Website *string `json:"website"` + // Email address of the customer + Email *string `json:"email"` +} + +func (o *UpdateInvoiceCustomer) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *UpdateInvoiceCustomer) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *UpdateInvoiceCustomer) GetWebsite() *string { + if o == nil { + return nil + } + return o.Website +} + +func (o *UpdateInvoiceCustomer) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +// UpdateInvoiceResponseBody - Response after updating an invoice +type UpdateInvoiceResponseBody struct { + // Unique identifier for the invoice + ID string `json:"id"` + // Current status of the invoice + Status UpdateInvoiceStatusResponse `json:"status"` + // Due date of the invoice in ISO 8601 format + DueDate string `json:"dueDate"` + // Issue date of the invoice in ISO 8601 format + IssueDate string `json:"issueDate"` + // Invoice number as shown to the customer (auto-generated if not provided) + InvoiceNumber *string `json:"invoiceNumber,omitempty"` + // Total amount of the invoice, or null if not yet calculated + Amount *float64 `json:"amount"` + // Currency code (ISO 4217) for the invoice amount + Currency *string `json:"currency"` + // Customer details + Customer *UpdateInvoiceCustomer `json:"customer"` + // Timestamp when the invoice was paid (ISO 8601), or null if unpaid + PaidAt *string `json:"paidAt"` + // Timestamp when a payment reminder was sent (ISO 8601), or null if never sent + ReminderSentAt *string `json:"reminderSentAt"` + // Optional note attached to the invoice + Note *string `json:"note"` + // Value-added tax amount, or null if not applicable + Vat *float64 `json:"vat"` + // Tax amount, or null if not applicable + Tax *float64 `json:"tax"` + // Discount amount applied to the invoice, or null if none + Discount *float64 `json:"discount"` + // Subtotal before taxes and discounts, or null if not calculated + Subtotal *float64 `json:"subtotal"` + // Timestamp when the invoice was viewed by the customer (ISO 8601), or null if never viewed + ViewedAt *string `json:"viewedAt"` + // Name of the customer as shown on the invoice, or null if not set + CustomerName *string `json:"customerName"` + // Email address to which the invoice was sent, or null if not sent + SentTo *string `json:"sentTo"` + // Timestamp when the invoice was sent (ISO 8601), or null if not sent + SentAt *string `json:"sentAt"` + // Timestamp when the invoice was created (ISO 8601) + CreatedAt string `json:"createdAt"` + // Timestamp when the invoice was last updated (ISO 8601) + UpdatedAt string `json:"updatedAt"` + // URL to download the invoice PDF, or null if not generated + PdfURL *string `json:"pdfUrl"` + // URL to preview the invoice in the browser, or null if not generated + PreviewURL *string `json:"previewUrl"` +} + +func (o *UpdateInvoiceResponseBody) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *UpdateInvoiceResponseBody) GetStatus() UpdateInvoiceStatusResponse { + if o == nil { + return UpdateInvoiceStatusResponse("") + } + return o.Status +} + +func (o *UpdateInvoiceResponseBody) GetDueDate() string { + if o == nil { + return "" + } + return o.DueDate +} + +func (o *UpdateInvoiceResponseBody) GetIssueDate() string { + if o == nil { + return "" + } + return o.IssueDate +} + +func (o *UpdateInvoiceResponseBody) GetInvoiceNumber() *string { + if o == nil { + return nil + } + return o.InvoiceNumber +} + +func (o *UpdateInvoiceResponseBody) GetAmount() *float64 { + if o == nil { + return nil + } + return o.Amount +} + +func (o *UpdateInvoiceResponseBody) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *UpdateInvoiceResponseBody) GetCustomer() *UpdateInvoiceCustomer { + if o == nil { + return nil + } + return o.Customer +} + +func (o *UpdateInvoiceResponseBody) GetPaidAt() *string { + if o == nil { + return nil + } + return o.PaidAt +} + +func (o *UpdateInvoiceResponseBody) GetReminderSentAt() *string { + if o == nil { + return nil + } + return o.ReminderSentAt +} + +func (o *UpdateInvoiceResponseBody) GetNote() *string { + if o == nil { + return nil + } + return o.Note +} + +func (o *UpdateInvoiceResponseBody) GetVat() *float64 { + if o == nil { + return nil + } + return o.Vat +} + +func (o *UpdateInvoiceResponseBody) GetTax() *float64 { + if o == nil { + return nil + } + return o.Tax +} + +func (o *UpdateInvoiceResponseBody) GetDiscount() *float64 { + if o == nil { + return nil + } + return o.Discount +} + +func (o *UpdateInvoiceResponseBody) GetSubtotal() *float64 { + if o == nil { + return nil + } + return o.Subtotal +} + +func (o *UpdateInvoiceResponseBody) GetViewedAt() *string { + if o == nil { + return nil + } + return o.ViewedAt +} + +func (o *UpdateInvoiceResponseBody) GetCustomerName() *string { + if o == nil { + return nil + } + return o.CustomerName +} + +func (o *UpdateInvoiceResponseBody) GetSentTo() *string { + if o == nil { + return nil + } + return o.SentTo +} + +func (o *UpdateInvoiceResponseBody) GetSentAt() *string { + if o == nil { + return nil + } + return o.SentAt +} + +func (o *UpdateInvoiceResponseBody) GetCreatedAt() string { + if o == nil { + return "" + } + return o.CreatedAt +} + +func (o *UpdateInvoiceResponseBody) GetUpdatedAt() string { + if o == nil { + return "" + } + return o.UpdatedAt +} + +func (o *UpdateInvoiceResponseBody) GetPdfURL() *string { + if o == nil { + return nil + } + return o.PdfURL +} + +func (o *UpdateInvoiceResponseBody) GetPreviewURL() *string { + if o == nil { + return nil + } + return o.PreviewURL +} + +type UpdateInvoiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Invoice updated successfully. + Object *UpdateInvoiceResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *UpdateInvoiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateInvoiceResponse) GetObject() *UpdateInvoiceResponseBody { + if o == nil { + return nil + } + return o.Object +} + +func (o *UpdateInvoiceResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatenotificationstatus.go b/models/operations/updatenotificationstatus.go new file mode 100644 index 0000000..ee8bed4 --- /dev/null +++ b/models/operations/updatenotificationstatus.go @@ -0,0 +1,100 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/midday-ai/midday-go/models/components" +) + +// UpdateNotificationStatusStatus - The new status for the notification +type UpdateNotificationStatusStatus string + +const ( + UpdateNotificationStatusStatusUnread UpdateNotificationStatusStatus = "unread" + UpdateNotificationStatusStatusRead UpdateNotificationStatusStatus = "read" + UpdateNotificationStatusStatusArchived UpdateNotificationStatusStatus = "archived" +) + +func (e UpdateNotificationStatusStatus) ToPointer() *UpdateNotificationStatusStatus { + return &e +} +func (e *UpdateNotificationStatusStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "unread": + fallthrough + case "read": + fallthrough + case "archived": + *e = UpdateNotificationStatusStatus(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateNotificationStatusStatus: %v", v) + } +} + +type UpdateNotificationStatusRequestBody struct { + // The new status for the notification + Status UpdateNotificationStatusStatus `json:"status"` +} + +func (o *UpdateNotificationStatusRequestBody) GetStatus() UpdateNotificationStatusStatus { + if o == nil { + return UpdateNotificationStatusStatus("") + } + return o.Status +} + +type UpdateNotificationStatusRequest struct { + // The ID of the notification to update + NotificationID string `pathParam:"style=simple,explode=false,name=notificationId"` + RequestBody UpdateNotificationStatusRequestBody `request:"mediaType=application/json"` +} + +func (o *UpdateNotificationStatusRequest) GetNotificationID() string { + if o == nil { + return "" + } + return o.NotificationID +} + +func (o *UpdateNotificationStatusRequest) GetRequestBody() UpdateNotificationStatusRequestBody { + if o == nil { + return UpdateNotificationStatusRequestBody{} + } + return o.RequestBody +} + +type UpdateNotificationStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Notification status updated successfully. + NotificationResponseSchema *components.NotificationResponseSchema + // An error occurred + ErrorResponse *components.ErrorResponse +} + +func (o *UpdateNotificationStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateNotificationStatusResponse) GetNotificationResponseSchema() *components.NotificationResponseSchema { + if o == nil { + return nil + } + return o.NotificationResponseSchema +} + +func (o *UpdateNotificationStatusResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatetag.go b/models/operations/updatetag.go index 47183f2..f4f8e0c 100644 --- a/models/operations/updatetag.go +++ b/models/operations/updatetag.go @@ -19,8 +19,9 @@ func (o *UpdateTagRequestBody) GetName() string { } type UpdateTagRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - RequestBody *UpdateTagRequestBody `request:"mediaType=application/json"` + // The ID of the tag to update. + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateTagRequestBody `request:"mediaType=application/json"` } func (o *UpdateTagRequest) GetID() string { @@ -30,9 +31,9 @@ func (o *UpdateTagRequest) GetID() string { return o.ID } -func (o *UpdateTagRequest) GetRequestBody() *UpdateTagRequestBody { +func (o *UpdateTagRequest) GetRequestBody() UpdateTagRequestBody { if o == nil { - return nil + return UpdateTagRequestBody{} } return o.RequestBody } @@ -41,6 +42,8 @@ type UpdateTagResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tag updated TagResponse *components.TagResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTagResponse) GetHTTPMeta() components.HTTPMetadata { @@ -56,3 +59,10 @@ func (o *UpdateTagResponse) GetTagResponse() *components.TagResponse { } return o.TagResponse } + +func (o *UpdateTagResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updateteambyid.go b/models/operations/updateteambyid.go index 8cdd707..22dcf1e 100644 --- a/models/operations/updateteambyid.go +++ b/models/operations/updateteambyid.go @@ -8,6 +8,154 @@ import ( "github.com/midday-ai/midday-go/models/components" ) +// ExportSettings - Export settings for transactions +type ExportSettings struct { + CsvDelimiter string `json:"csvDelimiter"` + IncludeCSV bool `json:"includeCSV"` + IncludeXLSX bool `json:"includeXLSX"` + SendEmail bool `json:"sendEmail"` + SendCopyToMe *bool `json:"sendCopyToMe,omitempty"` + AccountantEmail *string `json:"accountantEmail,omitempty"` +} + +func (o *ExportSettings) GetCsvDelimiter() string { + if o == nil { + return "" + } + return o.CsvDelimiter +} + +func (o *ExportSettings) GetIncludeCSV() bool { + if o == nil { + return false + } + return o.IncludeCSV +} + +func (o *ExportSettings) GetIncludeXLSX() bool { + if o == nil { + return false + } + return o.IncludeXLSX +} + +func (o *ExportSettings) GetSendEmail() bool { + if o == nil { + return false + } + return o.SendEmail +} + +func (o *ExportSettings) GetSendCopyToMe() *bool { + if o == nil { + return nil + } + return o.SendCopyToMe +} + +func (o *ExportSettings) GetAccountantEmail() *string { + if o == nil { + return nil + } + return o.AccountantEmail +} + +// CompanyType - Type of company or team +type CompanyType string + +const ( + CompanyTypeFreelancer CompanyType = "freelancer" + CompanyTypeSoloFounder CompanyType = "solo_founder" + CompanyTypeSmallTeam CompanyType = "small_team" + CompanyTypeStartup CompanyType = "startup" + CompanyTypeAgency CompanyType = "agency" + CompanyTypeEcommerce CompanyType = "ecommerce" + CompanyTypeCreator CompanyType = "creator" + CompanyTypeNonProfit CompanyType = "non_profit" + CompanyTypeAccountant CompanyType = "accountant" + CompanyTypeExploring CompanyType = "exploring" +) + +func (e CompanyType) ToPointer() *CompanyType { + return &e +} +func (e *CompanyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "freelancer": + fallthrough + case "solo_founder": + fallthrough + case "small_team": + fallthrough + case "startup": + fallthrough + case "agency": + fallthrough + case "ecommerce": + fallthrough + case "creator": + fallthrough + case "non_profit": + fallthrough + case "accountant": + fallthrough + case "exploring": + *e = CompanyType(v) + return nil + default: + return fmt.Errorf("invalid value for CompanyType: %v", v) + } +} + +// HeardAbout - How the user heard about the product +type HeardAbout string + +const ( + HeardAboutTwitter HeardAbout = "twitter" + HeardAboutYoutube HeardAbout = "youtube" + HeardAboutFriend HeardAbout = "friend" + HeardAboutGoogle HeardAbout = "google" + HeardAboutBlog HeardAbout = "blog" + HeardAboutPodcast HeardAbout = "podcast" + HeardAboutGithub HeardAbout = "github" + HeardAboutOther HeardAbout = "other" +) + +func (e HeardAbout) ToPointer() *HeardAbout { + return &e +} +func (e *HeardAbout) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "twitter": + fallthrough + case "youtube": + fallthrough + case "friend": + fallthrough + case "google": + fallthrough + case "blog": + fallthrough + case "podcast": + fallthrough + case "github": + fallthrough + case "other": + *e = HeardAbout(v) + return nil + default: + return fmt.Errorf("invalid value for HeardAbout: %v", v) + } +} + type UpdateTeamByIDRequestBody struct { // Name of the team or organization. Must be between 2 and 32 characters Name *string `json:"name,omitempty"` @@ -19,6 +167,14 @@ type UpdateTeamByIDRequestBody struct { BaseCurrency *string `json:"baseCurrency,omitempty"` // Country code for the team CountryCode *string `json:"countryCode,omitempty"` + // Month when the fiscal year starts (1-12). Null for trailing 12 months. Defaults based on country if not specified. + FiscalYearStartMonth *int64 `json:"fiscalYearStartMonth,omitempty"` + // Export settings for transactions + ExportSettings *ExportSettings `json:"exportSettings,omitempty"` + // Type of company or team + CompanyType *CompanyType `json:"companyType,omitempty"` + // How the user heard about the product + HeardAbout *HeardAbout `json:"heardAbout,omitempty"` } func (o *UpdateTeamByIDRequestBody) GetName() *string { @@ -56,9 +212,38 @@ func (o *UpdateTeamByIDRequestBody) GetCountryCode() *string { return o.CountryCode } +func (o *UpdateTeamByIDRequestBody) GetFiscalYearStartMonth() *int64 { + if o == nil { + return nil + } + return o.FiscalYearStartMonth +} + +func (o *UpdateTeamByIDRequestBody) GetExportSettings() *ExportSettings { + if o == nil { + return nil + } + return o.ExportSettings +} + +func (o *UpdateTeamByIDRequestBody) GetCompanyType() *CompanyType { + if o == nil { + return nil + } + return o.CompanyType +} + +func (o *UpdateTeamByIDRequestBody) GetHeardAbout() *HeardAbout { + if o == nil { + return nil + } + return o.HeardAbout +} + type UpdateTeamByIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - RequestBody *UpdateTeamByIDRequestBody `request:"mediaType=application/json"` + // Unique identifier of the team + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateTeamByIDRequestBody `request:"mediaType=application/json"` } func (o *UpdateTeamByIDRequest) GetID() string { @@ -68,9 +253,9 @@ func (o *UpdateTeamByIDRequest) GetID() string { return o.ID } -func (o *UpdateTeamByIDRequest) GetRequestBody() *UpdateTeamByIDRequestBody { +func (o *UpdateTeamByIDRequest) GetRequestBody() UpdateTeamByIDRequestBody { if o == nil { - return nil + return UpdateTeamByIDRequestBody{} } return o.RequestBody } @@ -149,6 +334,8 @@ type UpdateTeamByIDResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Team updated Object *UpdateTeamByIDResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTeamByIDResponse) GetHTTPMeta() components.HTTPMetadata { @@ -164,3 +351,10 @@ func (o *UpdateTeamByIDResponse) GetObject() *UpdateTeamByIDResponseBody { } return o.Object } + +func (o *UpdateTeamByIDResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatetrackerentry.go b/models/operations/updatetrackerentry.go index c3e214e..0308973 100644 --- a/models/operations/updatetrackerentry.go +++ b/models/operations/updatetrackerentry.go @@ -15,8 +15,8 @@ type UpdateTrackerEntryRequestBody struct { Stop time.Time `json:"stop"` // Array of dates for which to create tracker entries Dates []string `json:"dates"` - // Unique identifier of the user assigned to this tracker entry - AssignedID *string `json:"assignedId"` + // Unique identifier of the user assigned to this tracker entry. If not provided, will use the authenticated user + AssignedID *string `json:"assignedId,omitempty"` // Unique identifier of the project associated with this tracker entry ProjectID string `json:"projectId"` // Optional description or notes for the tracker entry @@ -86,6 +86,7 @@ func (o *UpdateTrackerEntryRequestBody) GetDuration() float64 { } type UpdateTrackerEntryRequest struct { + // Unique identifier of the tracker entry to delete ID string `pathParam:"style=simple,explode=false,name=id"` RequestBody *UpdateTrackerEntryRequestBody `request:"mediaType=application/json"` } @@ -388,6 +389,8 @@ type UpdateTrackerEntryResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker entry updated successfully. Object *UpdateTrackerEntryResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTrackerEntryResponse) GetHTTPMeta() components.HTTPMetadata { @@ -403,3 +406,10 @@ func (o *UpdateTrackerEntryResponse) GetObject() *UpdateTrackerEntryResponseBody } return o.Object } + +func (o *UpdateTrackerEntryResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatetrackerproject.go b/models/operations/updatetrackerproject.go index 661a7c4..490679c 100644 --- a/models/operations/updatetrackerproject.go +++ b/models/operations/updatetrackerproject.go @@ -153,6 +153,7 @@ func (o *UpdateTrackerProjectRequestBody) GetTags() []UpdateTrackerProjectTag { } type UpdateTrackerProjectRequest struct { + // Unique identifier of the project to retrieve ID string `pathParam:"style=simple,explode=false,name=id"` RequestBody *UpdateTrackerProjectRequestBody `request:"mediaType=application/json"` } @@ -175,6 +176,8 @@ type UpdateTrackerProjectResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Tracker project updated successfully. TrackerProjectResponse *components.TrackerProjectResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTrackerProjectResponse) GetHTTPMeta() components.HTTPMetadata { @@ -190,3 +193,10 @@ func (o *UpdateTrackerProjectResponse) GetTrackerProjectResponse() *components.T } return o.TrackerProjectResponse } + +func (o *UpdateTrackerProjectResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatetransaction.go b/models/operations/updatetransaction.go index b48e953..666d906 100644 --- a/models/operations/updatetransaction.go +++ b/models/operations/updatetransaction.go @@ -17,6 +17,7 @@ const ( UpdateTransactionStatusCompleted UpdateTransactionStatus = "completed" UpdateTransactionStatusPosted UpdateTransactionStatus = "posted" UpdateTransactionStatusExcluded UpdateTransactionStatus = "excluded" + UpdateTransactionStatusExported UpdateTransactionStatus = "exported" ) func (e UpdateTransactionStatus) ToPointer() *UpdateTransactionStatus { @@ -37,6 +38,8 @@ func (e *UpdateTransactionStatus) UnmarshalJSON(data []byte) error { case "posted": fallthrough case "excluded": + fallthrough + case "exported": *e = UpdateTransactionStatus(v) return nil default: @@ -78,6 +81,16 @@ func (e *UpdateTransactionFrequency) UnmarshalJSON(data []byte) error { } type UpdateTransactionRequestBody struct { + // Name/description of the transaction. + Name *string `json:"name,omitempty"` + // Amount of the transaction. + Amount *float64 `json:"amount,omitempty"` + // Currency of the transaction. + Currency *string `json:"currency,omitempty"` + // Date of the transaction (ISO 8601). + Date *string `json:"date,omitempty"` + // Bank account ID associated with the transaction. + BankAccountID *string `json:"bankAccountId,omitempty"` // Category slug for the transaction. CategorySlug *string `json:"categorySlug,omitempty"` // Status of the transaction. @@ -92,6 +105,45 @@ type UpdateTransactionRequestBody struct { Note *string `json:"note,omitempty"` // Assigned user ID for the transaction. AssignedID *string `json:"assignedId,omitempty"` + // Tax rate as a percentage (e.g., 25 for 25% VAT). Only set when tax is calculated from a percentage. + TaxRate *float64 `json:"taxRate,omitempty"` + // Tax amount in the transaction currency. Always set when tax is present. + TaxAmount *float64 `json:"taxAmount,omitempty"` +} + +func (o *UpdateTransactionRequestBody) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateTransactionRequestBody) GetAmount() *float64 { + if o == nil { + return nil + } + return o.Amount +} + +func (o *UpdateTransactionRequestBody) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *UpdateTransactionRequestBody) GetDate() *string { + if o == nil { + return nil + } + return o.Date +} + +func (o *UpdateTransactionRequestBody) GetBankAccountID() *string { + if o == nil { + return nil + } + return o.BankAccountID } func (o *UpdateTransactionRequestBody) GetCategorySlug() *string { @@ -143,9 +195,24 @@ func (o *UpdateTransactionRequestBody) GetAssignedID() *string { return o.AssignedID } +func (o *UpdateTransactionRequestBody) GetTaxRate() *float64 { + if o == nil { + return nil + } + return o.TaxRate +} + +func (o *UpdateTransactionRequestBody) GetTaxAmount() *float64 { + if o == nil { + return nil + } + return o.TaxAmount +} + type UpdateTransactionRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - RequestBody *UpdateTransactionRequestBody `request:"mediaType=application/json"` + // Transaction ID (UUID). + ID string `pathParam:"style=simple,explode=false,name=id"` + RequestBody UpdateTransactionRequestBody `request:"mediaType=application/json"` } func (o *UpdateTransactionRequest) GetID() string { @@ -155,9 +222,9 @@ func (o *UpdateTransactionRequest) GetID() string { return o.ID } -func (o *UpdateTransactionRequest) GetRequestBody() *UpdateTransactionRequestBody { +func (o *UpdateTransactionRequest) GetRequestBody() UpdateTransactionRequestBody { if o == nil { - return nil + return UpdateTransactionRequestBody{} } return o.RequestBody } @@ -166,6 +233,8 @@ type UpdateTransactionResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transaction updated TransactionResponse *components.TransactionResponse + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTransactionResponse) GetHTTPMeta() components.HTTPMetadata { @@ -181,3 +250,10 @@ func (o *UpdateTransactionResponse) GetTransactionResponse() *components.Transac } return o.TransactionResponse } + +func (o *UpdateTransactionResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/updatetransactions.go b/models/operations/updatetransactions.go index 9952879..6b80a5e 100644 --- a/models/operations/updatetransactions.go +++ b/models/operations/updatetransactions.go @@ -17,6 +17,7 @@ const ( UpdateTransactionsStatusCompleted UpdateTransactionsStatus = "completed" UpdateTransactionsStatusPosted UpdateTransactionsStatus = "posted" UpdateTransactionsStatusExcluded UpdateTransactionsStatus = "excluded" + UpdateTransactionsStatusExported UpdateTransactionsStatus = "exported" ) func (e UpdateTransactionsStatus) ToPointer() *UpdateTransactionsStatus { @@ -37,6 +38,8 @@ func (e *UpdateTransactionsStatus) UnmarshalJSON(data []byte) error { case "posted": fallthrough case "excluded": + fallthrough + case "exported": *e = UpdateTransactionsStatus(v) return nil default: @@ -218,6 +221,8 @@ type UpdateTransactionsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Transactions updated Object *UpdateTransactionsResponseBody + // An error occurred + ErrorResponse *components.ErrorResponse } func (o *UpdateTransactionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -233,3 +238,10 @@ func (o *UpdateTransactionsResponse) GetObject() *UpdateTransactionsResponseBody } return o.Object } + +func (o *UpdateTransactionsResponse) GetErrorResponse() *components.ErrorResponse { + if o == nil { + return nil + } + return o.ErrorResponse +} diff --git a/models/operations/whatsappwebhook.go b/models/operations/whatsappwebhook.go new file mode 100644 index 0000000..88e3534 --- /dev/null +++ b/models/operations/whatsappwebhook.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +// WhatsappWebhookResponseBody - Webhook processed successfully +type WhatsappWebhookResponseBody struct { + Success bool `json:"success"` +} + +func (o *WhatsappWebhookResponseBody) GetSuccess() bool { + if o == nil { + return false + } + return o.Success +} + +type WhatsappWebhookResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook processed successfully + Object *WhatsappWebhookResponseBody +} + +func (o *WhatsappWebhookResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *WhatsappWebhookResponse) GetObject() *WhatsappWebhookResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/whatsappwebhookverify.go b/models/operations/whatsappwebhookverify.go new file mode 100644 index 0000000..1ee9687 --- /dev/null +++ b/models/operations/whatsappwebhookverify.go @@ -0,0 +1,54 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type WhatsappWebhookVerifyRequest struct { + HubMode string `queryParam:"style=form,explode=true,name=hub.mode"` + HubVerifyToken string `queryParam:"style=form,explode=true,name=hub.verify_token"` + HubChallenge string `queryParam:"style=form,explode=true,name=hub.challenge"` +} + +func (o *WhatsappWebhookVerifyRequest) GetHubMode() string { + if o == nil { + return "" + } + return o.HubMode +} + +func (o *WhatsappWebhookVerifyRequest) GetHubVerifyToken() string { + if o == nil { + return "" + } + return o.HubVerifyToken +} + +func (o *WhatsappWebhookVerifyRequest) GetHubChallenge() string { + if o == nil { + return "" + } + return o.HubChallenge +} + +type WhatsappWebhookVerifyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Webhook verified successfully + Res *string +} + +func (o *WhatsappWebhookVerifyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *WhatsappWebhookVerifyResponse) GetRes() *string { + if o == nil { + return nil + } + return o.Res +} diff --git a/models/operations/xerooauthcallback.go b/models/operations/xerooauthcallback.go new file mode 100644 index 0000000..0c03b66 --- /dev/null +++ b/models/operations/xerooauthcallback.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/midday-ai/midday-go/models/components" +) + +type XeroOAuthCallbackRequest struct { + // OAuth authorization code from Xero + Code *string `queryParam:"style=form,explode=true,name=code"` + // OAuth state parameter for CSRF protection + State string `queryParam:"style=form,explode=true,name=state"` + // OAuth error code if authorization failed + Error *string `queryParam:"style=form,explode=true,name=error"` +} + +func (o *XeroOAuthCallbackRequest) GetCode() *string { + if o == nil { + return nil + } + return o.Code +} + +func (o *XeroOAuthCallbackRequest) GetState() string { + if o == nil { + return "" + } + return o.State +} + +func (o *XeroOAuthCallbackRequest) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +type XeroOAuthCallbackResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + Headers map[string][]string +} + +func (o *XeroOAuthCallbackResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *XeroOAuthCallbackResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/notifications.go b/notifications.go new file mode 100644 index 0000000..aebd031 --- /dev/null +++ b/notifications.go @@ -0,0 +1,737 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// Notifications - Manage notifications +type Notifications struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newNotifications(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Notifications { + return &Notifications{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// List all notifications +// Retrieve a list of notifications for the authenticated team. +func (s *Notifications) List(ctx context.Context, request operations.ListNotificationsRequest, opts ...operations.Option) (*operations.ListNotificationsResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/notifications") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "listNotifications", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ListNotificationsResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.NotificationsResponseSchema + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotificationsResponseSchema = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// UpdateStatus - Update notification status +// Update the status of a specific notification. +func (s *Notifications) UpdateStatus(ctx context.Context, notificationID string, requestBody operations.UpdateNotificationStatusRequestBody, opts ...operations.Option) (*operations.UpdateNotificationStatusResponse, error) { + request := operations.UpdateNotificationStatusRequest{ + NotificationID: notificationID, + RequestBody: requestBody, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/notifications/{notificationId}/status", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "updateNotificationStatus", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "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) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.UpdateNotificationStatusResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.NotificationResponseSchema + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotificationResponseSchema = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// UpdateAllStatus - Update status of all notifications +// Update the status of all notifications for the authenticated team. +func (s *Notifications) UpdateAllStatus(ctx context.Context, request components.UpdateAllNotificationsStatusSchema, opts ...operations.Option) (*operations.UpdateAllNotificationsStatusResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/notifications/update-all-status") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "updateAllNotificationsStatus", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.UpdateAllNotificationsStatusResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.UpdateAllNotificationsStatusResponseSchema + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.UpdateAllNotificationsStatusResponseSchema = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} diff --git a/oauth.go b/oauth.go new file mode 100644 index 0000000..57ae823 --- /dev/null +++ b/oauth.go @@ -0,0 +1,1286 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// OAuth authorization flow +type OAuth struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newOAuth(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *OAuth { + return &OAuth{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// PostOAuthRegister - Dynamic Client Registration +// Register an OAuth client dynamically (RFC 7591). Used by MCP clients like ChatGPT and Claude. +func (s *OAuth) PostOAuthRegister(ctx context.Context, request operations.PostOAuthRegisterRequest, opts ...operations.Option) (*operations.PostOAuthRegisterResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/oauth/register") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postOAuthRegister", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PostOAuthRegisterResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PostOAuthRegisterResponseBody1 + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.TwoHundredApplicationJSONObject = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PostOAuthRegisterResponseBody2 + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.TwoHundredAndOneApplicationJSONObject = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.OAuthErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetOAuthAuthorization - OAuth Authorization Endpoint +// Initiate OAuth authorization flow and get consent screen information +func (s *OAuth) GetOAuthAuthorization(ctx context.Context, request operations.GetOAuthAuthorizationRequest, opts ...operations.Option) (*operations.GetOAuthAuthorizationResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/oauth/authorize") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getOAuthAuthorization", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetOAuthAuthorizationResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetOAuthAuthorizationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.OAuthErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PostOAuthAuthorization - OAuth Authorization Decision +// Process user's authorization decision (allow/deny) +func (s *OAuth) PostOAuthAuthorization(ctx context.Context, request operations.PostOAuthAuthorizationRequest, opts ...operations.Option) (*operations.PostOAuthAuthorizationResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/oauth/authorize") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postOAuthAuthorization", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PostOAuthAuthorizationResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PostOAuthAuthorizationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PostOAuthAuthorizationBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PostOAuthAuthorizationUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PostOAuthToken - OAuth Token Exchange +// Exchange authorization code for access token or refresh an access token +func (s *OAuth) PostOAuthToken(ctx context.Context, request components.OAuthTokenEndpointRequest, opts ...operations.Option) (*operations.PostOAuthTokenResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/oauth/token") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postOAuthToken", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PostOAuthTokenResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PostOAuthTokenResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.OAuthErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PostOAuthRevoke - OAuth Token Revocation +// Revoke an access token or refresh token +func (s *OAuth) PostOAuthRevoke(ctx context.Context, request operations.PostOAuthRevokeRequest, opts ...operations.Option) (*operations.PostOAuthRevokeResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/oauth/revoke") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postOAuthRevoke", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PostOAuthRevokeResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PostOAuthRevokeResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} diff --git a/metrics.go b/reports.go similarity index 79% rename from metrics.go rename to reports.go index 803d94d..76df60b 100644 --- a/metrics.go +++ b/reports.go @@ -17,27 +17,29 @@ import ( "net/url" ) -type Metrics struct { +// Reports - Financial reports +type Reports struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration hooks *hooks.Hooks } -func newMetrics(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Metrics { - return &Metrics{ +func newReports(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Reports { + return &Reports{ rootSDK: rootSDK, sdkConfiguration: sdkConfig, hooks: hooks, } } -// Revenue metrics -// Revenue metrics for the authenticated team. -func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetRevenueMetricsResponse, error) { - request := operations.GetRevenueMetricsRequest{ - From: from, - To: to, - Currency: currency, +// Revenue reports +// Revenue reports for the authenticated team. +func (s *Reports) Revenue(ctx context.Context, from string, to string, currency *string, revenueType *operations.GetRevenueReportsRevenueType, opts ...operations.Option) (*operations.GetRevenueReportsResponse, error) { + request := operations.GetRevenueReportsRequest{ + From: from, + To: to, + Currency: currency, + RevenueType: revenueType, } o := operations.Options{} @@ -58,7 +60,7 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/revenue") + opURL, err := url.JoinPath(baseURL, "/reports/revenue") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -68,7 +70,7 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getRevenueMetrics", + OperationID: "getRevenueReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -108,6 +110,16 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -116,11 +128,7 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -194,7 +202,7 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency } } - res := &operations.GetRevenueMetricsResponse{ + res := &operations.GetRevenueReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -236,24 +244,40 @@ func (s *Metrics) Revenue(ctx context.Context, from string, to string, currency } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Profit metrics -// Profit metrics for the authenticated team. -func (s *Metrics) Profit(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetProfitMetricsResponse, error) { - request := operations.GetProfitMetricsRequest{ - From: from, - To: to, - Currency: currency, +// Profit reports +// Profit reports for the authenticated team. +func (s *Reports) Profit(ctx context.Context, from string, to string, currency *string, revenueType *operations.GetProfitReportsRevenueType, opts ...operations.Option) (*operations.GetProfitReportsResponse, error) { + request := operations.GetProfitReportsRequest{ + From: from, + To: to, + Currency: currency, + RevenueType: revenueType, } o := operations.Options{} @@ -274,7 +298,7 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/profit") + opURL, err := url.JoinPath(baseURL, "/reports/profit") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -284,7 +308,7 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getProfitMetrics", + OperationID: "getProfitReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -324,6 +348,16 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -332,11 +366,7 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -410,7 +440,7 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * } } - res := &operations.GetProfitMetricsResponse{ + res := &operations.GetProfitReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -452,21 +482,36 @@ func (s *Metrics) Profit(ctx context.Context, from string, to string, currency * } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// BurnRate - Burn rate metrics -// Burn rate metrics for the authenticated team. -func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetBurnRateMetricsResponse, error) { - request := operations.GetBurnRateMetricsRequest{ +// BurnRate - Burn rate reports +// Burn rate reports for the authenticated team. +func (s *Reports) BurnRate(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetBurnRateReportsResponse, error) { + request := operations.GetBurnRateReportsRequest{ From: from, To: to, Currency: currency, @@ -490,7 +535,7 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/burn-rate") + opURL, err := url.JoinPath(baseURL, "/reports/burn-rate") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -500,7 +545,7 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getBurnRateMetrics", + OperationID: "getBurnRateReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -540,6 +585,16 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -548,11 +603,7 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -626,7 +677,7 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency } } - res := &operations.GetBurnRateMetricsResponse{ + res := &operations.GetBurnRateReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -642,12 +693,12 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency return nil, err } - var out []components.GetBurnRateResponseSchema + var out []components.BurnRateItem if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.GetBurnRateResponseSchemas = out + res.GetBurnRateResponseSchema = out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -668,23 +719,36 @@ func (s *Metrics) BurnRate(ctx context.Context, from string, to string, currency } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Runway metrics -// Runway metrics for the authenticated team. -func (s *Metrics) Runway(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetRunwayMetricsResponse, error) { - request := operations.GetRunwayMetricsRequest{ - From: from, - To: to, +// Runway reports +// Runway reports for the authenticated team. +func (s *Reports) Runway(ctx context.Context, currency *string, opts ...operations.Option) (*operations.GetRunwayReportsResponse, error) { + request := operations.GetRunwayReportsRequest{ Currency: currency, } @@ -706,7 +770,7 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/runway") + opURL, err := url.JoinPath(baseURL, "/reports/runway") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -716,7 +780,7 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getRunwayMetrics", + OperationID: "getRunwayReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -756,6 +820,16 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -764,11 +838,7 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -842,7 +912,7 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * } } - res := &operations.GetRunwayMetricsResponse{ + res := &operations.GetRunwayReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -884,21 +954,36 @@ func (s *Metrics) Runway(ctx context.Context, from string, to string, currency * } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Expenses - Expense metrics -// Expense metrics for the authenticated team. -func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetExpensesMetricsResponse, error) { - request := operations.GetExpensesMetricsRequest{ +// Expenses - Expense reports +// Expense reports for the authenticated team. +func (s *Reports) Expenses(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetExpensesReportsResponse, error) { + request := operations.GetExpensesReportsRequest{ From: from, To: to, Currency: currency, @@ -922,7 +1007,7 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/expenses") + opURL, err := url.JoinPath(baseURL, "/reports/expenses") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -932,7 +1017,7 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getExpensesMetrics", + OperationID: "getExpensesReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -972,6 +1057,16 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -980,11 +1075,7 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1058,7 +1149,7 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency } } - res := &operations.GetExpensesMetricsResponse{ + res := &operations.GetExpensesReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -1100,21 +1191,36 @@ func (s *Metrics) Expenses(ctx context.Context, from string, to string, currency } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil } -// Spending metrics -// Spending metrics for the authenticated team. -func (s *Metrics) Spending(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetSpendingMetricsResponse, error) { - request := operations.GetSpendingMetricsRequest{ +// Spending reports +// Spending reports for the authenticated team. +func (s *Reports) Spending(ctx context.Context, from string, to string, currency *string, opts ...operations.Option) (*operations.GetSpendingReportsResponse, error) { + request := operations.GetSpendingReportsRequest{ From: from, To: to, Currency: currency, @@ -1138,7 +1244,7 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/metrics/spending") + opURL, err := url.JoinPath(baseURL, "/reports/spending") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1148,7 +1254,7 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "getSpendingMetrics", + OperationID: "getSpendingReports", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -1188,6 +1294,16 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -1196,11 +1312,7 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1274,7 +1386,7 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency } } - res := &operations.GetSpendingMetricsResponse{ + res := &operations.GetSpendingReportsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -1316,11 +1428,26 @@ func (s *Metrics) Spending(ctx context.Context, from string, to string, currency } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/search.go b/search.go index 56657ad..e79edba 100644 --- a/search.go +++ b/search.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Search endpoints type Search struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,16 @@ func (s *Search) Search(ctx context.Context, request operations.SearchRequest, o if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +121,7 @@ func (s *Search) Search(ctx context.Context, request operations.SearchRequest, o httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -230,11 +237,26 @@ func (s *Search) Search(ctx context.Context, request operations.SearchRequest, o } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/tags.go b/tags.go index 6e4af84..40e1b47 100644 --- a/tags.go +++ b/tags.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Tags - Manage tags type Tags struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -98,6 +99,16 @@ func (s *Tags) List(ctx context.Context, opts ...operations.Option) (*operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -106,11 +117,7 @@ func (s *Tags) List(ctx context.Context, opts ...operations.Option) (*operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -226,11 +233,26 @@ func (s *Tags) List(ctx context.Context, opts ...operations.Option) (*operations } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -239,7 +261,7 @@ func (s *Tags) List(ctx context.Context, opts ...operations.Option) (*operations // Create a new tag // Create a new tag for the authenticated team. -func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts ...operations.Option) (*operations.CreateTagResponse, error) { +func (s *Tags) Create(ctx context.Context, request components.CreateTag, opts ...operations.Option) (*operations.CreateTagResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -272,7 +294,7 @@ func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts . OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -311,6 +333,16 @@ func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts . if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -319,11 +351,7 @@ func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts . httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -413,12 +441,12 @@ func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts . return nil, err } - var out components.TagsResponse + var out components.TagResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.TagsResponse = &out + res.TagResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -439,11 +467,26 @@ func (s *Tags) Create(ctx context.Context, request *components.CreateTag, opts . } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -521,6 +564,16 @@ func (s *Tags) Get(ctx context.Context, id string, opts ...operations.Option) (* if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -529,11 +582,7 @@ func (s *Tags) Get(ctx context.Context, id string, opts ...operations.Option) (* httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -649,11 +698,26 @@ func (s *Tags) Get(ctx context.Context, id string, opts ...operations.Option) (* } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -715,7 +779,7 @@ func (s *Tags) Delete(ctx context.Context, id string, opts ...operations.Option) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { @@ -731,6 +795,16 @@ func (s *Tags) Delete(ctx context.Context, id string, opts ...operations.Option) if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -739,11 +813,7 @@ func (s *Tags) Delete(ctx context.Context, id string, opts ...operations.Option) httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -839,11 +909,26 @@ func (s *Tags) Delete(ctx context.Context, id string, opts ...operations.Option) } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -852,7 +937,7 @@ func (s *Tags) Delete(ctx context.Context, id string, opts ...operations.Option) // Update a tag // Update a tag by ID for the authenticated team. -func (s *Tags) Update(ctx context.Context, id string, requestBody *operations.UpdateTagRequestBody, opts ...operations.Option) (*operations.UpdateTagResponse, error) { +func (s *Tags) Update(ctx context.Context, id string, requestBody operations.UpdateTagRequestBody, opts ...operations.Option) (*operations.UpdateTagResponse, error) { request := operations.UpdateTagRequest{ ID: id, RequestBody: requestBody, @@ -890,7 +975,7 @@ func (s *Tags) Update(ctx context.Context, id string, requestBody *operations.Up OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -929,6 +1014,16 @@ func (s *Tags) Update(ctx context.Context, id string, requestBody *operations.Up if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -937,11 +1032,7 @@ func (s *Tags) Update(ctx context.Context, id string, requestBody *operations.Up httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1057,11 +1148,26 @@ func (s *Tags) Update(ctx context.Context, id string, requestBody *operations.Up } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/teams.go b/teams.go index c7be1d8..4d1068c 100644 --- a/teams.go +++ b/teams.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Teams - Manage teams type Teams struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -98,6 +99,16 @@ func (s *Teams) List(ctx context.Context, opts ...operations.Option) (*operation if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -106,11 +117,7 @@ func (s *Teams) List(ctx context.Context, opts ...operations.Option) (*operation httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -226,11 +233,26 @@ func (s *Teams) List(ctx context.Context, opts ...operations.Option) (*operation } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -308,6 +330,16 @@ func (s *Teams) Get(ctx context.Context, id string, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -316,11 +348,7 @@ func (s *Teams) Get(ctx context.Context, id string, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -436,11 +464,26 @@ func (s *Teams) Get(ctx context.Context, id string, opts ...operations.Option) ( } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -449,7 +492,7 @@ func (s *Teams) Get(ctx context.Context, id string, opts ...operations.Option) ( // Update a team // Update a team for the authenticated workspace. If there’s no change, returns it as it is. -func (s *Teams) Update(ctx context.Context, id string, requestBody *operations.UpdateTeamByIDRequestBody, opts ...operations.Option) (*operations.UpdateTeamByIDResponse, error) { +func (s *Teams) Update(ctx context.Context, id string, requestBody operations.UpdateTeamByIDRequestBody, opts ...operations.Option) (*operations.UpdateTeamByIDResponse, error) { request := operations.UpdateTeamByIDRequest{ ID: id, RequestBody: requestBody, @@ -487,7 +530,7 @@ func (s *Teams) Update(ctx context.Context, id string, requestBody *operations.U OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -526,6 +569,16 @@ func (s *Teams) Update(ctx context.Context, id string, requestBody *operations.U if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -534,11 +587,7 @@ func (s *Teams) Update(ctx context.Context, id string, requestBody *operations.U httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -654,11 +703,26 @@ func (s *Teams) Update(ctx context.Context, id string, requestBody *operations.U } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -736,6 +800,16 @@ func (s *Teams) Members(ctx context.Context, id string, opts ...operations.Optio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -744,11 +818,7 @@ func (s *Teams) Members(ctx context.Context, id string, opts ...operations.Optio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -864,11 +934,26 @@ func (s *Teams) Members(ctx context.Context, id string, opts ...operations.Optio } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/trackerentries.go b/trackerentries.go index d908a17..a0a503e 100644 --- a/trackerentries.go +++ b/trackerentries.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// TrackerEntries - Manage time tracker entries type TrackerEntries struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -108,6 +109,16 @@ func (s *TrackerEntries) List(ctx context.Context, from string, to string, proje if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -116,11 +127,7 @@ func (s *TrackerEntries) List(ctx context.Context, from string, to string, proje httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -236,11 +243,26 @@ func (s *TrackerEntries) List(ctx context.Context, from string, to string, proje } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -321,6 +343,16 @@ func (s *TrackerEntries) Create(ctx context.Context, request *operations.CreateT if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -329,11 +361,7 @@ func (s *TrackerEntries) Create(ctx context.Context, request *operations.CreateT httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -449,11 +477,26 @@ func (s *TrackerEntries) Create(ctx context.Context, request *operations.CreateT } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -534,6 +577,16 @@ func (s *TrackerEntries) CreateBulk(ctx context.Context, request *operations.Cre if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -542,11 +595,7 @@ func (s *TrackerEntries) CreateBulk(ctx context.Context, request *operations.Cre httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -662,11 +711,26 @@ func (s *TrackerEntries) CreateBulk(ctx context.Context, request *operations.Cre } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -744,6 +808,16 @@ func (s *TrackerEntries) Delete(ctx context.Context, id string, opts ...operatio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -752,11 +826,7 @@ func (s *TrackerEntries) Delete(ctx context.Context, id string, opts ...operatio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -872,11 +942,26 @@ func (s *TrackerEntries) Delete(ctx context.Context, id string, opts ...operatio } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -962,6 +1047,16 @@ func (s *TrackerEntries) Update(ctx context.Context, id string, requestBody *ope if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -970,11 +1065,7 @@ func (s *TrackerEntries) Update(ctx context.Context, id string, requestBody *ope httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1090,11 +1181,26 @@ func (s *TrackerEntries) Update(ctx context.Context, id string, requestBody *ope } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/trackerprojects.go b/trackerprojects.go index e3dfdfa..17003aa 100644 --- a/trackerprojects.go +++ b/trackerprojects.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// TrackerProjects - Manage tracker projects type TrackerProjects struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,16 @@ func (s *TrackerProjects) List(ctx context.Context, request operations.ListTrack if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +121,7 @@ func (s *TrackerProjects) List(ctx context.Context, request operations.ListTrack httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -230,11 +237,26 @@ func (s *TrackerProjects) List(ctx context.Context, request operations.ListTrack } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -315,6 +337,16 @@ func (s *TrackerProjects) Create(ctx context.Context, request *operations.Create if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -323,11 +355,7 @@ func (s *TrackerProjects) Create(ctx context.Context, request *operations.Create httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -443,11 +471,26 @@ func (s *TrackerProjects) Create(ctx context.Context, request *operations.Create } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -525,6 +568,16 @@ func (s *TrackerProjects) Get(ctx context.Context, id string, opts ...operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -533,11 +586,7 @@ func (s *TrackerProjects) Get(ctx context.Context, id string, opts ...operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -653,11 +702,26 @@ func (s *TrackerProjects) Get(ctx context.Context, id string, opts ...operations } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -735,6 +799,16 @@ func (s *TrackerProjects) Delete(ctx context.Context, id string, opts ...operati if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -743,11 +817,7 @@ func (s *TrackerProjects) Delete(ctx context.Context, id string, opts ...operati httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -863,11 +933,26 @@ func (s *TrackerProjects) Delete(ctx context.Context, id string, opts ...operati } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -953,6 +1038,16 @@ func (s *TrackerProjects) Update(ctx context.Context, id string, requestBody *op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -961,11 +1056,7 @@ func (s *TrackerProjects) Update(ctx context.Context, id string, requestBody *op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1081,11 +1172,26 @@ func (s *TrackerProjects) Update(ctx context.Context, id string, requestBody *op } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/trackertimer.go b/trackertimer.go index feefdb4..98a944a 100644 --- a/trackertimer.go +++ b/trackertimer.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// TrackerTimer - Timer operations type TrackerTimer struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -105,6 +106,16 @@ func (s *TrackerTimer) StartTimer(ctx context.Context, request *operations.Start if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -113,11 +124,7 @@ func (s *TrackerTimer) StartTimer(ctx context.Context, request *operations.Start httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -233,11 +240,26 @@ func (s *TrackerTimer) StartTimer(ctx context.Context, request *operations.Start } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -318,6 +340,16 @@ func (s *TrackerTimer) StopTimer(ctx context.Context, request *operations.StopTi if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -326,11 +358,7 @@ func (s *TrackerTimer) StopTimer(ctx context.Context, request *operations.StopTi httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -446,11 +474,26 @@ func (s *TrackerTimer) StopTimer(ctx context.Context, request *operations.StopTi } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -532,6 +575,16 @@ func (s *TrackerTimer) GetCurrentTimer(ctx context.Context, assignedID *string, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -540,11 +593,7 @@ func (s *TrackerTimer) GetCurrentTimer(ctx context.Context, assignedID *string, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -660,11 +709,26 @@ func (s *TrackerTimer) GetCurrentTimer(ctx context.Context, assignedID *string, } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -746,6 +810,16 @@ func (s *TrackerTimer) GetTimerStatus(ctx context.Context, assignedID *string, o if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -754,11 +828,7 @@ func (s *TrackerTimer) GetTimerStatus(ctx context.Context, assignedID *string, o httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -874,11 +944,26 @@ func (s *TrackerTimer) GetTimerStatus(ctx context.Context, assignedID *string, o } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/transactions.go b/transactions.go index 78b9b04..fb0a67b 100644 --- a/transactions.go +++ b/transactions.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Transactions - Manage transactions type Transactions struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -102,6 +103,16 @@ func (s *Transactions) List(ctx context.Context, request operations.ListTransact if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -110,11 +121,7 @@ func (s *Transactions) List(ctx context.Context, request operations.ListTransact httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -230,11 +237,26 @@ func (s *Transactions) List(ctx context.Context, request operations.ListTransact } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -243,7 +265,7 @@ func (s *Transactions) List(ctx context.Context, request operations.ListTransact // Create a transaction // Create a transaction -func (s *Transactions) Create(ctx context.Context, request *operations.CreateTransactionRequest, opts ...operations.Option) (*operations.CreateTransactionResponse, error) { +func (s *Transactions) Create(ctx context.Context, request operations.CreateTransactionRequest, opts ...operations.Option) (*operations.CreateTransactionResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -276,7 +298,7 @@ func (s *Transactions) Create(ctx context.Context, request *operations.CreateTra OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -315,6 +337,16 @@ func (s *Transactions) Create(ctx context.Context, request *operations.CreateTra if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -323,11 +355,7 @@ func (s *Transactions) Create(ctx context.Context, request *operations.CreateTra httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -443,11 +471,26 @@ func (s *Transactions) Create(ctx context.Context, request *operations.CreateTra } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -525,6 +568,16 @@ func (s *Transactions) Get(ctx context.Context, id string, opts ...operations.Op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -533,11 +586,7 @@ func (s *Transactions) Get(ctx context.Context, id string, opts ...operations.Op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -653,11 +702,26 @@ func (s *Transactions) Get(ctx context.Context, id string, opts ...operations.Op } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -735,6 +799,16 @@ func (s *Transactions) Delete(ctx context.Context, id string, opts ...operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -743,11 +817,7 @@ func (s *Transactions) Delete(ctx context.Context, id string, opts ...operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -863,11 +933,26 @@ func (s *Transactions) Delete(ctx context.Context, id string, opts ...operations } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -876,7 +961,7 @@ func (s *Transactions) Delete(ctx context.Context, id string, opts ...operations // Update a transaction // Update a transaction for the authenticated team. If there's no change, returns it as it is. -func (s *Transactions) Update(ctx context.Context, id string, requestBody *operations.UpdateTransactionRequestBody, opts ...operations.Option) (*operations.UpdateTransactionResponse, error) { +func (s *Transactions) Update(ctx context.Context, id string, requestBody operations.UpdateTransactionRequestBody, opts ...operations.Option) (*operations.UpdateTransactionResponse, error) { request := operations.UpdateTransactionRequest{ ID: id, RequestBody: requestBody, @@ -914,7 +999,7 @@ func (s *Transactions) Update(ctx context.Context, id string, requestBody *opera OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -953,6 +1038,16 @@ func (s *Transactions) Update(ctx context.Context, id string, requestBody *opera if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -961,11 +1056,7 @@ func (s *Transactions) Update(ctx context.Context, id string, requestBody *opera httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1080,6 +1171,318 @@ func (s *Transactions) Update(ctx context.Context, id string, requestBody *opera return nil, err } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// GetAttachmentPreSignedURL - Generate pre-signed URL for transaction attachment +// Generate a pre-signed URL for accessing a transaction attachment. The URL is valid for 60 seconds and allows secure temporary access to the attachment file. +func (s *Transactions) GetAttachmentPreSignedURL(ctx context.Context, transactionID string, attachmentID string, download *bool, opts ...operations.Option) (*operations.GetTransactionAttachmentPreSignedURLResponse, error) { + request := operations.GetTransactionAttachmentPreSignedURLRequest{ + TransactionID: transactionID, + AttachmentID: attachmentID, + Download: download, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/transactions/{transactionId}/attachments/{attachmentId}/presigned-url", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getTransactionAttachmentPreSignedUrl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetTransactionAttachmentPreSignedURLResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.GetTransactionAttachmentPreSignedURLResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetTransactionAttachmentPreSignedURLBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetTransactionAttachmentPreSignedURLNotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.GetTransactionAttachmentPreSignedURLInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -1127,7 +1530,7 @@ func (s *Transactions) CreateMany(ctx context.Context, request []operations.Requ OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -1166,6 +1569,16 @@ func (s *Transactions) CreateMany(ctx context.Context, request []operations.Requ if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -1174,11 +1587,7 @@ func (s *Transactions) CreateMany(ctx context.Context, request []operations.Requ httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1294,11 +1703,26 @@ func (s *Transactions) CreateMany(ctx context.Context, request []operations.Requ } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -1340,7 +1764,7 @@ func (s *Transactions) DeleteMany(ctx context.Context, request []string, opts .. OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -1379,6 +1803,16 @@ func (s *Transactions) DeleteMany(ctx context.Context, request []string, opts .. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -1387,11 +1821,7 @@ func (s *Transactions) DeleteMany(ctx context.Context, request []string, opts .. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1507,11 +1937,26 @@ func (s *Transactions) DeleteMany(ctx context.Context, request []string, opts .. } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -1520,7 +1965,7 @@ func (s *Transactions) DeleteMany(ctx context.Context, request []string, opts .. // UpdateMany - Bulk update transactions // Bulk update transactions for the authenticated team. If there's no change, returns it as it is. -func (s *Transactions) UpdateMany(ctx context.Context, request *operations.UpdateTransactionsRequest, opts ...operations.Option) (*operations.UpdateTransactionsResponse, error) { +func (s *Transactions) UpdateMany(ctx context.Context, request operations.UpdateTransactionsRequest, opts ...operations.Option) (*operations.UpdateTransactionsResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1553,7 +1998,7 @@ func (s *Transactions) UpdateMany(ctx context.Context, request *operations.Updat OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -1592,6 +2037,16 @@ func (s *Transactions) UpdateMany(ctx context.Context, request *operations.Updat if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -1600,11 +2055,7 @@ func (s *Transactions) UpdateMany(ctx context.Context, request *operations.Updat httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -1720,11 +2171,26 @@ func (s *Transactions) UpdateMany(ctx context.Context, request *operations.Updat } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/users.go b/users.go index 1e0c8a4..5c7c78b 100644 --- a/users.go +++ b/users.go @@ -17,6 +17,7 @@ import ( "net/url" ) +// Users - Manage users type Users struct { rootSDK *Midday sdkConfiguration config.SDKConfiguration @@ -98,6 +99,16 @@ func (s *Users) Get(ctx context.Context, opts ...operations.Option) (*operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -106,11 +117,7 @@ func (s *Users) Get(ctx context.Context, opts ...operations.Option) (*operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -226,11 +233,26 @@ func (s *Users) Get(ctx context.Context, opts ...operations.Option) (*operations } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil @@ -239,7 +261,7 @@ func (s *Users) Get(ctx context.Context, opts ...operations.Option) (*operations // Update the current user // Update the current user for the authenticated team. -func (s *Users) Update(ctx context.Context, request *operations.UpdateCurrentUserRequest, opts ...operations.Option) (*operations.UpdateCurrentUserResponse, error) { +func (s *Users) Update(ctx context.Context, request operations.UpdateCurrentUserRequest, opts ...operations.Option) (*operations.UpdateCurrentUserResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -272,7 +294,7 @@ func (s *Users) Update(ctx context.Context, request *operations.UpdateCurrentUse OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -311,6 +333,16 @@ func (s *Users) Update(ctx context.Context, request *operations.UpdateCurrentUse if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } } } @@ -319,11 +351,7 @@ func (s *Users) Update(ctx context.Context, request *operations.UpdateCurrentUse httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", + "5XX", }, }, func() (*http.Response, error) { if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { @@ -439,11 +467,26 @@ func (s *Users) Update(ctx context.Context, request *operations.UpdateCurrentUse } return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil diff --git a/webhooks.go b/webhooks.go new file mode 100644 index 0000000..0e76a86 --- /dev/null +++ b/webhooks.go @@ -0,0 +1,1609 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package middaygo + +import ( + "bytes" + "context" + "fmt" + "github.com/midday-ai/midday-go/internal/config" + "github.com/midday-ai/midday-go/internal/hooks" + "github.com/midday-ai/midday-go/internal/utils" + "github.com/midday-ai/midday-go/models/apierrors" + "github.com/midday-ai/midday-go/models/components" + "github.com/midday-ai/midday-go/models/operations" + "github.com/midday-ai/midday-go/retry" + "net/http" + "net/url" +) + +// Webhooks - Webhook endpoints +type Webhooks struct { + rootSDK *Midday + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newWebhooks(rootSDK *Midday, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Webhooks { + return &Webhooks{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// InboxWebhook - Inbox webhook +// Webhook endpoint for receiving inbox emails from Postmark +func (s *Webhooks) InboxWebhook(ctx context.Context, request any, opts ...operations.Option) (*operations.InboxWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/inbox") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "inboxWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "403", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.InboxWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.InboxWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.InboxWebhookBadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.InboxWebhookInternalServerError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PlaidWebhook - Plaid webhook handler +// Handles Plaid webhook events for transaction updates and item status changes. Verifies the Plaid-Verification JWT signature. +func (s *Webhooks) PlaidWebhook(ctx context.Context, opts ...operations.Option) (*operations.PlaidWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/plaid") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "plaidWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PlaidWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PlaidWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PolarWebhook - Polar webhook handler +// Handles Polar webhook events for subscription changes. Verifies webhook signature and processes subscription events. +func (s *Webhooks) PolarWebhook(ctx context.Context, opts ...operations.Option) (*operations.PolarWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/polar") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "polarWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PolarWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.PolarWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// StripeWebhook - Stripe webhook handler +// Handles Stripe webhook events for invoice payments. Verifies webhook signature and processes payment events. +func (s *Webhooks) StripeWebhook(ctx context.Context, opts ...operations.Option) (*operations.StripeWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/stripe") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "stripeWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.StripeWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.StripeWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// TellerWebhook - Teller webhook handler +// Handles Teller webhook events for enrollment disconnections and transaction updates. +func (s *Webhooks) TellerWebhook(ctx context.Context, opts ...operations.Option) (*operations.TellerWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/teller") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "tellerWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.TellerWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.TellerWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// WhatsappWebhookVerify - WhatsApp webhook verification +// Verify webhook URL for WhatsApp Business API +func (s *Webhooks) WhatsappWebhookVerify(ctx context.Context, hubMode string, hubVerifyToken string, hubChallenge string, opts ...operations.Option) (*operations.WhatsappWebhookVerifyResponse, error) { + request := operations.WhatsappWebhookVerifyRequest{ + HubMode: hubMode, + HubVerifyToken: hubVerifyToken, + HubChallenge: hubChallenge, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/whatsapp") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "whatsappWebhookVerify", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + 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", "text/plain") + 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) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.WhatsappWebhookVerifyResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `text/plain`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + out := string(rawBody) + res.Res = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// WhatsappWebhook - WhatsApp webhook +// Receive messages, media, and button replies from WhatsApp Business API +func (s *Webhooks) WhatsappWebhook(ctx context.Context, request any, opts ...operations.Option) (*operations.WhatsappWebhookResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/webhook/whatsapp") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "whatsappWebhook", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 300000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.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.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.WhatsappWebhookResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out operations.WhatsappWebhookResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +}