orb-billing 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +169 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -0
- package/dist/internal/utils/contenttype.d.ts +1 -0
- package/dist/internal/utils/contenttype.js +33 -0
- package/dist/internal/utils/headers.d.ts +4 -0
- package/dist/internal/utils/headers.js +92 -0
- package/dist/internal/utils/index.d.ts +8 -0
- package/dist/internal/utils/index.js +27 -0
- package/dist/internal/utils/pathparams.d.ts +2 -0
- package/dist/internal/utils/pathparams.js +53 -0
- package/dist/internal/utils/queryparams.d.ts +2 -0
- package/dist/internal/utils/queryparams.js +178 -0
- package/dist/internal/utils/requestbody.d.ts +2 -0
- package/dist/internal/utils/requestbody.js +318 -0
- package/dist/internal/utils/retries.d.ts +20 -0
- package/dist/internal/utils/retries.js +250 -0
- package/dist/internal/utils/security.d.ts +2 -0
- package/dist/internal/utils/security.js +188 -0
- package/dist/internal/utils/utils.d.ts +37 -0
- package/dist/internal/utils/utils.js +370 -0
- package/dist/sdk/availability.d.ts +19 -0
- package/dist/sdk/availability.js +135 -0
- package/dist/sdk/coupon.d.ts +53 -0
- package/dist/sdk/coupon.js +358 -0
- package/dist/sdk/credit.d.ts +142 -0
- package/dist/sdk/credit.js +501 -0
- package/dist/sdk/creditnote.d.ts +26 -0
- package/dist/sdk/creditnote.js +186 -0
- package/dist/sdk/customer.d.ts +264 -0
- package/dist/sdk/customer.js +958 -0
- package/dist/sdk/event.d.ts +258 -0
- package/dist/sdk/event.js +732 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +20 -0
- package/dist/sdk/invoice.d.ts +60 -0
- package/dist/sdk/invoice.js +416 -0
- package/dist/sdk/models/operations/addledgerentryexternalid.d.ts +16 -0
- package/dist/sdk/models/operations/addledgerentryexternalid.js +95 -0
- package/dist/sdk/models/operations/amendevent.d.ts +23 -0
- package/dist/sdk/models/operations/amendevent.js +99 -0
- package/dist/sdk/models/operations/amendusage.d.ts +34 -0
- package/dist/sdk/models/operations/amendusage.js +122 -0
- package/dist/sdk/models/operations/amendusageexternalcustomerid.d.ts +34 -0
- package/dist/sdk/models/operations/amendusageexternalcustomerid.js +122 -0
- package/dist/sdk/models/operations/archivecoupon.d.ts +15 -0
- package/dist/sdk/models/operations/archivecoupon.js +91 -0
- package/dist/sdk/models/operations/cancelsubscription.d.ts +16 -0
- package/dist/sdk/models/operations/cancelsubscription.js +95 -0
- package/dist/sdk/models/operations/closebackfill.d.ts +15 -0
- package/dist/sdk/models/operations/closebackfill.js +91 -0
- package/dist/sdk/models/operations/createbackfill.d.ts +12 -0
- package/dist/sdk/models/operations/createbackfill.js +79 -0
- package/dist/sdk/models/operations/createcoupon.d.ts +12 -0
- package/dist/sdk/models/operations/createcoupon.js +79 -0
- package/dist/sdk/models/operations/createcustomer.d.ts +12 -0
- package/dist/sdk/models/operations/createcustomer.js +79 -0
- package/dist/sdk/models/operations/createcustomerbalancetransaction.d.ts +16 -0
- package/dist/sdk/models/operations/createcustomerbalancetransaction.js +95 -0
- package/dist/sdk/models/operations/createinvoicelineitem.d.ts +12 -0
- package/dist/sdk/models/operations/createinvoicelineitem.js +79 -0
- package/dist/sdk/models/operations/createledgerentry.d.ts +16 -0
- package/dist/sdk/models/operations/createledgerentry.js +95 -0
- package/dist/sdk/models/operations/createsubscription.d.ts +12 -0
- package/dist/sdk/models/operations/createsubscription.js +79 -0
- package/dist/sdk/models/operations/deletecustomer.d.ts +22 -0
- package/dist/sdk/models/operations/deletecustomer.js +78 -0
- package/dist/sdk/models/operations/deprecateevent.d.ts +22 -0
- package/dist/sdk/models/operations/deprecateevent.js +95 -0
- package/dist/sdk/models/operations/fetchcoupon.d.ts +15 -0
- package/dist/sdk/models/operations/fetchcoupon.js +91 -0
- package/dist/sdk/models/operations/fetchcreditnote.d.ts +18 -0
- package/dist/sdk/models/operations/fetchcreditnote.js +91 -0
- package/dist/sdk/models/operations/fetchcustomer.d.ts +18 -0
- package/dist/sdk/models/operations/fetchcustomer.js +91 -0
- package/dist/sdk/models/operations/fetchcustomercosts.d.ts +34 -0
- package/dist/sdk/models/operations/fetchcustomercosts.js +107 -0
- package/dist/sdk/models/operations/fetchcustomercostsexternalid.d.ts +31 -0
- package/dist/sdk/models/operations/fetchcustomercostsexternalid.js +107 -0
- package/dist/sdk/models/operations/fetchcustomercredits.d.ts +26 -0
- package/dist/sdk/models/operations/fetchcustomercredits.js +99 -0
- package/dist/sdk/models/operations/fetchcustomercreditsexternalid.d.ts +23 -0
- package/dist/sdk/models/operations/fetchcustomercreditsexternalid.js +99 -0
- package/dist/sdk/models/operations/fetchcustomercreditsledger.d.ts +35 -0
- package/dist/sdk/models/operations/fetchcustomercreditsledger.js +111 -0
- package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.d.ts +35 -0
- package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.js +111 -0
- package/dist/sdk/models/operations/fetchcustomerexternalid.d.ts +15 -0
- package/dist/sdk/models/operations/fetchcustomerexternalid.js +91 -0
- package/dist/sdk/models/operations/fetchinvoice.d.ts +15 -0
- package/dist/sdk/models/operations/fetchinvoice.js +91 -0
- package/dist/sdk/models/operations/fetchplan.d.ts +15 -0
- package/dist/sdk/models/operations/fetchplan.js +91 -0
- package/dist/sdk/models/operations/fetchplanexternalid.d.ts +15 -0
- package/dist/sdk/models/operations/fetchplanexternalid.js +91 -0
- package/dist/sdk/models/operations/fetchsubscription.d.ts +15 -0
- package/dist/sdk/models/operations/fetchsubscription.js +91 -0
- package/dist/sdk/models/operations/fetchsubscriptioncosts.d.ts +31 -0
- package/dist/sdk/models/operations/fetchsubscriptioncosts.js +107 -0
- package/dist/sdk/models/operations/fetchsubscriptionschedule.d.ts +23 -0
- package/dist/sdk/models/operations/fetchsubscriptionschedule.js +99 -0
- package/dist/sdk/models/operations/fetchsubscriptionusage.d.ts +39 -0
- package/dist/sdk/models/operations/fetchsubscriptionusage.js +115 -0
- package/dist/sdk/models/operations/fetchupcominginvoice.d.ts +15 -0
- package/dist/sdk/models/operations/fetchupcominginvoice.js +91 -0
- package/dist/sdk/models/operations/index.d.ts +55 -0
- package/dist/sdk/models/operations/index.js +74 -0
- package/dist/sdk/models/operations/ingest.d.ts +30 -0
- package/dist/sdk/models/operations/ingest.js +118 -0
- package/dist/sdk/models/operations/issueinvoice.d.ts +19 -0
- package/dist/sdk/models/operations/issueinvoice.js +95 -0
- package/dist/sdk/models/operations/listbackfills.d.ts +22 -0
- package/dist/sdk/models/operations/listbackfills.js +95 -0
- package/dist/sdk/models/operations/listbalancetransactions.d.ts +23 -0
- package/dist/sdk/models/operations/listbalancetransactions.js +99 -0
- package/dist/sdk/models/operations/listcoupons.d.ts +30 -0
- package/dist/sdk/models/operations/listcoupons.js +103 -0
- package/dist/sdk/models/operations/listcouponsubscriptions.d.ts +15 -0
- package/dist/sdk/models/operations/listcouponsubscriptions.js +91 -0
- package/dist/sdk/models/operations/listcreditnote.d.ts +34 -0
- package/dist/sdk/models/operations/listcreditnote.js +107 -0
- package/dist/sdk/models/operations/listcustomers.d.ts +22 -0
- package/dist/sdk/models/operations/listcustomers.js +95 -0
- package/dist/sdk/models/operations/listinvoices.d.ts +38 -0
- package/dist/sdk/models/operations/listinvoices.js +111 -0
- package/dist/sdk/models/operations/listplans.d.ts +22 -0
- package/dist/sdk/models/operations/listplans.js +95 -0
- package/dist/sdk/models/operations/listsubscriptions.d.ts +24 -0
- package/dist/sdk/models/operations/listsubscriptions.js +103 -0
- package/dist/sdk/models/operations/ping.d.ts +12 -0
- package/dist/sdk/models/operations/ping.js +79 -0
- package/dist/sdk/models/operations/revertbackfill.d.ts +15 -0
- package/dist/sdk/models/operations/revertbackfill.js +91 -0
- package/dist/sdk/models/operations/scheduleplanchange.d.ts +16 -0
- package/dist/sdk/models/operations/scheduleplanchange.js +95 -0
- package/dist/sdk/models/operations/searchevents.d.ts +23 -0
- package/dist/sdk/models/operations/searchevents.js +99 -0
- package/dist/sdk/models/operations/unschedulecancellation.d.ts +15 -0
- package/dist/sdk/models/operations/unschedulecancellation.js +91 -0
- package/dist/sdk/models/operations/unscheduleplanchange.d.ts +15 -0
- package/dist/sdk/models/operations/unscheduleplanchange.js +91 -0
- package/dist/sdk/models/operations/updatecustomer.d.ts +19 -0
- package/dist/sdk/models/operations/updatecustomer.js +95 -0
- package/dist/sdk/models/operations/updatecustomerexternalid.d.ts +16 -0
- package/dist/sdk/models/operations/updatecustomerexternalid.js +95 -0
- package/dist/sdk/models/operations/updatefixedfeequantity.d.ts +16 -0
- package/dist/sdk/models/operations/updatefixedfeequantity.js +95 -0
- package/dist/sdk/models/operations/voidinvoice.d.ts +19 -0
- package/dist/sdk/models/operations/voidinvoice.js +95 -0
- package/dist/sdk/models/shared/action.d.ts +8 -0
- package/dist/sdk/models/shared/action.js +15 -0
- package/dist/sdk/models/shared/amendedevent.d.ts +28 -0
- package/dist/sdk/models/shared/amendedevent.js +81 -0
- package/dist/sdk/models/shared/amendedusage.d.ts +16 -0
- package/dist/sdk/models/shared/amendedusage.js +62 -0
- package/dist/sdk/models/shared/amendeventresult.d.ts +10 -0
- package/dist/sdk/models/shared/amendeventresult.js +48 -0
- package/dist/sdk/models/shared/autocollection.d.ts +18 -0
- package/dist/sdk/models/shared/autocollection.js +66 -0
- package/dist/sdk/models/shared/availability.d.ts +7 -0
- package/dist/sdk/models/shared/availability.js +48 -0
- package/dist/sdk/models/shared/backfill.d.ts +27 -0
- package/dist/sdk/models/shared/backfill.js +104 -0
- package/dist/sdk/models/shared/backfills.d.ts +10 -0
- package/dist/sdk/models/shared/backfills.js +57 -0
- package/dist/sdk/models/shared/backfillstatus.d.ts +9 -0
- package/dist/sdk/models/shared/backfillstatus.js +16 -0
- package/dist/sdk/models/shared/billablemetric.d.ts +4 -0
- package/dist/sdk/models/shared/billablemetric.js +45 -0
- package/dist/sdk/models/shared/billablemetricminified.d.ts +5 -0
- package/dist/sdk/models/shared/billablemetricminified.js +50 -0
- package/dist/sdk/models/shared/bpsconfig.d.ts +8 -0
- package/dist/sdk/models/shared/bpsconfig.js +53 -0
- package/dist/sdk/models/shared/bpspriceoverride.d.ts +24 -0
- package/dist/sdk/models/shared/bpspriceoverride.js +74 -0
- package/dist/sdk/models/shared/bpstier.d.ts +7 -0
- package/dist/sdk/models/shared/bpstier.js +60 -0
- package/dist/sdk/models/shared/bulkbpsconfig.d.ts +8 -0
- package/dist/sdk/models/shared/bulkbpsconfig.js +50 -0
- package/dist/sdk/models/shared/bulkbpspriceoverride.d.ts +24 -0
- package/dist/sdk/models/shared/bulkbpspriceoverride.js +74 -0
- package/dist/sdk/models/shared/bulkbpstier.d.ts +6 -0
- package/dist/sdk/models/shared/bulkbpstier.js +55 -0
- package/dist/sdk/models/shared/bulkconfig.d.ts +8 -0
- package/dist/sdk/models/shared/bulkconfig.js +50 -0
- package/dist/sdk/models/shared/bulkpriceoverride.d.ts +24 -0
- package/dist/sdk/models/shared/bulkpriceoverride.js +74 -0
- package/dist/sdk/models/shared/bulktier.d.ts +5 -0
- package/dist/sdk/models/shared/bulktier.js +50 -0
- package/dist/sdk/models/shared/cadence.d.ts +5 -0
- package/dist/sdk/models/shared/cadence.js +12 -0
- package/dist/sdk/models/shared/canceloption.d.ts +8 -0
- package/dist/sdk/models/shared/canceloption.js +15 -0
- package/dist/sdk/models/shared/changeoption.d.ts +8 -0
- package/dist/sdk/models/shared/changeoption.js +15 -0
- package/dist/sdk/models/shared/changeoption1.d.ts +8 -0
- package/dist/sdk/models/shared/changeoption1.js +15 -0
- package/dist/sdk/models/shared/coupon.d.ts +36 -0
- package/dist/sdk/models/shared/coupon.js +88 -0
- package/dist/sdk/models/shared/coupons.d.ts +10 -0
- package/dist/sdk/models/shared/coupons.js +57 -0
- package/dist/sdk/models/shared/credit.d.ts +16 -0
- package/dist/sdk/models/shared/credit.js +64 -0
- package/dist/sdk/models/shared/creditblock.d.ts +15 -0
- package/dist/sdk/models/shared/creditblock.js +58 -0
- package/dist/sdk/models/shared/creditledgerentries.d.ts +10 -0
- package/dist/sdk/models/shared/creditledgerentries.js +57 -0
- package/dist/sdk/models/shared/creditledgerentry.d.ts +58 -0
- package/dist/sdk/models/shared/creditledgerentry.js +144 -0
- package/dist/sdk/models/shared/creditnote.d.ts +71 -0
- package/dist/sdk/models/shared/creditnote.js +134 -0
- package/dist/sdk/models/shared/creditnotelineitem.d.ts +38 -0
- package/dist/sdk/models/shared/creditnotelineitem.js +86 -0
- package/dist/sdk/models/shared/creditnotes.d.ts +10 -0
- package/dist/sdk/models/shared/creditnotes.js +57 -0
- package/dist/sdk/models/shared/creditnotesummary.d.ts +9 -0
- package/dist/sdk/models/shared/creditnotesummary.js +74 -0
- package/dist/sdk/models/shared/creditnotetype.d.ts +7 -0
- package/dist/sdk/models/shared/creditnotetype.js +14 -0
- package/dist/sdk/models/shared/credits.d.ts +10 -0
- package/dist/sdk/models/shared/credits.js +57 -0
- package/dist/sdk/models/shared/customer.d.ts +227 -0
- package/dist/sdk/models/shared/customer.js +364 -0
- package/dist/sdk/models/shared/customerbalancetransaction.d.ts +57 -0
- package/dist/sdk/models/shared/customerbalancetransaction.js +133 -0
- package/dist/sdk/models/shared/customercost.d.ts +15 -0
- package/dist/sdk/models/shared/customercost.js +75 -0
- package/dist/sdk/models/shared/customercosts.d.ts +8 -0
- package/dist/sdk/models/shared/customercosts.js +50 -0
- package/dist/sdk/models/shared/customerminified.d.ts +8 -0
- package/dist/sdk/models/shared/customerminified.js +53 -0
- package/dist/sdk/models/shared/customers.d.ts +10 -0
- package/dist/sdk/models/shared/customers.js +57 -0
- package/dist/sdk/models/shared/debug.d.ts +8 -0
- package/dist/sdk/models/shared/debug.js +53 -0
- package/dist/sdk/models/shared/deprecatedeventresult.d.ts +10 -0
- package/dist/sdk/models/shared/deprecatedeventresult.js +48 -0
- package/dist/sdk/models/shared/discount.d.ts +25 -0
- package/dist/sdk/models/shared/discount.js +71 -0
- package/dist/sdk/models/shared/discounttype.d.ts +6 -0
- package/dist/sdk/models/shared/discounttype.js +13 -0
- package/dist/sdk/models/shared/durationunit.d.ts +8 -0
- package/dist/sdk/models/shared/durationunit.js +15 -0
- package/dist/sdk/models/shared/entrystatus.d.ts +7 -0
- package/dist/sdk/models/shared/entrystatus.js +14 -0
- package/dist/sdk/models/shared/entrytype.d.ts +9 -0
- package/dist/sdk/models/shared/entrytype.js +16 -0
- package/dist/sdk/models/shared/event.d.ts +32 -0
- package/dist/sdk/models/shared/event.js +82 -0
- package/dist/sdk/models/shared/eventsearchcriteria.d.ts +11 -0
- package/dist/sdk/models/shared/eventsearchcriteria.js +50 -0
- package/dist/sdk/models/shared/eventsearchresults.d.ts +10 -0
- package/dist/sdk/models/shared/eventsearchresults.js +57 -0
- package/dist/sdk/models/shared/externalmarketplace.d.ts +8 -0
- package/dist/sdk/models/shared/externalmarketplace.js +15 -0
- package/dist/sdk/models/shared/fixedfeequantitychange.d.ts +18 -0
- package/dist/sdk/models/shared/fixedfeequantitychange.js +66 -0
- package/dist/sdk/models/shared/fixedfeequantityschedule.d.ts +7 -0
- package/dist/sdk/models/shared/fixedfeequantityschedule.js +68 -0
- package/dist/sdk/models/shared/granularity.d.ts +6 -0
- package/dist/sdk/models/shared/granularity.js +13 -0
- package/dist/sdk/models/shared/grouping.d.ts +8 -0
- package/dist/sdk/models/shared/grouping.js +53 -0
- package/dist/sdk/models/shared/index.d.ts +125 -0
- package/dist/sdk/models/shared/index.js +144 -0
- package/dist/sdk/models/shared/ingestionresponse.d.ts +13 -0
- package/dist/sdk/models/shared/ingestionresponse.js +57 -0
- package/dist/sdk/models/shared/invoice.d.ts +274 -0
- package/dist/sdk/models/shared/invoice.js +460 -0
- package/dist/sdk/models/shared/invoicelineitem.d.ts +207 -0
- package/dist/sdk/models/shared/invoicelineitem.js +416 -0
- package/dist/sdk/models/shared/invoices.d.ts +10 -0
- package/dist/sdk/models/shared/invoices.js +57 -0
- package/dist/sdk/models/shared/invoicesettings.d.ts +18 -0
- package/dist/sdk/models/shared/invoicesettings.js +58 -0
- package/dist/sdk/models/shared/invoicestatus.d.ts +10 -0
- package/dist/sdk/models/shared/invoicestatus.js +17 -0
- package/dist/sdk/models/shared/lineitem.d.ts +58 -0
- package/dist/sdk/models/shared/lineitem.js +147 -0
- package/dist/sdk/models/shared/matrixconfig.d.ts +13 -0
- package/dist/sdk/models/shared/matrixconfig.js +60 -0
- package/dist/sdk/models/shared/matrixconfig1.d.ts +10 -0
- package/dist/sdk/models/shared/matrixconfig1.js +48 -0
- package/dist/sdk/models/shared/matrixvalue.d.ts +8 -0
- package/dist/sdk/models/shared/matrixvalue.js +50 -0
- package/dist/sdk/models/shared/modeltype.d.ts +10 -0
- package/dist/sdk/models/shared/modeltype.js +17 -0
- package/dist/sdk/models/shared/newbackfill.d.ts +27 -0
- package/dist/sdk/models/shared/newbackfill.js +82 -0
- package/dist/sdk/models/shared/newcoupon.d.ts +24 -0
- package/dist/sdk/models/shared/newcoupon.js +69 -0
- package/dist/sdk/models/shared/newcreditledgerentry.d.ts +44 -0
- package/dist/sdk/models/shared/newcreditledgerentry.js +109 -0
- package/dist/sdk/models/shared/newcustomer.d.ts +202 -0
- package/dist/sdk/models/shared/newcustomer.js +324 -0
- package/dist/sdk/models/shared/newinvoicelineitem.d.ts +28 -0
- package/dist/sdk/models/shared/newinvoicelineitem.js +79 -0
- package/dist/sdk/models/shared/newsubscription.d.ts +79 -0
- package/dist/sdk/models/shared/newsubscription.js +145 -0
- package/dist/sdk/models/shared/newtransaction.d.ts +10 -0
- package/dist/sdk/models/shared/newtransaction.js +56 -0
- package/dist/sdk/models/shared/packageconfig.d.ts +8 -0
- package/dist/sdk/models/shared/packageconfig.js +53 -0
- package/dist/sdk/models/shared/packagepriceoverride.d.ts +24 -0
- package/dist/sdk/models/shared/packagepriceoverride.js +74 -0
- package/dist/sdk/models/shared/paginationmetadata.d.ts +5 -0
- package/dist/sdk/models/shared/paginationmetadata.js +50 -0
- package/dist/sdk/models/shared/perpricecost.d.ts +24 -0
- package/dist/sdk/models/shared/perpricecost.js +67 -0
- package/dist/sdk/models/shared/phaseoverride.d.ts +40 -0
- package/dist/sdk/models/shared/phaseoverride.js +100 -0
- package/dist/sdk/models/shared/plan.d.ts +101 -0
- package/dist/sdk/models/shared/plan.js +250 -0
- package/dist/sdk/models/shared/planminified.d.ts +5 -0
- package/dist/sdk/models/shared/planminified.js +50 -0
- package/dist/sdk/models/shared/planphase.d.ts +68 -0
- package/dist/sdk/models/shared/planphase.js +162 -0
- package/dist/sdk/models/shared/plans.d.ts +10 -0
- package/dist/sdk/models/shared/plans.js +57 -0
- package/dist/sdk/models/shared/price.d.ts +114 -0
- package/dist/sdk/models/shared/price.js +245 -0
- package/dist/sdk/models/shared/pricegroup.d.ts +17 -0
- package/dist/sdk/models/shared/pricegroup.js +65 -0
- package/dist/sdk/models/shared/product.d.ts +6 -0
- package/dist/sdk/models/shared/product.js +59 -0
- package/dist/sdk/models/shared/reason.d.ts +9 -0
- package/dist/sdk/models/shared/reason.js +16 -0
- package/dist/sdk/models/shared/requestvalidationerror.d.ts +20 -0
- package/dist/sdk/models/shared/requestvalidationerror.js +65 -0
- package/dist/sdk/models/shared/security.d.ts +4 -0
- package/dist/sdk/models/shared/security.js +45 -0
- package/dist/sdk/models/shared/sublineitem.d.ts +32 -0
- package/dist/sdk/models/shared/sublineitem.js +102 -0
- package/dist/sdk/models/shared/sublineitem1.d.ts +24 -0
- package/dist/sdk/models/shared/sublineitem1.js +75 -0
- package/dist/sdk/models/shared/sublineitem2.d.ts +6 -0
- package/dist/sdk/models/shared/sublineitem2.js +55 -0
- package/dist/sdk/models/shared/subscription.d.ts +95 -0
- package/dist/sdk/models/shared/subscription.js +207 -0
- package/dist/sdk/models/shared/subscriptioncancellation.d.ts +12 -0
- package/dist/sdk/models/shared/subscriptioncancellation.js +55 -0
- package/dist/sdk/models/shared/subscriptioncost.d.ts +15 -0
- package/dist/sdk/models/shared/subscriptioncost.js +75 -0
- package/dist/sdk/models/shared/subscriptioncosts.d.ts +8 -0
- package/dist/sdk/models/shared/subscriptioncosts.js +50 -0
- package/dist/sdk/models/shared/subscriptionminified.d.ts +7 -0
- package/dist/sdk/models/shared/subscriptionminified.js +48 -0
- package/dist/sdk/models/shared/subscriptionplanchange.d.ts +54 -0
- package/dist/sdk/models/shared/subscriptionplanchange.js +104 -0
- package/dist/sdk/models/shared/subscriptions.d.ts +10 -0
- package/dist/sdk/models/shared/subscriptions.js +57 -0
- package/dist/sdk/models/shared/subscriptionschedule.d.ts +10 -0
- package/dist/sdk/models/shared/subscriptionschedule.js +57 -0
- package/dist/sdk/models/shared/subscriptionscheduleitem.d.ts +7 -0
- package/dist/sdk/models/shared/subscriptionscheduleitem.js +65 -0
- package/dist/sdk/models/shared/subscriptionstatus.d.ts +5 -0
- package/dist/sdk/models/shared/subscriptionstatus.js +12 -0
- package/dist/sdk/models/shared/subscriptionusage.d.ts +8 -0
- package/dist/sdk/models/shared/subscriptionusage.js +50 -0
- package/dist/sdk/models/shared/taxamount.d.ts +15 -0
- package/dist/sdk/models/shared/taxamount.js +55 -0
- package/dist/sdk/models/shared/tier.d.ts +6 -0
- package/dist/sdk/models/shared/tier.js +55 -0
- package/dist/sdk/models/shared/tier7.d.ts +7 -0
- package/dist/sdk/models/shared/tier7.js +60 -0
- package/dist/sdk/models/shared/tierconfig.d.ts +9 -0
- package/dist/sdk/models/shared/tierconfig.js +58 -0
- package/dist/sdk/models/shared/tieredbpsconfig.d.ts +8 -0
- package/dist/sdk/models/shared/tieredbpsconfig.js +50 -0
- package/dist/sdk/models/shared/tieredbpsconfig1.d.ts +5 -0
- package/dist/sdk/models/shared/tieredbpsconfig1.js +47 -0
- package/dist/sdk/models/shared/tieredbpspriceoverride.d.ts +21 -0
- package/dist/sdk/models/shared/tieredbpspriceoverride.js +74 -0
- package/dist/sdk/models/shared/tieredconfig.d.ts +8 -0
- package/dist/sdk/models/shared/tieredconfig.js +50 -0
- package/dist/sdk/models/shared/tieredpriceoverride.d.ts +27 -0
- package/dist/sdk/models/shared/tieredpriceoverride.js +74 -0
- package/dist/sdk/models/shared/transactions.d.ts +10 -0
- package/dist/sdk/models/shared/transactions.js +57 -0
- package/dist/sdk/models/shared/transactiontype.d.ts +4 -0
- package/dist/sdk/models/shared/transactiontype.js +11 -0
- package/dist/sdk/models/shared/trialconfig.d.ts +8 -0
- package/dist/sdk/models/shared/trialconfig.js +54 -0
- package/dist/sdk/models/shared/type.d.ts +7 -0
- package/dist/sdk/models/shared/type.js +14 -0
- package/dist/sdk/models/shared/unitconfig.d.ts +7 -0
- package/dist/sdk/models/shared/unitconfig.js +48 -0
- package/dist/sdk/models/shared/unitpriceoverride.d.ts +24 -0
- package/dist/sdk/models/shared/unitpriceoverride.js +74 -0
- package/dist/sdk/models/shared/upcominginvoice.d.ts +95 -0
- package/dist/sdk/models/shared/upcominginvoice.js +193 -0
- package/dist/sdk/models/shared/updateevent.d.ts +28 -0
- package/dist/sdk/models/shared/updateevent.js +77 -0
- package/dist/sdk/models/shared/usage.d.ts +13 -0
- package/dist/sdk/models/shared/usage.js +69 -0
- package/dist/sdk/models/shared/usageitem.d.ts +6 -0
- package/dist/sdk/models/shared/usageitem.js +63 -0
- package/dist/sdk/models/shared/validationerrors.d.ts +13 -0
- package/dist/sdk/models/shared/validationerrors.js +59 -0
- package/dist/sdk/models/shared/viewmode.d.ts +7 -0
- package/dist/sdk/models/shared/viewmode.js +14 -0
- package/dist/sdk/plan.d.ts +222 -0
- package/dist/sdk/plan.js +422 -0
- package/dist/sdk/sdk.d.ts +298 -0
- package/dist/sdk/sdk.js +110 -0
- package/dist/sdk/subscription.d.ts +614 -0
- package/dist/sdk/subscription.js +1192 -0
- package/dist/sdk/types/index.d.ts +1 -0
- package/dist/sdk/types/index.js +20 -0
- package/dist/sdk/types/rfcdate.d.ts +9 -0
- package/dist/sdk/types/rfcdate.js +59 -0
- package/package.json +33 -0
package/dist/sdk/plan.js
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
40
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
41
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
42
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
43
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
44
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
45
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
49
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
50
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
51
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
52
|
+
function step(op) {
|
|
53
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
54
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
55
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
56
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
57
|
+
switch (op[0]) {
|
|
58
|
+
case 0: case 1: t = op; break;
|
|
59
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
60
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
61
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
62
|
+
default:
|
|
63
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
64
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
65
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
66
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
67
|
+
if (t[2]) _.ops.pop();
|
|
68
|
+
_.trys.pop(); continue;
|
|
69
|
+
}
|
|
70
|
+
op = body.call(thisArg, _);
|
|
71
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
72
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
+
exports.Plan = void 0;
|
|
77
|
+
var utils = __importStar(require("../internal/utils"));
|
|
78
|
+
var operations = __importStar(require("./models/operations"));
|
|
79
|
+
var shared = __importStar(require("./models/shared"));
|
|
80
|
+
/**
|
|
81
|
+
* The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be subscribed to by a customer. Plans define the billing behavior of the subscription.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price object. The model_type field determines the key for the configuration object that is present.
|
|
85
|
+
*
|
|
86
|
+
* ## Unit pricing
|
|
87
|
+
* With unit pricing, each unit costs a fixed amount.
|
|
88
|
+
* ```json
|
|
89
|
+
* {
|
|
90
|
+
* ...
|
|
91
|
+
* "model_type": "unit",
|
|
92
|
+
* "unit_config": {
|
|
93
|
+
* "unit_amount": "0.50"
|
|
94
|
+
* }
|
|
95
|
+
* ...
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* ## Tiered pricing
|
|
100
|
+
* In tiered pricing, the cost of a given unit depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first ten units may cost $0.50 each and all units thereafter may cost $0.10 each.
|
|
101
|
+
* ```json
|
|
102
|
+
* {
|
|
103
|
+
* ...
|
|
104
|
+
* "model_type": "tiered",
|
|
105
|
+
* "tiered_config": {
|
|
106
|
+
* "tiers": [
|
|
107
|
+
* {
|
|
108
|
+
* "first_unit": 1,
|
|
109
|
+
* "last_unit": 10,
|
|
110
|
+
* "unit_amount": "0.50"
|
|
111
|
+
* },
|
|
112
|
+
* {
|
|
113
|
+
* "first_unit": 11,
|
|
114
|
+
* "last_unit": null,
|
|
115
|
+
* "unit_amount": "0.10"
|
|
116
|
+
* }
|
|
117
|
+
* ]
|
|
118
|
+
* }
|
|
119
|
+
* ...
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* ## Bulk pricing
|
|
124
|
+
* Bulk pricing applies when the number of units determine the cost of all units. For example, if you've bought less than 10 units, they may each be $0.50 for a total of $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 (i.e. 101 units total would be $40.40).
|
|
125
|
+
* ```json
|
|
126
|
+
* {
|
|
127
|
+
* ...
|
|
128
|
+
* "model_type": "bulk",
|
|
129
|
+
* "bulk_config": {
|
|
130
|
+
* "tiers": [
|
|
131
|
+
* {
|
|
132
|
+
* "maximum_units": 10,
|
|
133
|
+
* "unit_amount": "0.50"
|
|
134
|
+
* },
|
|
135
|
+
* {
|
|
136
|
+
* "maximum_units": 1000,
|
|
137
|
+
* "unit_amount": "0.40"
|
|
138
|
+
* }
|
|
139
|
+
* ]
|
|
140
|
+
* }
|
|
141
|
+
* ...
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* ## Package pricing
|
|
146
|
+
* Package pricing defines the size or granularity of a unit for billing purposes. For example, if the package size is set to 5, then 4 units will be billed as 5 and 6 units will be billed at 10.
|
|
147
|
+
* ```json
|
|
148
|
+
* {
|
|
149
|
+
* ...
|
|
150
|
+
* "model_type": "package",
|
|
151
|
+
* "package_config": {
|
|
152
|
+
* "package_amount": "0.80",
|
|
153
|
+
* "package_size": 10
|
|
154
|
+
* }
|
|
155
|
+
* ...
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* ## BPS pricing
|
|
160
|
+
* BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a percent (the number of basis points to charge), as well as a cap per event to assess. For example, this would allow you to assess a fee of 0.25% on every payment you process, with a maximum charge of $25 per payment.
|
|
161
|
+
* ```json
|
|
162
|
+
* {
|
|
163
|
+
* ...
|
|
164
|
+
* "model_type": "bps",
|
|
165
|
+
* "bps_config": {
|
|
166
|
+
* "bps": 125,
|
|
167
|
+
* "per_unit_maximum": "11.00"
|
|
168
|
+
* }
|
|
169
|
+
* ...
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* ## Bulk BPS pricing
|
|
174
|
+
* Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total quantity across all events. Similar to bulk pricing, the BPS parameters of a given event depends on the tier range that the billing period falls into. Each tier range is defined by an upper bound. For example, after $1.5M of payment volume is reached, each individual payment may have a lower cap or a smaller take-rate.
|
|
175
|
+
* ```json
|
|
176
|
+
* ...
|
|
177
|
+
* "model_type": "bulk_bps",
|
|
178
|
+
* "bulk_bps_config": {
|
|
179
|
+
* "tiers": [
|
|
180
|
+
* {
|
|
181
|
+
* "maximum_amount": "1000000.00",
|
|
182
|
+
* "bps": 125,
|
|
183
|
+
* "per_unit_maximum": "19.00"
|
|
184
|
+
* },
|
|
185
|
+
* {
|
|
186
|
+
* "maximum_amount": null,
|
|
187
|
+
* "bps": 115,
|
|
188
|
+
* "per_unit_maximum": "4.00"
|
|
189
|
+
* }
|
|
190
|
+
* ]
|
|
191
|
+
* }
|
|
192
|
+
* ...
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* ## Tiered BPS pricing
|
|
197
|
+
* Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's applicable parameter is a function of its marginal addition to the period total. Similar to tiered pricing, the BPS parameters of a given event depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first few payments may have a 0.8 BPS take-rate and all payments after a specific volume may incur a take-rate of 0.5 BPS each.
|
|
198
|
+
* ```json
|
|
199
|
+
* ...
|
|
200
|
+
* "model_type": "tiered_bps",
|
|
201
|
+
* "tiered_bps_config": {
|
|
202
|
+
* "tiers": [
|
|
203
|
+
* {
|
|
204
|
+
* "minimum_amount": "0",
|
|
205
|
+
* "maximum_amount": "1000000.00",
|
|
206
|
+
* "bps": 125,
|
|
207
|
+
* "per_unit_maximum": "19.00"
|
|
208
|
+
* },
|
|
209
|
+
* {
|
|
210
|
+
* "minimum_amount": "1000000.00",
|
|
211
|
+
* "maximum_amount": null,
|
|
212
|
+
* "bps": 115,
|
|
213
|
+
* "per_unit_maximum": "4.00"
|
|
214
|
+
* }
|
|
215
|
+
* ]
|
|
216
|
+
* }
|
|
217
|
+
* ...
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* ## Matrix pricing
|
|
222
|
+
* Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. `dimensions` defines the two event property values evaluated in this pricing model. In a one-dimensional matrix, the second value is `null`. Every configuration has a list of `matrix_values` which give the unit prices for specified property values. In a one-dimensional matrix, the matrix values will have `dimension_values` where the second value of the pair is null. If an event does not match any of the dimension values in the matrix, it will resort to the `default_unit_amount`.
|
|
223
|
+
* ```json
|
|
224
|
+
* ...
|
|
225
|
+
* "model_type": "matrix"
|
|
226
|
+
* "matrix_config": {
|
|
227
|
+
* "default_unit_amount": "3.00",
|
|
228
|
+
* "dimensions": [
|
|
229
|
+
* "cluster_name",
|
|
230
|
+
* "region"
|
|
231
|
+
* ],
|
|
232
|
+
* "matrix_values": [
|
|
233
|
+
* {
|
|
234
|
+
* "dimension_values": [
|
|
235
|
+
* "alpha",
|
|
236
|
+
* "west"
|
|
237
|
+
* ],
|
|
238
|
+
* "unit_amount": "2.00"
|
|
239
|
+
* },
|
|
240
|
+
* ...
|
|
241
|
+
* ]
|
|
242
|
+
* }
|
|
243
|
+
* ...
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* ### Fixed fees
|
|
247
|
+
* Fixed fees are prices that are applied independent of usage quantites, and follow unit pricing. They also have an additional parameter `fixed_price_quantity`. If the Price represents a fixed cost, this represents the quantity of units applied.
|
|
248
|
+
* ```json
|
|
249
|
+
* {
|
|
250
|
+
* ...
|
|
251
|
+
* "id": "price_id",
|
|
252
|
+
* "model_type": "unit",
|
|
253
|
+
* "unit_config": {
|
|
254
|
+
* "unit_amount": "2.00"
|
|
255
|
+
* },
|
|
256
|
+
* "fixed_price_quantity": 3.0
|
|
257
|
+
* ...
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
262
|
+
var Plan = /** @class */ (function () {
|
|
263
|
+
function Plan(sdkConfig) {
|
|
264
|
+
this.sdkConfiguration = sdkConfig;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Fetch plan
|
|
268
|
+
*
|
|
269
|
+
* @remarks
|
|
270
|
+
* This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) details given a plan identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.
|
|
271
|
+
*
|
|
272
|
+
* ## Serialized prices
|
|
273
|
+
* Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given [Price](../guides/concepts#plan-and-price) object. The `model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](../guides/concepts#plan-and-price).
|
|
274
|
+
*
|
|
275
|
+
* ## Phases
|
|
276
|
+
* Orb supports plan phases, also known as contract ramps. For plans with phases, the serialized prices refer to all prices across all phases.
|
|
277
|
+
*/
|
|
278
|
+
Plan.prototype.fetch = function (req, config) {
|
|
279
|
+
var _a, _b;
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
|
|
282
|
+
return __generator(this, function (_c) {
|
|
283
|
+
switch (_c.label) {
|
|
284
|
+
case 0:
|
|
285
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
286
|
+
req = new operations.FetchPlanRequest(req);
|
|
287
|
+
}
|
|
288
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
289
|
+
url = utils.generateURL(baseURL, "/plans/{plan_id}", req);
|
|
290
|
+
client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
|
|
291
|
+
headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
|
|
292
|
+
headers["Accept"] = "application/json";
|
|
293
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
294
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
295
|
+
case 1:
|
|
296
|
+
httpRes = _c.sent();
|
|
297
|
+
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
298
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
299
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
300
|
+
}
|
|
301
|
+
res = new operations.FetchPlanResponse({
|
|
302
|
+
statusCode: httpRes.status,
|
|
303
|
+
contentType: contentType,
|
|
304
|
+
rawResponse: httpRes,
|
|
305
|
+
});
|
|
306
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
307
|
+
switch (true) {
|
|
308
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
309
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
310
|
+
res.plan = utils.objectToClass(JSON.parse(decodedRes), shared.Plan);
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
return [2 /*return*/, res];
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Fetch plan by external ID
|
|
321
|
+
*
|
|
322
|
+
* @remarks
|
|
323
|
+
* This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) details given an external_plan_id identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.
|
|
324
|
+
*
|
|
325
|
+
* ## Serialized prices
|
|
326
|
+
* Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given [Price](../guides/concepts#plan-and-price) object. The `model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](../guides/concepts#plan-and-price).
|
|
327
|
+
*/
|
|
328
|
+
Plan.prototype.getByExternalId = function (req, config) {
|
|
329
|
+
var _a, _b;
|
|
330
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
331
|
+
var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
|
|
332
|
+
return __generator(this, function (_c) {
|
|
333
|
+
switch (_c.label) {
|
|
334
|
+
case 0:
|
|
335
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
336
|
+
req = new operations.FetchPlanExternalIdRequest(req);
|
|
337
|
+
}
|
|
338
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
339
|
+
url = utils.generateURL(baseURL, "/plans/external_plan_id/{external_plan_id}", req);
|
|
340
|
+
client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
|
|
341
|
+
headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
|
|
342
|
+
headers["Accept"] = "application/json";
|
|
343
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
344
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
345
|
+
case 1:
|
|
346
|
+
httpRes = _c.sent();
|
|
347
|
+
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
348
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
349
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
350
|
+
}
|
|
351
|
+
res = new operations.FetchPlanExternalIdResponse({
|
|
352
|
+
statusCode: httpRes.status,
|
|
353
|
+
contentType: contentType,
|
|
354
|
+
rawResponse: httpRes,
|
|
355
|
+
});
|
|
356
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
357
|
+
switch (true) {
|
|
358
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
359
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
360
|
+
res.plan = utils.objectToClass(JSON.parse(decodedRes), shared.Plan);
|
|
361
|
+
}
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
return [2 /*return*/, res];
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* List plans
|
|
371
|
+
*
|
|
372
|
+
* @remarks
|
|
373
|
+
* This endpoint returns a list of all [plans](../guides/concepts##plan-and-price) for an account in a list format.
|
|
374
|
+
*
|
|
375
|
+
* The list of plans is ordered starting from the most recently created plan. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.
|
|
376
|
+
*
|
|
377
|
+
*/
|
|
378
|
+
Plan.prototype.list = function (req, config) {
|
|
379
|
+
var _a, _b;
|
|
380
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
381
|
+
var baseURL, url, client, headers, queryParams, httpRes, contentType, res, decodedRes;
|
|
382
|
+
return __generator(this, function (_c) {
|
|
383
|
+
switch (_c.label) {
|
|
384
|
+
case 0:
|
|
385
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
386
|
+
req = new operations.ListPlansRequest(req);
|
|
387
|
+
}
|
|
388
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
389
|
+
url = baseURL.replace(/\/$/, "") + "/plans";
|
|
390
|
+
client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
|
|
391
|
+
headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
|
|
392
|
+
queryParams = utils.serializeQueryParams(req);
|
|
393
|
+
headers["Accept"] = "application/json";
|
|
394
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
395
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
396
|
+
case 1:
|
|
397
|
+
httpRes = _c.sent();
|
|
398
|
+
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
399
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
400
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
401
|
+
}
|
|
402
|
+
res = new operations.ListPlansResponse({
|
|
403
|
+
statusCode: httpRes.status,
|
|
404
|
+
contentType: contentType,
|
|
405
|
+
rawResponse: httpRes,
|
|
406
|
+
});
|
|
407
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
408
|
+
switch (true) {
|
|
409
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
410
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
411
|
+
res.plans = utils.objectToClass(JSON.parse(decodedRes), shared.Plans);
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
return [2 /*return*/, res];
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
return Plan;
|
|
421
|
+
}());
|
|
422
|
+
exports.Plan = Plan;
|