@paid-ai/paid-node 1.8.0 → 2.0.0
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/dist/cjs/Client.d.ts +3 -3
- package/dist/cjs/Client.js +13 -13
- package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
- package/dist/cjs/api/errors/UnprocessableEntityError.js +50 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/analytics/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/analytics/client/Client.js +5 -2
- package/dist/cjs/api/resources/analyticsExperimental/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/analyticsExperimental/client/Client.js +5 -2
- package/dist/cjs/api/resources/checkouts/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/checkouts/client/Client.js +4 -1
- package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +5 -0
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +6 -4
- package/dist/cjs/api/resources/contacts/client/Client.js +10 -4
- package/dist/cjs/api/resources/credits/client/Client.d.ts +19 -0
- package/dist/cjs/api/resources/credits/client/Client.js +105 -1
- package/dist/cjs/api/resources/credits/client/requests/GetCreditTransactionSummaryRequest.d.ts +33 -0
- package/dist/cjs/api/resources/credits/client/requests/ListCreditTransactionsRequest.d.ts +2 -0
- package/dist/cjs/api/resources/credits/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestGroupBy.d.ts +4 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestGroupBy.js +7 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestInterval.d.ts +6 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestInterval.js +9 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestType.d.ts +6 -0
- package/dist/cjs/api/resources/credits/types/GetCreditTransactionSummaryRequestType.js +9 -0
- package/dist/cjs/api/resources/credits/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/credits/types/index.js +3 -0
- package/dist/cjs/api/resources/customViewsExperimental/client/Client.d.ts +26 -3
- package/dist/cjs/api/resources/customViewsExperimental/client/Client.js +101 -4
- package/dist/cjs/api/resources/customViewsExperimental/client/requests/CreateCustomViewRequest.d.ts +4 -0
- package/dist/cjs/api/resources/customViewsExperimental/client/requests/GetCustomViewCustomerUnitsRequest.d.ts +14 -0
- package/dist/cjs/api/resources/customViewsExperimental/client/requests/GetCustomViewDataRequest.d.ts +6 -0
- package/dist/cjs/api/resources/customViewsExperimental/client/requests/UpdateCustomViewRequest.d.ts +4 -0
- package/dist/cjs/api/resources/customViewsExperimental/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/GetCustomViewDataRequestIncludeDraft.d.ts +5 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/GetCustomViewDataRequestIncludeDraft.js +8 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/GetCustomViewDataRequestUnitMode.d.ts +6 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/GetCustomViewDataRequestUnitMode.js +9 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/customViewsExperimental/types/index.js +2 -0
- package/dist/cjs/api/resources/customerPortals/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/customerPortals/client/Client.js +1 -1
- package/dist/cjs/api/resources/customers/client/Client.d.ts +489 -19
- package/dist/cjs/api/resources/customers/client/Client.js +2018 -207
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerApiKeyByExternalIdRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerApiKeyRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerFundingInstructionsByExternalIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerFundingInstructionsRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerUnitAliasByExternalIdRequest.d.ts +18 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerUnitAliasByKeyRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerUnitAliasRequest.d.ts +18 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomerUnitCreateUnderParent.d.ts +21 -0
- package/dist/cjs/api/resources/customers/client/requests/DeleteCustomerUnitAliasByExternalIdRequest.d.ts +16 -0
- package/dist/cjs/api/resources/customers/client/requests/DeleteCustomerUnitAliasByKeyRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customers/client/requests/DeleteCustomerUnitAliasRequest.d.ts +16 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerFundingInstructionsByExternalIdRequest.d.ts +11 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerFundingInstructionsRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerUnitByKeyRequest.d.ts +10 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerUnitSpendByExternalIdRequest.d.ts +22 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerUnitSpendRequest.d.ts +22 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerUnitSpendRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/GrantCustomerCreditsByExternalIdRequest.d.ts +2 -1
- package/dist/cjs/api/resources/customers/client/requests/GrantCustomerCreditsRequest.d.ts +2 -1
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerApiKeysByExternalIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerApiKeysByExternalIdRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerApiKeysRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerApiKeysRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesByExternalIdRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesByExternalIdRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesByKeyRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesByKeyRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitAliasesRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitsByExternalIdRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customers/client/requests/ListCustomerUnitsRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customers/client/requests/RevokeCustomerApiKeyByExternalIdRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customers/client/requests/RevokeCustomerApiKeyByExternalIdRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/RevokeCustomerApiKeyRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customers/client/requests/RevokeCustomerApiKeyRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +23 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasByExternalIdResponse.d.ts +1 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasByExternalIdResponse.js +3 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasByKeyResponse.d.ts +1 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasByKeyResponse.js +3 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasResponse.d.ts +1 -0
- package/dist/cjs/api/resources/customers/types/DeleteCustomerUnitAliasResponse.js +3 -0
- package/dist/cjs/api/resources/customers/types/ListCustomerUnitsByExternalIdRequestStatus.d.ts +1 -0
- package/dist/cjs/api/resources/customers/types/ListCustomerUnitsByExternalIdRequestStatus.js +1 -0
- package/dist/cjs/api/resources/customers/types/ListCustomerUnitsRequestStatus.d.ts +1 -0
- package/dist/cjs/api/resources/customers/types/ListCustomerUnitsRequestStatus.js +1 -0
- package/dist/cjs/api/resources/customers/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/customers/types/index.js +3 -0
- package/dist/cjs/api/resources/deliveredValue/client/Client.d.ts +60 -0
- package/dist/cjs/api/resources/deliveredValue/client/Client.js +248 -0
- package/dist/cjs/api/resources/deliveredValue/client/requests/GetDeliveredValueRequest.d.ts +18 -0
- package/dist/cjs/api/resources/deliveredValue/client/requests/GetDeliveredValueRequest.js +3 -0
- package/dist/cjs/api/resources/deliveredValue/client/requests/GetDeliveredValueSummaryRequest.d.ts +29 -0
- package/dist/cjs/api/resources/deliveredValue/client/requests/GetDeliveredValueSummaryRequest.js +3 -0
- package/dist/cjs/api/resources/deliveredValue/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/{customerGroups → deliveredValue}/index.d.ts +1 -0
- package/dist/cjs/api/resources/{customerGroups → deliveredValue}/index.js +1 -0
- package/dist/cjs/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestGroupBy.d.ts +7 -0
- package/dist/cjs/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestGroupBy.js +10 -0
- package/dist/cjs/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestInterval.d.ts +8 -0
- package/dist/cjs/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestInterval.js +11 -0
- package/dist/cjs/api/resources/deliveredValue/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/deliveredValue/types/index.js +18 -0
- package/dist/cjs/api/resources/index.d.ts +4 -2
- package/dist/cjs/api/resources/index.js +5 -3
- package/dist/cjs/api/resources/orders/client/Client.d.ts +87 -1
- package/dist/cjs/api/resources/orders/client/Client.js +146 -1
- package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +12 -1
- package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.js +12 -0
- package/dist/cjs/api/resources/orders/client/requests/ProvisionRequest.d.ts +82 -0
- package/dist/cjs/api/resources/orders/client/requests/ProvisionRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +12 -1
- package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.js +12 -0
- package/dist/cjs/api/resources/orders/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/paymentAllocations/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/paymentAllocations/client/Client.js +4 -1
- package/dist/cjs/api/resources/payments/client/requests/CreatePaymentRequest.d.ts +1 -1
- package/dist/cjs/api/resources/signals/client/Client.d.ts +137 -4
- package/dist/cjs/api/resources/signals/client/Client.js +389 -4
- package/dist/cjs/api/resources/signals/client/requests/BulkSignalsRequest.d.ts +17 -3
- package/dist/cjs/api/resources/signals/client/requests/CreateSignalSummaryExportRequest.d.ts +56 -0
- package/dist/cjs/api/resources/signals/client/requests/CreateSignalSummaryExportRequest.js +12 -0
- package/dist/cjs/api/resources/signals/client/requests/GetSignalSummaryExportRequest.d.ts +9 -0
- package/dist/cjs/api/resources/signals/client/requests/GetSignalSummaryExportRequest.js +3 -0
- package/dist/cjs/api/resources/signals/client/requests/GetSignalSummaryRequest.d.ts +45 -0
- package/dist/cjs/api/resources/signals/client/requests/GetSignalSummaryRequest.js +3 -0
- package/dist/cjs/api/resources/signals/client/requests/SignalLookupRequest.d.ts +10 -0
- package/dist/cjs/api/resources/signals/client/requests/SignalLookupRequest.js +3 -0
- package/dist/cjs/api/resources/signals/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/signals/index.d.ts +1 -0
- package/dist/cjs/api/resources/signals/index.js +1 -0
- package/dist/cjs/api/resources/signals/types/GetSignalSummaryRequestGroupBy.d.ts +5 -0
- package/dist/cjs/api/resources/signals/types/GetSignalSummaryRequestGroupBy.js +8 -0
- package/dist/cjs/api/resources/signals/types/GetSignalSummaryRequestInterval.d.ts +7 -0
- package/dist/cjs/api/resources/signals/types/GetSignalSummaryRequestInterval.js +10 -0
- package/dist/cjs/api/resources/signals/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/signals/types/index.js +18 -0
- package/dist/cjs/api/resources/valueMetrics/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/valueMetrics/client/Client.js +1 -1
- package/dist/cjs/api/resources/valueModels/client/Client.d.ts +4 -2
- package/dist/cjs/api/resources/valueModels/client/Client.js +8 -2
- package/dist/cjs/api/resources/valueModels/client/requests/ValueModelUploadRequest.d.ts +2 -0
- package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +5 -5
- package/dist/cjs/api/resources/valueReceipts/client/Client.js +5 -5
- package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/client/Client.js +2 -2
- package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.d.ts +1 -1
- package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.ts +0 -1
- package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.js +0 -1
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.ts +0 -1
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.js +0 -1
- package/dist/cjs/api/types/Attribution.d.ts +3 -0
- package/dist/cjs/api/types/Checkout.d.ts +4 -0
- package/dist/cjs/api/types/CheckoutDetails.d.ts +4 -0
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +9 -0
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +3 -0
- package/dist/cjs/api/types/CreditBenefitInput.d.ts +5 -0
- package/dist/cjs/api/types/CreditBenefitInput.js +2 -0
- package/dist/cjs/api/types/CreditBenefitOutput.d.ts +2 -0
- package/dist/cjs/api/types/CreditGrantCreateRequest.d.ts +2 -0
- package/dist/cjs/api/types/CreditTransaction.d.ts +1 -1
- package/dist/cjs/api/types/CreditTransactionSummaryBucket.d.ts +25 -0
- package/dist/cjs/api/types/CreditTransactionSummaryBucket.js +3 -0
- package/dist/cjs/api/types/CreditTransactionSummaryResponse.d.ts +32 -0
- package/dist/cjs/api/types/CreditTransactionSummaryResponse.js +23 -0
- package/dist/cjs/api/types/CustomView.d.ts +4 -0
- package/dist/cjs/api/types/CustomViewAuthoringDetail.d.ts +4 -0
- package/dist/cjs/api/types/CustomViewContextCap.d.ts +27 -0
- package/dist/cjs/api/types/CustomViewContextCap.js +11 -0
- package/dist/cjs/api/types/CustomViewCustomerUnit.d.ts +16 -0
- package/dist/cjs/api/types/CustomViewCustomerUnit.js +3 -0
- package/dist/cjs/api/types/CustomViewDataContext.d.ts +57 -0
- package/dist/cjs/api/types/CustomViewDataContext.js +21 -0
- package/dist/cjs/api/types/CustomViewDetail.d.ts +4 -0
- package/dist/cjs/api/types/CustomViewPreviewHarnessRequest.d.ts +2 -1
- package/dist/cjs/api/types/CustomViewSummary.d.ts +4 -0
- package/dist/cjs/api/types/CustomViewUnitSelection.d.ts +14 -0
- package/dist/cjs/api/types/CustomViewUnitSelection.js +3 -0
- package/dist/cjs/api/types/CustomerAlias.d.ts +2 -0
- package/dist/cjs/api/types/CustomerApiKey.d.ts +31 -0
- package/dist/cjs/api/types/CustomerApiKey.js +13 -0
- package/dist/cjs/api/types/CustomerApiKeyCreate.d.ts +8 -0
- package/dist/cjs/api/types/CustomerApiKeyCreate.js +3 -0
- package/dist/cjs/api/types/CustomerApiKeyCreated.d.ts +33 -0
- package/dist/cjs/api/types/CustomerApiKeyCreated.js +13 -0
- package/dist/cjs/api/types/CustomerApiKeyList.d.ts +5 -0
- package/dist/cjs/api/types/CustomerApiKeyList.js +3 -0
- package/dist/cjs/api/types/CustomerAttribution.d.ts +3 -0
- package/dist/cjs/api/types/CustomerFundingInstructions.d.ts +24 -0
- package/dist/cjs/api/types/CustomerFundingInstructions.js +10 -0
- package/dist/cjs/api/types/CustomerFundingInstructionsCreateRequest.d.ts +4 -0
- package/dist/cjs/api/types/CustomerFundingInstructionsCreateRequest.js +3 -0
- package/dist/cjs/api/types/CustomerUnit.d.ts +13 -2
- package/dist/cjs/api/types/CustomerUnit.js +2 -1
- package/dist/cjs/api/types/CustomerUnitAttribution.d.ts +2 -2
- package/dist/cjs/api/types/CustomerUnitByKey.d.ts +37 -0
- package/dist/cjs/api/types/CustomerUnitByKey.js +13 -0
- package/dist/cjs/api/types/CustomerUnitCapEndedPolicy.d.ts +5 -3
- package/dist/cjs/api/types/CustomerUnitCapEndedPolicy.js +1 -1
- package/dist/cjs/api/types/CustomerUnitCapPolicy.d.ts +5 -3
- package/dist/cjs/api/types/CustomerUnitCapPolicy.js +1 -1
- package/dist/cjs/api/types/CustomerUnitCapSavedPolicy.d.ts +26 -0
- package/dist/cjs/api/types/CustomerUnitCapSavedPolicy.js +11 -0
- package/dist/cjs/api/types/CustomerUnitCapSchedule.d.ts +9 -0
- package/dist/cjs/api/types/CustomerUnitCapSchedule.js +3 -0
- package/dist/cjs/api/types/CustomerUnitCapScheduleInput.d.ts +9 -0
- package/dist/cjs/api/types/CustomerUnitCapScheduleInput.js +3 -0
- package/dist/cjs/api/types/CustomerUnitCapSet.d.ts +5 -3
- package/dist/cjs/api/types/CustomerUnitCapSet.js +1 -1
- package/dist/cjs/api/types/CustomerUnitCapSetResponse.d.ts +3 -1
- package/dist/cjs/api/types/CustomerUnitCreate.d.ts +3 -1
- package/dist/cjs/api/types/CustomerUnitCreatedUnderParent.d.ts +34 -0
- package/dist/cjs/api/types/CustomerUnitCreatedUnderParent.js +13 -0
- package/dist/cjs/api/types/CustomerUnitSpendResponse.d.ts +12 -0
- package/dist/cjs/api/types/CustomerUnitSpendResponse.js +3 -0
- package/dist/cjs/api/types/CustomerUnitSpendWindow.d.ts +9 -0
- package/dist/cjs/api/types/CustomerUnitSpendWindow.js +3 -0
- package/dist/cjs/api/types/CustomerUnitUpdate.d.ts +2 -0
- package/dist/cjs/api/types/DeliveredValueCalculation.d.ts +11 -0
- package/dist/cjs/api/types/DeliveredValueCalculation.js +3 -0
- package/dist/cjs/api/types/DeliveredValueCalculationTerm.d.ts +34 -0
- package/dist/cjs/api/types/DeliveredValueCalculationTerm.js +24 -0
- package/dist/cjs/api/types/DeliveredValueMetric.d.ts +54 -0
- package/dist/cjs/api/types/DeliveredValueMetric.js +3 -0
- package/dist/cjs/api/types/DeliveredValueResponse.d.ts +34 -0
- package/dist/cjs/api/types/DeliveredValueResponse.js +3 -0
- package/dist/cjs/api/types/DeliveredValueSignal.d.ts +14 -0
- package/dist/cjs/api/types/DeliveredValueSignal.js +3 -0
- package/dist/cjs/api/types/DeliveredValueSignalValue.d.ts +8 -0
- package/dist/cjs/api/types/DeliveredValueSignalValue.js +3 -0
- package/dist/cjs/api/types/DeliveredValueSummaryBucket.d.ts +20 -0
- package/dist/cjs/api/types/DeliveredValueSummaryBucket.js +3 -0
- package/dist/cjs/api/types/DeliveredValueSummaryResponse.d.ts +41 -0
- package/dist/cjs/api/types/DeliveredValueSummaryResponse.js +22 -0
- package/dist/cjs/api/types/GrantCustomerCreditsResponse.d.ts +1 -1
- package/dist/cjs/api/types/PlanCreditBenefit.d.ts +4 -6
- package/dist/cjs/api/types/PlanCreditBenefit.js +0 -4
- package/dist/cjs/api/types/PricingOutput.d.ts +3 -0
- package/dist/cjs/api/types/ProductCreditBenefitInput.d.ts +5 -0
- package/dist/cjs/api/types/ProductCreditBenefitInput.js +2 -0
- package/dist/cjs/api/types/ProductCreditBenefitOutput.d.ts +2 -0
- package/dist/cjs/api/types/ProductPricingOutput.d.ts +3 -0
- package/dist/cjs/api/types/ProductSeatBasedPrepaidCreditsInput.d.ts +3 -0
- package/dist/cjs/api/types/ProductUsageBracketedPrepaidCreditsInput.d.ts +4 -0
- package/dist/cjs/api/types/ProductUsageBracketedPrepaidCreditsInput.js +1 -0
- package/dist/cjs/api/types/ProductUsageCostPlusInput.d.ts +2 -0
- package/dist/cjs/api/types/ProductUsageCostPlusInput.js +1 -0
- package/dist/cjs/api/types/ProductUsageGraduatedInput.d.ts +2 -0
- package/dist/cjs/api/types/ProductUsageGraduatedInput.js +1 -0
- package/dist/cjs/api/types/ProductUsagePerUnitInput.d.ts +2 -0
- package/dist/cjs/api/types/ProductUsagePerUnitInput.js +1 -0
- package/dist/cjs/api/types/ProductUsagePrepaidCreditsInput.d.ts +5 -0
- package/dist/cjs/api/types/ProductUsagePrepaidCreditsInput.js +1 -0
- package/dist/cjs/api/types/ProductUsageVolumeInput.d.ts +2 -0
- package/dist/cjs/api/types/ProductUsageVolumeInput.js +1 -0
- package/dist/cjs/api/types/ProvisionBillingFrequencyOverride.d.ts +14 -0
- package/dist/cjs/api/types/ProvisionBillingFrequencyOverride.js +14 -0
- package/dist/cjs/api/types/ProvisionContact.d.ts +20 -0
- package/dist/cjs/api/types/ProvisionContact.js +14 -0
- package/dist/cjs/api/types/ProvisionCreatedContact.d.ts +14 -0
- package/dist/cjs/api/types/ProvisionCreatedContact.js +12 -0
- package/dist/cjs/api/types/ProvisionCreatedCustomer.d.ts +14 -0
- package/dist/cjs/api/types/ProvisionCreatedCustomer.js +12 -0
- package/dist/cjs/api/types/ProvisionCreatedOrder.d.ts +17 -0
- package/dist/cjs/api/types/ProvisionCreatedOrder.js +12 -0
- package/dist/cjs/api/types/ProvisionCreatedOrderLine.d.ts +17 -0
- package/dist/cjs/api/types/ProvisionCreatedOrderLine.js +12 -0
- package/dist/cjs/api/types/ProvisionCreditBenefit.d.ts +44 -0
- package/dist/cjs/api/types/ProvisionCreditBenefit.js +26 -0
- package/dist/cjs/api/types/ProvisionCustomer.d.ts +23 -0
- package/dist/cjs/api/types/ProvisionCustomer.js +12 -0
- package/dist/cjs/api/types/ProvisionExternalReference.d.ts +16 -0
- package/dist/cjs/api/types/ProvisionExternalReference.js +14 -0
- package/dist/cjs/api/types/ProvisionOrder.d.ts +39 -0
- package/dist/cjs/api/types/ProvisionOrder.js +20 -0
- package/dist/cjs/api/types/ProvisionOrderLine.d.ts +12 -0
- package/dist/cjs/api/types/ProvisionOrderLine.js +3 -0
- package/dist/cjs/api/types/ProvisionOrderLineAttribute.d.ts +96 -0
- package/dist/cjs/api/types/ProvisionOrderLineAttribute.js +50 -0
- package/dist/cjs/api/types/ProvisionOrderLineType.d.ts +7 -0
- package/dist/cjs/api/types/ProvisionOrderLineType.js +10 -0
- package/dist/cjs/api/types/ProvisionProduct.d.ts +95 -0
- package/dist/cjs/api/types/ProvisionProduct.js +52 -0
- package/dist/cjs/api/types/ProvisionResponse.d.ts +17 -0
- package/dist/cjs/api/types/ProvisionResponse.js +12 -0
- package/dist/cjs/api/types/SeatBasedPrepaidCreditsInput.d.ts +3 -0
- package/dist/cjs/api/types/Signal.d.ts +8 -2
- package/dist/cjs/api/types/SignalListItem.d.ts +1 -1
- package/dist/cjs/api/types/SignalLookupResponse.d.ts +7 -0
- package/dist/cjs/api/types/SignalLookupResponse.js +3 -0
- package/dist/cjs/api/types/SignalSummaryBandsDimension.d.ts +21 -0
- package/dist/cjs/api/types/SignalSummaryBandsDimension.js +3 -0
- package/dist/cjs/api/types/SignalSummaryColumn.d.ts +8 -0
- package/dist/cjs/api/types/SignalSummaryColumn.js +3 -0
- package/dist/cjs/api/types/SignalSummaryDefinitionSpec.d.ts +21 -0
- package/dist/cjs/api/types/SignalSummaryDefinitionSpec.js +11 -0
- package/dist/cjs/api/types/SignalSummaryDefinitionSpecDimensionsItem.d.ts +10 -0
- package/dist/cjs/api/types/SignalSummaryDefinitionSpecDimensionsItem.js +3 -0
- package/dist/cjs/api/types/SignalSummaryExport.d.ts +36 -0
- package/dist/cjs/api/types/SignalSummaryExport.js +18 -0
- package/dist/cjs/api/types/SignalSummaryGroups.d.ts +9 -0
- package/dist/cjs/api/types/SignalSummaryGroups.js +3 -0
- package/dist/cjs/api/types/SignalSummaryMeasure.d.ts +16 -0
- package/dist/cjs/api/types/SignalSummaryMeasure.js +14 -0
- package/dist/cjs/api/types/SignalSummaryPage.d.ts +8 -0
- package/dist/cjs/api/types/SignalSummaryPage.js +3 -0
- package/dist/cjs/api/types/SignalSummaryPoint.d.ts +16 -0
- package/dist/cjs/api/types/SignalSummaryPoint.js +3 -0
- package/dist/cjs/api/types/SignalSummaryPresenceDimension.d.ts +23 -0
- package/dist/cjs/api/types/SignalSummaryPresenceDimension.js +3 -0
- package/dist/cjs/api/types/SignalSummaryResponse.d.ts +29 -0
- package/dist/cjs/api/types/SignalSummaryResponse.js +19 -0
- package/dist/cjs/api/types/SignalSummarySignalSelection.d.ts +8 -0
- package/dist/cjs/api/types/SignalSummarySignalSelection.js +3 -0
- package/dist/cjs/api/types/SignalSummarySpecInput.d.ts +21 -0
- package/dist/cjs/api/types/SignalSummarySpecInput.js +11 -0
- package/dist/cjs/api/types/SignalSummarySpecInputDimensionsItem.d.ts +10 -0
- package/dist/cjs/api/types/SignalSummarySpecInputDimensionsItem.js +3 -0
- package/dist/cjs/api/types/SignalsMetadataResponse.d.ts +22 -1
- package/dist/cjs/api/types/SignalsMetadataResponse.js +24 -0
- package/dist/cjs/api/types/UpdateContactRequest.d.ts +1 -0
- package/dist/cjs/api/types/UsageBracketedPrepaidCreditsInput.d.ts +4 -0
- package/dist/cjs/api/types/UsageBracketedPrepaidCreditsInput.js +1 -0
- package/dist/cjs/api/types/UsageCostPlusInput.d.ts +2 -0
- package/dist/cjs/api/types/UsageCostPlusInput.js +1 -0
- package/dist/cjs/api/types/UsageGraduatedInput.d.ts +2 -0
- package/dist/cjs/api/types/UsageGraduatedInput.js +1 -0
- package/dist/cjs/api/types/UsagePerUnitInput.d.ts +2 -0
- package/dist/cjs/api/types/UsagePerUnitInput.js +1 -0
- package/dist/cjs/api/types/UsagePrepaidCreditsInput.d.ts +5 -0
- package/dist/cjs/api/types/UsagePrepaidCreditsInput.js +1 -0
- package/dist/cjs/api/types/UsageVolumeInput.d.ts +2 -0
- package/dist/cjs/api/types/UsageVolumeInput.js +1 -0
- package/dist/cjs/api/types/ValidateCustomViewRequest.d.ts +4 -0
- package/dist/cjs/api/types/ValueModelContent.d.ts +17 -15
- package/dist/cjs/api/types/ValueModelContent.js +7 -0
- package/dist/cjs/api/types/ValueReceiptDetail.d.ts +1 -0
- package/dist/cjs/api/types/ValueReceiptSummary.d.ts +1 -0
- package/dist/cjs/api/types/ValueReceiptSyncResponse.d.ts +1 -0
- package/dist/cjs/api/types/ViewCustomerUnitsResponse.d.ts +7 -0
- package/dist/cjs/api/types/ViewCustomerUnitsResponse.js +3 -0
- package/dist/cjs/api/types/ViewDataResponse.d.ts +2 -0
- package/dist/cjs/api/types/Webhook.d.ts +0 -1
- package/dist/cjs/api/types/Webhook.js +0 -1
- package/dist/cjs/api/types/WebhookUpdateResponse.d.ts +0 -1
- package/dist/cjs/api/types/WebhookUpdateResponse.js +0 -1
- package/dist/cjs/api/types/WritableProvisionOrderLineType.d.ts +6 -0
- package/dist/cjs/api/types/WritableProvisionOrderLineType.js +9 -0
- package/dist/cjs/api/types/index.d.ts +59 -10
- package/dist/cjs/api/types/index.js +59 -10
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -3
- package/dist/esm/Client.mjs +7 -7
- package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +13 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/analytics/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/analytics/client/Client.mjs +5 -2
- package/dist/esm/api/resources/analyticsExperimental/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/analyticsExperimental/client/Client.mjs +5 -2
- package/dist/esm/api/resources/checkouts/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/checkouts/client/Client.mjs +4 -1
- package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +5 -0
- package/dist/esm/api/resources/contacts/client/Client.d.mts +6 -4
- package/dist/esm/api/resources/contacts/client/Client.mjs +10 -4
- package/dist/esm/api/resources/credits/client/Client.d.mts +19 -0
- package/dist/esm/api/resources/credits/client/Client.mjs +105 -1
- package/dist/esm/api/resources/credits/client/requests/GetCreditTransactionSummaryRequest.d.mts +33 -0
- package/dist/esm/api/resources/credits/client/requests/ListCreditTransactionsRequest.d.mts +2 -0
- package/dist/esm/api/resources/credits/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestGroupBy.d.mts +4 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestGroupBy.mjs +4 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestInterval.d.mts +6 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestInterval.mjs +6 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestType.d.mts +6 -0
- package/dist/esm/api/resources/credits/types/GetCreditTransactionSummaryRequestType.mjs +6 -0
- package/dist/esm/api/resources/credits/types/index.d.mts +3 -0
- package/dist/esm/api/resources/credits/types/index.mjs +3 -0
- package/dist/esm/api/resources/customViewsExperimental/client/Client.d.mts +26 -3
- package/dist/esm/api/resources/customViewsExperimental/client/Client.mjs +101 -4
- package/dist/esm/api/resources/customViewsExperimental/client/requests/CreateCustomViewRequest.d.mts +4 -0
- package/dist/esm/api/resources/customViewsExperimental/client/requests/GetCustomViewCustomerUnitsRequest.d.mts +14 -0
- package/dist/esm/api/resources/customViewsExperimental/client/requests/GetCustomViewDataRequest.d.mts +6 -0
- package/dist/esm/api/resources/customViewsExperimental/client/requests/UpdateCustomViewRequest.d.mts +4 -0
- package/dist/esm/api/resources/customViewsExperimental/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/customViewsExperimental/types/GetCustomViewDataRequestIncludeDraft.d.mts +5 -0
- package/dist/esm/api/resources/customViewsExperimental/types/GetCustomViewDataRequestIncludeDraft.mjs +5 -0
- package/dist/esm/api/resources/customViewsExperimental/types/GetCustomViewDataRequestUnitMode.d.mts +6 -0
- package/dist/esm/api/resources/customViewsExperimental/types/GetCustomViewDataRequestUnitMode.mjs +6 -0
- package/dist/esm/api/resources/customViewsExperimental/types/index.d.mts +2 -0
- package/dist/esm/api/resources/customViewsExperimental/types/index.mjs +2 -0
- package/dist/esm/api/resources/customerPortals/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/customerPortals/client/Client.mjs +1 -1
- package/dist/esm/api/resources/customers/client/Client.d.mts +489 -19
- package/dist/esm/api/resources/customers/client/Client.mjs +2018 -207
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerApiKeyByExternalIdRequest.d.mts +15 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerApiKeyRequest.d.mts +15 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerFundingInstructionsByExternalIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerFundingInstructionsRequest.d.mts +13 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerUnitAliasByExternalIdRequest.d.mts +18 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerUnitAliasByKeyRequest.d.mts +15 -0
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerUnitAliasRequest.d.mts +18 -0
- package/dist/esm/api/resources/customers/client/requests/CustomerUnitCreateUnderParent.d.mts +21 -0
- package/dist/esm/api/resources/customers/client/requests/DeleteCustomerUnitAliasByExternalIdRequest.d.mts +16 -0
- package/dist/esm/api/resources/customers/client/requests/DeleteCustomerUnitAliasByKeyRequest.d.mts +13 -0
- package/dist/esm/api/resources/customers/client/requests/DeleteCustomerUnitAliasRequest.d.mts +16 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerFundingInstructionsByExternalIdRequest.d.mts +11 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerFundingInstructionsRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerUnitByKeyRequest.d.mts +10 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerUnitSpendByExternalIdRequest.d.mts +22 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerUnitSpendRequest.d.mts +22 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerUnitSpendRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/GrantCustomerCreditsByExternalIdRequest.d.mts +2 -1
- package/dist/esm/api/resources/customers/client/requests/GrantCustomerCreditsRequest.d.mts +2 -1
- package/dist/esm/api/resources/customers/client/requests/ListCustomerApiKeysByExternalIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerApiKeysByExternalIdRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerApiKeysRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerApiKeysRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesByExternalIdRequest.d.mts +15 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesByExternalIdRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesByKeyRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesByKeyRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesRequest.d.mts +15 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitAliasesRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitsByExternalIdRequest.d.mts +1 -1
- package/dist/esm/api/resources/customers/client/requests/ListCustomerUnitsRequest.d.mts +1 -1
- package/dist/esm/api/resources/customers/client/requests/RevokeCustomerApiKeyByExternalIdRequest.d.mts +13 -0
- package/dist/esm/api/resources/customers/client/requests/RevokeCustomerApiKeyByExternalIdRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/RevokeCustomerApiKeyRequest.d.mts +13 -0
- package/dist/esm/api/resources/customers/client/requests/RevokeCustomerApiKeyRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +23 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasByExternalIdResponse.d.mts +1 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasByExternalIdResponse.mjs +2 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasByKeyResponse.d.mts +1 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasByKeyResponse.mjs +2 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasResponse.d.mts +1 -0
- package/dist/esm/api/resources/customers/types/DeleteCustomerUnitAliasResponse.mjs +2 -0
- package/dist/esm/api/resources/customers/types/ListCustomerUnitsByExternalIdRequestStatus.d.mts +1 -0
- package/dist/esm/api/resources/customers/types/ListCustomerUnitsByExternalIdRequestStatus.mjs +1 -0
- package/dist/esm/api/resources/customers/types/ListCustomerUnitsRequestStatus.d.mts +1 -0
- package/dist/esm/api/resources/customers/types/ListCustomerUnitsRequestStatus.mjs +1 -0
- package/dist/esm/api/resources/customers/types/index.d.mts +3 -0
- package/dist/esm/api/resources/customers/types/index.mjs +3 -0
- package/dist/esm/api/resources/deliveredValue/client/Client.d.mts +60 -0
- package/dist/esm/api/resources/deliveredValue/client/Client.mjs +211 -0
- package/dist/esm/api/resources/deliveredValue/client/requests/GetDeliveredValueRequest.d.mts +18 -0
- package/dist/esm/api/resources/deliveredValue/client/requests/GetDeliveredValueRequest.mjs +2 -0
- package/dist/esm/api/resources/deliveredValue/client/requests/GetDeliveredValueSummaryRequest.d.mts +29 -0
- package/dist/esm/api/resources/deliveredValue/client/requests/GetDeliveredValueSummaryRequest.mjs +2 -0
- package/dist/esm/api/resources/deliveredValue/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/{customerGroups → deliveredValue}/index.d.mts +1 -0
- package/dist/esm/api/resources/{customerGroups → deliveredValue}/index.mjs +1 -0
- package/dist/esm/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestGroupBy.d.mts +7 -0
- package/dist/esm/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestGroupBy.mjs +7 -0
- package/dist/esm/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestInterval.d.mts +8 -0
- package/dist/esm/api/resources/deliveredValue/types/GetDeliveredValueSummaryRequestInterval.mjs +8 -0
- package/dist/esm/api/resources/deliveredValue/types/index.d.mts +2 -0
- package/dist/esm/api/resources/deliveredValue/types/index.mjs +2 -0
- package/dist/esm/api/resources/index.d.mts +4 -2
- package/dist/esm/api/resources/index.mjs +4 -2
- package/dist/esm/api/resources/orders/client/Client.d.mts +87 -1
- package/dist/esm/api/resources/orders/client/Client.mjs +146 -1
- package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +12 -1
- package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.mjs +11 -1
- package/dist/esm/api/resources/orders/client/requests/ProvisionRequest.d.mts +82 -0
- package/dist/esm/api/resources/orders/client/requests/ProvisionRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +12 -1
- package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.mjs +11 -1
- package/dist/esm/api/resources/orders/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/paymentAllocations/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/paymentAllocations/client/Client.mjs +4 -1
- package/dist/esm/api/resources/payments/client/requests/CreatePaymentRequest.d.mts +1 -1
- package/dist/esm/api/resources/signals/client/Client.d.mts +137 -4
- package/dist/esm/api/resources/signals/client/Client.mjs +389 -4
- package/dist/esm/api/resources/signals/client/requests/BulkSignalsRequest.d.mts +17 -3
- package/dist/esm/api/resources/signals/client/requests/CreateSignalSummaryExportRequest.d.mts +56 -0
- package/dist/esm/api/resources/signals/client/requests/CreateSignalSummaryExportRequest.mjs +9 -0
- package/dist/esm/api/resources/signals/client/requests/GetSignalSummaryExportRequest.d.mts +9 -0
- package/dist/esm/api/resources/signals/client/requests/GetSignalSummaryExportRequest.mjs +2 -0
- package/dist/esm/api/resources/signals/client/requests/GetSignalSummaryRequest.d.mts +45 -0
- package/dist/esm/api/resources/signals/client/requests/GetSignalSummaryRequest.mjs +2 -0
- package/dist/esm/api/resources/signals/client/requests/SignalLookupRequest.d.mts +10 -0
- package/dist/esm/api/resources/signals/client/requests/SignalLookupRequest.mjs +2 -0
- package/dist/esm/api/resources/signals/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/signals/index.d.mts +1 -0
- package/dist/esm/api/resources/signals/index.mjs +1 -0
- package/dist/esm/api/resources/signals/types/GetSignalSummaryRequestGroupBy.d.mts +5 -0
- package/dist/esm/api/resources/signals/types/GetSignalSummaryRequestGroupBy.mjs +5 -0
- package/dist/esm/api/resources/signals/types/GetSignalSummaryRequestInterval.d.mts +7 -0
- package/dist/esm/api/resources/signals/types/GetSignalSummaryRequestInterval.mjs +7 -0
- package/dist/esm/api/resources/signals/types/index.d.mts +2 -0
- package/dist/esm/api/resources/signals/types/index.mjs +2 -0
- package/dist/esm/api/resources/valueMetrics/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/valueMetrics/client/Client.mjs +1 -1
- package/dist/esm/api/resources/valueModels/client/Client.d.mts +4 -2
- package/dist/esm/api/resources/valueModels/client/Client.mjs +8 -2
- package/dist/esm/api/resources/valueModels/client/requests/ValueModelUploadRequest.d.mts +2 -0
- package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +5 -5
- package/dist/esm/api/resources/valueReceipts/client/Client.mjs +5 -5
- package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/client/Client.mjs +2 -2
- package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.d.mts +1 -1
- package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.mts +0 -1
- package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.mjs +0 -1
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.mts +0 -1
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.mjs +0 -1
- package/dist/esm/api/types/Attribution.d.mts +3 -0
- package/dist/esm/api/types/Checkout.d.mts +4 -0
- package/dist/esm/api/types/CheckoutDetails.d.mts +4 -0
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +9 -0
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +3 -0
- package/dist/esm/api/types/CreditBenefitInput.d.mts +5 -0
- package/dist/esm/api/types/CreditBenefitInput.mjs +2 -0
- package/dist/esm/api/types/CreditBenefitOutput.d.mts +2 -0
- package/dist/esm/api/types/CreditGrantCreateRequest.d.mts +2 -0
- package/dist/esm/api/types/CreditTransaction.d.mts +1 -1
- package/dist/esm/api/types/CreditTransactionSummaryBucket.d.mts +25 -0
- package/dist/esm/api/types/CreditTransactionSummaryBucket.mjs +2 -0
- package/dist/esm/api/types/CreditTransactionSummaryResponse.d.mts +32 -0
- package/dist/esm/api/types/CreditTransactionSummaryResponse.mjs +20 -0
- package/dist/esm/api/types/CustomView.d.mts +4 -0
- package/dist/esm/api/types/CustomViewAuthoringDetail.d.mts +4 -0
- package/dist/esm/api/types/CustomViewContextCap.d.mts +27 -0
- package/dist/esm/api/types/CustomViewContextCap.mjs +8 -0
- package/dist/esm/api/types/CustomViewCustomerUnit.d.mts +16 -0
- package/dist/esm/api/types/CustomViewCustomerUnit.mjs +2 -0
- package/dist/esm/api/types/CustomViewDataContext.d.mts +57 -0
- package/dist/esm/api/types/CustomViewDataContext.mjs +18 -0
- package/dist/esm/api/types/CustomViewDetail.d.mts +4 -0
- package/dist/esm/api/types/CustomViewPreviewHarnessRequest.d.mts +2 -1
- package/dist/esm/api/types/CustomViewSummary.d.mts +4 -0
- package/dist/esm/api/types/CustomViewUnitSelection.d.mts +14 -0
- package/dist/esm/api/types/CustomViewUnitSelection.mjs +2 -0
- package/dist/esm/api/types/CustomerAlias.d.mts +2 -0
- package/dist/esm/api/types/CustomerApiKey.d.mts +31 -0
- package/dist/esm/api/types/CustomerApiKey.mjs +10 -0
- package/dist/esm/api/types/CustomerApiKeyCreate.d.mts +8 -0
- package/dist/esm/api/types/CustomerApiKeyCreate.mjs +2 -0
- package/dist/esm/api/types/CustomerApiKeyCreated.d.mts +33 -0
- package/dist/esm/api/types/CustomerApiKeyCreated.mjs +10 -0
- package/dist/esm/api/types/CustomerApiKeyList.d.mts +5 -0
- package/dist/esm/api/types/CustomerApiKeyList.mjs +2 -0
- package/dist/esm/api/types/CustomerAttribution.d.mts +3 -0
- package/dist/esm/api/types/CustomerFundingInstructions.d.mts +24 -0
- package/dist/esm/api/types/CustomerFundingInstructions.mjs +7 -0
- package/dist/esm/api/types/CustomerFundingInstructionsCreateRequest.d.mts +4 -0
- package/dist/esm/api/types/CustomerFundingInstructionsCreateRequest.mjs +2 -0
- package/dist/esm/api/types/CustomerUnit.d.mts +13 -2
- package/dist/esm/api/types/CustomerUnit.mjs +2 -1
- package/dist/esm/api/types/CustomerUnitAttribution.d.mts +2 -2
- package/dist/esm/api/types/CustomerUnitByKey.d.mts +37 -0
- package/dist/esm/api/types/CustomerUnitByKey.mjs +10 -0
- package/dist/esm/api/types/CustomerUnitCapEndedPolicy.d.mts +5 -3
- package/dist/esm/api/types/CustomerUnitCapEndedPolicy.mjs +1 -1
- package/dist/esm/api/types/CustomerUnitCapPolicy.d.mts +5 -3
- package/dist/esm/api/types/CustomerUnitCapPolicy.mjs +1 -1
- package/dist/esm/api/types/CustomerUnitCapSavedPolicy.d.mts +26 -0
- package/dist/esm/api/types/CustomerUnitCapSavedPolicy.mjs +8 -0
- package/dist/esm/api/types/CustomerUnitCapSchedule.d.mts +9 -0
- package/dist/esm/api/types/CustomerUnitCapSchedule.mjs +2 -0
- package/dist/esm/api/types/CustomerUnitCapScheduleInput.d.mts +9 -0
- package/dist/esm/api/types/CustomerUnitCapScheduleInput.mjs +2 -0
- package/dist/esm/api/types/CustomerUnitCapSet.d.mts +5 -3
- package/dist/esm/api/types/CustomerUnitCapSet.mjs +1 -1
- package/dist/esm/api/types/CustomerUnitCapSetResponse.d.mts +3 -1
- package/dist/esm/api/types/CustomerUnitCreate.d.mts +3 -1
- package/dist/esm/api/types/CustomerUnitCreatedUnderParent.d.mts +34 -0
- package/dist/esm/api/types/CustomerUnitCreatedUnderParent.mjs +10 -0
- package/dist/esm/api/types/CustomerUnitSpendResponse.d.mts +12 -0
- package/dist/esm/api/types/CustomerUnitSpendResponse.mjs +2 -0
- package/dist/esm/api/types/CustomerUnitSpendWindow.d.mts +9 -0
- package/dist/esm/api/types/CustomerUnitSpendWindow.mjs +2 -0
- package/dist/esm/api/types/CustomerUnitUpdate.d.mts +2 -0
- package/dist/esm/api/types/DeliveredValueCalculation.d.mts +11 -0
- package/dist/esm/api/types/DeliveredValueCalculation.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueCalculationTerm.d.mts +34 -0
- package/dist/esm/api/types/DeliveredValueCalculationTerm.mjs +21 -0
- package/dist/esm/api/types/DeliveredValueMetric.d.mts +54 -0
- package/dist/esm/api/types/DeliveredValueMetric.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueResponse.d.mts +34 -0
- package/dist/esm/api/types/DeliveredValueResponse.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueSignal.d.mts +14 -0
- package/dist/esm/api/types/DeliveredValueSignal.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueSignalValue.d.mts +8 -0
- package/dist/esm/api/types/DeliveredValueSignalValue.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueSummaryBucket.d.mts +20 -0
- package/dist/esm/api/types/DeliveredValueSummaryBucket.mjs +2 -0
- package/dist/esm/api/types/DeliveredValueSummaryResponse.d.mts +41 -0
- package/dist/esm/api/types/DeliveredValueSummaryResponse.mjs +19 -0
- package/dist/esm/api/types/GrantCustomerCreditsResponse.d.mts +1 -1
- package/dist/esm/api/types/PlanCreditBenefit.d.mts +4 -6
- package/dist/esm/api/types/PlanCreditBenefit.mjs +0 -4
- package/dist/esm/api/types/PricingOutput.d.mts +3 -0
- package/dist/esm/api/types/ProductCreditBenefitInput.d.mts +5 -0
- package/dist/esm/api/types/ProductCreditBenefitInput.mjs +2 -0
- package/dist/esm/api/types/ProductCreditBenefitOutput.d.mts +2 -0
- package/dist/esm/api/types/ProductPricingOutput.d.mts +3 -0
- package/dist/esm/api/types/ProductSeatBasedPrepaidCreditsInput.d.mts +3 -0
- package/dist/esm/api/types/ProductUsageBracketedPrepaidCreditsInput.d.mts +4 -0
- package/dist/esm/api/types/ProductUsageBracketedPrepaidCreditsInput.mjs +1 -0
- package/dist/esm/api/types/ProductUsageCostPlusInput.d.mts +2 -0
- package/dist/esm/api/types/ProductUsageCostPlusInput.mjs +1 -0
- package/dist/esm/api/types/ProductUsageGraduatedInput.d.mts +2 -0
- package/dist/esm/api/types/ProductUsageGraduatedInput.mjs +1 -0
- package/dist/esm/api/types/ProductUsagePerUnitInput.d.mts +2 -0
- package/dist/esm/api/types/ProductUsagePerUnitInput.mjs +1 -0
- package/dist/esm/api/types/ProductUsagePrepaidCreditsInput.d.mts +5 -0
- package/dist/esm/api/types/ProductUsagePrepaidCreditsInput.mjs +1 -0
- package/dist/esm/api/types/ProductUsageVolumeInput.d.mts +2 -0
- package/dist/esm/api/types/ProductUsageVolumeInput.mjs +1 -0
- package/dist/esm/api/types/ProvisionBillingFrequencyOverride.d.mts +14 -0
- package/dist/esm/api/types/ProvisionBillingFrequencyOverride.mjs +11 -0
- package/dist/esm/api/types/ProvisionContact.d.mts +20 -0
- package/dist/esm/api/types/ProvisionContact.mjs +11 -0
- package/dist/esm/api/types/ProvisionCreatedContact.d.mts +14 -0
- package/dist/esm/api/types/ProvisionCreatedContact.mjs +9 -0
- package/dist/esm/api/types/ProvisionCreatedCustomer.d.mts +14 -0
- package/dist/esm/api/types/ProvisionCreatedCustomer.mjs +9 -0
- package/dist/esm/api/types/ProvisionCreatedOrder.d.mts +17 -0
- package/dist/esm/api/types/ProvisionCreatedOrder.mjs +9 -0
- package/dist/esm/api/types/ProvisionCreatedOrderLine.d.mts +17 -0
- package/dist/esm/api/types/ProvisionCreatedOrderLine.mjs +9 -0
- package/dist/esm/api/types/ProvisionCreditBenefit.d.mts +44 -0
- package/dist/esm/api/types/ProvisionCreditBenefit.mjs +23 -0
- package/dist/esm/api/types/ProvisionCustomer.d.mts +23 -0
- package/dist/esm/api/types/ProvisionCustomer.mjs +9 -0
- package/dist/esm/api/types/ProvisionExternalReference.d.mts +16 -0
- package/dist/esm/api/types/ProvisionExternalReference.mjs +11 -0
- package/dist/esm/api/types/ProvisionOrder.d.mts +39 -0
- package/dist/esm/api/types/ProvisionOrder.mjs +17 -0
- package/dist/esm/api/types/ProvisionOrderLine.d.mts +12 -0
- package/dist/esm/api/types/ProvisionOrderLine.mjs +2 -0
- package/dist/esm/api/types/ProvisionOrderLineAttribute.d.mts +96 -0
- package/dist/esm/api/types/ProvisionOrderLineAttribute.mjs +47 -0
- package/dist/esm/api/types/ProvisionOrderLineType.d.mts +7 -0
- package/dist/esm/api/types/ProvisionOrderLineType.mjs +7 -0
- package/dist/esm/api/types/ProvisionProduct.d.mts +95 -0
- package/dist/esm/api/types/ProvisionProduct.mjs +49 -0
- package/dist/esm/api/types/ProvisionResponse.d.mts +17 -0
- package/dist/esm/api/types/ProvisionResponse.mjs +9 -0
- package/dist/esm/api/types/SeatBasedPrepaidCreditsInput.d.mts +3 -0
- package/dist/esm/api/types/Signal.d.mts +8 -2
- package/dist/esm/api/types/SignalListItem.d.mts +1 -1
- package/dist/esm/api/types/SignalLookupResponse.d.mts +7 -0
- package/dist/esm/api/types/SignalLookupResponse.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryBandsDimension.d.mts +21 -0
- package/dist/esm/api/types/SignalSummaryBandsDimension.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryColumn.d.mts +8 -0
- package/dist/esm/api/types/SignalSummaryColumn.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryDefinitionSpec.d.mts +21 -0
- package/dist/esm/api/types/SignalSummaryDefinitionSpec.mjs +8 -0
- package/dist/esm/api/types/SignalSummaryDefinitionSpecDimensionsItem.d.mts +10 -0
- package/dist/esm/api/types/SignalSummaryDefinitionSpecDimensionsItem.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryExport.d.mts +36 -0
- package/dist/esm/api/types/SignalSummaryExport.mjs +15 -0
- package/dist/esm/api/types/SignalSummaryGroups.d.mts +9 -0
- package/dist/esm/api/types/SignalSummaryGroups.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryMeasure.d.mts +16 -0
- package/dist/esm/api/types/SignalSummaryMeasure.mjs +11 -0
- package/dist/esm/api/types/SignalSummaryPage.d.mts +8 -0
- package/dist/esm/api/types/SignalSummaryPage.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryPoint.d.mts +16 -0
- package/dist/esm/api/types/SignalSummaryPoint.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryPresenceDimension.d.mts +23 -0
- package/dist/esm/api/types/SignalSummaryPresenceDimension.mjs +2 -0
- package/dist/esm/api/types/SignalSummaryResponse.d.mts +29 -0
- package/dist/esm/api/types/SignalSummaryResponse.mjs +16 -0
- package/dist/esm/api/types/SignalSummarySignalSelection.d.mts +8 -0
- package/dist/esm/api/types/SignalSummarySignalSelection.mjs +2 -0
- package/dist/esm/api/types/SignalSummarySpecInput.d.mts +21 -0
- package/dist/esm/api/types/SignalSummarySpecInput.mjs +8 -0
- package/dist/esm/api/types/SignalSummarySpecInputDimensionsItem.d.mts +10 -0
- package/dist/esm/api/types/SignalSummarySpecInputDimensionsItem.mjs +2 -0
- package/dist/esm/api/types/SignalsMetadataResponse.d.mts +22 -1
- package/dist/esm/api/types/SignalsMetadataResponse.mjs +23 -1
- package/dist/esm/api/types/UpdateContactRequest.d.mts +1 -0
- package/dist/esm/api/types/UsageBracketedPrepaidCreditsInput.d.mts +4 -0
- package/dist/esm/api/types/UsageBracketedPrepaidCreditsInput.mjs +1 -0
- package/dist/esm/api/types/UsageCostPlusInput.d.mts +2 -0
- package/dist/esm/api/types/UsageCostPlusInput.mjs +1 -0
- package/dist/esm/api/types/UsageGraduatedInput.d.mts +2 -0
- package/dist/esm/api/types/UsageGraduatedInput.mjs +1 -0
- package/dist/esm/api/types/UsagePerUnitInput.d.mts +2 -0
- package/dist/esm/api/types/UsagePerUnitInput.mjs +1 -0
- package/dist/esm/api/types/UsagePrepaidCreditsInput.d.mts +5 -0
- package/dist/esm/api/types/UsagePrepaidCreditsInput.mjs +1 -0
- package/dist/esm/api/types/UsageVolumeInput.d.mts +2 -0
- package/dist/esm/api/types/UsageVolumeInput.mjs +1 -0
- package/dist/esm/api/types/ValidateCustomViewRequest.d.mts +4 -0
- package/dist/esm/api/types/ValueModelContent.d.mts +17 -15
- package/dist/esm/api/types/ValueModelContent.mjs +7 -0
- package/dist/esm/api/types/ValueReceiptDetail.d.mts +1 -0
- package/dist/esm/api/types/ValueReceiptSummary.d.mts +1 -0
- package/dist/esm/api/types/ValueReceiptSyncResponse.d.mts +1 -0
- package/dist/esm/api/types/ViewCustomerUnitsResponse.d.mts +7 -0
- package/dist/esm/api/types/ViewCustomerUnitsResponse.mjs +2 -0
- package/dist/esm/api/types/ViewDataResponse.d.mts +2 -0
- package/dist/esm/api/types/Webhook.d.mts +0 -1
- package/dist/esm/api/types/Webhook.mjs +0 -1
- package/dist/esm/api/types/WebhookUpdateResponse.d.mts +0 -1
- package/dist/esm/api/types/WebhookUpdateResponse.mjs +0 -1
- package/dist/esm/api/types/WritableProvisionOrderLineType.d.mts +6 -0
- package/dist/esm/api/types/WritableProvisionOrderLineType.mjs +6 -0
- package/dist/esm/api/types/index.d.mts +59 -10
- package/dist/esm/api/types/index.mjs +59 -10
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +2461 -730
- package/dist/cjs/api/resources/customerGroups/client/Client.d.ts +0 -153
- package/dist/cjs/api/resources/customerGroups/client/Client.js +0 -636
- package/dist/cjs/api/resources/customerGroups/client/requests/CreateCustomerGroupMembersRequest.d.ts +0 -14
- package/dist/cjs/api/resources/customerGroups/client/requests/CreateCustomerGroupRequest.d.ts +0 -10
- package/dist/cjs/api/resources/customerGroups/client/requests/DeleteCustomerGroupMembersRequest.d.ts +0 -14
- package/dist/cjs/api/resources/customerGroups/client/requests/DeleteCustomerGroupRequest.d.ts +0 -9
- package/dist/cjs/api/resources/customerGroups/client/requests/GetCustomerGroupRequest.d.ts +0 -9
- package/dist/cjs/api/resources/customerGroups/client/requests/ListCustomerGroupsRequest.d.ts +0 -8
- package/dist/cjs/api/resources/customerGroups/client/requests/UpdateCustomerGroupMembersRequest.d.ts +0 -14
- package/dist/cjs/api/resources/customerGroups/client/requests/UpdateCustomerGroupRequest.d.ts +0 -11
- package/dist/cjs/api/resources/customerGroups/client/requests/index.d.ts +0 -8
- package/dist/cjs/api/types/AddMembersResponse.d.ts +0 -5
- package/dist/cjs/api/types/CustomerGroupDeleteResponse.d.ts +0 -4
- package/dist/cjs/api/types/CustomerGroupDetail.d.ts +0 -10
- package/dist/cjs/api/types/CustomerGroupListResponse.d.ts +0 -5
- package/dist/cjs/api/types/CustomerGroupMember.d.ts +0 -5
- package/dist/cjs/api/types/CustomerGroupSummary.d.ts +0 -8
- package/dist/cjs/api/types/CustomerUnitCapOpenPolicy.d.ts +0 -29
- package/dist/cjs/api/types/CustomerUnitCapOpenPolicy.js +0 -15
- package/dist/cjs/api/types/MemberRequest.d.ts +0 -4
- package/dist/cjs/api/types/RemoveMembersResponse.d.ts +0 -5
- package/dist/cjs/api/types/SetMembersResponse.d.ts +0 -6
- package/dist/esm/api/resources/customerGroups/client/Client.d.mts +0 -153
- package/dist/esm/api/resources/customerGroups/client/Client.mjs +0 -599
- package/dist/esm/api/resources/customerGroups/client/requests/CreateCustomerGroupMembersRequest.d.mts +0 -14
- package/dist/esm/api/resources/customerGroups/client/requests/CreateCustomerGroupRequest.d.mts +0 -10
- package/dist/esm/api/resources/customerGroups/client/requests/DeleteCustomerGroupMembersRequest.d.mts +0 -14
- package/dist/esm/api/resources/customerGroups/client/requests/DeleteCustomerGroupRequest.d.mts +0 -9
- package/dist/esm/api/resources/customerGroups/client/requests/GetCustomerGroupRequest.d.mts +0 -9
- package/dist/esm/api/resources/customerGroups/client/requests/ListCustomerGroupsRequest.d.mts +0 -8
- package/dist/esm/api/resources/customerGroups/client/requests/UpdateCustomerGroupMembersRequest.d.mts +0 -14
- package/dist/esm/api/resources/customerGroups/client/requests/UpdateCustomerGroupRequest.d.mts +0 -11
- package/dist/esm/api/resources/customerGroups/client/requests/index.d.mts +0 -8
- package/dist/esm/api/types/AddMembersResponse.d.mts +0 -5
- package/dist/esm/api/types/CustomerGroupDeleteResponse.d.mts +0 -4
- package/dist/esm/api/types/CustomerGroupDetail.d.mts +0 -10
- package/dist/esm/api/types/CustomerGroupListResponse.d.mts +0 -5
- package/dist/esm/api/types/CustomerGroupMember.d.mts +0 -5
- package/dist/esm/api/types/CustomerGroupSummary.d.mts +0 -8
- package/dist/esm/api/types/CustomerUnitCapOpenPolicy.d.mts +0 -29
- package/dist/esm/api/types/CustomerUnitCapOpenPolicy.mjs +0 -12
- package/dist/esm/api/types/MemberRequest.d.mts +0 -4
- package/dist/esm/api/types/RemoveMembersResponse.d.mts +0 -5
- package/dist/esm/api/types/SetMembersResponse.d.mts +0 -6
- /package/dist/cjs/api/resources/{customerGroups/client/requests/CreateCustomerGroupMembersRequest.js → credits/client/requests/GetCreditTransactionSummaryRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/CreateCustomerGroupRequest.js → customViewsExperimental/client/requests/GetCustomViewCustomerUnitsRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/DeleteCustomerGroupMembersRequest.js → customers/client/requests/CreateCustomerApiKeyByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/DeleteCustomerGroupRequest.js → customers/client/requests/CreateCustomerApiKeyRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/GetCustomerGroupRequest.js → customers/client/requests/CreateCustomerFundingInstructionsByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/ListCustomerGroupsRequest.js → customers/client/requests/CreateCustomerFundingInstructionsRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/UpdateCustomerGroupMembersRequest.js → customers/client/requests/CreateCustomerUnitAliasByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups/client/requests/UpdateCustomerGroupRequest.js → customers/client/requests/CreateCustomerUnitAliasByKeyRequest.js} +0 -0
- /package/dist/cjs/api/{types/AddMembersResponse.js → resources/customers/client/requests/CreateCustomerUnitAliasRequest.js} +0 -0
- /package/dist/cjs/api/{types/CustomerGroupDeleteResponse.js → resources/customers/client/requests/CustomerUnitCreateUnderParent.js} +0 -0
- /package/dist/cjs/api/{types/CustomerGroupDetail.js → resources/customers/client/requests/DeleteCustomerUnitAliasByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/CustomerGroupListResponse.js → resources/customers/client/requests/DeleteCustomerUnitAliasByKeyRequest.js} +0 -0
- /package/dist/cjs/api/{types/CustomerGroupMember.js → resources/customers/client/requests/DeleteCustomerUnitAliasRequest.js} +0 -0
- /package/dist/cjs/api/{types/CustomerGroupSummary.js → resources/customers/client/requests/GetCustomerFundingInstructionsByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/MemberRequest.js → resources/customers/client/requests/GetCustomerFundingInstructionsRequest.js} +0 -0
- /package/dist/cjs/api/{types/RemoveMembersResponse.js → resources/customers/client/requests/GetCustomerUnitByKeyRequest.js} +0 -0
- /package/dist/cjs/api/{types/SetMembersResponse.js → resources/customers/client/requests/GetCustomerUnitSpendByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customerGroups → deliveredValue}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{customerGroups → deliveredValue}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{customerGroups → deliveredValue}/client/requests/index.js +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/CreateCustomerGroupMembersRequest.mjs → credits/client/requests/GetCreditTransactionSummaryRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/CreateCustomerGroupRequest.mjs → customViewsExperimental/client/requests/GetCustomViewCustomerUnitsRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/DeleteCustomerGroupMembersRequest.mjs → customers/client/requests/CreateCustomerApiKeyByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/DeleteCustomerGroupRequest.mjs → customers/client/requests/CreateCustomerApiKeyRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/GetCustomerGroupRequest.mjs → customers/client/requests/CreateCustomerFundingInstructionsByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/ListCustomerGroupsRequest.mjs → customers/client/requests/CreateCustomerFundingInstructionsRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/UpdateCustomerGroupMembersRequest.mjs → customers/client/requests/CreateCustomerUnitAliasByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups/client/requests/UpdateCustomerGroupRequest.mjs → customers/client/requests/CreateCustomerUnitAliasByKeyRequest.mjs} +0 -0
- /package/dist/esm/api/{types/AddMembersResponse.mjs → resources/customers/client/requests/CreateCustomerUnitAliasRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CustomerGroupDeleteResponse.mjs → resources/customers/client/requests/CustomerUnitCreateUnderParent.mjs} +0 -0
- /package/dist/esm/api/{types/CustomerGroupDetail.mjs → resources/customers/client/requests/DeleteCustomerUnitAliasByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CustomerGroupListResponse.mjs → resources/customers/client/requests/DeleteCustomerUnitAliasByKeyRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CustomerGroupMember.mjs → resources/customers/client/requests/DeleteCustomerUnitAliasRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CustomerGroupSummary.mjs → resources/customers/client/requests/GetCustomerFundingInstructionsByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/MemberRequest.mjs → resources/customers/client/requests/GetCustomerFundingInstructionsRequest.mjs} +0 -0
- /package/dist/esm/api/{types/RemoveMembersResponse.mjs → resources/customers/client/requests/GetCustomerUnitByKeyRequest.mjs} +0 -0
- /package/dist/esm/api/{types/SetMembersResponse.mjs → resources/customers/client/requests/GetCustomerUnitSpendByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customerGroups → deliveredValue}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{customerGroups → deliveredValue}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{customerGroups → deliveredValue}/client/requests/index.mjs +0 -0
|
@@ -120,13 +120,14 @@ export class Customers {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
* Creates a new customer for the organization
|
|
123
|
+
* Creates a new customer for the organization. `externalId` shares one set of ids with customer unit ids and aliases, unique across the organization and ignoring letter case: an external id that another customer already holds as a unit id or alias, or as its external id in another case, is refused with `409 EXTERNAL_ID_IN_USE`. The same id in the same case is `400 DUPLICATE_EXTERNAL_ID`, as before.
|
|
124
124
|
*
|
|
125
125
|
* @param {Paid.CreateCustomerRequest} request
|
|
126
126
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
127
|
*
|
|
128
128
|
* @throws {@link Paid.BadRequestError}
|
|
129
129
|
* @throws {@link Paid.ForbiddenError}
|
|
130
|
+
* @throws {@link Paid.ConflictError}
|
|
130
131
|
* @throws {@link Paid.InternalServerError}
|
|
131
132
|
*
|
|
132
133
|
* @example
|
|
@@ -162,6 +163,8 @@ export class Customers {
|
|
|
162
163
|
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
163
164
|
case 403:
|
|
164
165
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
166
|
+
case 409:
|
|
167
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
165
168
|
case 500:
|
|
166
169
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
167
170
|
default:
|
|
@@ -268,7 +271,7 @@ export class Customers {
|
|
|
268
271
|
});
|
|
269
272
|
}
|
|
270
273
|
/**
|
|
271
|
-
* Create an alternate external identifier for a customer by Paid display ID.
|
|
274
|
+
* Create an alternate external identifier for a customer by Paid display ID. The alias shares one set of ids with customer external ids and unit ids, unique within the organization and ignoring letter case: an alias that another customer already holds as its external id, a unit id or an alias is refused with `409 EXTERNAL_ID_IN_USE` (an exact match keeps its older code, `ALIAS_CONFLICTS_WITH_CUSTOMER_EXTERNAL_ID` or `CUSTOMER_ALIAS_ALREADY_EXISTS`).
|
|
272
275
|
*
|
|
273
276
|
* @param {Paid.CreateCustomerAliasRequest} request
|
|
274
277
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -485,7 +488,7 @@ export class Customers {
|
|
|
485
488
|
});
|
|
486
489
|
}
|
|
487
490
|
/**
|
|
488
|
-
* Update a customer by Paid display ID. Use the value returned as `customer.id`, for example `cus_abc123`. If you have your own customer ID, use `PUT /api/v2/customers/external/{externalId}`.
|
|
491
|
+
* Update a customer by Paid display ID. Use the value returned as `customer.id`, for example `cus_abc123`. If you have your own customer ID, use `PUT /api/v2/customers/external/{externalId}`. Changing `externalId` follows the organization-wide id rule: a new id that another customer already holds as its external id, a unit id or an alias, ignoring letter case, is refused with `409 EXTERNAL_ID_IN_USE`; the same id in the same case stays `400 DUPLICATE_EXTERNAL_ID`. When the id changes, the previous id is kept as an alias of the customer, so signals that still use it keep resolving to it.
|
|
489
492
|
*
|
|
490
493
|
* @param {Paid.UpdateCustomerByIdRequest} request
|
|
491
494
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -493,6 +496,7 @@ export class Customers {
|
|
|
493
496
|
* @throws {@link Paid.BadRequestError}
|
|
494
497
|
* @throws {@link Paid.ForbiddenError}
|
|
495
498
|
* @throws {@link Paid.NotFoundError}
|
|
499
|
+
* @throws {@link Paid.ConflictError}
|
|
496
500
|
* @throws {@link Paid.InternalServerError}
|
|
497
501
|
*
|
|
498
502
|
* @example
|
|
@@ -532,6 +536,8 @@ export class Customers {
|
|
|
532
536
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
533
537
|
case 404:
|
|
534
538
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
539
|
+
case 409:
|
|
540
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
535
541
|
case 500:
|
|
536
542
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
537
543
|
default:
|
|
@@ -560,7 +566,7 @@ export class Customers {
|
|
|
560
566
|
});
|
|
561
567
|
}
|
|
562
568
|
/**
|
|
563
|
-
* Delete a customer by Paid display ID. Use the value returned as `customer.id`, for example `cus_abc123`. If you have your own customer ID, use `DELETE /api/v2/customers/external/{externalId}`.
|
|
569
|
+
* Delete a customer by Paid display ID. Use the value returned as `customer.id`, for example `cus_abc123`. If you have your own customer ID, use `DELETE /api/v2/customers/external/{externalId}`. A customer that still has orders, invoices, payments, contacts, child customers or other linked records is not deleted: the request returns 409 `CUSTOMER_HAS_ASSOCIATIONS` and `details` lists what is linked.
|
|
564
570
|
*
|
|
565
571
|
* @param {Paid.DeleteCustomerByIdRequest} request
|
|
566
572
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -568,6 +574,7 @@ export class Customers {
|
|
|
568
574
|
* @throws {@link Paid.BadRequestError}
|
|
569
575
|
* @throws {@link Paid.ForbiddenError}
|
|
570
576
|
* @throws {@link Paid.NotFoundError}
|
|
577
|
+
* @throws {@link Paid.ConflictError}
|
|
571
578
|
* @throws {@link Paid.InternalServerError}
|
|
572
579
|
*
|
|
573
580
|
* @example
|
|
@@ -603,6 +610,8 @@ export class Customers {
|
|
|
603
610
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
604
611
|
case 404:
|
|
605
612
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
613
|
+
case 409:
|
|
614
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
606
615
|
case 500:
|
|
607
616
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
608
617
|
default:
|
|
@@ -777,7 +786,7 @@ export class Customers {
|
|
|
777
786
|
});
|
|
778
787
|
}
|
|
779
788
|
/**
|
|
780
|
-
* Create an alternate external identifier for a customer by external ID.
|
|
789
|
+
* Create an alternate external identifier for a customer by external ID. The alias shares one set of ids with customer external ids and unit ids, unique within the organization and ignoring letter case: an alias that another customer already holds as its external id, a unit id or an alias is refused with `409 EXTERNAL_ID_IN_USE` (an exact match keeps its older code, `ALIAS_CONFLICTS_WITH_CUSTOMER_EXTERNAL_ID` or `CUSTOMER_ALIAS_ALREADY_EXISTS`).
|
|
781
790
|
*
|
|
782
791
|
* @param {Paid.CreateCustomerAliasByExternalIdRequest} request
|
|
783
792
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -994,7 +1003,7 @@ export class Customers {
|
|
|
994
1003
|
});
|
|
995
1004
|
}
|
|
996
1005
|
/**
|
|
997
|
-
* Update a customer by external ID
|
|
1006
|
+
* Update a customer by external ID. Changing `externalId` follows the organization-wide id rule: a new id that another customer already holds as its external id, a unit id or an alias, ignoring letter case, is refused with `409 EXTERNAL_ID_IN_USE`; the same id in the same case stays `400 DUPLICATE_EXTERNAL_ID`. When the id changes, the previous id is kept as an alias of the customer, so signals that still use it keep resolving to it.
|
|
998
1007
|
*
|
|
999
1008
|
* @param {Paid.UpdateCustomerByExternalIdRequest} request
|
|
1000
1009
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1002,6 +1011,7 @@ export class Customers {
|
|
|
1002
1011
|
* @throws {@link Paid.BadRequestError}
|
|
1003
1012
|
* @throws {@link Paid.ForbiddenError}
|
|
1004
1013
|
* @throws {@link Paid.NotFoundError}
|
|
1014
|
+
* @throws {@link Paid.ConflictError}
|
|
1005
1015
|
* @throws {@link Paid.InternalServerError}
|
|
1006
1016
|
*
|
|
1007
1017
|
* @example
|
|
@@ -1041,6 +1051,8 @@ export class Customers {
|
|
|
1041
1051
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1042
1052
|
case 404:
|
|
1043
1053
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1054
|
+
case 409:
|
|
1055
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1044
1056
|
case 500:
|
|
1045
1057
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1046
1058
|
default:
|
|
@@ -1069,7 +1081,7 @@ export class Customers {
|
|
|
1069
1081
|
});
|
|
1070
1082
|
}
|
|
1071
1083
|
/**
|
|
1072
|
-
* Delete a customer by external ID
|
|
1084
|
+
* Delete a customer by external ID. A customer that still has orders, invoices, payments, contacts, child customers or other linked records is not deleted: the request returns 409 `CUSTOMER_HAS_ASSOCIATIONS` and `details` lists what is linked.
|
|
1073
1085
|
*
|
|
1074
1086
|
* @param {Paid.DeleteCustomerByExternalIdRequest} request
|
|
1075
1087
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1077,6 +1089,7 @@ export class Customers {
|
|
|
1077
1089
|
* @throws {@link Paid.BadRequestError}
|
|
1078
1090
|
* @throws {@link Paid.ForbiddenError}
|
|
1079
1091
|
* @throws {@link Paid.NotFoundError}
|
|
1092
|
+
* @throws {@link Paid.ConflictError}
|
|
1080
1093
|
* @throws {@link Paid.InternalServerError}
|
|
1081
1094
|
*
|
|
1082
1095
|
* @example
|
|
@@ -1112,6 +1125,8 @@ export class Customers {
|
|
|
1112
1125
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1113
1126
|
case 404:
|
|
1114
1127
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1128
|
+
case 409:
|
|
1129
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1115
1130
|
case 500:
|
|
1116
1131
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1117
1132
|
default:
|
|
@@ -1284,6 +1299,7 @@ export class Customers {
|
|
|
1284
1299
|
* @throws {@link Paid.BadRequestError}
|
|
1285
1300
|
* @throws {@link Paid.ForbiddenError}
|
|
1286
1301
|
* @throws {@link Paid.NotFoundError}
|
|
1302
|
+
* @throws {@link Paid.ConflictError}
|
|
1287
1303
|
* @throws {@link Paid.InternalServerError}
|
|
1288
1304
|
*
|
|
1289
1305
|
* @example
|
|
@@ -1293,7 +1309,8 @@ export class Customers {
|
|
|
1293
1309
|
* creditCurrencyKey: "api_credits",
|
|
1294
1310
|
* amount: 10000,
|
|
1295
1311
|
* startsAt: "2026-06-05T12:00:00Z",
|
|
1296
|
-
* expiresAt: "2026-12-31T23:59:59Z"
|
|
1312
|
+
* expiresAt: "2026-12-31T23:59:59Z",
|
|
1313
|
+
* idempotencyKey: "grant_acme_2026-06-05"
|
|
1297
1314
|
* }
|
|
1298
1315
|
* })
|
|
1299
1316
|
*/
|
|
@@ -1328,6 +1345,8 @@ export class Customers {
|
|
|
1328
1345
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1329
1346
|
case 404:
|
|
1330
1347
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1348
|
+
case 409:
|
|
1349
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1331
1350
|
case 500:
|
|
1332
1351
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1333
1352
|
default:
|
|
@@ -1594,6 +1613,7 @@ export class Customers {
|
|
|
1594
1613
|
* @throws {@link Paid.BadRequestError}
|
|
1595
1614
|
* @throws {@link Paid.ForbiddenError}
|
|
1596
1615
|
* @throws {@link Paid.NotFoundError}
|
|
1616
|
+
* @throws {@link Paid.ConflictError}
|
|
1597
1617
|
* @throws {@link Paid.InternalServerError}
|
|
1598
1618
|
*
|
|
1599
1619
|
* @example
|
|
@@ -1603,7 +1623,8 @@ export class Customers {
|
|
|
1603
1623
|
* creditCurrencyKey: "api_credits",
|
|
1604
1624
|
* amount: 10000,
|
|
1605
1625
|
* startsAt: "2026-06-05T12:00:00Z",
|
|
1606
|
-
* expiresAt: "2026-12-31T23:59:59Z"
|
|
1626
|
+
* expiresAt: "2026-12-31T23:59:59Z",
|
|
1627
|
+
* idempotencyKey: "grant_acme_2026-06-05"
|
|
1607
1628
|
* }
|
|
1608
1629
|
* })
|
|
1609
1630
|
*/
|
|
@@ -1638,6 +1659,8 @@ export class Customers {
|
|
|
1638
1659
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1639
1660
|
case 404:
|
|
1640
1661
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1662
|
+
case 409:
|
|
1663
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1641
1664
|
case 500:
|
|
1642
1665
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1643
1666
|
default:
|
|
@@ -1741,9 +1764,9 @@ export class Customers {
|
|
|
1741
1764
|
});
|
|
1742
1765
|
}
|
|
1743
1766
|
/**
|
|
1744
|
-
*
|
|
1767
|
+
* Returns the virtual bank account (Stripe funding instructions) a customer can pay by bank transfer into, by Paid display ID.
|
|
1745
1768
|
*
|
|
1746
|
-
* @param {Paid.
|
|
1769
|
+
* @param {Paid.GetCustomerFundingInstructionsRequest} request
|
|
1747
1770
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1748
1771
|
*
|
|
1749
1772
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -1752,37 +1775,25 @@ export class Customers {
|
|
|
1752
1775
|
* @throws {@link Paid.InternalServerError}
|
|
1753
1776
|
*
|
|
1754
1777
|
* @example
|
|
1755
|
-
* await client.customers.
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1778
|
+
* await client.customers.getCustomerFundingInstructions({
|
|
1779
|
+
* id: "cus_abc123",
|
|
1780
|
+
* currency: "USD"
|
|
1758
1781
|
* })
|
|
1759
1782
|
*/
|
|
1760
|
-
|
|
1761
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1783
|
+
getCustomerFundingInstructions(request, requestOptions) {
|
|
1784
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerFundingInstructions(request, requestOptions));
|
|
1762
1785
|
}
|
|
1763
|
-
|
|
1786
|
+
__getCustomerFundingInstructions(request, requestOptions) {
|
|
1764
1787
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1765
1788
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1766
|
-
const {
|
|
1789
|
+
const { id, currency } = request;
|
|
1767
1790
|
const _queryParams = {};
|
|
1768
|
-
if (
|
|
1769
|
-
_queryParams.
|
|
1770
|
-
}
|
|
1771
|
-
if (offset != null) {
|
|
1772
|
-
_queryParams.offset = offset.toString();
|
|
1773
|
-
}
|
|
1774
|
-
if (status != null) {
|
|
1775
|
-
_queryParams.status = status;
|
|
1776
|
-
}
|
|
1777
|
-
if (externalType != null) {
|
|
1778
|
-
_queryParams.externalType = externalType;
|
|
1779
|
-
}
|
|
1780
|
-
if (parentExternalId != null) {
|
|
1781
|
-
_queryParams.parentExternalId = parentExternalId;
|
|
1791
|
+
if (currency != null) {
|
|
1792
|
+
_queryParams.currency = currency;
|
|
1782
1793
|
}
|
|
1783
1794
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1784
1795
|
const _response = yield core.fetcher({
|
|
1785
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers
|
|
1796
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/funding-instructions`),
|
|
1786
1797
|
method: "GET",
|
|
1787
1798
|
headers: _headers,
|
|
1788
1799
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -1819,7 +1830,7 @@ export class Customers {
|
|
|
1819
1830
|
rawResponse: _response.rawResponse,
|
|
1820
1831
|
});
|
|
1821
1832
|
case "timeout":
|
|
1822
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/
|
|
1833
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/funding-instructions.");
|
|
1823
1834
|
case "unknown":
|
|
1824
1835
|
throw new errors.PaidError({
|
|
1825
1836
|
message: _response.error.errorMessage,
|
|
@@ -1829,35 +1840,33 @@ export class Customers {
|
|
|
1829
1840
|
});
|
|
1830
1841
|
}
|
|
1831
1842
|
/**
|
|
1832
|
-
* Creates a
|
|
1843
|
+
* Creates a dedicated virtual bank account for the customer to pay invoices by bank transfer, by Paid display ID. Returns the existing account if one already exists for the currency. Requires a live-mode organization with Stripe connected and Bank Transfers enabled on the Stripe account.
|
|
1833
1844
|
*
|
|
1834
|
-
* @param {Paid.
|
|
1845
|
+
* @param {Paid.CreateCustomerFundingInstructionsRequest} request
|
|
1835
1846
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1836
1847
|
*
|
|
1837
1848
|
* @throws {@link Paid.BadRequestError}
|
|
1838
1849
|
* @throws {@link Paid.ForbiddenError}
|
|
1839
1850
|
* @throws {@link Paid.NotFoundError}
|
|
1840
|
-
* @throws {@link Paid.
|
|
1851
|
+
* @throws {@link Paid.UnprocessableEntityError}
|
|
1841
1852
|
* @throws {@link Paid.InternalServerError}
|
|
1842
1853
|
*
|
|
1843
1854
|
* @example
|
|
1844
|
-
* await client.customers.
|
|
1845
|
-
*
|
|
1846
|
-
* body: {
|
|
1847
|
-
* externalId: "team-research"
|
|
1848
|
-
* }
|
|
1855
|
+
* await client.customers.createCustomerFundingInstructions({
|
|
1856
|
+
* id: "cus_abc123",
|
|
1857
|
+
* body: {}
|
|
1849
1858
|
* })
|
|
1850
1859
|
*/
|
|
1851
|
-
|
|
1852
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1860
|
+
createCustomerFundingInstructions(request, requestOptions) {
|
|
1861
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerFundingInstructions(request, requestOptions));
|
|
1853
1862
|
}
|
|
1854
|
-
|
|
1863
|
+
__createCustomerFundingInstructions(request, requestOptions) {
|
|
1855
1864
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1856
1865
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1857
|
-
const {
|
|
1866
|
+
const { id, body: _body } = request;
|
|
1858
1867
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1859
1868
|
const _response = yield core.fetcher({
|
|
1860
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers
|
|
1869
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/funding-instructions`),
|
|
1861
1870
|
method: "POST",
|
|
1862
1871
|
headers: _headers,
|
|
1863
1872
|
contentType: "application/json",
|
|
@@ -1879,8 +1888,8 @@ export class Customers {
|
|
|
1879
1888
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1880
1889
|
case 404:
|
|
1881
1890
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1882
|
-
case
|
|
1883
|
-
throw new Paid.
|
|
1891
|
+
case 422:
|
|
1892
|
+
throw new Paid.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1884
1893
|
case 500:
|
|
1885
1894
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1886
1895
|
default:
|
|
@@ -1899,7 +1908,7 @@ export class Customers {
|
|
|
1899
1908
|
rawResponse: _response.rawResponse,
|
|
1900
1909
|
});
|
|
1901
1910
|
case "timeout":
|
|
1902
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/
|
|
1911
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/funding-instructions.");
|
|
1903
1912
|
case "unknown":
|
|
1904
1913
|
throw new errors.PaidError({
|
|
1905
1914
|
message: _response.error.errorMessage,
|
|
@@ -1909,9 +1918,9 @@ export class Customers {
|
|
|
1909
1918
|
});
|
|
1910
1919
|
}
|
|
1911
1920
|
/**
|
|
1912
|
-
* Returns
|
|
1921
|
+
* Returns the virtual bank account (Stripe funding instructions) a customer can pay by bank transfer into, by your external ID.
|
|
1913
1922
|
*
|
|
1914
|
-
* @param {Paid.
|
|
1923
|
+
* @param {Paid.GetCustomerFundingInstructionsByExternalIdRequest} request
|
|
1915
1924
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1916
1925
|
*
|
|
1917
1926
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -1920,97 +1929,28 @@ export class Customers {
|
|
|
1920
1929
|
* @throws {@link Paid.InternalServerError}
|
|
1921
1930
|
*
|
|
1922
1931
|
* @example
|
|
1923
|
-
* await client.customers.
|
|
1924
|
-
* externalId: "
|
|
1925
|
-
*
|
|
1932
|
+
* await client.customers.getCustomerFundingInstructionsByExternalId({
|
|
1933
|
+
* externalId: "externalId",
|
|
1934
|
+
* currency: "USD"
|
|
1926
1935
|
* })
|
|
1927
1936
|
*/
|
|
1928
|
-
|
|
1929
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1937
|
+
getCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
1938
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerFundingInstructionsByExternalId(request, requestOptions));
|
|
1930
1939
|
}
|
|
1931
|
-
|
|
1940
|
+
__getCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
1932
1941
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1933
1942
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1934
|
-
const { externalId,
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
method: "GET",
|
|
1939
|
-
headers: _headers,
|
|
1940
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1941
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
1942
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
1943
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1944
|
-
});
|
|
1945
|
-
if (_response.ok) {
|
|
1946
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1947
|
-
}
|
|
1948
|
-
if (_response.error.reason === "status-code") {
|
|
1949
|
-
switch (_response.error.statusCode) {
|
|
1950
|
-
case 400:
|
|
1951
|
-
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
1952
|
-
case 403:
|
|
1953
|
-
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1954
|
-
case 404:
|
|
1955
|
-
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1956
|
-
case 500:
|
|
1957
|
-
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1958
|
-
default:
|
|
1959
|
-
throw new errors.PaidError({
|
|
1960
|
-
statusCode: _response.error.statusCode,
|
|
1961
|
-
body: _response.error.body,
|
|
1962
|
-
rawResponse: _response.rawResponse,
|
|
1963
|
-
});
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
switch (_response.error.reason) {
|
|
1967
|
-
case "non-json":
|
|
1968
|
-
throw new errors.PaidError({
|
|
1969
|
-
statusCode: _response.error.statusCode,
|
|
1970
|
-
body: _response.error.rawBody,
|
|
1971
|
-
rawResponse: _response.rawResponse,
|
|
1972
|
-
});
|
|
1973
|
-
case "timeout":
|
|
1974
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
1975
|
-
case "unknown":
|
|
1976
|
-
throw new errors.PaidError({
|
|
1977
|
-
message: _response.error.errorMessage,
|
|
1978
|
-
rawResponse: _response.rawResponse,
|
|
1979
|
-
});
|
|
1943
|
+
const { externalId, currency } = request;
|
|
1944
|
+
const _queryParams = {};
|
|
1945
|
+
if (currency != null) {
|
|
1946
|
+
_queryParams.currency = currency;
|
|
1980
1947
|
}
|
|
1981
|
-
});
|
|
1982
|
-
}
|
|
1983
|
-
/**
|
|
1984
|
-
* Soft-deletes a unit: it stays readable with `status: DELETED` and cannot be reactivated. Spend history that references it is kept, and signals that keep naming it are still attributed to it. `409` while the unit has ACTIVE children or a cap in force or scheduled; the root follows the same rules, and once it is deleted a new root can be created. Addresses the customer by your external customer id.
|
|
1985
|
-
*
|
|
1986
|
-
* @param {Paid.DeleteCustomerUnitByExternalIdRequest} request
|
|
1987
|
-
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1988
|
-
*
|
|
1989
|
-
* @throws {@link Paid.BadRequestError}
|
|
1990
|
-
* @throws {@link Paid.ForbiddenError}
|
|
1991
|
-
* @throws {@link Paid.NotFoundError}
|
|
1992
|
-
* @throws {@link Paid.ConflictError}
|
|
1993
|
-
* @throws {@link Paid.InternalServerError}
|
|
1994
|
-
*
|
|
1995
|
-
* @example
|
|
1996
|
-
* await client.customers.deleteCustomerUnitByExternalId({
|
|
1997
|
-
* externalId: "customer_123",
|
|
1998
|
-
* externalCustomerUnitId: "team-research"
|
|
1999
|
-
* })
|
|
2000
|
-
*/
|
|
2001
|
-
deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2002
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitByExternalId(request, requestOptions));
|
|
2003
|
-
}
|
|
2004
|
-
__deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2005
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2006
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2007
|
-
const { externalId, externalCustomerUnitId } = request;
|
|
2008
1948
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2009
1949
|
const _response = yield core.fetcher({
|
|
2010
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/
|
|
2011
|
-
method: "
|
|
1950
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/funding-instructions`),
|
|
1951
|
+
method: "GET",
|
|
2012
1952
|
headers: _headers,
|
|
2013
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1953
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2014
1954
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2015
1955
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2016
1956
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -2026,8 +1966,6 @@ export class Customers {
|
|
|
2026
1966
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2027
1967
|
case 404:
|
|
2028
1968
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2029
|
-
case 409:
|
|
2030
|
-
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2031
1969
|
case 500:
|
|
2032
1970
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2033
1971
|
default:
|
|
@@ -2046,7 +1984,7 @@ export class Customers {
|
|
|
2046
1984
|
rawResponse: _response.rawResponse,
|
|
2047
1985
|
});
|
|
2048
1986
|
case "timeout":
|
|
2049
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
1987
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/funding-instructions.");
|
|
2050
1988
|
case "unknown":
|
|
2051
1989
|
throw new errors.PaidError({
|
|
2052
1990
|
message: _response.error.errorMessage,
|
|
@@ -2056,35 +1994,34 @@ export class Customers {
|
|
|
2056
1994
|
});
|
|
2057
1995
|
}
|
|
2058
1996
|
/**
|
|
2059
|
-
*
|
|
1997
|
+
* Creates a dedicated virtual bank account for the customer to pay invoices by bank transfer, by your external ID. Returns the existing account if one already exists for the currency. Requires a live-mode organization with Stripe connected and Bank Transfers enabled on the Stripe account.
|
|
2060
1998
|
*
|
|
2061
|
-
* @param {Paid.
|
|
1999
|
+
* @param {Paid.CreateCustomerFundingInstructionsByExternalIdRequest} request
|
|
2062
2000
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2063
2001
|
*
|
|
2064
2002
|
* @throws {@link Paid.BadRequestError}
|
|
2065
2003
|
* @throws {@link Paid.ForbiddenError}
|
|
2066
2004
|
* @throws {@link Paid.NotFoundError}
|
|
2067
|
-
* @throws {@link Paid.
|
|
2005
|
+
* @throws {@link Paid.UnprocessableEntityError}
|
|
2068
2006
|
* @throws {@link Paid.InternalServerError}
|
|
2069
2007
|
*
|
|
2070
2008
|
* @example
|
|
2071
|
-
* await client.customers.
|
|
2072
|
-
* externalId: "
|
|
2073
|
-
* externalCustomerUnitId: "team-research",
|
|
2009
|
+
* await client.customers.createCustomerFundingInstructionsByExternalId({
|
|
2010
|
+
* externalId: "externalId",
|
|
2074
2011
|
* body: {}
|
|
2075
2012
|
* })
|
|
2076
2013
|
*/
|
|
2077
|
-
|
|
2078
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2014
|
+
createCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
2015
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerFundingInstructionsByExternalId(request, requestOptions));
|
|
2079
2016
|
}
|
|
2080
|
-
|
|
2017
|
+
__createCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
2081
2018
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2082
2019
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2083
|
-
const { externalId,
|
|
2020
|
+
const { externalId, body: _body } = request;
|
|
2084
2021
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2085
2022
|
const _response = yield core.fetcher({
|
|
2086
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/
|
|
2087
|
-
method: "
|
|
2023
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/funding-instructions`),
|
|
2024
|
+
method: "POST",
|
|
2088
2025
|
headers: _headers,
|
|
2089
2026
|
contentType: "application/json",
|
|
2090
2027
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2105,8 +2042,8 @@ export class Customers {
|
|
|
2105
2042
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2106
2043
|
case 404:
|
|
2107
2044
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2108
|
-
case
|
|
2109
|
-
throw new Paid.
|
|
2045
|
+
case 422:
|
|
2046
|
+
throw new Paid.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2110
2047
|
case 500:
|
|
2111
2048
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2112
2049
|
default:
|
|
@@ -2125,7 +2062,7 @@ export class Customers {
|
|
|
2125
2062
|
rawResponse: _response.rawResponse,
|
|
2126
2063
|
});
|
|
2127
2064
|
case "timeout":
|
|
2128
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
2065
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/funding-instructions.");
|
|
2129
2066
|
case "unknown":
|
|
2130
2067
|
throw new errors.PaidError({
|
|
2131
2068
|
message: _response.error.errorMessage,
|
|
@@ -2135,9 +2072,9 @@ export class Customers {
|
|
|
2135
2072
|
});
|
|
2136
2073
|
}
|
|
2137
2074
|
/**
|
|
2138
|
-
* Lists the customer's units as a flat list, newest last; assemble the tree from `parentExternalId` (`null` on the root unit, `isRoot: true`). Deleted units are hidden unless `status=DELETED` is given
|
|
2075
|
+
* Lists the customer's units as a flat list, newest last; assemble the tree from `parentExternalId` (`null` on the root unit, `isRoot: true`). Deleted units are hidden unless `status=DELETED` is given, drafts unless `status=DRAFT`. Filter by `externalType`, or by `parentExternalId` for one level of the tree. Addresses the customer by your external customer id.
|
|
2139
2076
|
*
|
|
2140
|
-
* @param {Paid.
|
|
2077
|
+
* @param {Paid.ListCustomerUnitsByExternalIdRequest} request
|
|
2141
2078
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2142
2079
|
*
|
|
2143
2080
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2146,18 +2083,18 @@ export class Customers {
|
|
|
2146
2083
|
* @throws {@link Paid.InternalServerError}
|
|
2147
2084
|
*
|
|
2148
2085
|
* @example
|
|
2149
|
-
* await client.customers.
|
|
2150
|
-
*
|
|
2086
|
+
* await client.customers.listCustomerUnitsByExternalId({
|
|
2087
|
+
* externalId: "customer_123",
|
|
2151
2088
|
* parentExternalId: "dept-rnd"
|
|
2152
2089
|
* })
|
|
2153
2090
|
*/
|
|
2154
|
-
|
|
2155
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2091
|
+
listCustomerUnitsByExternalId(request, requestOptions) {
|
|
2092
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitsByExternalId(request, requestOptions));
|
|
2156
2093
|
}
|
|
2157
|
-
|
|
2094
|
+
__listCustomerUnitsByExternalId(request, requestOptions) {
|
|
2158
2095
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2159
2096
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2160
|
-
const {
|
|
2097
|
+
const { externalId, limit, offset, status, externalType, parentExternalId } = request;
|
|
2161
2098
|
const _queryParams = {};
|
|
2162
2099
|
if (limit != null) {
|
|
2163
2100
|
_queryParams.limit = limit.toString();
|
|
@@ -2176,7 +2113,7 @@ export class Customers {
|
|
|
2176
2113
|
}
|
|
2177
2114
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2178
2115
|
const _response = yield core.fetcher({
|
|
2179
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(
|
|
2116
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units`),
|
|
2180
2117
|
method: "GET",
|
|
2181
2118
|
headers: _headers,
|
|
2182
2119
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -2213,7 +2150,7 @@ export class Customers {
|
|
|
2213
2150
|
rawResponse: _response.rawResponse,
|
|
2214
2151
|
});
|
|
2215
2152
|
case "timeout":
|
|
2216
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{
|
|
2153
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units.");
|
|
2217
2154
|
case "unknown":
|
|
2218
2155
|
throw new errors.PaidError({
|
|
2219
2156
|
message: _response.error.errorMessage,
|
|
@@ -2223,9 +2160,9 @@ export class Customers {
|
|
|
2223
2160
|
});
|
|
2224
2161
|
}
|
|
2225
2162
|
/**
|
|
2226
|
-
* Creates a unit for this customer. `externalId` is your own key for it: required, unique within the customer
|
|
2163
|
+
* Creates a unit for this customer. `externalId` is your own key for it: required, immutable, and unique within the organization (no other customer's unit id, external id or alias may be the same, ignoring letter case); every unit route addresses the unit by it, and `name` defaults to it. Omit `parentExternalId` to create the customer's root unit (its first unit; `409 ROOT_EXISTS` if it already has one — a customer created with an external id usable as a unit key already has its root, keyed by that external id, so name it as the parent instead); otherwise the parent must exist (`409 PARENT_NOT_FOUND`) and be ACTIVE. A create whose `externalId` is one of this customer's `DRAFT` units promotes the draft in place: same unit, same id, now ACTIVE with the request's name, type, metadata and parent (`parentExternalId` is required; a draft sits under the root). A signal that names a unit before it exists is accepted; with draft units enabled for your organization it creates a `DRAFT` unit under the customer's root that holds the key, and creating the unit with that key later promotes the draft; otherwise its spend attaches to the unit once you create it with that key. `409` also when the externalId is taken on this customer (`CUSTOMER_UNIT_EXISTS`) or by another customer of the organization (`EXTERNAL_ID_IN_USE`), the tree would get too deep, the customer is on seat-based billing, or a root unit is sent with `billable: false` (`ROOT_UNIT_ALWAYS_BILLABLE`). `403 FEATURE_NOT_ENABLED` for `billable: false` when non-billable units are not enabled for your organization. Addresses the customer by your external customer id.
|
|
2227
2164
|
*
|
|
2228
|
-
* @param {Paid.
|
|
2165
|
+
* @param {Paid.CreateCustomerUnitByExternalIdRequest} request
|
|
2229
2166
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2230
2167
|
*
|
|
2231
2168
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2235,23 +2172,23 @@ export class Customers {
|
|
|
2235
2172
|
* @throws {@link Paid.InternalServerError}
|
|
2236
2173
|
*
|
|
2237
2174
|
* @example
|
|
2238
|
-
* await client.customers.
|
|
2239
|
-
*
|
|
2175
|
+
* await client.customers.createCustomerUnitByExternalId({
|
|
2176
|
+
* externalId: "customer_123",
|
|
2240
2177
|
* body: {
|
|
2241
2178
|
* externalId: "team-research"
|
|
2242
2179
|
* }
|
|
2243
2180
|
* })
|
|
2244
2181
|
*/
|
|
2245
|
-
|
|
2246
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2182
|
+
createCustomerUnitByExternalId(request, requestOptions) {
|
|
2183
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitByExternalId(request, requestOptions));
|
|
2247
2184
|
}
|
|
2248
|
-
|
|
2185
|
+
__createCustomerUnitByExternalId(request, requestOptions) {
|
|
2249
2186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2250
2187
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2251
|
-
const {
|
|
2188
|
+
const { externalId, body: _body } = request;
|
|
2252
2189
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2253
2190
|
const _response = yield core.fetcher({
|
|
2254
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(
|
|
2191
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units`),
|
|
2255
2192
|
method: "POST",
|
|
2256
2193
|
headers: _headers,
|
|
2257
2194
|
contentType: "application/json",
|
|
@@ -2293,7 +2230,7 @@ export class Customers {
|
|
|
2293
2230
|
rawResponse: _response.rawResponse,
|
|
2294
2231
|
});
|
|
2295
2232
|
case "timeout":
|
|
2296
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{
|
|
2233
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/customer-units.");
|
|
2297
2234
|
case "unknown":
|
|
2298
2235
|
throw new errors.PaidError({
|
|
2299
2236
|
message: _response.error.errorMessage,
|
|
@@ -2303,9 +2240,9 @@ export class Customers {
|
|
|
2303
2240
|
});
|
|
2304
2241
|
}
|
|
2305
2242
|
/**
|
|
2306
|
-
* Returns one unit of this customer by its `externalId`, including a deleted one. `404` when the unit does not exist or belongs to another customer.
|
|
2243
|
+
* Returns one unit of this customer by its `externalId`, including a deleted one. `404` when the unit does not exist or belongs to another customer. Addresses the customer by your external customer id.
|
|
2307
2244
|
*
|
|
2308
|
-
* @param {Paid.
|
|
2245
|
+
* @param {Paid.GetCustomerUnitByExternalIdRequest} request
|
|
2309
2246
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2310
2247
|
*
|
|
2311
2248
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2314,21 +2251,21 @@ export class Customers {
|
|
|
2314
2251
|
* @throws {@link Paid.InternalServerError}
|
|
2315
2252
|
*
|
|
2316
2253
|
* @example
|
|
2317
|
-
* await client.customers.
|
|
2318
|
-
*
|
|
2254
|
+
* await client.customers.getCustomerUnitByExternalId({
|
|
2255
|
+
* externalId: "customer_123",
|
|
2319
2256
|
* externalCustomerUnitId: "team-research"
|
|
2320
2257
|
* })
|
|
2321
2258
|
*/
|
|
2322
|
-
|
|
2323
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2259
|
+
getCustomerUnitByExternalId(request, requestOptions) {
|
|
2260
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitByExternalId(request, requestOptions));
|
|
2324
2261
|
}
|
|
2325
|
-
|
|
2262
|
+
__getCustomerUnitByExternalId(request, requestOptions) {
|
|
2326
2263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2327
2264
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2328
|
-
const {
|
|
2265
|
+
const { externalId, externalCustomerUnitId } = request;
|
|
2329
2266
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2330
2267
|
const _response = yield core.fetcher({
|
|
2331
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(
|
|
2268
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
2332
2269
|
method: "GET",
|
|
2333
2270
|
headers: _headers,
|
|
2334
2271
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2365,7 +2302,7 @@ export class Customers {
|
|
|
2365
2302
|
rawResponse: _response.rawResponse,
|
|
2366
2303
|
});
|
|
2367
2304
|
case "timeout":
|
|
2368
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{
|
|
2305
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2369
2306
|
case "unknown":
|
|
2370
2307
|
throw new errors.PaidError({
|
|
2371
2308
|
message: _response.error.errorMessage,
|
|
@@ -2375,9 +2312,9 @@ export class Customers {
|
|
|
2375
2312
|
});
|
|
2376
2313
|
}
|
|
2377
2314
|
/**
|
|
2378
|
-
* Soft-deletes a unit: it stays readable with `status: DELETED` and cannot be reactivated. Spend history that references it is kept, and signals that keep naming it are still attributed to it. `409` while the unit has ACTIVE children or a cap in force or scheduled; the root follows the same rules, and once it is deleted a new root can be created.
|
|
2315
|
+
* Soft-deletes a unit: it stays readable with `status: DELETED` and cannot be reactivated. Spend history that references it is kept, and signals that keep naming it are still attributed to it. A `DRAFT` unit is deleted the same way: it stays readable as DELETED, its key stays reserved, and spend already keyed to it stays its own. `409` while the unit has ACTIVE or DRAFT children or a cap in force or scheduled; the root follows the same rules, and once it is deleted a new root can be created. Addresses the customer by your external customer id.
|
|
2379
2316
|
*
|
|
2380
|
-
* @param {Paid.
|
|
2317
|
+
* @param {Paid.DeleteCustomerUnitByExternalIdRequest} request
|
|
2381
2318
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2382
2319
|
*
|
|
2383
2320
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2387,21 +2324,21 @@ export class Customers {
|
|
|
2387
2324
|
* @throws {@link Paid.InternalServerError}
|
|
2388
2325
|
*
|
|
2389
2326
|
* @example
|
|
2390
|
-
* await client.customers.
|
|
2391
|
-
*
|
|
2327
|
+
* await client.customers.deleteCustomerUnitByExternalId({
|
|
2328
|
+
* externalId: "customer_123",
|
|
2392
2329
|
* externalCustomerUnitId: "team-research"
|
|
2393
2330
|
* })
|
|
2394
2331
|
*/
|
|
2395
|
-
|
|
2396
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2332
|
+
deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2333
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitByExternalId(request, requestOptions));
|
|
2397
2334
|
}
|
|
2398
|
-
|
|
2335
|
+
__deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2399
2336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2400
2337
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2401
|
-
const {
|
|
2338
|
+
const { externalId, externalCustomerUnitId } = request;
|
|
2402
2339
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2403
2340
|
const _response = yield core.fetcher({
|
|
2404
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(
|
|
2341
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
2405
2342
|
method: "DELETE",
|
|
2406
2343
|
headers: _headers,
|
|
2407
2344
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2440,7 +2377,7 @@ export class Customers {
|
|
|
2440
2377
|
rawResponse: _response.rawResponse,
|
|
2441
2378
|
});
|
|
2442
2379
|
case "timeout":
|
|
2443
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{
|
|
2380
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2444
2381
|
case "unknown":
|
|
2445
2382
|
throw new errors.PaidError({
|
|
2446
2383
|
message: _response.error.errorMessage,
|
|
@@ -2450,9 +2387,9 @@ export class Customers {
|
|
|
2450
2387
|
});
|
|
2451
2388
|
}
|
|
2452
2389
|
/**
|
|
2453
|
-
* Renames, re-types, re-parents or annotates a unit, the root included. `externalId` cannot change. Re-parenting (`parentExternalId`) moves the unit with everything under it. Spend already recorded keeps naming the unit it landed on; caps are evaluated on the current tree, so from the move on the unit's spend in the running cap period counts toward its new ancestors' caps and no longer toward the old ones. `409` for a deleted unit, a parent that does not exist or is not ACTIVE, a move of the root (`ROOT_UNIT_IMMOVABLE`), a move under the unit's own subtree, or a tree that would get too deep.
|
|
2390
|
+
* Renames, re-types, re-parents or annotates a unit, the root included. `externalId` cannot change. Re-parenting (`parentExternalId`) moves the unit with everything under it. Spend already recorded keeps naming the unit it landed on; caps are evaluated on the current tree, so from the move on the unit's spend in the running cap period counts toward its new ancestors' caps and no longer toward the old ones. `billable` flips the unit's own setting; moving a unit under a non-billable one makes it non-billable in effect (`effectiveBillable`). `409` for a deleted unit (`CUSTOMER_UNIT_DELETED`), a draft (`CUSTOMER_UNIT_DRAFT`), a parent that does not exist or is not ACTIVE, a move of the root (`ROOT_UNIT_IMMOVABLE`), `billable: false` on the root (`ROOT_UNIT_ALWAYS_BILLABLE`), a move under the unit's own subtree, or a tree that would get too deep. `403 FEATURE_NOT_ENABLED` for `billable: false` when non-billable units are not enabled for your organization. Addresses the customer by your external customer id.
|
|
2454
2391
|
*
|
|
2455
|
-
* @param {Paid.
|
|
2392
|
+
* @param {Paid.UpdateCustomerUnitByExternalIdRequest} request
|
|
2456
2393
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2457
2394
|
*
|
|
2458
2395
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2462,23 +2399,1657 @@ export class Customers {
|
|
|
2462
2399
|
* @throws {@link Paid.InternalServerError}
|
|
2463
2400
|
*
|
|
2464
2401
|
* @example
|
|
2465
|
-
* await client.customers.
|
|
2466
|
-
*
|
|
2402
|
+
* await client.customers.updateCustomerUnitByExternalId({
|
|
2403
|
+
* externalId: "customer_123",
|
|
2467
2404
|
* externalCustomerUnitId: "team-research",
|
|
2468
2405
|
* body: {}
|
|
2469
2406
|
* })
|
|
2470
2407
|
*/
|
|
2471
|
-
|
|
2472
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2408
|
+
updateCustomerUnitByExternalId(request, requestOptions) {
|
|
2409
|
+
return core.HttpResponsePromise.fromPromise(this.__updateCustomerUnitByExternalId(request, requestOptions));
|
|
2473
2410
|
}
|
|
2474
|
-
|
|
2411
|
+
__updateCustomerUnitByExternalId(request, requestOptions) {
|
|
2475
2412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2476
2413
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2477
|
-
const {
|
|
2414
|
+
const { externalId, externalCustomerUnitId, body: _body } = request;
|
|
2415
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2416
|
+
const _response = yield core.fetcher({
|
|
2417
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
2418
|
+
method: "PATCH",
|
|
2419
|
+
headers: _headers,
|
|
2420
|
+
contentType: "application/json",
|
|
2421
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2422
|
+
requestType: "json",
|
|
2423
|
+
body: _body,
|
|
2424
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2425
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2426
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2427
|
+
});
|
|
2428
|
+
if (_response.ok) {
|
|
2429
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2430
|
+
}
|
|
2431
|
+
if (_response.error.reason === "status-code") {
|
|
2432
|
+
switch (_response.error.statusCode) {
|
|
2433
|
+
case 400:
|
|
2434
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2435
|
+
case 403:
|
|
2436
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2437
|
+
case 404:
|
|
2438
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2439
|
+
case 409:
|
|
2440
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2441
|
+
case 500:
|
|
2442
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2443
|
+
default:
|
|
2444
|
+
throw new errors.PaidError({
|
|
2445
|
+
statusCode: _response.error.statusCode,
|
|
2446
|
+
body: _response.error.body,
|
|
2447
|
+
rawResponse: _response.rawResponse,
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
switch (_response.error.reason) {
|
|
2452
|
+
case "non-json":
|
|
2453
|
+
throw new errors.PaidError({
|
|
2454
|
+
statusCode: _response.error.statusCode,
|
|
2455
|
+
body: _response.error.rawBody,
|
|
2456
|
+
rawResponse: _response.rawResponse,
|
|
2457
|
+
});
|
|
2458
|
+
case "timeout":
|
|
2459
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PATCH /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2460
|
+
case "unknown":
|
|
2461
|
+
throw new errors.PaidError({
|
|
2462
|
+
message: _response.error.errorMessage,
|
|
2463
|
+
rawResponse: _response.rawResponse,
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* Lists the aliases that land signals on this unit. A customer-level alias (created on the customer routes) points at the customer's root unit, so it is listed under the root. Addresses the customer by your external customer id.
|
|
2470
|
+
*
|
|
2471
|
+
* @param {Paid.ListCustomerUnitAliasesByExternalIdRequest} request
|
|
2472
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2473
|
+
*
|
|
2474
|
+
* @throws {@link Paid.BadRequestError}
|
|
2475
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2476
|
+
* @throws {@link Paid.NotFoundError}
|
|
2477
|
+
* @throws {@link Paid.InternalServerError}
|
|
2478
|
+
*
|
|
2479
|
+
* @example
|
|
2480
|
+
* await client.customers.listCustomerUnitAliasesByExternalId({
|
|
2481
|
+
* externalId: "customer_123",
|
|
2482
|
+
* externalCustomerUnitId: "team-research"
|
|
2483
|
+
* })
|
|
2484
|
+
*/
|
|
2485
|
+
listCustomerUnitAliasesByExternalId(request, requestOptions) {
|
|
2486
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliasesByExternalId(request, requestOptions));
|
|
2487
|
+
}
|
|
2488
|
+
__listCustomerUnitAliasesByExternalId(request, requestOptions) {
|
|
2489
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2490
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2491
|
+
const { externalId, externalCustomerUnitId, limit, offset } = request;
|
|
2492
|
+
const _queryParams = {};
|
|
2493
|
+
if (limit != null) {
|
|
2494
|
+
_queryParams.limit = limit.toString();
|
|
2495
|
+
}
|
|
2496
|
+
if (offset != null) {
|
|
2497
|
+
_queryParams.offset = offset.toString();
|
|
2498
|
+
}
|
|
2499
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2500
|
+
const _response = yield core.fetcher({
|
|
2501
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
2502
|
+
method: "GET",
|
|
2503
|
+
headers: _headers,
|
|
2504
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2505
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2506
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2507
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2508
|
+
});
|
|
2509
|
+
if (_response.ok) {
|
|
2510
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2511
|
+
}
|
|
2512
|
+
if (_response.error.reason === "status-code") {
|
|
2513
|
+
switch (_response.error.statusCode) {
|
|
2514
|
+
case 400:
|
|
2515
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2516
|
+
case 403:
|
|
2517
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2518
|
+
case 404:
|
|
2519
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2520
|
+
case 500:
|
|
2521
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2522
|
+
default:
|
|
2523
|
+
throw new errors.PaidError({
|
|
2524
|
+
statusCode: _response.error.statusCode,
|
|
2525
|
+
body: _response.error.body,
|
|
2526
|
+
rawResponse: _response.rawResponse,
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
switch (_response.error.reason) {
|
|
2531
|
+
case "non-json":
|
|
2532
|
+
throw new errors.PaidError({
|
|
2533
|
+
statusCode: _response.error.statusCode,
|
|
2534
|
+
body: _response.error.rawBody,
|
|
2535
|
+
rawResponse: _response.rawResponse,
|
|
2536
|
+
});
|
|
2537
|
+
case "timeout":
|
|
2538
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
2539
|
+
case "unknown":
|
|
2540
|
+
throw new errors.PaidError({
|
|
2541
|
+
message: _response.error.errorMessage,
|
|
2542
|
+
rawResponse: _response.rawResponse,
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Creates an alias that lands signals on this unit: a signal whose `externalCustomerId` is the alias resolves to this customer and, when it names no `customerUnit`, to this unit. The alias shares one set of ids with customer external ids and unit ids, unique within the organization and ignoring letter case: an alias another customer holds is refused with `409 EXTERNAL_ID_IN_USE`. Addresses the customer by your external customer id.
|
|
2549
|
+
*
|
|
2550
|
+
* @param {Paid.CreateCustomerUnitAliasByExternalIdRequest} request
|
|
2551
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2552
|
+
*
|
|
2553
|
+
* @throws {@link Paid.BadRequestError}
|
|
2554
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2555
|
+
* @throws {@link Paid.NotFoundError}
|
|
2556
|
+
* @throws {@link Paid.ConflictError}
|
|
2557
|
+
* @throws {@link Paid.InternalServerError}
|
|
2558
|
+
*
|
|
2559
|
+
* @example
|
|
2560
|
+
* await client.customers.createCustomerUnitAliasByExternalId({
|
|
2561
|
+
* externalId: "customer_123",
|
|
2562
|
+
* externalCustomerUnitId: "team-research",
|
|
2563
|
+
* body: {
|
|
2564
|
+
* alias: "child-customer-1"
|
|
2565
|
+
* }
|
|
2566
|
+
* })
|
|
2567
|
+
*/
|
|
2568
|
+
createCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2569
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAliasByExternalId(request, requestOptions));
|
|
2570
|
+
}
|
|
2571
|
+
__createCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2572
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2573
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2574
|
+
const { externalId, externalCustomerUnitId, body: _body } = request;
|
|
2575
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2576
|
+
const _response = yield core.fetcher({
|
|
2577
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
2578
|
+
method: "POST",
|
|
2579
|
+
headers: _headers,
|
|
2580
|
+
contentType: "application/json",
|
|
2581
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2582
|
+
requestType: "json",
|
|
2583
|
+
body: _body,
|
|
2584
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2585
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2586
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2587
|
+
});
|
|
2588
|
+
if (_response.ok) {
|
|
2589
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2590
|
+
}
|
|
2591
|
+
if (_response.error.reason === "status-code") {
|
|
2592
|
+
switch (_response.error.statusCode) {
|
|
2593
|
+
case 400:
|
|
2594
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2595
|
+
case 403:
|
|
2596
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2597
|
+
case 404:
|
|
2598
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2599
|
+
case 409:
|
|
2600
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2601
|
+
case 500:
|
|
2602
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2603
|
+
default:
|
|
2604
|
+
throw new errors.PaidError({
|
|
2605
|
+
statusCode: _response.error.statusCode,
|
|
2606
|
+
body: _response.error.body,
|
|
2607
|
+
rawResponse: _response.rawResponse,
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
switch (_response.error.reason) {
|
|
2612
|
+
case "non-json":
|
|
2613
|
+
throw new errors.PaidError({
|
|
2614
|
+
statusCode: _response.error.statusCode,
|
|
2615
|
+
body: _response.error.rawBody,
|
|
2616
|
+
rawResponse: _response.rawResponse,
|
|
2617
|
+
});
|
|
2618
|
+
case "timeout":
|
|
2619
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
2620
|
+
case "unknown":
|
|
2621
|
+
throw new errors.PaidError({
|
|
2622
|
+
message: _response.error.errorMessage,
|
|
2623
|
+
rawResponse: _response.rawResponse,
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Deletes an alias of this unit. Signals still sent with it then resolve to nothing again. Addresses the customer by your external customer id.
|
|
2630
|
+
*
|
|
2631
|
+
* @param {Paid.DeleteCustomerUnitAliasByExternalIdRequest} request
|
|
2632
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2633
|
+
*
|
|
2634
|
+
* @throws {@link Paid.BadRequestError}
|
|
2635
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2636
|
+
* @throws {@link Paid.NotFoundError}
|
|
2637
|
+
* @throws {@link Paid.InternalServerError}
|
|
2638
|
+
*
|
|
2639
|
+
* @example
|
|
2640
|
+
* await client.customers.deleteCustomerUnitAliasByExternalId({
|
|
2641
|
+
* externalId: "customer_123",
|
|
2642
|
+
* externalCustomerUnitId: "team-research",
|
|
2643
|
+
* alias: "tenant-7-sandbox"
|
|
2644
|
+
* })
|
|
2645
|
+
*/
|
|
2646
|
+
deleteCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2647
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAliasByExternalId(request, requestOptions));
|
|
2648
|
+
}
|
|
2649
|
+
__deleteCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2650
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2651
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2652
|
+
const { externalId, externalCustomerUnitId, alias } = request;
|
|
2653
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2654
|
+
const _response = yield core.fetcher({
|
|
2655
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases/${core.url.encodePathParam(alias)}`),
|
|
2656
|
+
method: "DELETE",
|
|
2657
|
+
headers: _headers,
|
|
2658
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2659
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2660
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2661
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2662
|
+
});
|
|
2663
|
+
if (_response.ok) {
|
|
2664
|
+
return {
|
|
2665
|
+
data: _response.body,
|
|
2666
|
+
rawResponse: _response.rawResponse,
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
if (_response.error.reason === "status-code") {
|
|
2670
|
+
switch (_response.error.statusCode) {
|
|
2671
|
+
case 400:
|
|
2672
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2673
|
+
case 403:
|
|
2674
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2675
|
+
case 404:
|
|
2676
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2677
|
+
case 500:
|
|
2678
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2679
|
+
default:
|
|
2680
|
+
throw new errors.PaidError({
|
|
2681
|
+
statusCode: _response.error.statusCode,
|
|
2682
|
+
body: _response.error.body,
|
|
2683
|
+
rawResponse: _response.rawResponse,
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
switch (_response.error.reason) {
|
|
2688
|
+
case "non-json":
|
|
2689
|
+
throw new errors.PaidError({
|
|
2690
|
+
statusCode: _response.error.statusCode,
|
|
2691
|
+
body: _response.error.rawBody,
|
|
2692
|
+
rawResponse: _response.rawResponse,
|
|
2693
|
+
});
|
|
2694
|
+
case "timeout":
|
|
2695
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases/{alias}.");
|
|
2696
|
+
case "unknown":
|
|
2697
|
+
throw new errors.PaidError({
|
|
2698
|
+
message: _response.error.errorMessage,
|
|
2699
|
+
rawResponse: _response.rawResponse,
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* Lists the customer's units as a flat list, newest last; assemble the tree from `parentExternalId` (`null` on the root unit, `isRoot: true`). Deleted units are hidden unless `status=DELETED` is given, drafts unless `status=DRAFT`. Filter by `externalType`, or by `parentExternalId` for one level of the tree. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2706
|
+
*
|
|
2707
|
+
* @param {Paid.ListCustomerUnitsRequest} request
|
|
2708
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2709
|
+
*
|
|
2710
|
+
* @throws {@link Paid.BadRequestError}
|
|
2711
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2712
|
+
* @throws {@link Paid.NotFoundError}
|
|
2713
|
+
* @throws {@link Paid.InternalServerError}
|
|
2714
|
+
*
|
|
2715
|
+
* @example
|
|
2716
|
+
* await client.customers.listCustomerUnits({
|
|
2717
|
+
* id: "cus_abc123",
|
|
2718
|
+
* parentExternalId: "dept-rnd"
|
|
2719
|
+
* })
|
|
2720
|
+
*/
|
|
2721
|
+
listCustomerUnits(request, requestOptions) {
|
|
2722
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnits(request, requestOptions));
|
|
2723
|
+
}
|
|
2724
|
+
__listCustomerUnits(request, requestOptions) {
|
|
2725
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2726
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2727
|
+
const { id, limit, offset, status, externalType, parentExternalId } = request;
|
|
2728
|
+
const _queryParams = {};
|
|
2729
|
+
if (limit != null) {
|
|
2730
|
+
_queryParams.limit = limit.toString();
|
|
2731
|
+
}
|
|
2732
|
+
if (offset != null) {
|
|
2733
|
+
_queryParams.offset = offset.toString();
|
|
2734
|
+
}
|
|
2735
|
+
if (status != null) {
|
|
2736
|
+
_queryParams.status = status;
|
|
2737
|
+
}
|
|
2738
|
+
if (externalType != null) {
|
|
2739
|
+
_queryParams.externalType = externalType;
|
|
2740
|
+
}
|
|
2741
|
+
if (parentExternalId != null) {
|
|
2742
|
+
_queryParams.parentExternalId = parentExternalId;
|
|
2743
|
+
}
|
|
2744
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2745
|
+
const _response = yield core.fetcher({
|
|
2746
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units`),
|
|
2747
|
+
method: "GET",
|
|
2748
|
+
headers: _headers,
|
|
2749
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2750
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2751
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2752
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2753
|
+
});
|
|
2754
|
+
if (_response.ok) {
|
|
2755
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2756
|
+
}
|
|
2757
|
+
if (_response.error.reason === "status-code") {
|
|
2758
|
+
switch (_response.error.statusCode) {
|
|
2759
|
+
case 400:
|
|
2760
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2761
|
+
case 403:
|
|
2762
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2763
|
+
case 404:
|
|
2764
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2765
|
+
case 500:
|
|
2766
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2767
|
+
default:
|
|
2768
|
+
throw new errors.PaidError({
|
|
2769
|
+
statusCode: _response.error.statusCode,
|
|
2770
|
+
body: _response.error.body,
|
|
2771
|
+
rawResponse: _response.rawResponse,
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
switch (_response.error.reason) {
|
|
2776
|
+
case "non-json":
|
|
2777
|
+
throw new errors.PaidError({
|
|
2778
|
+
statusCode: _response.error.statusCode,
|
|
2779
|
+
body: _response.error.rawBody,
|
|
2780
|
+
rawResponse: _response.rawResponse,
|
|
2781
|
+
});
|
|
2782
|
+
case "timeout":
|
|
2783
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units.");
|
|
2784
|
+
case "unknown":
|
|
2785
|
+
throw new errors.PaidError({
|
|
2786
|
+
message: _response.error.errorMessage,
|
|
2787
|
+
rawResponse: _response.rawResponse,
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Creates a unit for this customer. `externalId` is your own key for it: required, immutable, and unique within the organization (no other customer's unit id, external id or alias may be the same, ignoring letter case); every unit route addresses the unit by it, and `name` defaults to it. Omit `parentExternalId` to create the customer's root unit (its first unit; `409 ROOT_EXISTS` if it already has one — a customer created with an external id usable as a unit key already has its root, keyed by that external id, so name it as the parent instead); otherwise the parent must exist (`409 PARENT_NOT_FOUND`) and be ACTIVE. A create whose `externalId` is one of this customer's `DRAFT` units promotes the draft in place: same unit, same id, now ACTIVE with the request's name, type, metadata and parent (`parentExternalId` is required; a draft sits under the root). A signal that names a unit before it exists is accepted; with draft units enabled for your organization it creates a `DRAFT` unit under the customer's root that holds the key, and creating the unit with that key later promotes the draft; otherwise its spend attaches to the unit once you create it with that key. `409` also when the externalId is taken on this customer (`CUSTOMER_UNIT_EXISTS`) or by another customer of the organization (`EXTERNAL_ID_IN_USE`), the tree would get too deep, the customer is on seat-based billing, or a root unit is sent with `billable: false` (`ROOT_UNIT_ALWAYS_BILLABLE`). `403 FEATURE_NOT_ENABLED` for `billable: false` when non-billable units are not enabled for your organization. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2794
|
+
*
|
|
2795
|
+
* @param {Paid.CreateCustomerUnitRequest} request
|
|
2796
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2797
|
+
*
|
|
2798
|
+
* @throws {@link Paid.BadRequestError}
|
|
2799
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2800
|
+
* @throws {@link Paid.NotFoundError}
|
|
2801
|
+
* @throws {@link Paid.ConflictError}
|
|
2802
|
+
* @throws {@link Paid.InternalServerError}
|
|
2803
|
+
*
|
|
2804
|
+
* @example
|
|
2805
|
+
* await client.customers.createCustomerUnit({
|
|
2806
|
+
* id: "cus_abc123",
|
|
2807
|
+
* body: {
|
|
2808
|
+
* externalId: "team-research"
|
|
2809
|
+
* }
|
|
2810
|
+
* })
|
|
2811
|
+
*/
|
|
2812
|
+
createCustomerUnit(request, requestOptions) {
|
|
2813
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnit(request, requestOptions));
|
|
2814
|
+
}
|
|
2815
|
+
__createCustomerUnit(request, requestOptions) {
|
|
2816
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2817
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2818
|
+
const { id, body: _body } = request;
|
|
2819
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2820
|
+
const _response = yield core.fetcher({
|
|
2821
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units`),
|
|
2822
|
+
method: "POST",
|
|
2823
|
+
headers: _headers,
|
|
2824
|
+
contentType: "application/json",
|
|
2825
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2826
|
+
requestType: "json",
|
|
2827
|
+
body: _body,
|
|
2828
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2829
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2830
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2831
|
+
});
|
|
2832
|
+
if (_response.ok) {
|
|
2833
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2834
|
+
}
|
|
2835
|
+
if (_response.error.reason === "status-code") {
|
|
2836
|
+
switch (_response.error.statusCode) {
|
|
2837
|
+
case 400:
|
|
2838
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2839
|
+
case 403:
|
|
2840
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2841
|
+
case 404:
|
|
2842
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2843
|
+
case 409:
|
|
2844
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2845
|
+
case 500:
|
|
2846
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2847
|
+
default:
|
|
2848
|
+
throw new errors.PaidError({
|
|
2849
|
+
statusCode: _response.error.statusCode,
|
|
2850
|
+
body: _response.error.body,
|
|
2851
|
+
rawResponse: _response.rawResponse,
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
switch (_response.error.reason) {
|
|
2856
|
+
case "non-json":
|
|
2857
|
+
throw new errors.PaidError({
|
|
2858
|
+
statusCode: _response.error.statusCode,
|
|
2859
|
+
body: _response.error.rawBody,
|
|
2860
|
+
rawResponse: _response.rawResponse,
|
|
2861
|
+
});
|
|
2862
|
+
case "timeout":
|
|
2863
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/customer-units.");
|
|
2864
|
+
case "unknown":
|
|
2865
|
+
throw new errors.PaidError({
|
|
2866
|
+
message: _response.error.errorMessage,
|
|
2867
|
+
rawResponse: _response.rawResponse,
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Returns one unit of this customer by its `externalId`, including a deleted one. `404` when the unit does not exist or belongs to another customer. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2874
|
+
*
|
|
2875
|
+
* @param {Paid.GetCustomerUnitRequest} request
|
|
2876
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2877
|
+
*
|
|
2878
|
+
* @throws {@link Paid.BadRequestError}
|
|
2879
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2880
|
+
* @throws {@link Paid.NotFoundError}
|
|
2881
|
+
* @throws {@link Paid.InternalServerError}
|
|
2882
|
+
*
|
|
2883
|
+
* @example
|
|
2884
|
+
* await client.customers.getCustomerUnit({
|
|
2885
|
+
* id: "cus_abc123",
|
|
2886
|
+
* externalCustomerUnitId: "team-research"
|
|
2887
|
+
* })
|
|
2888
|
+
*/
|
|
2889
|
+
getCustomerUnit(request, requestOptions) {
|
|
2890
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnit(request, requestOptions));
|
|
2891
|
+
}
|
|
2892
|
+
__getCustomerUnit(request, requestOptions) {
|
|
2893
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2894
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2895
|
+
const { id, externalCustomerUnitId } = request;
|
|
2896
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2897
|
+
const _response = yield core.fetcher({
|
|
2898
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
2899
|
+
method: "GET",
|
|
2900
|
+
headers: _headers,
|
|
2901
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2902
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2903
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2904
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2905
|
+
});
|
|
2906
|
+
if (_response.ok) {
|
|
2907
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2908
|
+
}
|
|
2909
|
+
if (_response.error.reason === "status-code") {
|
|
2910
|
+
switch (_response.error.statusCode) {
|
|
2911
|
+
case 400:
|
|
2912
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2913
|
+
case 403:
|
|
2914
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2915
|
+
case 404:
|
|
2916
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2917
|
+
case 500:
|
|
2918
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2919
|
+
default:
|
|
2920
|
+
throw new errors.PaidError({
|
|
2921
|
+
statusCode: _response.error.statusCode,
|
|
2922
|
+
body: _response.error.body,
|
|
2923
|
+
rawResponse: _response.rawResponse,
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
switch (_response.error.reason) {
|
|
2928
|
+
case "non-json":
|
|
2929
|
+
throw new errors.PaidError({
|
|
2930
|
+
statusCode: _response.error.statusCode,
|
|
2931
|
+
body: _response.error.rawBody,
|
|
2932
|
+
rawResponse: _response.rawResponse,
|
|
2933
|
+
});
|
|
2934
|
+
case "timeout":
|
|
2935
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
2936
|
+
case "unknown":
|
|
2937
|
+
throw new errors.PaidError({
|
|
2938
|
+
message: _response.error.errorMessage,
|
|
2939
|
+
rawResponse: _response.rawResponse,
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* Soft-deletes a unit: it stays readable with `status: DELETED` and cannot be reactivated. Spend history that references it is kept, and signals that keep naming it are still attributed to it. A `DRAFT` unit is deleted the same way: it stays readable as DELETED, its key stays reserved, and spend already keyed to it stays its own. `409` while the unit has ACTIVE or DRAFT children or a cap in force or scheduled; the root follows the same rules, and once it is deleted a new root can be created. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2946
|
+
*
|
|
2947
|
+
* @param {Paid.DeleteCustomerUnitRequest} request
|
|
2948
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2949
|
+
*
|
|
2950
|
+
* @throws {@link Paid.BadRequestError}
|
|
2951
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2952
|
+
* @throws {@link Paid.NotFoundError}
|
|
2953
|
+
* @throws {@link Paid.ConflictError}
|
|
2954
|
+
* @throws {@link Paid.InternalServerError}
|
|
2955
|
+
*
|
|
2956
|
+
* @example
|
|
2957
|
+
* await client.customers.deleteCustomerUnit({
|
|
2958
|
+
* id: "cus_abc123",
|
|
2959
|
+
* externalCustomerUnitId: "team-research"
|
|
2960
|
+
* })
|
|
2961
|
+
*/
|
|
2962
|
+
deleteCustomerUnit(request, requestOptions) {
|
|
2963
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnit(request, requestOptions));
|
|
2964
|
+
}
|
|
2965
|
+
__deleteCustomerUnit(request, requestOptions) {
|
|
2966
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2967
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2968
|
+
const { id, externalCustomerUnitId } = request;
|
|
2969
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2970
|
+
const _response = yield core.fetcher({
|
|
2971
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
2972
|
+
method: "DELETE",
|
|
2973
|
+
headers: _headers,
|
|
2974
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2975
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
2976
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
2977
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2978
|
+
});
|
|
2979
|
+
if (_response.ok) {
|
|
2980
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2981
|
+
}
|
|
2982
|
+
if (_response.error.reason === "status-code") {
|
|
2983
|
+
switch (_response.error.statusCode) {
|
|
2984
|
+
case 400:
|
|
2985
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2986
|
+
case 403:
|
|
2987
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2988
|
+
case 404:
|
|
2989
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2990
|
+
case 409:
|
|
2991
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2992
|
+
case 500:
|
|
2993
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2994
|
+
default:
|
|
2995
|
+
throw new errors.PaidError({
|
|
2996
|
+
statusCode: _response.error.statusCode,
|
|
2997
|
+
body: _response.error.body,
|
|
2998
|
+
rawResponse: _response.rawResponse,
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
switch (_response.error.reason) {
|
|
3003
|
+
case "non-json":
|
|
3004
|
+
throw new errors.PaidError({
|
|
3005
|
+
statusCode: _response.error.statusCode,
|
|
3006
|
+
body: _response.error.rawBody,
|
|
3007
|
+
rawResponse: _response.rawResponse,
|
|
3008
|
+
});
|
|
3009
|
+
case "timeout":
|
|
3010
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
3011
|
+
case "unknown":
|
|
3012
|
+
throw new errors.PaidError({
|
|
3013
|
+
message: _response.error.errorMessage,
|
|
3014
|
+
rawResponse: _response.rawResponse,
|
|
3015
|
+
});
|
|
3016
|
+
}
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Renames, re-types, re-parents or annotates a unit, the root included. `externalId` cannot change. Re-parenting (`parentExternalId`) moves the unit with everything under it. Spend already recorded keeps naming the unit it landed on; caps are evaluated on the current tree, so from the move on the unit's spend in the running cap period counts toward its new ancestors' caps and no longer toward the old ones. `billable` flips the unit's own setting; moving a unit under a non-billable one makes it non-billable in effect (`effectiveBillable`). `409` for a deleted unit (`CUSTOMER_UNIT_DELETED`), a draft (`CUSTOMER_UNIT_DRAFT`), a parent that does not exist or is not ACTIVE, a move of the root (`ROOT_UNIT_IMMOVABLE`), `billable: false` on the root (`ROOT_UNIT_ALWAYS_BILLABLE`), a move under the unit's own subtree, or a tree that would get too deep. `403 FEATURE_NOT_ENABLED` for `billable: false` when non-billable units are not enabled for your organization. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
3021
|
+
*
|
|
3022
|
+
* @param {Paid.UpdateCustomerUnitRequest} request
|
|
3023
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3024
|
+
*
|
|
3025
|
+
* @throws {@link Paid.BadRequestError}
|
|
3026
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3027
|
+
* @throws {@link Paid.NotFoundError}
|
|
3028
|
+
* @throws {@link Paid.ConflictError}
|
|
3029
|
+
* @throws {@link Paid.InternalServerError}
|
|
3030
|
+
*
|
|
3031
|
+
* @example
|
|
3032
|
+
* await client.customers.updateCustomerUnit({
|
|
3033
|
+
* id: "cus_abc123",
|
|
3034
|
+
* externalCustomerUnitId: "team-research",
|
|
3035
|
+
* body: {}
|
|
3036
|
+
* })
|
|
3037
|
+
*/
|
|
3038
|
+
updateCustomerUnit(request, requestOptions) {
|
|
3039
|
+
return core.HttpResponsePromise.fromPromise(this.__updateCustomerUnit(request, requestOptions));
|
|
3040
|
+
}
|
|
3041
|
+
__updateCustomerUnit(request, requestOptions) {
|
|
3042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3043
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3044
|
+
const { id, externalCustomerUnitId, body: _body } = request;
|
|
3045
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3046
|
+
const _response = yield core.fetcher({
|
|
3047
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
3048
|
+
method: "PATCH",
|
|
3049
|
+
headers: _headers,
|
|
3050
|
+
contentType: "application/json",
|
|
3051
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3052
|
+
requestType: "json",
|
|
3053
|
+
body: _body,
|
|
3054
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3055
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3056
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3057
|
+
});
|
|
3058
|
+
if (_response.ok) {
|
|
3059
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3060
|
+
}
|
|
3061
|
+
if (_response.error.reason === "status-code") {
|
|
3062
|
+
switch (_response.error.statusCode) {
|
|
3063
|
+
case 400:
|
|
3064
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3065
|
+
case 403:
|
|
3066
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3067
|
+
case 404:
|
|
3068
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3069
|
+
case 409:
|
|
3070
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3071
|
+
case 500:
|
|
3072
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3073
|
+
default:
|
|
3074
|
+
throw new errors.PaidError({
|
|
3075
|
+
statusCode: _response.error.statusCode,
|
|
3076
|
+
body: _response.error.body,
|
|
3077
|
+
rawResponse: _response.rawResponse,
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
switch (_response.error.reason) {
|
|
3082
|
+
case "non-json":
|
|
3083
|
+
throw new errors.PaidError({
|
|
3084
|
+
statusCode: _response.error.statusCode,
|
|
3085
|
+
body: _response.error.rawBody,
|
|
3086
|
+
rawResponse: _response.rawResponse,
|
|
3087
|
+
});
|
|
3088
|
+
case "timeout":
|
|
3089
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PATCH /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
3090
|
+
case "unknown":
|
|
3091
|
+
throw new errors.PaidError({
|
|
3092
|
+
message: _response.error.errorMessage,
|
|
3093
|
+
rawResponse: _response.rawResponse,
|
|
3094
|
+
});
|
|
3095
|
+
}
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
/**
|
|
3099
|
+
* Lists the aliases that land signals on this unit. A customer-level alias (created on the customer routes) points at the customer's root unit, so it is listed under the root. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
3100
|
+
*
|
|
3101
|
+
* @param {Paid.ListCustomerUnitAliasesRequest} request
|
|
3102
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3103
|
+
*
|
|
3104
|
+
* @throws {@link Paid.BadRequestError}
|
|
3105
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3106
|
+
* @throws {@link Paid.NotFoundError}
|
|
3107
|
+
* @throws {@link Paid.InternalServerError}
|
|
3108
|
+
*
|
|
3109
|
+
* @example
|
|
3110
|
+
* await client.customers.listCustomerUnitAliases({
|
|
3111
|
+
* id: "cus_abc123",
|
|
3112
|
+
* externalCustomerUnitId: "team-research"
|
|
3113
|
+
* })
|
|
3114
|
+
*/
|
|
3115
|
+
listCustomerUnitAliases(request, requestOptions) {
|
|
3116
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliases(request, requestOptions));
|
|
3117
|
+
}
|
|
3118
|
+
__listCustomerUnitAliases(request, requestOptions) {
|
|
3119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3121
|
+
const { id, externalCustomerUnitId, limit, offset } = request;
|
|
3122
|
+
const _queryParams = {};
|
|
3123
|
+
if (limit != null) {
|
|
3124
|
+
_queryParams.limit = limit.toString();
|
|
3125
|
+
}
|
|
3126
|
+
if (offset != null) {
|
|
3127
|
+
_queryParams.offset = offset.toString();
|
|
3128
|
+
}
|
|
3129
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3130
|
+
const _response = yield core.fetcher({
|
|
3131
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
3132
|
+
method: "GET",
|
|
3133
|
+
headers: _headers,
|
|
3134
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3135
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3136
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3137
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3138
|
+
});
|
|
3139
|
+
if (_response.ok) {
|
|
3140
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3141
|
+
}
|
|
3142
|
+
if (_response.error.reason === "status-code") {
|
|
3143
|
+
switch (_response.error.statusCode) {
|
|
3144
|
+
case 400:
|
|
3145
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3146
|
+
case 403:
|
|
3147
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3148
|
+
case 404:
|
|
3149
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3150
|
+
case 500:
|
|
3151
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3152
|
+
default:
|
|
3153
|
+
throw new errors.PaidError({
|
|
3154
|
+
statusCode: _response.error.statusCode,
|
|
3155
|
+
body: _response.error.body,
|
|
3156
|
+
rawResponse: _response.rawResponse,
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
switch (_response.error.reason) {
|
|
3161
|
+
case "non-json":
|
|
3162
|
+
throw new errors.PaidError({
|
|
3163
|
+
statusCode: _response.error.statusCode,
|
|
3164
|
+
body: _response.error.rawBody,
|
|
3165
|
+
rawResponse: _response.rawResponse,
|
|
3166
|
+
});
|
|
3167
|
+
case "timeout":
|
|
3168
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
3169
|
+
case "unknown":
|
|
3170
|
+
throw new errors.PaidError({
|
|
3171
|
+
message: _response.error.errorMessage,
|
|
3172
|
+
rawResponse: _response.rawResponse,
|
|
3173
|
+
});
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* Creates an alias that lands signals on this unit: a signal whose `externalCustomerId` is the alias resolves to this customer and, when it names no `customerUnit`, to this unit. The alias shares one set of ids with customer external ids and unit ids, unique within the organization and ignoring letter case: an alias another customer holds is refused with `409 EXTERNAL_ID_IN_USE`. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
3179
|
+
*
|
|
3180
|
+
* @param {Paid.CreateCustomerUnitAliasRequest} request
|
|
3181
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3182
|
+
*
|
|
3183
|
+
* @throws {@link Paid.BadRequestError}
|
|
3184
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3185
|
+
* @throws {@link Paid.NotFoundError}
|
|
3186
|
+
* @throws {@link Paid.ConflictError}
|
|
3187
|
+
* @throws {@link Paid.InternalServerError}
|
|
3188
|
+
*
|
|
3189
|
+
* @example
|
|
3190
|
+
* await client.customers.createCustomerUnitAlias({
|
|
3191
|
+
* id: "cus_abc123",
|
|
3192
|
+
* externalCustomerUnitId: "team-research",
|
|
3193
|
+
* body: {
|
|
3194
|
+
* alias: "child-customer-1"
|
|
3195
|
+
* }
|
|
3196
|
+
* })
|
|
3197
|
+
*/
|
|
3198
|
+
createCustomerUnitAlias(request, requestOptions) {
|
|
3199
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAlias(request, requestOptions));
|
|
3200
|
+
}
|
|
3201
|
+
__createCustomerUnitAlias(request, requestOptions) {
|
|
3202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3204
|
+
const { id, externalCustomerUnitId, body: _body } = request;
|
|
3205
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3206
|
+
const _response = yield core.fetcher({
|
|
3207
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
3208
|
+
method: "POST",
|
|
3209
|
+
headers: _headers,
|
|
3210
|
+
contentType: "application/json",
|
|
3211
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3212
|
+
requestType: "json",
|
|
3213
|
+
body: _body,
|
|
3214
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3215
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3216
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3217
|
+
});
|
|
3218
|
+
if (_response.ok) {
|
|
3219
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3220
|
+
}
|
|
3221
|
+
if (_response.error.reason === "status-code") {
|
|
3222
|
+
switch (_response.error.statusCode) {
|
|
3223
|
+
case 400:
|
|
3224
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3225
|
+
case 403:
|
|
3226
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3227
|
+
case 404:
|
|
3228
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3229
|
+
case 409:
|
|
3230
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3231
|
+
case 500:
|
|
3232
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3233
|
+
default:
|
|
3234
|
+
throw new errors.PaidError({
|
|
3235
|
+
statusCode: _response.error.statusCode,
|
|
3236
|
+
body: _response.error.body,
|
|
3237
|
+
rawResponse: _response.rawResponse,
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
switch (_response.error.reason) {
|
|
3242
|
+
case "non-json":
|
|
3243
|
+
throw new errors.PaidError({
|
|
3244
|
+
statusCode: _response.error.statusCode,
|
|
3245
|
+
body: _response.error.rawBody,
|
|
3246
|
+
rawResponse: _response.rawResponse,
|
|
3247
|
+
});
|
|
3248
|
+
case "timeout":
|
|
3249
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
3250
|
+
case "unknown":
|
|
3251
|
+
throw new errors.PaidError({
|
|
3252
|
+
message: _response.error.errorMessage,
|
|
3253
|
+
rawResponse: _response.rawResponse,
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3258
|
+
/**
|
|
3259
|
+
* Deletes an alias of this unit. Signals still sent with it then resolve to nothing again. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
3260
|
+
*
|
|
3261
|
+
* @param {Paid.DeleteCustomerUnitAliasRequest} request
|
|
3262
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3263
|
+
*
|
|
3264
|
+
* @throws {@link Paid.BadRequestError}
|
|
3265
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3266
|
+
* @throws {@link Paid.NotFoundError}
|
|
3267
|
+
* @throws {@link Paid.InternalServerError}
|
|
3268
|
+
*
|
|
3269
|
+
* @example
|
|
3270
|
+
* await client.customers.deleteCustomerUnitAlias({
|
|
3271
|
+
* id: "cus_abc123",
|
|
3272
|
+
* externalCustomerUnitId: "team-research",
|
|
3273
|
+
* alias: "tenant-7-sandbox"
|
|
3274
|
+
* })
|
|
3275
|
+
*/
|
|
3276
|
+
deleteCustomerUnitAlias(request, requestOptions) {
|
|
3277
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAlias(request, requestOptions));
|
|
3278
|
+
}
|
|
3279
|
+
__deleteCustomerUnitAlias(request, requestOptions) {
|
|
3280
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3281
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3282
|
+
const { id, externalCustomerUnitId, alias } = request;
|
|
3283
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3284
|
+
const _response = yield core.fetcher({
|
|
3285
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/aliases/${core.url.encodePathParam(alias)}`),
|
|
3286
|
+
method: "DELETE",
|
|
3287
|
+
headers: _headers,
|
|
3288
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3289
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3290
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3291
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3292
|
+
});
|
|
3293
|
+
if (_response.ok) {
|
|
3294
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3295
|
+
}
|
|
3296
|
+
if (_response.error.reason === "status-code") {
|
|
3297
|
+
switch (_response.error.statusCode) {
|
|
3298
|
+
case 400:
|
|
3299
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3300
|
+
case 403:
|
|
3301
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3302
|
+
case 404:
|
|
3303
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3304
|
+
case 500:
|
|
3305
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3306
|
+
default:
|
|
3307
|
+
throw new errors.PaidError({
|
|
3308
|
+
statusCode: _response.error.statusCode,
|
|
3309
|
+
body: _response.error.body,
|
|
3310
|
+
rawResponse: _response.rawResponse,
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
switch (_response.error.reason) {
|
|
3315
|
+
case "non-json":
|
|
3316
|
+
throw new errors.PaidError({
|
|
3317
|
+
statusCode: _response.error.statusCode,
|
|
3318
|
+
body: _response.error.rawBody,
|
|
3319
|
+
rawResponse: _response.rawResponse,
|
|
3320
|
+
});
|
|
3321
|
+
case "timeout":
|
|
3322
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/customer-units/{externalCustomerUnitId}/aliases/{alias}.");
|
|
3323
|
+
case "unknown":
|
|
3324
|
+
throw new errors.PaidError({
|
|
3325
|
+
message: _response.error.errorMessage,
|
|
3326
|
+
rawResponse: _response.rawResponse,
|
|
3327
|
+
});
|
|
3328
|
+
}
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
/**
|
|
3332
|
+
* Returns a unit by its key without naming its customer. The answer carries the customer's ids (`customerId`, `customerExternalId`) so the customer routes are one hop away, but, like the create on this path, not Paid's unit id: a caller of these routes names units by key. The key is looked up across the organization ignoring letter case. When more than one unit carries it in another letter case (legacy duplicates across customers, or case variants on one customer), the exact spelling decides; when that does not single one out either, the answer is `409 CUSTOMER_UNIT_AMBIGUOUS`: use the customer's unit routes, where the key is exact.
|
|
3333
|
+
*
|
|
3334
|
+
* @param {Paid.GetCustomerUnitByKeyRequest} request
|
|
3335
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3336
|
+
*
|
|
3337
|
+
* @throws {@link Paid.BadRequestError}
|
|
3338
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3339
|
+
* @throws {@link Paid.NotFoundError}
|
|
3340
|
+
* @throws {@link Paid.ConflictError}
|
|
3341
|
+
* @throws {@link Paid.InternalServerError}
|
|
3342
|
+
*
|
|
3343
|
+
* @example
|
|
3344
|
+
* await client.customers.getCustomerUnitByKey({
|
|
3345
|
+
* externalCustomerUnitId: "team-research"
|
|
3346
|
+
* })
|
|
3347
|
+
*/
|
|
3348
|
+
getCustomerUnitByKey(request, requestOptions) {
|
|
3349
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitByKey(request, requestOptions));
|
|
3350
|
+
}
|
|
3351
|
+
__getCustomerUnitByKey(request, requestOptions) {
|
|
3352
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3354
|
+
const { externalCustomerUnitId } = request;
|
|
3355
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3356
|
+
const _response = yield core.fetcher({
|
|
3357
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customer-units/external/${core.url.encodePathParam(externalCustomerUnitId)}`),
|
|
3358
|
+
method: "GET",
|
|
3359
|
+
headers: _headers,
|
|
3360
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3361
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3362
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3363
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3364
|
+
});
|
|
3365
|
+
if (_response.ok) {
|
|
3366
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3367
|
+
}
|
|
3368
|
+
if (_response.error.reason === "status-code") {
|
|
3369
|
+
switch (_response.error.statusCode) {
|
|
3370
|
+
case 400:
|
|
3371
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3372
|
+
case 403:
|
|
3373
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3374
|
+
case 404:
|
|
3375
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3376
|
+
case 409:
|
|
3377
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3378
|
+
case 500:
|
|
3379
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3380
|
+
default:
|
|
3381
|
+
throw new errors.PaidError({
|
|
3382
|
+
statusCode: _response.error.statusCode,
|
|
3383
|
+
body: _response.error.body,
|
|
3384
|
+
rawResponse: _response.rawResponse,
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
switch (_response.error.reason) {
|
|
3389
|
+
case "non-json":
|
|
3390
|
+
throw new errors.PaidError({
|
|
3391
|
+
statusCode: _response.error.statusCode,
|
|
3392
|
+
body: _response.error.rawBody,
|
|
3393
|
+
rawResponse: _response.rawResponse,
|
|
3394
|
+
});
|
|
3395
|
+
case "timeout":
|
|
3396
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customer-units/external/{externalCustomerUnitId}.");
|
|
3397
|
+
case "unknown":
|
|
3398
|
+
throw new errors.PaidError({
|
|
3399
|
+
message: _response.error.errorMessage,
|
|
3400
|
+
rawResponse: _response.rawResponse,
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Lists the aliases that land signals on this unit, without naming its customer. The key is looked up across the organization ignoring letter case. When more than one unit carries it in another letter case (legacy duplicates across customers, or case variants on one customer), the exact spelling decides; when that does not single one out either, the answer is `409 CUSTOMER_UNIT_AMBIGUOUS`: use the customer's unit routes, where the key is exact.
|
|
3407
|
+
*
|
|
3408
|
+
* @param {Paid.ListCustomerUnitAliasesByKeyRequest} request
|
|
3409
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3410
|
+
*
|
|
3411
|
+
* @throws {@link Paid.BadRequestError}
|
|
3412
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3413
|
+
* @throws {@link Paid.NotFoundError}
|
|
3414
|
+
* @throws {@link Paid.ConflictError}
|
|
3415
|
+
* @throws {@link Paid.InternalServerError}
|
|
3416
|
+
*
|
|
3417
|
+
* @example
|
|
3418
|
+
* await client.customers.listCustomerUnitAliasesByKey({
|
|
3419
|
+
* externalCustomerUnitId: "team-research"
|
|
3420
|
+
* })
|
|
3421
|
+
*/
|
|
3422
|
+
listCustomerUnitAliasesByKey(request, requestOptions) {
|
|
3423
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliasesByKey(request, requestOptions));
|
|
3424
|
+
}
|
|
3425
|
+
__listCustomerUnitAliasesByKey(request, requestOptions) {
|
|
3426
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3427
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3428
|
+
const { externalCustomerUnitId, limit, offset } = request;
|
|
3429
|
+
const _queryParams = {};
|
|
3430
|
+
if (limit != null) {
|
|
3431
|
+
_queryParams.limit = limit.toString();
|
|
3432
|
+
}
|
|
3433
|
+
if (offset != null) {
|
|
3434
|
+
_queryParams.offset = offset.toString();
|
|
3435
|
+
}
|
|
3436
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3437
|
+
const _response = yield core.fetcher({
|
|
3438
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customer-units/external/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
3439
|
+
method: "GET",
|
|
3440
|
+
headers: _headers,
|
|
3441
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3442
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3443
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3444
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3445
|
+
});
|
|
3446
|
+
if (_response.ok) {
|
|
3447
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3448
|
+
}
|
|
3449
|
+
if (_response.error.reason === "status-code") {
|
|
3450
|
+
switch (_response.error.statusCode) {
|
|
3451
|
+
case 400:
|
|
3452
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3453
|
+
case 403:
|
|
3454
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3455
|
+
case 404:
|
|
3456
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3457
|
+
case 409:
|
|
3458
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3459
|
+
case 500:
|
|
3460
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3461
|
+
default:
|
|
3462
|
+
throw new errors.PaidError({
|
|
3463
|
+
statusCode: _response.error.statusCode,
|
|
3464
|
+
body: _response.error.body,
|
|
3465
|
+
rawResponse: _response.rawResponse,
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
switch (_response.error.reason) {
|
|
3470
|
+
case "non-json":
|
|
3471
|
+
throw new errors.PaidError({
|
|
3472
|
+
statusCode: _response.error.statusCode,
|
|
3473
|
+
body: _response.error.rawBody,
|
|
3474
|
+
rawResponse: _response.rawResponse,
|
|
3475
|
+
});
|
|
3476
|
+
case "timeout":
|
|
3477
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customer-units/external/{externalCustomerUnitId}/aliases.");
|
|
3478
|
+
case "unknown":
|
|
3479
|
+
throw new errors.PaidError({
|
|
3480
|
+
message: _response.error.errorMessage,
|
|
3481
|
+
rawResponse: _response.rawResponse,
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
/**
|
|
3487
|
+
* Creates an alias that lands signals on this unit, without naming its customer: a signal whose `externalCustomerId` is the alias resolves to the unit's customer and is attributed to this unit. The alias must be unique within the organization ignoring letter case (`409 EXTERNAL_ID_IN_USE`). The key is looked up across the organization ignoring letter case. When more than one unit carries it in another letter case (legacy duplicates across customers, or case variants on one customer), the exact spelling decides; when that does not single one out either, the answer is `409 CUSTOMER_UNIT_AMBIGUOUS`: use the customer's unit routes, where the key is exact.
|
|
3488
|
+
*
|
|
3489
|
+
* @param {Paid.CreateCustomerUnitAliasByKeyRequest} request
|
|
3490
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3491
|
+
*
|
|
3492
|
+
* @throws {@link Paid.BadRequestError}
|
|
3493
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3494
|
+
* @throws {@link Paid.NotFoundError}
|
|
3495
|
+
* @throws {@link Paid.ConflictError}
|
|
3496
|
+
* @throws {@link Paid.InternalServerError}
|
|
3497
|
+
*
|
|
3498
|
+
* @example
|
|
3499
|
+
* await client.customers.createCustomerUnitAliasByKey({
|
|
3500
|
+
* externalCustomerUnitId: "team-research",
|
|
3501
|
+
* body: {
|
|
3502
|
+
* alias: "child-customer-1"
|
|
3503
|
+
* }
|
|
3504
|
+
* })
|
|
3505
|
+
*/
|
|
3506
|
+
createCustomerUnitAliasByKey(request, requestOptions) {
|
|
3507
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAliasByKey(request, requestOptions));
|
|
3508
|
+
}
|
|
3509
|
+
__createCustomerUnitAliasByKey(request, requestOptions) {
|
|
3510
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3511
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3512
|
+
const { externalCustomerUnitId, body: _body } = request;
|
|
3513
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3514
|
+
const _response = yield core.fetcher({
|
|
3515
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customer-units/external/${core.url.encodePathParam(externalCustomerUnitId)}/aliases`),
|
|
3516
|
+
method: "POST",
|
|
3517
|
+
headers: _headers,
|
|
3518
|
+
contentType: "application/json",
|
|
3519
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3520
|
+
requestType: "json",
|
|
3521
|
+
body: _body,
|
|
3522
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3523
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3524
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3525
|
+
});
|
|
3526
|
+
if (_response.ok) {
|
|
3527
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3528
|
+
}
|
|
3529
|
+
if (_response.error.reason === "status-code") {
|
|
3530
|
+
switch (_response.error.statusCode) {
|
|
3531
|
+
case 400:
|
|
3532
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3533
|
+
case 403:
|
|
3534
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3535
|
+
case 404:
|
|
3536
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3537
|
+
case 409:
|
|
3538
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3539
|
+
case 500:
|
|
3540
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3541
|
+
default:
|
|
3542
|
+
throw new errors.PaidError({
|
|
3543
|
+
statusCode: _response.error.statusCode,
|
|
3544
|
+
body: _response.error.body,
|
|
3545
|
+
rawResponse: _response.rawResponse,
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
switch (_response.error.reason) {
|
|
3550
|
+
case "non-json":
|
|
3551
|
+
throw new errors.PaidError({
|
|
3552
|
+
statusCode: _response.error.statusCode,
|
|
3553
|
+
body: _response.error.rawBody,
|
|
3554
|
+
rawResponse: _response.rawResponse,
|
|
3555
|
+
});
|
|
3556
|
+
case "timeout":
|
|
3557
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customer-units/external/{externalCustomerUnitId}/aliases.");
|
|
3558
|
+
case "unknown":
|
|
3559
|
+
throw new errors.PaidError({
|
|
3560
|
+
message: _response.error.errorMessage,
|
|
3561
|
+
rawResponse: _response.rawResponse,
|
|
3562
|
+
});
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
}
|
|
3566
|
+
/**
|
|
3567
|
+
* Deletes an alias of this unit, without naming its customer. Signals still sent with it then resolve to nothing again. The key is looked up across the organization ignoring letter case. When more than one unit carries it in another letter case (legacy duplicates across customers, or case variants on one customer), the exact spelling decides; when that does not single one out either, the answer is `409 CUSTOMER_UNIT_AMBIGUOUS`: use the customer's unit routes, where the key is exact.
|
|
3568
|
+
*
|
|
3569
|
+
* @param {Paid.DeleteCustomerUnitAliasByKeyRequest} request
|
|
3570
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3571
|
+
*
|
|
3572
|
+
* @throws {@link Paid.BadRequestError}
|
|
3573
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3574
|
+
* @throws {@link Paid.NotFoundError}
|
|
3575
|
+
* @throws {@link Paid.ConflictError}
|
|
3576
|
+
* @throws {@link Paid.InternalServerError}
|
|
3577
|
+
*
|
|
3578
|
+
* @example
|
|
3579
|
+
* await client.customers.deleteCustomerUnitAliasByKey({
|
|
3580
|
+
* externalCustomerUnitId: "team-research",
|
|
3581
|
+
* alias: "tenant-7"
|
|
3582
|
+
* })
|
|
3583
|
+
*/
|
|
3584
|
+
deleteCustomerUnitAliasByKey(request, requestOptions) {
|
|
3585
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAliasByKey(request, requestOptions));
|
|
3586
|
+
}
|
|
3587
|
+
__deleteCustomerUnitAliasByKey(request, requestOptions) {
|
|
3588
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3589
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3590
|
+
const { externalCustomerUnitId, alias } = request;
|
|
3591
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3592
|
+
const _response = yield core.fetcher({
|
|
3593
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customer-units/external/${core.url.encodePathParam(externalCustomerUnitId)}/aliases/${core.url.encodePathParam(alias)}`),
|
|
3594
|
+
method: "DELETE",
|
|
3595
|
+
headers: _headers,
|
|
3596
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3597
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3598
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3599
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3600
|
+
});
|
|
3601
|
+
if (_response.ok) {
|
|
3602
|
+
return {
|
|
3603
|
+
data: _response.body,
|
|
3604
|
+
rawResponse: _response.rawResponse,
|
|
3605
|
+
};
|
|
3606
|
+
}
|
|
3607
|
+
if (_response.error.reason === "status-code") {
|
|
3608
|
+
switch (_response.error.statusCode) {
|
|
3609
|
+
case 400:
|
|
3610
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3611
|
+
case 403:
|
|
3612
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3613
|
+
case 404:
|
|
3614
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3615
|
+
case 409:
|
|
3616
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3617
|
+
case 500:
|
|
3618
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3619
|
+
default:
|
|
3620
|
+
throw new errors.PaidError({
|
|
3621
|
+
statusCode: _response.error.statusCode,
|
|
3622
|
+
body: _response.error.body,
|
|
3623
|
+
rawResponse: _response.rawResponse,
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
switch (_response.error.reason) {
|
|
3628
|
+
case "non-json":
|
|
3629
|
+
throw new errors.PaidError({
|
|
3630
|
+
statusCode: _response.error.statusCode,
|
|
3631
|
+
body: _response.error.rawBody,
|
|
3632
|
+
rawResponse: _response.rawResponse,
|
|
3633
|
+
});
|
|
3634
|
+
case "timeout":
|
|
3635
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customer-units/external/{externalCustomerUnitId}/aliases/{alias}.");
|
|
3636
|
+
case "unknown":
|
|
3637
|
+
throw new errors.PaidError({
|
|
3638
|
+
message: _response.error.errorMessage,
|
|
3639
|
+
rawResponse: _response.rawResponse,
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
});
|
|
3643
|
+
}
|
|
3644
|
+
/**
|
|
3645
|
+
* Creates a unit by naming its parent alone; the customer is whoever the parent belongs to, so a caller that only knows its own ids never needs the customer routes. `parentExternalId` is looked up across the organization, ignoring letter case, among unit ids, customer external ids and aliases: a unit becomes the parent; a customer (by external id or alias) stands for the top of its tree, so the new unit goes under the root unit, or becomes the root when the customer has none. The parent is only ever named by your id, never by a Paid id, so a customer with no external id takes its units through the customer's unit routes. The answer carries the unit's `externalId` and its customer's ids, not Paid's unit id. `externalId` follows the same rules as on the customer-scoped create: required, immutable, unique within the organization ignoring letter case. `409 PARENT_NOT_FOUND` when nothing matches, `PARENT_NOT_ACTIVE` for a deleted or draft parent, `PARENT_AMBIGUOUS` when legacy rows let the id name more than one customer (use that customer's unit routes), `PARENT_CHANGED` when the reference pointed elsewhere by the time the create ran (send it again), and otherwise the customer-scoped create's 409s (`CUSTOMER_UNIT_EXISTS`, `EXTERNAL_ID_IN_USE`, `DEPTH_EXCEEDED`, `SEAT_BILLING`, and `ROOT_UNIT_ALWAYS_BILLABLE` for `billable: false` on a unit that would become the root). `403 FEATURE_NOT_ENABLED` for `billable: false` when non-billable units are not enabled for your organization.
|
|
3646
|
+
*
|
|
3647
|
+
* @param {Paid.CustomerUnitCreateUnderParent} request
|
|
3648
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3649
|
+
*
|
|
3650
|
+
* @throws {@link Paid.BadRequestError}
|
|
3651
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3652
|
+
* @throws {@link Paid.ConflictError}
|
|
3653
|
+
* @throws {@link Paid.InternalServerError}
|
|
3654
|
+
*
|
|
3655
|
+
* @example
|
|
3656
|
+
* await client.customers.createCustomerUnitUnderParent({
|
|
3657
|
+
* externalId: "team-research",
|
|
3658
|
+
* parentExternalId: "dept-rnd"
|
|
3659
|
+
* })
|
|
3660
|
+
*/
|
|
3661
|
+
createCustomerUnitUnderParent(request, requestOptions) {
|
|
3662
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitUnderParent(request, requestOptions));
|
|
3663
|
+
}
|
|
3664
|
+
__createCustomerUnitUnderParent(request, requestOptions) {
|
|
3665
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3666
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3667
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3668
|
+
const _response = yield core.fetcher({
|
|
3669
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "customer-units/"),
|
|
3670
|
+
method: "POST",
|
|
3671
|
+
headers: _headers,
|
|
3672
|
+
contentType: "application/json",
|
|
3673
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3674
|
+
requestType: "json",
|
|
3675
|
+
body: request,
|
|
3676
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3677
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3678
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3679
|
+
});
|
|
3680
|
+
if (_response.ok) {
|
|
3681
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3682
|
+
}
|
|
3683
|
+
if (_response.error.reason === "status-code") {
|
|
3684
|
+
switch (_response.error.statusCode) {
|
|
3685
|
+
case 400:
|
|
3686
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3687
|
+
case 403:
|
|
3688
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3689
|
+
case 409:
|
|
3690
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3691
|
+
case 500:
|
|
3692
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3693
|
+
default:
|
|
3694
|
+
throw new errors.PaidError({
|
|
3695
|
+
statusCode: _response.error.statusCode,
|
|
3696
|
+
body: _response.error.body,
|
|
3697
|
+
rawResponse: _response.rawResponse,
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3701
|
+
switch (_response.error.reason) {
|
|
3702
|
+
case "non-json":
|
|
3703
|
+
throw new errors.PaidError({
|
|
3704
|
+
statusCode: _response.error.statusCode,
|
|
3705
|
+
body: _response.error.rawBody,
|
|
3706
|
+
rawResponse: _response.rawResponse,
|
|
3707
|
+
});
|
|
3708
|
+
case "timeout":
|
|
3709
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customer-units/.");
|
|
3710
|
+
case "unknown":
|
|
3711
|
+
throw new errors.PaidError({
|
|
3712
|
+
message: _response.error.errorMessage,
|
|
3713
|
+
rawResponse: _response.rawResponse,
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
}
|
|
3718
|
+
/**
|
|
3719
|
+
* Lists this customer's API keys, newest first and paginated, revoked and expired ones included. The secret is never returned; `keyPrefix` and `last4` identify each key. Addresses the customer by your external customer id.
|
|
3720
|
+
*
|
|
3721
|
+
* @param {Paid.ListCustomerApiKeysByExternalIdRequest} request
|
|
3722
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3723
|
+
*
|
|
3724
|
+
* @throws {@link Paid.BadRequestError}
|
|
3725
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3726
|
+
* @throws {@link Paid.NotFoundError}
|
|
3727
|
+
* @throws {@link Paid.InternalServerError}
|
|
3728
|
+
*
|
|
3729
|
+
* @example
|
|
3730
|
+
* await client.customers.listCustomerApiKeysByExternalId({
|
|
3731
|
+
* externalId: "customer_123"
|
|
3732
|
+
* })
|
|
3733
|
+
*/
|
|
3734
|
+
listCustomerApiKeysByExternalId(request, requestOptions) {
|
|
3735
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerApiKeysByExternalId(request, requestOptions));
|
|
3736
|
+
}
|
|
3737
|
+
__listCustomerApiKeysByExternalId(request, requestOptions) {
|
|
3738
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3739
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3740
|
+
const { externalId, limit, offset } = request;
|
|
3741
|
+
const _queryParams = {};
|
|
3742
|
+
if (limit != null) {
|
|
3743
|
+
_queryParams.limit = limit.toString();
|
|
3744
|
+
}
|
|
3745
|
+
if (offset != null) {
|
|
3746
|
+
_queryParams.offset = offset.toString();
|
|
3747
|
+
}
|
|
3748
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3749
|
+
const _response = yield core.fetcher({
|
|
3750
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/api-keys`),
|
|
3751
|
+
method: "GET",
|
|
3752
|
+
headers: _headers,
|
|
3753
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3754
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3755
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3756
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3757
|
+
});
|
|
3758
|
+
if (_response.ok) {
|
|
3759
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3760
|
+
}
|
|
3761
|
+
if (_response.error.reason === "status-code") {
|
|
3762
|
+
switch (_response.error.statusCode) {
|
|
3763
|
+
case 400:
|
|
3764
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3765
|
+
case 403:
|
|
3766
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3767
|
+
case 404:
|
|
3768
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3769
|
+
case 500:
|
|
3770
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3771
|
+
default:
|
|
3772
|
+
throw new errors.PaidError({
|
|
3773
|
+
statusCode: _response.error.statusCode,
|
|
3774
|
+
body: _response.error.body,
|
|
3775
|
+
rawResponse: _response.rawResponse,
|
|
3776
|
+
});
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
switch (_response.error.reason) {
|
|
3780
|
+
case "non-json":
|
|
3781
|
+
throw new errors.PaidError({
|
|
3782
|
+
statusCode: _response.error.statusCode,
|
|
3783
|
+
body: _response.error.rawBody,
|
|
3784
|
+
rawResponse: _response.rawResponse,
|
|
3785
|
+
});
|
|
3786
|
+
case "timeout":
|
|
3787
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/api-keys.");
|
|
3788
|
+
case "unknown":
|
|
3789
|
+
throw new errors.PaidError({
|
|
3790
|
+
message: _response.error.errorMessage,
|
|
3791
|
+
rawResponse: _response.rawResponse,
|
|
3792
|
+
});
|
|
3793
|
+
}
|
|
3794
|
+
});
|
|
3795
|
+
}
|
|
3796
|
+
/**
|
|
3797
|
+
* Creates an API key bound to this customer. The response carries the secret in `key`, returned only this once: store it immediately, as Paid keeps only its hash. The key acts for this customer alone: it can send signals for this customer through `POST /api/v2/signals/bulk`, and every other route refuses it. Requires `write:api-keys`, which full-access keys hold; a restricted key needs the scope granted explicitly. Addresses the customer by your external customer id.
|
|
3798
|
+
*
|
|
3799
|
+
* @param {Paid.CreateCustomerApiKeyByExternalIdRequest} request
|
|
3800
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3801
|
+
*
|
|
3802
|
+
* @throws {@link Paid.BadRequestError}
|
|
3803
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3804
|
+
* @throws {@link Paid.NotFoundError}
|
|
3805
|
+
* @throws {@link Paid.InternalServerError}
|
|
3806
|
+
*
|
|
3807
|
+
* @example
|
|
3808
|
+
* await client.customers.createCustomerApiKeyByExternalId({
|
|
3809
|
+
* externalId: "customer_123",
|
|
3810
|
+
* body: {
|
|
3811
|
+
* name: "Tenant runtime (production)"
|
|
3812
|
+
* }
|
|
3813
|
+
* })
|
|
3814
|
+
*/
|
|
3815
|
+
createCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3816
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerApiKeyByExternalId(request, requestOptions));
|
|
3817
|
+
}
|
|
3818
|
+
__createCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3819
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3820
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3821
|
+
const { externalId, body: _body } = request;
|
|
3822
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3823
|
+
const _response = yield core.fetcher({
|
|
3824
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/api-keys`),
|
|
3825
|
+
method: "POST",
|
|
3826
|
+
headers: _headers,
|
|
3827
|
+
contentType: "application/json",
|
|
3828
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3829
|
+
requestType: "json",
|
|
3830
|
+
body: _body,
|
|
3831
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3832
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3833
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3834
|
+
});
|
|
3835
|
+
if (_response.ok) {
|
|
3836
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3837
|
+
}
|
|
3838
|
+
if (_response.error.reason === "status-code") {
|
|
3839
|
+
switch (_response.error.statusCode) {
|
|
3840
|
+
case 400:
|
|
3841
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3842
|
+
case 403:
|
|
3843
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3844
|
+
case 404:
|
|
3845
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3846
|
+
case 500:
|
|
3847
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3848
|
+
default:
|
|
3849
|
+
throw new errors.PaidError({
|
|
3850
|
+
statusCode: _response.error.statusCode,
|
|
3851
|
+
body: _response.error.body,
|
|
3852
|
+
rawResponse: _response.rawResponse,
|
|
3853
|
+
});
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
switch (_response.error.reason) {
|
|
3857
|
+
case "non-json":
|
|
3858
|
+
throw new errors.PaidError({
|
|
3859
|
+
statusCode: _response.error.statusCode,
|
|
3860
|
+
body: _response.error.rawBody,
|
|
3861
|
+
rawResponse: _response.rawResponse,
|
|
3862
|
+
});
|
|
3863
|
+
case "timeout":
|
|
3864
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/api-keys.");
|
|
3865
|
+
case "unknown":
|
|
3866
|
+
throw new errors.PaidError({
|
|
3867
|
+
message: _response.error.errorMessage,
|
|
3868
|
+
rawResponse: _response.rawResponse,
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3873
|
+
/**
|
|
3874
|
+
* Revokes one of this customer's keys, which then stops authenticating. Keys are never deleted: a revoked key stays listed with `revokedAt` set, and deleting the customer revokes its keys too. Revoking an already revoked key returns it unchanged. `404` when the key does not belong to this customer. Addresses the customer by your external customer id.
|
|
3875
|
+
*
|
|
3876
|
+
* @param {Paid.RevokeCustomerApiKeyByExternalIdRequest} request
|
|
3877
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3878
|
+
*
|
|
3879
|
+
* @throws {@link Paid.BadRequestError}
|
|
3880
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3881
|
+
* @throws {@link Paid.NotFoundError}
|
|
3882
|
+
* @throws {@link Paid.InternalServerError}
|
|
3883
|
+
*
|
|
3884
|
+
* @example
|
|
3885
|
+
* await client.customers.revokeCustomerApiKeyByExternalId({
|
|
3886
|
+
* externalId: "customer_123",
|
|
3887
|
+
* apiKeyId: "apiKeyId"
|
|
3888
|
+
* })
|
|
3889
|
+
*/
|
|
3890
|
+
revokeCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3891
|
+
return core.HttpResponsePromise.fromPromise(this.__revokeCustomerApiKeyByExternalId(request, requestOptions));
|
|
3892
|
+
}
|
|
3893
|
+
__revokeCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3894
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3895
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3896
|
+
const { externalId, apiKeyId } = request;
|
|
3897
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3898
|
+
const _response = yield core.fetcher({
|
|
3899
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/api-keys/${core.url.encodePathParam(apiKeyId)}`),
|
|
3900
|
+
method: "DELETE",
|
|
3901
|
+
headers: _headers,
|
|
3902
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3903
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3904
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3905
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3906
|
+
});
|
|
3907
|
+
if (_response.ok) {
|
|
3908
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3909
|
+
}
|
|
3910
|
+
if (_response.error.reason === "status-code") {
|
|
3911
|
+
switch (_response.error.statusCode) {
|
|
3912
|
+
case 400:
|
|
3913
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3914
|
+
case 403:
|
|
3915
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3916
|
+
case 404:
|
|
3917
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3918
|
+
case 500:
|
|
3919
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3920
|
+
default:
|
|
3921
|
+
throw new errors.PaidError({
|
|
3922
|
+
statusCode: _response.error.statusCode,
|
|
3923
|
+
body: _response.error.body,
|
|
3924
|
+
rawResponse: _response.rawResponse,
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
switch (_response.error.reason) {
|
|
3929
|
+
case "non-json":
|
|
3930
|
+
throw new errors.PaidError({
|
|
3931
|
+
statusCode: _response.error.statusCode,
|
|
3932
|
+
body: _response.error.rawBody,
|
|
3933
|
+
rawResponse: _response.rawResponse,
|
|
3934
|
+
});
|
|
3935
|
+
case "timeout":
|
|
3936
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/api-keys/{apiKeyId}.");
|
|
3937
|
+
case "unknown":
|
|
3938
|
+
throw new errors.PaidError({
|
|
3939
|
+
message: _response.error.errorMessage,
|
|
3940
|
+
rawResponse: _response.rawResponse,
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
/**
|
|
3946
|
+
* Lists this customer's API keys, newest first and paginated, revoked and expired ones included. The secret is never returned; `keyPrefix` and `last4` identify each key. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
3947
|
+
*
|
|
3948
|
+
* @param {Paid.ListCustomerApiKeysRequest} request
|
|
3949
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3950
|
+
*
|
|
3951
|
+
* @throws {@link Paid.BadRequestError}
|
|
3952
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3953
|
+
* @throws {@link Paid.NotFoundError}
|
|
3954
|
+
* @throws {@link Paid.InternalServerError}
|
|
3955
|
+
*
|
|
3956
|
+
* @example
|
|
3957
|
+
* await client.customers.listCustomerApiKeys({
|
|
3958
|
+
* id: "cus_abc123"
|
|
3959
|
+
* })
|
|
3960
|
+
*/
|
|
3961
|
+
listCustomerApiKeys(request, requestOptions) {
|
|
3962
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerApiKeys(request, requestOptions));
|
|
3963
|
+
}
|
|
3964
|
+
__listCustomerApiKeys(request, requestOptions) {
|
|
3965
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3966
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3967
|
+
const { id, limit, offset } = request;
|
|
3968
|
+
const _queryParams = {};
|
|
3969
|
+
if (limit != null) {
|
|
3970
|
+
_queryParams.limit = limit.toString();
|
|
3971
|
+
}
|
|
3972
|
+
if (offset != null) {
|
|
3973
|
+
_queryParams.offset = offset.toString();
|
|
3974
|
+
}
|
|
3975
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3976
|
+
const _response = yield core.fetcher({
|
|
3977
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/api-keys`),
|
|
3978
|
+
method: "GET",
|
|
3979
|
+
headers: _headers,
|
|
3980
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3981
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3982
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3983
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3984
|
+
});
|
|
3985
|
+
if (_response.ok) {
|
|
3986
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3987
|
+
}
|
|
3988
|
+
if (_response.error.reason === "status-code") {
|
|
3989
|
+
switch (_response.error.statusCode) {
|
|
3990
|
+
case 400:
|
|
3991
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3992
|
+
case 403:
|
|
3993
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3994
|
+
case 404:
|
|
3995
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3996
|
+
case 500:
|
|
3997
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3998
|
+
default:
|
|
3999
|
+
throw new errors.PaidError({
|
|
4000
|
+
statusCode: _response.error.statusCode,
|
|
4001
|
+
body: _response.error.body,
|
|
4002
|
+
rawResponse: _response.rawResponse,
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
switch (_response.error.reason) {
|
|
4007
|
+
case "non-json":
|
|
4008
|
+
throw new errors.PaidError({
|
|
4009
|
+
statusCode: _response.error.statusCode,
|
|
4010
|
+
body: _response.error.rawBody,
|
|
4011
|
+
rawResponse: _response.rawResponse,
|
|
4012
|
+
});
|
|
4013
|
+
case "timeout":
|
|
4014
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/api-keys.");
|
|
4015
|
+
case "unknown":
|
|
4016
|
+
throw new errors.PaidError({
|
|
4017
|
+
message: _response.error.errorMessage,
|
|
4018
|
+
rawResponse: _response.rawResponse,
|
|
4019
|
+
});
|
|
4020
|
+
}
|
|
4021
|
+
});
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* Creates an API key bound to this customer. The response carries the secret in `key`, returned only this once: store it immediately, as Paid keeps only its hash. The key acts for this customer alone: it can send signals for this customer through `POST /api/v2/signals/bulk`, and every other route refuses it. Requires `write:api-keys`, which full-access keys hold; a restricted key needs the scope granted explicitly. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
4025
|
+
*
|
|
4026
|
+
* @param {Paid.CreateCustomerApiKeyRequest} request
|
|
4027
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4028
|
+
*
|
|
4029
|
+
* @throws {@link Paid.BadRequestError}
|
|
4030
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4031
|
+
* @throws {@link Paid.NotFoundError}
|
|
4032
|
+
* @throws {@link Paid.InternalServerError}
|
|
4033
|
+
*
|
|
4034
|
+
* @example
|
|
4035
|
+
* await client.customers.createCustomerApiKey({
|
|
4036
|
+
* id: "cus_abc123",
|
|
4037
|
+
* body: {
|
|
4038
|
+
* name: "Tenant runtime (production)"
|
|
4039
|
+
* }
|
|
4040
|
+
* })
|
|
4041
|
+
*/
|
|
4042
|
+
createCustomerApiKey(request, requestOptions) {
|
|
4043
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerApiKey(request, requestOptions));
|
|
4044
|
+
}
|
|
4045
|
+
__createCustomerApiKey(request, requestOptions) {
|
|
4046
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4047
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4048
|
+
const { id, body: _body } = request;
|
|
2478
4049
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2479
4050
|
const _response = yield core.fetcher({
|
|
2480
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/
|
|
2481
|
-
method: "
|
|
4051
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/api-keys`),
|
|
4052
|
+
method: "POST",
|
|
2482
4053
|
headers: _headers,
|
|
2483
4054
|
contentType: "application/json",
|
|
2484
4055
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2499,8 +4070,6 @@ export class Customers {
|
|
|
2499
4070
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2500
4071
|
case 404:
|
|
2501
4072
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2502
|
-
case 409:
|
|
2503
|
-
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2504
4073
|
case 500:
|
|
2505
4074
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2506
4075
|
default:
|
|
@@ -2519,7 +4088,79 @@ export class Customers {
|
|
|
2519
4088
|
rawResponse: _response.rawResponse,
|
|
2520
4089
|
});
|
|
2521
4090
|
case "timeout":
|
|
2522
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
4091
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/api-keys.");
|
|
4092
|
+
case "unknown":
|
|
4093
|
+
throw new errors.PaidError({
|
|
4094
|
+
message: _response.error.errorMessage,
|
|
4095
|
+
rawResponse: _response.rawResponse,
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
4098
|
+
});
|
|
4099
|
+
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Revokes one of this customer's keys, which then stops authenticating. Keys are never deleted: a revoked key stays listed with `revokedAt` set, and deleting the customer revokes its keys too. Revoking an already revoked key returns it unchanged. `404` when the key does not belong to this customer. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
4102
|
+
*
|
|
4103
|
+
* @param {Paid.RevokeCustomerApiKeyRequest} request
|
|
4104
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4105
|
+
*
|
|
4106
|
+
* @throws {@link Paid.BadRequestError}
|
|
4107
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4108
|
+
* @throws {@link Paid.NotFoundError}
|
|
4109
|
+
* @throws {@link Paid.InternalServerError}
|
|
4110
|
+
*
|
|
4111
|
+
* @example
|
|
4112
|
+
* await client.customers.revokeCustomerApiKey({
|
|
4113
|
+
* id: "cus_abc123",
|
|
4114
|
+
* apiKeyId: "apiKeyId"
|
|
4115
|
+
* })
|
|
4116
|
+
*/
|
|
4117
|
+
revokeCustomerApiKey(request, requestOptions) {
|
|
4118
|
+
return core.HttpResponsePromise.fromPromise(this.__revokeCustomerApiKey(request, requestOptions));
|
|
4119
|
+
}
|
|
4120
|
+
__revokeCustomerApiKey(request, requestOptions) {
|
|
4121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4123
|
+
const { id, apiKeyId } = request;
|
|
4124
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4125
|
+
const _response = yield core.fetcher({
|
|
4126
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/api-keys/${core.url.encodePathParam(apiKeyId)}`),
|
|
4127
|
+
method: "DELETE",
|
|
4128
|
+
headers: _headers,
|
|
4129
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
4130
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
4131
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
4132
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4133
|
+
});
|
|
4134
|
+
if (_response.ok) {
|
|
4135
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4136
|
+
}
|
|
4137
|
+
if (_response.error.reason === "status-code") {
|
|
4138
|
+
switch (_response.error.statusCode) {
|
|
4139
|
+
case 400:
|
|
4140
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4141
|
+
case 403:
|
|
4142
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4143
|
+
case 404:
|
|
4144
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4145
|
+
case 500:
|
|
4146
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4147
|
+
default:
|
|
4148
|
+
throw new errors.PaidError({
|
|
4149
|
+
statusCode: _response.error.statusCode,
|
|
4150
|
+
body: _response.error.body,
|
|
4151
|
+
rawResponse: _response.rawResponse,
|
|
4152
|
+
});
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
switch (_response.error.reason) {
|
|
4156
|
+
case "non-json":
|
|
4157
|
+
throw new errors.PaidError({
|
|
4158
|
+
statusCode: _response.error.statusCode,
|
|
4159
|
+
body: _response.error.rawBody,
|
|
4160
|
+
rawResponse: _response.rawResponse,
|
|
4161
|
+
});
|
|
4162
|
+
case "timeout":
|
|
4163
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/api-keys/{apiKeyId}.");
|
|
2523
4164
|
case "unknown":
|
|
2524
4165
|
throw new errors.PaidError({
|
|
2525
4166
|
message: _response.error.errorMessage,
|
|
@@ -2606,7 +4247,7 @@ export class Customers {
|
|
|
2606
4247
|
});
|
|
2607
4248
|
}
|
|
2608
4249
|
/**
|
|
2609
|
-
* Sets the cap on this customer unit for one credits currency
|
|
4250
|
+
* Sets the cap on this customer unit for one credits currency. Returns `changed: false` without creating a version when the effective timeline is unchanged; otherwise records a new version, preserving earlier rows. The newest version wins where they overlap. `effectiveFrom` controls applicability; `schedule` defines monthly UTC boundaries independently. Omit schedule to inherit the version covering effectiveFrom, or use the creation-time UTC day if none applies. Select the currency with `creditsCurrencyId` in the body; it may be omitted only when the organization has exactly one credits currency. A cap covers the unit and every unit beneath it, so a cap on the customer's root unit covers every unit of that customer; spend from a signal that names no unit counts toward no cap. `404` when the customer or the unit does not exist. `409` for customers on seat-based billing, a deleted unit (`CUSTOMER_UNIT_DELETED`) or a draft (`CUSTOMER_UNIT_DRAFT`). Addresses the customer by your external customer id.
|
|
2610
4251
|
*
|
|
2611
4252
|
* @param {Paid.SetCustomerUnitCapByExternalIdRequest} request
|
|
2612
4253
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2766,6 +4407,91 @@ export class Customers {
|
|
|
2766
4407
|
}
|
|
2767
4408
|
});
|
|
2768
4409
|
}
|
|
4410
|
+
/**
|
|
4411
|
+
* Returns the credits of one credits currency spent by this customer unit and every unit beneath it during a window, whether or not the unit has a cap. The window runs from `start` (inclusive) to `end` (exclusive), at most 366 days; omit both for the current calendar month (UTC). For a capped unit over its cap's current period, `spent` equals the cap's `used`. Spend from a signal that names no unit counts toward no unit. Select the currency with `creditsCurrencyId`; it may be omitted only when the organization has exactly one credits currency, which is then used and echoed back. `404` when the customer or the unit does not exist. Addresses the customer by your external customer id.
|
|
4412
|
+
*
|
|
4413
|
+
* @param {Paid.GetCustomerUnitSpendByExternalIdRequest} request
|
|
4414
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4415
|
+
*
|
|
4416
|
+
* @throws {@link Paid.BadRequestError}
|
|
4417
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4418
|
+
* @throws {@link Paid.NotFoundError}
|
|
4419
|
+
* @throws {@link Paid.InternalServerError}
|
|
4420
|
+
*
|
|
4421
|
+
* @example
|
|
4422
|
+
* await client.customers.getCustomerUnitSpendByExternalId({
|
|
4423
|
+
* externalId: "customer_123",
|
|
4424
|
+
* externalCustomerUnitId: "tenant-a",
|
|
4425
|
+
* creditsCurrencyId: "7f4f5d4c-55e9-4d5b-a3e7-c9eb3d2d01bf",
|
|
4426
|
+
* start: "2026-10-01T00:00:00Z",
|
|
4427
|
+
* end: "2026-11-01T00:00:00Z"
|
|
4428
|
+
* })
|
|
4429
|
+
*/
|
|
4430
|
+
getCustomerUnitSpendByExternalId(request, requestOptions) {
|
|
4431
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitSpendByExternalId(request, requestOptions));
|
|
4432
|
+
}
|
|
4433
|
+
__getCustomerUnitSpendByExternalId(request, requestOptions) {
|
|
4434
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4435
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4436
|
+
const { externalId, externalCustomerUnitId, creditsCurrencyId, start, end } = request;
|
|
4437
|
+
const _queryParams = {};
|
|
4438
|
+
if (creditsCurrencyId != null) {
|
|
4439
|
+
_queryParams.creditsCurrencyId = creditsCurrencyId;
|
|
4440
|
+
}
|
|
4441
|
+
if (start != null) {
|
|
4442
|
+
_queryParams.start = start;
|
|
4443
|
+
}
|
|
4444
|
+
if (end != null) {
|
|
4445
|
+
_queryParams.end = end;
|
|
4446
|
+
}
|
|
4447
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4448
|
+
const _response = yield core.fetcher({
|
|
4449
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/spend`),
|
|
4450
|
+
method: "GET",
|
|
4451
|
+
headers: _headers,
|
|
4452
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4453
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
4454
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
4455
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4456
|
+
});
|
|
4457
|
+
if (_response.ok) {
|
|
4458
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4459
|
+
}
|
|
4460
|
+
if (_response.error.reason === "status-code") {
|
|
4461
|
+
switch (_response.error.statusCode) {
|
|
4462
|
+
case 400:
|
|
4463
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4464
|
+
case 403:
|
|
4465
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4466
|
+
case 404:
|
|
4467
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4468
|
+
case 500:
|
|
4469
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4470
|
+
default:
|
|
4471
|
+
throw new errors.PaidError({
|
|
4472
|
+
statusCode: _response.error.statusCode,
|
|
4473
|
+
body: _response.error.body,
|
|
4474
|
+
rawResponse: _response.rawResponse,
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
switch (_response.error.reason) {
|
|
4479
|
+
case "non-json":
|
|
4480
|
+
throw new errors.PaidError({
|
|
4481
|
+
statusCode: _response.error.statusCode,
|
|
4482
|
+
body: _response.error.rawBody,
|
|
4483
|
+
rawResponse: _response.rawResponse,
|
|
4484
|
+
});
|
|
4485
|
+
case "timeout":
|
|
4486
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/spend.");
|
|
4487
|
+
case "unknown":
|
|
4488
|
+
throw new errors.PaidError({
|
|
4489
|
+
message: _response.error.errorMessage,
|
|
4490
|
+
rawResponse: _response.rawResponse,
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
2769
4495
|
/**
|
|
2770
4496
|
* Returns the cap in force on this customer unit for one credits currency, with usage in the current period when available. Select the currency with `creditsCurrencyId`; it may be omitted only when the organization has exactly one credits currency, which is then used and echoed back. `404` when the customer or the unit does not exist, or the unit has no cap in force for that currency. The usage figures are advisory: other spend may land between this read and the next burn. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2771
4497
|
*
|
|
@@ -2844,7 +4570,7 @@ export class Customers {
|
|
|
2844
4570
|
});
|
|
2845
4571
|
}
|
|
2846
4572
|
/**
|
|
2847
|
-
* Sets the cap on this customer unit for one credits currency
|
|
4573
|
+
* Sets the cap on this customer unit for one credits currency. Returns `changed: false` without creating a version when the effective timeline is unchanged; otherwise records a new version, preserving earlier rows. The newest version wins where they overlap. `effectiveFrom` controls applicability; `schedule` defines monthly UTC boundaries independently. Omit schedule to inherit the version covering effectiveFrom, or use the creation-time UTC day if none applies. Select the currency with `creditsCurrencyId` in the body; it may be omitted only when the organization has exactly one credits currency. A cap covers the unit and every unit beneath it, so a cap on the customer's root unit covers every unit of that customer; spend from a signal that names no unit counts toward no cap. `404` when the customer or the unit does not exist. `409` for customers on seat-based billing, a deleted unit (`CUSTOMER_UNIT_DELETED`) or a draft (`CUSTOMER_UNIT_DRAFT`). Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
2848
4574
|
*
|
|
2849
4575
|
* @param {Paid.SetCustomerUnitCapRequest} request
|
|
2850
4576
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3004,6 +4730,91 @@ export class Customers {
|
|
|
3004
4730
|
}
|
|
3005
4731
|
});
|
|
3006
4732
|
}
|
|
4733
|
+
/**
|
|
4734
|
+
* Returns the credits of one credits currency spent by this customer unit and every unit beneath it during a window, whether or not the unit has a cap. The window runs from `start` (inclusive) to `end` (exclusive), at most 366 days; omit both for the current calendar month (UTC). For a capped unit over its cap's current period, `spent` equals the cap's `used`. Spend from a signal that names no unit counts toward no unit. Select the currency with `creditsCurrencyId`; it may be omitted only when the organization has exactly one credits currency, which is then used and echoed back. `404` when the customer or the unit does not exist. Use the value returned as `customer.id`, for example `cus_abc123`; if you have your own customer ID, use the `/api/v2/customers/external/{externalId}/…` twin.
|
|
4735
|
+
*
|
|
4736
|
+
* @param {Paid.GetCustomerUnitSpendRequest} request
|
|
4737
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4738
|
+
*
|
|
4739
|
+
* @throws {@link Paid.BadRequestError}
|
|
4740
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4741
|
+
* @throws {@link Paid.NotFoundError}
|
|
4742
|
+
* @throws {@link Paid.InternalServerError}
|
|
4743
|
+
*
|
|
4744
|
+
* @example
|
|
4745
|
+
* await client.customers.getCustomerUnitSpend({
|
|
4746
|
+
* id: "cus_abc123",
|
|
4747
|
+
* externalCustomerUnitId: "tenant-a",
|
|
4748
|
+
* creditsCurrencyId: "7f4f5d4c-55e9-4d5b-a3e7-c9eb3d2d01bf",
|
|
4749
|
+
* start: "2026-10-01T00:00:00Z",
|
|
4750
|
+
* end: "2026-11-01T00:00:00Z"
|
|
4751
|
+
* })
|
|
4752
|
+
*/
|
|
4753
|
+
getCustomerUnitSpend(request, requestOptions) {
|
|
4754
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitSpend(request, requestOptions));
|
|
4755
|
+
}
|
|
4756
|
+
__getCustomerUnitSpend(request, requestOptions) {
|
|
4757
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4758
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4759
|
+
const { id, externalCustomerUnitId, creditsCurrencyId, start, end } = request;
|
|
4760
|
+
const _queryParams = {};
|
|
4761
|
+
if (creditsCurrencyId != null) {
|
|
4762
|
+
_queryParams.creditsCurrencyId = creditsCurrencyId;
|
|
4763
|
+
}
|
|
4764
|
+
if (start != null) {
|
|
4765
|
+
_queryParams.start = start;
|
|
4766
|
+
}
|
|
4767
|
+
if (end != null) {
|
|
4768
|
+
_queryParams.end = end;
|
|
4769
|
+
}
|
|
4770
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4771
|
+
const _response = yield core.fetcher({
|
|
4772
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/customer-units/${core.url.encodePathParam(externalCustomerUnitId)}/spend`),
|
|
4773
|
+
method: "GET",
|
|
4774
|
+
headers: _headers,
|
|
4775
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4776
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
4777
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
4778
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4779
|
+
});
|
|
4780
|
+
if (_response.ok) {
|
|
4781
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4782
|
+
}
|
|
4783
|
+
if (_response.error.reason === "status-code") {
|
|
4784
|
+
switch (_response.error.statusCode) {
|
|
4785
|
+
case 400:
|
|
4786
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4787
|
+
case 403:
|
|
4788
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4789
|
+
case 404:
|
|
4790
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4791
|
+
case 500:
|
|
4792
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4793
|
+
default:
|
|
4794
|
+
throw new errors.PaidError({
|
|
4795
|
+
statusCode: _response.error.statusCode,
|
|
4796
|
+
body: _response.error.body,
|
|
4797
|
+
rawResponse: _response.rawResponse,
|
|
4798
|
+
});
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
switch (_response.error.reason) {
|
|
4802
|
+
case "non-json":
|
|
4803
|
+
throw new errors.PaidError({
|
|
4804
|
+
statusCode: _response.error.statusCode,
|
|
4805
|
+
body: _response.error.rawBody,
|
|
4806
|
+
rawResponse: _response.rawResponse,
|
|
4807
|
+
});
|
|
4808
|
+
case "timeout":
|
|
4809
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}/spend.");
|
|
4810
|
+
case "unknown":
|
|
4811
|
+
throw new errors.PaidError({
|
|
4812
|
+
message: _response.error.errorMessage,
|
|
4813
|
+
rawResponse: _response.rawResponse,
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
});
|
|
4817
|
+
}
|
|
3007
4818
|
_getAuthorizationHeader() {
|
|
3008
4819
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3009
4820
|
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|