@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
|
@@ -156,13 +156,14 @@ class Customers {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* Creates a new customer for the organization
|
|
159
|
+
* 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.
|
|
160
160
|
*
|
|
161
161
|
* @param {Paid.CreateCustomerRequest} request
|
|
162
162
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
163
163
|
*
|
|
164
164
|
* @throws {@link Paid.BadRequestError}
|
|
165
165
|
* @throws {@link Paid.ForbiddenError}
|
|
166
|
+
* @throws {@link Paid.ConflictError}
|
|
166
167
|
* @throws {@link Paid.InternalServerError}
|
|
167
168
|
*
|
|
168
169
|
* @example
|
|
@@ -198,6 +199,8 @@ class Customers {
|
|
|
198
199
|
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
199
200
|
case 403:
|
|
200
201
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
202
|
+
case 409:
|
|
203
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
201
204
|
case 500:
|
|
202
205
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
203
206
|
default:
|
|
@@ -304,7 +307,7 @@ class Customers {
|
|
|
304
307
|
});
|
|
305
308
|
}
|
|
306
309
|
/**
|
|
307
|
-
* Create an alternate external identifier for a customer by Paid display ID.
|
|
310
|
+
* 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`).
|
|
308
311
|
*
|
|
309
312
|
* @param {Paid.CreateCustomerAliasRequest} request
|
|
310
313
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -521,7 +524,7 @@ class Customers {
|
|
|
521
524
|
});
|
|
522
525
|
}
|
|
523
526
|
/**
|
|
524
|
-
* 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}`.
|
|
527
|
+
* 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.
|
|
525
528
|
*
|
|
526
529
|
* @param {Paid.UpdateCustomerByIdRequest} request
|
|
527
530
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -529,6 +532,7 @@ class Customers {
|
|
|
529
532
|
* @throws {@link Paid.BadRequestError}
|
|
530
533
|
* @throws {@link Paid.ForbiddenError}
|
|
531
534
|
* @throws {@link Paid.NotFoundError}
|
|
535
|
+
* @throws {@link Paid.ConflictError}
|
|
532
536
|
* @throws {@link Paid.InternalServerError}
|
|
533
537
|
*
|
|
534
538
|
* @example
|
|
@@ -568,6 +572,8 @@ class Customers {
|
|
|
568
572
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
569
573
|
case 404:
|
|
570
574
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
575
|
+
case 409:
|
|
576
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
571
577
|
case 500:
|
|
572
578
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
573
579
|
default:
|
|
@@ -596,7 +602,7 @@ class Customers {
|
|
|
596
602
|
});
|
|
597
603
|
}
|
|
598
604
|
/**
|
|
599
|
-
* 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}`.
|
|
605
|
+
* 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.
|
|
600
606
|
*
|
|
601
607
|
* @param {Paid.DeleteCustomerByIdRequest} request
|
|
602
608
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -604,6 +610,7 @@ class Customers {
|
|
|
604
610
|
* @throws {@link Paid.BadRequestError}
|
|
605
611
|
* @throws {@link Paid.ForbiddenError}
|
|
606
612
|
* @throws {@link Paid.NotFoundError}
|
|
613
|
+
* @throws {@link Paid.ConflictError}
|
|
607
614
|
* @throws {@link Paid.InternalServerError}
|
|
608
615
|
*
|
|
609
616
|
* @example
|
|
@@ -639,6 +646,8 @@ class Customers {
|
|
|
639
646
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
640
647
|
case 404:
|
|
641
648
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
649
|
+
case 409:
|
|
650
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
642
651
|
case 500:
|
|
643
652
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
644
653
|
default:
|
|
@@ -813,7 +822,7 @@ class Customers {
|
|
|
813
822
|
});
|
|
814
823
|
}
|
|
815
824
|
/**
|
|
816
|
-
* Create an alternate external identifier for a customer by external ID.
|
|
825
|
+
* 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`).
|
|
817
826
|
*
|
|
818
827
|
* @param {Paid.CreateCustomerAliasByExternalIdRequest} request
|
|
819
828
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1030,7 +1039,7 @@ class Customers {
|
|
|
1030
1039
|
});
|
|
1031
1040
|
}
|
|
1032
1041
|
/**
|
|
1033
|
-
* Update a customer by external ID
|
|
1042
|
+
* 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.
|
|
1034
1043
|
*
|
|
1035
1044
|
* @param {Paid.UpdateCustomerByExternalIdRequest} request
|
|
1036
1045
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1038,6 +1047,7 @@ class Customers {
|
|
|
1038
1047
|
* @throws {@link Paid.BadRequestError}
|
|
1039
1048
|
* @throws {@link Paid.ForbiddenError}
|
|
1040
1049
|
* @throws {@link Paid.NotFoundError}
|
|
1050
|
+
* @throws {@link Paid.ConflictError}
|
|
1041
1051
|
* @throws {@link Paid.InternalServerError}
|
|
1042
1052
|
*
|
|
1043
1053
|
* @example
|
|
@@ -1077,6 +1087,8 @@ class Customers {
|
|
|
1077
1087
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1078
1088
|
case 404:
|
|
1079
1089
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1090
|
+
case 409:
|
|
1091
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1080
1092
|
case 500:
|
|
1081
1093
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1082
1094
|
default:
|
|
@@ -1105,7 +1117,7 @@ class Customers {
|
|
|
1105
1117
|
});
|
|
1106
1118
|
}
|
|
1107
1119
|
/**
|
|
1108
|
-
* Delete a customer by external ID
|
|
1120
|
+
* 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.
|
|
1109
1121
|
*
|
|
1110
1122
|
* @param {Paid.DeleteCustomerByExternalIdRequest} request
|
|
1111
1123
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1113,6 +1125,7 @@ class Customers {
|
|
|
1113
1125
|
* @throws {@link Paid.BadRequestError}
|
|
1114
1126
|
* @throws {@link Paid.ForbiddenError}
|
|
1115
1127
|
* @throws {@link Paid.NotFoundError}
|
|
1128
|
+
* @throws {@link Paid.ConflictError}
|
|
1116
1129
|
* @throws {@link Paid.InternalServerError}
|
|
1117
1130
|
*
|
|
1118
1131
|
* @example
|
|
@@ -1148,6 +1161,8 @@ class Customers {
|
|
|
1148
1161
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1149
1162
|
case 404:
|
|
1150
1163
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1164
|
+
case 409:
|
|
1165
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1151
1166
|
case 500:
|
|
1152
1167
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1153
1168
|
default:
|
|
@@ -1320,6 +1335,7 @@ class Customers {
|
|
|
1320
1335
|
* @throws {@link Paid.BadRequestError}
|
|
1321
1336
|
* @throws {@link Paid.ForbiddenError}
|
|
1322
1337
|
* @throws {@link Paid.NotFoundError}
|
|
1338
|
+
* @throws {@link Paid.ConflictError}
|
|
1323
1339
|
* @throws {@link Paid.InternalServerError}
|
|
1324
1340
|
*
|
|
1325
1341
|
* @example
|
|
@@ -1329,7 +1345,8 @@ class Customers {
|
|
|
1329
1345
|
* creditCurrencyKey: "api_credits",
|
|
1330
1346
|
* amount: 10000,
|
|
1331
1347
|
* startsAt: "2026-06-05T12:00:00Z",
|
|
1332
|
-
* expiresAt: "2026-12-31T23:59:59Z"
|
|
1348
|
+
* expiresAt: "2026-12-31T23:59:59Z",
|
|
1349
|
+
* idempotencyKey: "grant_acme_2026-06-05"
|
|
1333
1350
|
* }
|
|
1334
1351
|
* })
|
|
1335
1352
|
*/
|
|
@@ -1364,6 +1381,8 @@ class Customers {
|
|
|
1364
1381
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1365
1382
|
case 404:
|
|
1366
1383
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1384
|
+
case 409:
|
|
1385
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1367
1386
|
case 500:
|
|
1368
1387
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1369
1388
|
default:
|
|
@@ -1630,6 +1649,7 @@ class Customers {
|
|
|
1630
1649
|
* @throws {@link Paid.BadRequestError}
|
|
1631
1650
|
* @throws {@link Paid.ForbiddenError}
|
|
1632
1651
|
* @throws {@link Paid.NotFoundError}
|
|
1652
|
+
* @throws {@link Paid.ConflictError}
|
|
1633
1653
|
* @throws {@link Paid.InternalServerError}
|
|
1634
1654
|
*
|
|
1635
1655
|
* @example
|
|
@@ -1639,7 +1659,8 @@ class Customers {
|
|
|
1639
1659
|
* creditCurrencyKey: "api_credits",
|
|
1640
1660
|
* amount: 10000,
|
|
1641
1661
|
* startsAt: "2026-06-05T12:00:00Z",
|
|
1642
|
-
* expiresAt: "2026-12-31T23:59:59Z"
|
|
1662
|
+
* expiresAt: "2026-12-31T23:59:59Z",
|
|
1663
|
+
* idempotencyKey: "grant_acme_2026-06-05"
|
|
1643
1664
|
* }
|
|
1644
1665
|
* })
|
|
1645
1666
|
*/
|
|
@@ -1674,6 +1695,8 @@ class Customers {
|
|
|
1674
1695
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1675
1696
|
case 404:
|
|
1676
1697
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1698
|
+
case 409:
|
|
1699
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
1677
1700
|
case 500:
|
|
1678
1701
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1679
1702
|
default:
|
|
@@ -1777,9 +1800,9 @@ class Customers {
|
|
|
1777
1800
|
});
|
|
1778
1801
|
}
|
|
1779
1802
|
/**
|
|
1780
|
-
*
|
|
1803
|
+
* Returns the virtual bank account (Stripe funding instructions) a customer can pay by bank transfer into, by Paid display ID.
|
|
1781
1804
|
*
|
|
1782
|
-
* @param {Paid.
|
|
1805
|
+
* @param {Paid.GetCustomerFundingInstructionsRequest} request
|
|
1783
1806
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1784
1807
|
*
|
|
1785
1808
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -1788,37 +1811,25 @@ class Customers {
|
|
|
1788
1811
|
* @throws {@link Paid.InternalServerError}
|
|
1789
1812
|
*
|
|
1790
1813
|
* @example
|
|
1791
|
-
* await client.customers.
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1814
|
+
* await client.customers.getCustomerFundingInstructions({
|
|
1815
|
+
* id: "cus_abc123",
|
|
1816
|
+
* currency: "USD"
|
|
1794
1817
|
* })
|
|
1795
1818
|
*/
|
|
1796
|
-
|
|
1797
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1819
|
+
getCustomerFundingInstructions(request, requestOptions) {
|
|
1820
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerFundingInstructions(request, requestOptions));
|
|
1798
1821
|
}
|
|
1799
|
-
|
|
1822
|
+
__getCustomerFundingInstructions(request, requestOptions) {
|
|
1800
1823
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1801
1824
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1802
|
-
const {
|
|
1825
|
+
const { id, currency } = request;
|
|
1803
1826
|
const _queryParams = {};
|
|
1804
|
-
if (
|
|
1805
|
-
_queryParams.
|
|
1806
|
-
}
|
|
1807
|
-
if (offset != null) {
|
|
1808
|
-
_queryParams.offset = offset.toString();
|
|
1809
|
-
}
|
|
1810
|
-
if (status != null) {
|
|
1811
|
-
_queryParams.status = status;
|
|
1812
|
-
}
|
|
1813
|
-
if (externalType != null) {
|
|
1814
|
-
_queryParams.externalType = externalType;
|
|
1815
|
-
}
|
|
1816
|
-
if (parentExternalId != null) {
|
|
1817
|
-
_queryParams.parentExternalId = parentExternalId;
|
|
1827
|
+
if (currency != null) {
|
|
1828
|
+
_queryParams.currency = currency;
|
|
1818
1829
|
}
|
|
1819
1830
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1820
1831
|
const _response = yield core.fetcher({
|
|
1821
|
-
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
|
|
1832
|
+
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`),
|
|
1822
1833
|
method: "GET",
|
|
1823
1834
|
headers: _headers,
|
|
1824
1835
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -1855,7 +1866,7 @@ class Customers {
|
|
|
1855
1866
|
rawResponse: _response.rawResponse,
|
|
1856
1867
|
});
|
|
1857
1868
|
case "timeout":
|
|
1858
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/
|
|
1869
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/funding-instructions.");
|
|
1859
1870
|
case "unknown":
|
|
1860
1871
|
throw new errors.PaidError({
|
|
1861
1872
|
message: _response.error.errorMessage,
|
|
@@ -1865,35 +1876,33 @@ class Customers {
|
|
|
1865
1876
|
});
|
|
1866
1877
|
}
|
|
1867
1878
|
/**
|
|
1868
|
-
* Creates a
|
|
1879
|
+
* 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.
|
|
1869
1880
|
*
|
|
1870
|
-
* @param {Paid.
|
|
1881
|
+
* @param {Paid.CreateCustomerFundingInstructionsRequest} request
|
|
1871
1882
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1872
1883
|
*
|
|
1873
1884
|
* @throws {@link Paid.BadRequestError}
|
|
1874
1885
|
* @throws {@link Paid.ForbiddenError}
|
|
1875
1886
|
* @throws {@link Paid.NotFoundError}
|
|
1876
|
-
* @throws {@link Paid.
|
|
1887
|
+
* @throws {@link Paid.UnprocessableEntityError}
|
|
1877
1888
|
* @throws {@link Paid.InternalServerError}
|
|
1878
1889
|
*
|
|
1879
1890
|
* @example
|
|
1880
|
-
* await client.customers.
|
|
1881
|
-
*
|
|
1882
|
-
* body: {
|
|
1883
|
-
* externalId: "team-research"
|
|
1884
|
-
* }
|
|
1891
|
+
* await client.customers.createCustomerFundingInstructions({
|
|
1892
|
+
* id: "cus_abc123",
|
|
1893
|
+
* body: {}
|
|
1885
1894
|
* })
|
|
1886
1895
|
*/
|
|
1887
|
-
|
|
1888
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1896
|
+
createCustomerFundingInstructions(request, requestOptions) {
|
|
1897
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerFundingInstructions(request, requestOptions));
|
|
1889
1898
|
}
|
|
1890
|
-
|
|
1899
|
+
__createCustomerFundingInstructions(request, requestOptions) {
|
|
1891
1900
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1892
1901
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1893
|
-
const {
|
|
1902
|
+
const { id, body: _body } = request;
|
|
1894
1903
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1895
1904
|
const _response = yield core.fetcher({
|
|
1896
|
-
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
|
|
1905
|
+
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`),
|
|
1897
1906
|
method: "POST",
|
|
1898
1907
|
headers: _headers,
|
|
1899
1908
|
contentType: "application/json",
|
|
@@ -1915,8 +1924,8 @@ class Customers {
|
|
|
1915
1924
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1916
1925
|
case 404:
|
|
1917
1926
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1918
|
-
case
|
|
1919
|
-
throw new Paid.
|
|
1927
|
+
case 422:
|
|
1928
|
+
throw new Paid.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1920
1929
|
case 500:
|
|
1921
1930
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1922
1931
|
default:
|
|
@@ -1935,7 +1944,7 @@ class Customers {
|
|
|
1935
1944
|
rawResponse: _response.rawResponse,
|
|
1936
1945
|
});
|
|
1937
1946
|
case "timeout":
|
|
1938
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/
|
|
1947
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/funding-instructions.");
|
|
1939
1948
|
case "unknown":
|
|
1940
1949
|
throw new errors.PaidError({
|
|
1941
1950
|
message: _response.error.errorMessage,
|
|
@@ -1945,9 +1954,9 @@ class Customers {
|
|
|
1945
1954
|
});
|
|
1946
1955
|
}
|
|
1947
1956
|
/**
|
|
1948
|
-
* Returns
|
|
1957
|
+
* Returns the virtual bank account (Stripe funding instructions) a customer can pay by bank transfer into, by your external ID.
|
|
1949
1958
|
*
|
|
1950
|
-
* @param {Paid.
|
|
1959
|
+
* @param {Paid.GetCustomerFundingInstructionsByExternalIdRequest} request
|
|
1951
1960
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
1952
1961
|
*
|
|
1953
1962
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -1956,97 +1965,28 @@ class Customers {
|
|
|
1956
1965
|
* @throws {@link Paid.InternalServerError}
|
|
1957
1966
|
*
|
|
1958
1967
|
* @example
|
|
1959
|
-
* await client.customers.
|
|
1960
|
-
* externalId: "
|
|
1961
|
-
*
|
|
1968
|
+
* await client.customers.getCustomerFundingInstructionsByExternalId({
|
|
1969
|
+
* externalId: "externalId",
|
|
1970
|
+
* currency: "USD"
|
|
1962
1971
|
* })
|
|
1963
1972
|
*/
|
|
1964
|
-
|
|
1965
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
1973
|
+
getCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
1974
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerFundingInstructionsByExternalId(request, requestOptions));
|
|
1966
1975
|
}
|
|
1967
|
-
|
|
1976
|
+
__getCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
1968
1977
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1969
1978
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1970
|
-
const { externalId,
|
|
1971
|
-
const
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
method: "GET",
|
|
1975
|
-
headers: _headers,
|
|
1976
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1977
|
-
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,
|
|
1978
|
-
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,
|
|
1979
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1980
|
-
});
|
|
1981
|
-
if (_response.ok) {
|
|
1982
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1983
|
-
}
|
|
1984
|
-
if (_response.error.reason === "status-code") {
|
|
1985
|
-
switch (_response.error.statusCode) {
|
|
1986
|
-
case 400:
|
|
1987
|
-
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
1988
|
-
case 403:
|
|
1989
|
-
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1990
|
-
case 404:
|
|
1991
|
-
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1992
|
-
case 500:
|
|
1993
|
-
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1994
|
-
default:
|
|
1995
|
-
throw new errors.PaidError({
|
|
1996
|
-
statusCode: _response.error.statusCode,
|
|
1997
|
-
body: _response.error.body,
|
|
1998
|
-
rawResponse: _response.rawResponse,
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
switch (_response.error.reason) {
|
|
2003
|
-
case "non-json":
|
|
2004
|
-
throw new errors.PaidError({
|
|
2005
|
-
statusCode: _response.error.statusCode,
|
|
2006
|
-
body: _response.error.rawBody,
|
|
2007
|
-
rawResponse: _response.rawResponse,
|
|
2008
|
-
});
|
|
2009
|
-
case "timeout":
|
|
2010
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2011
|
-
case "unknown":
|
|
2012
|
-
throw new errors.PaidError({
|
|
2013
|
-
message: _response.error.errorMessage,
|
|
2014
|
-
rawResponse: _response.rawResponse,
|
|
2015
|
-
});
|
|
1979
|
+
const { externalId, currency } = request;
|
|
1980
|
+
const _queryParams = {};
|
|
1981
|
+
if (currency != null) {
|
|
1982
|
+
_queryParams.currency = currency;
|
|
2016
1983
|
}
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
2019
|
-
/**
|
|
2020
|
-
* 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.
|
|
2021
|
-
*
|
|
2022
|
-
* @param {Paid.DeleteCustomerUnitByExternalIdRequest} request
|
|
2023
|
-
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2024
|
-
*
|
|
2025
|
-
* @throws {@link Paid.BadRequestError}
|
|
2026
|
-
* @throws {@link Paid.ForbiddenError}
|
|
2027
|
-
* @throws {@link Paid.NotFoundError}
|
|
2028
|
-
* @throws {@link Paid.ConflictError}
|
|
2029
|
-
* @throws {@link Paid.InternalServerError}
|
|
2030
|
-
*
|
|
2031
|
-
* @example
|
|
2032
|
-
* await client.customers.deleteCustomerUnitByExternalId({
|
|
2033
|
-
* externalId: "customer_123",
|
|
2034
|
-
* externalCustomerUnitId: "team-research"
|
|
2035
|
-
* })
|
|
2036
|
-
*/
|
|
2037
|
-
deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2038
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitByExternalId(request, requestOptions));
|
|
2039
|
-
}
|
|
2040
|
-
__deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2041
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2042
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2043
|
-
const { externalId, externalCustomerUnitId } = request;
|
|
2044
1984
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2045
1985
|
const _response = yield core.fetcher({
|
|
2046
|
-
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)}/
|
|
2047
|
-
method: "
|
|
1986
|
+
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`),
|
|
1987
|
+
method: "GET",
|
|
2048
1988
|
headers: _headers,
|
|
2049
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1989
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2050
1990
|
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,
|
|
2051
1991
|
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,
|
|
2052
1992
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -2062,8 +2002,6 @@ class Customers {
|
|
|
2062
2002
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2063
2003
|
case 404:
|
|
2064
2004
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2065
|
-
case 409:
|
|
2066
|
-
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2067
2005
|
case 500:
|
|
2068
2006
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2069
2007
|
default:
|
|
@@ -2082,7 +2020,7 @@ class Customers {
|
|
|
2082
2020
|
rawResponse: _response.rawResponse,
|
|
2083
2021
|
});
|
|
2084
2022
|
case "timeout":
|
|
2085
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
2023
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/funding-instructions.");
|
|
2086
2024
|
case "unknown":
|
|
2087
2025
|
throw new errors.PaidError({
|
|
2088
2026
|
message: _response.error.errorMessage,
|
|
@@ -2092,35 +2030,34 @@ class Customers {
|
|
|
2092
2030
|
});
|
|
2093
2031
|
}
|
|
2094
2032
|
/**
|
|
2095
|
-
*
|
|
2033
|
+
* 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.
|
|
2096
2034
|
*
|
|
2097
|
-
* @param {Paid.
|
|
2035
|
+
* @param {Paid.CreateCustomerFundingInstructionsByExternalIdRequest} request
|
|
2098
2036
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2099
2037
|
*
|
|
2100
2038
|
* @throws {@link Paid.BadRequestError}
|
|
2101
2039
|
* @throws {@link Paid.ForbiddenError}
|
|
2102
2040
|
* @throws {@link Paid.NotFoundError}
|
|
2103
|
-
* @throws {@link Paid.
|
|
2041
|
+
* @throws {@link Paid.UnprocessableEntityError}
|
|
2104
2042
|
* @throws {@link Paid.InternalServerError}
|
|
2105
2043
|
*
|
|
2106
2044
|
* @example
|
|
2107
|
-
* await client.customers.
|
|
2108
|
-
* externalId: "
|
|
2109
|
-
* externalCustomerUnitId: "team-research",
|
|
2045
|
+
* await client.customers.createCustomerFundingInstructionsByExternalId({
|
|
2046
|
+
* externalId: "externalId",
|
|
2110
2047
|
* body: {}
|
|
2111
2048
|
* })
|
|
2112
2049
|
*/
|
|
2113
|
-
|
|
2114
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2050
|
+
createCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
2051
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerFundingInstructionsByExternalId(request, requestOptions));
|
|
2115
2052
|
}
|
|
2116
|
-
|
|
2053
|
+
__createCustomerFundingInstructionsByExternalId(request, requestOptions) {
|
|
2117
2054
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2118
2055
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2119
|
-
const { externalId,
|
|
2056
|
+
const { externalId, body: _body } = request;
|
|
2120
2057
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2121
2058
|
const _response = yield core.fetcher({
|
|
2122
|
-
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)}/
|
|
2123
|
-
method: "
|
|
2059
|
+
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`),
|
|
2060
|
+
method: "POST",
|
|
2124
2061
|
headers: _headers,
|
|
2125
2062
|
contentType: "application/json",
|
|
2126
2063
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2141,8 +2078,8 @@ class Customers {
|
|
|
2141
2078
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2142
2079
|
case 404:
|
|
2143
2080
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2144
|
-
case
|
|
2145
|
-
throw new Paid.
|
|
2081
|
+
case 422:
|
|
2082
|
+
throw new Paid.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2146
2083
|
case 500:
|
|
2147
2084
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2148
2085
|
default:
|
|
@@ -2161,7 +2098,7 @@ class Customers {
|
|
|
2161
2098
|
rawResponse: _response.rawResponse,
|
|
2162
2099
|
});
|
|
2163
2100
|
case "timeout":
|
|
2164
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
2101
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/funding-instructions.");
|
|
2165
2102
|
case "unknown":
|
|
2166
2103
|
throw new errors.PaidError({
|
|
2167
2104
|
message: _response.error.errorMessage,
|
|
@@ -2171,9 +2108,9 @@ class Customers {
|
|
|
2171
2108
|
});
|
|
2172
2109
|
}
|
|
2173
2110
|
/**
|
|
2174
|
-
* 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
|
|
2111
|
+
* 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.
|
|
2175
2112
|
*
|
|
2176
|
-
* @param {Paid.
|
|
2113
|
+
* @param {Paid.ListCustomerUnitsByExternalIdRequest} request
|
|
2177
2114
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2178
2115
|
*
|
|
2179
2116
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2182,18 +2119,18 @@ class Customers {
|
|
|
2182
2119
|
* @throws {@link Paid.InternalServerError}
|
|
2183
2120
|
*
|
|
2184
2121
|
* @example
|
|
2185
|
-
* await client.customers.
|
|
2186
|
-
*
|
|
2122
|
+
* await client.customers.listCustomerUnitsByExternalId({
|
|
2123
|
+
* externalId: "customer_123",
|
|
2187
2124
|
* parentExternalId: "dept-rnd"
|
|
2188
2125
|
* })
|
|
2189
2126
|
*/
|
|
2190
|
-
|
|
2191
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2127
|
+
listCustomerUnitsByExternalId(request, requestOptions) {
|
|
2128
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitsByExternalId(request, requestOptions));
|
|
2192
2129
|
}
|
|
2193
|
-
|
|
2130
|
+
__listCustomerUnitsByExternalId(request, requestOptions) {
|
|
2194
2131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2195
2132
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2196
|
-
const {
|
|
2133
|
+
const { externalId, limit, offset, status, externalType, parentExternalId } = request;
|
|
2197
2134
|
const _queryParams = {};
|
|
2198
2135
|
if (limit != null) {
|
|
2199
2136
|
_queryParams.limit = limit.toString();
|
|
@@ -2212,7 +2149,7 @@ class Customers {
|
|
|
2212
2149
|
}
|
|
2213
2150
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2214
2151
|
const _response = yield core.fetcher({
|
|
2215
|
-
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(
|
|
2152
|
+
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`),
|
|
2216
2153
|
method: "GET",
|
|
2217
2154
|
headers: _headers,
|
|
2218
2155
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -2249,7 +2186,7 @@ class Customers {
|
|
|
2249
2186
|
rawResponse: _response.rawResponse,
|
|
2250
2187
|
});
|
|
2251
2188
|
case "timeout":
|
|
2252
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{
|
|
2189
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units.");
|
|
2253
2190
|
case "unknown":
|
|
2254
2191
|
throw new errors.PaidError({
|
|
2255
2192
|
message: _response.error.errorMessage,
|
|
@@ -2259,9 +2196,9 @@ class Customers {
|
|
|
2259
2196
|
});
|
|
2260
2197
|
}
|
|
2261
2198
|
/**
|
|
2262
|
-
* Creates a unit for this customer. `externalId` is your own key for it: required, unique within the customer
|
|
2199
|
+
* 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.
|
|
2263
2200
|
*
|
|
2264
|
-
* @param {Paid.
|
|
2201
|
+
* @param {Paid.CreateCustomerUnitByExternalIdRequest} request
|
|
2265
2202
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2266
2203
|
*
|
|
2267
2204
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2271,23 +2208,23 @@ class Customers {
|
|
|
2271
2208
|
* @throws {@link Paid.InternalServerError}
|
|
2272
2209
|
*
|
|
2273
2210
|
* @example
|
|
2274
|
-
* await client.customers.
|
|
2275
|
-
*
|
|
2211
|
+
* await client.customers.createCustomerUnitByExternalId({
|
|
2212
|
+
* externalId: "customer_123",
|
|
2276
2213
|
* body: {
|
|
2277
2214
|
* externalId: "team-research"
|
|
2278
2215
|
* }
|
|
2279
2216
|
* })
|
|
2280
2217
|
*/
|
|
2281
|
-
|
|
2282
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2218
|
+
createCustomerUnitByExternalId(request, requestOptions) {
|
|
2219
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitByExternalId(request, requestOptions));
|
|
2283
2220
|
}
|
|
2284
|
-
|
|
2221
|
+
__createCustomerUnitByExternalId(request, requestOptions) {
|
|
2285
2222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2286
2223
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2287
|
-
const {
|
|
2224
|
+
const { externalId, body: _body } = request;
|
|
2288
2225
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2289
2226
|
const _response = yield core.fetcher({
|
|
2290
|
-
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(
|
|
2227
|
+
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`),
|
|
2291
2228
|
method: "POST",
|
|
2292
2229
|
headers: _headers,
|
|
2293
2230
|
contentType: "application/json",
|
|
@@ -2329,7 +2266,7 @@ class Customers {
|
|
|
2329
2266
|
rawResponse: _response.rawResponse,
|
|
2330
2267
|
});
|
|
2331
2268
|
case "timeout":
|
|
2332
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{
|
|
2269
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/customer-units.");
|
|
2333
2270
|
case "unknown":
|
|
2334
2271
|
throw new errors.PaidError({
|
|
2335
2272
|
message: _response.error.errorMessage,
|
|
@@ -2339,9 +2276,9 @@ class Customers {
|
|
|
2339
2276
|
});
|
|
2340
2277
|
}
|
|
2341
2278
|
/**
|
|
2342
|
-
* 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.
|
|
2279
|
+
* 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.
|
|
2343
2280
|
*
|
|
2344
|
-
* @param {Paid.
|
|
2281
|
+
* @param {Paid.GetCustomerUnitByExternalIdRequest} request
|
|
2345
2282
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2346
2283
|
*
|
|
2347
2284
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2350,21 +2287,21 @@ class Customers {
|
|
|
2350
2287
|
* @throws {@link Paid.InternalServerError}
|
|
2351
2288
|
*
|
|
2352
2289
|
* @example
|
|
2353
|
-
* await client.customers.
|
|
2354
|
-
*
|
|
2290
|
+
* await client.customers.getCustomerUnitByExternalId({
|
|
2291
|
+
* externalId: "customer_123",
|
|
2355
2292
|
* externalCustomerUnitId: "team-research"
|
|
2356
2293
|
* })
|
|
2357
2294
|
*/
|
|
2358
|
-
|
|
2359
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2295
|
+
getCustomerUnitByExternalId(request, requestOptions) {
|
|
2296
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitByExternalId(request, requestOptions));
|
|
2360
2297
|
}
|
|
2361
|
-
|
|
2298
|
+
__getCustomerUnitByExternalId(request, requestOptions) {
|
|
2362
2299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2363
2300
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2364
|
-
const {
|
|
2301
|
+
const { externalId, externalCustomerUnitId } = request;
|
|
2365
2302
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2366
2303
|
const _response = yield core.fetcher({
|
|
2367
|
-
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(
|
|
2304
|
+
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)}`),
|
|
2368
2305
|
method: "GET",
|
|
2369
2306
|
headers: _headers,
|
|
2370
2307
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2401,7 +2338,7 @@ class Customers {
|
|
|
2401
2338
|
rawResponse: _response.rawResponse,
|
|
2402
2339
|
});
|
|
2403
2340
|
case "timeout":
|
|
2404
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{
|
|
2341
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2405
2342
|
case "unknown":
|
|
2406
2343
|
throw new errors.PaidError({
|
|
2407
2344
|
message: _response.error.errorMessage,
|
|
@@ -2411,9 +2348,9 @@ class Customers {
|
|
|
2411
2348
|
});
|
|
2412
2349
|
}
|
|
2413
2350
|
/**
|
|
2414
|
-
* 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.
|
|
2351
|
+
* 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.
|
|
2415
2352
|
*
|
|
2416
|
-
* @param {Paid.
|
|
2353
|
+
* @param {Paid.DeleteCustomerUnitByExternalIdRequest} request
|
|
2417
2354
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2418
2355
|
*
|
|
2419
2356
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2423,21 +2360,21 @@ class Customers {
|
|
|
2423
2360
|
* @throws {@link Paid.InternalServerError}
|
|
2424
2361
|
*
|
|
2425
2362
|
* @example
|
|
2426
|
-
* await client.customers.
|
|
2427
|
-
*
|
|
2363
|
+
* await client.customers.deleteCustomerUnitByExternalId({
|
|
2364
|
+
* externalId: "customer_123",
|
|
2428
2365
|
* externalCustomerUnitId: "team-research"
|
|
2429
2366
|
* })
|
|
2430
2367
|
*/
|
|
2431
|
-
|
|
2432
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2368
|
+
deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2369
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitByExternalId(request, requestOptions));
|
|
2433
2370
|
}
|
|
2434
|
-
|
|
2371
|
+
__deleteCustomerUnitByExternalId(request, requestOptions) {
|
|
2435
2372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2436
2373
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2437
|
-
const {
|
|
2374
|
+
const { externalId, externalCustomerUnitId } = request;
|
|
2438
2375
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2439
2376
|
const _response = yield core.fetcher({
|
|
2440
|
-
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(
|
|
2377
|
+
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)}`),
|
|
2441
2378
|
method: "DELETE",
|
|
2442
2379
|
headers: _headers,
|
|
2443
2380
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2476,7 +2413,7 @@ class Customers {
|
|
|
2476
2413
|
rawResponse: _response.rawResponse,
|
|
2477
2414
|
});
|
|
2478
2415
|
case "timeout":
|
|
2479
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{
|
|
2416
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2480
2417
|
case "unknown":
|
|
2481
2418
|
throw new errors.PaidError({
|
|
2482
2419
|
message: _response.error.errorMessage,
|
|
@@ -2486,9 +2423,9 @@ class Customers {
|
|
|
2486
2423
|
});
|
|
2487
2424
|
}
|
|
2488
2425
|
/**
|
|
2489
|
-
* 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.
|
|
2426
|
+
* 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.
|
|
2490
2427
|
*
|
|
2491
|
-
* @param {Paid.
|
|
2428
|
+
* @param {Paid.UpdateCustomerUnitByExternalIdRequest} request
|
|
2492
2429
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2493
2430
|
*
|
|
2494
2431
|
* @throws {@link Paid.BadRequestError}
|
|
@@ -2498,23 +2435,1657 @@ class Customers {
|
|
|
2498
2435
|
* @throws {@link Paid.InternalServerError}
|
|
2499
2436
|
*
|
|
2500
2437
|
* @example
|
|
2501
|
-
* await client.customers.
|
|
2502
|
-
*
|
|
2438
|
+
* await client.customers.updateCustomerUnitByExternalId({
|
|
2439
|
+
* externalId: "customer_123",
|
|
2503
2440
|
* externalCustomerUnitId: "team-research",
|
|
2504
2441
|
* body: {}
|
|
2505
2442
|
* })
|
|
2506
2443
|
*/
|
|
2507
|
-
|
|
2508
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
2444
|
+
updateCustomerUnitByExternalId(request, requestOptions) {
|
|
2445
|
+
return core.HttpResponsePromise.fromPromise(this.__updateCustomerUnitByExternalId(request, requestOptions));
|
|
2509
2446
|
}
|
|
2510
|
-
|
|
2447
|
+
__updateCustomerUnitByExternalId(request, requestOptions) {
|
|
2511
2448
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2512
2449
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2513
|
-
const {
|
|
2450
|
+
const { externalId, externalCustomerUnitId, body: _body } = request;
|
|
2451
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2452
|
+
const _response = yield core.fetcher({
|
|
2453
|
+
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)}`),
|
|
2454
|
+
method: "PATCH",
|
|
2455
|
+
headers: _headers,
|
|
2456
|
+
contentType: "application/json",
|
|
2457
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2458
|
+
requestType: "json",
|
|
2459
|
+
body: _body,
|
|
2460
|
+
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,
|
|
2461
|
+
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,
|
|
2462
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2463
|
+
});
|
|
2464
|
+
if (_response.ok) {
|
|
2465
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2466
|
+
}
|
|
2467
|
+
if (_response.error.reason === "status-code") {
|
|
2468
|
+
switch (_response.error.statusCode) {
|
|
2469
|
+
case 400:
|
|
2470
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2471
|
+
case 403:
|
|
2472
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2473
|
+
case 404:
|
|
2474
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2475
|
+
case 409:
|
|
2476
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2477
|
+
case 500:
|
|
2478
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2479
|
+
default:
|
|
2480
|
+
throw new errors.PaidError({
|
|
2481
|
+
statusCode: _response.error.statusCode,
|
|
2482
|
+
body: _response.error.body,
|
|
2483
|
+
rawResponse: _response.rawResponse,
|
|
2484
|
+
});
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
switch (_response.error.reason) {
|
|
2488
|
+
case "non-json":
|
|
2489
|
+
throw new errors.PaidError({
|
|
2490
|
+
statusCode: _response.error.statusCode,
|
|
2491
|
+
body: _response.error.rawBody,
|
|
2492
|
+
rawResponse: _response.rawResponse,
|
|
2493
|
+
});
|
|
2494
|
+
case "timeout":
|
|
2495
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PATCH /customers/external/{externalId}/customer-units/{externalCustomerUnitId}.");
|
|
2496
|
+
case "unknown":
|
|
2497
|
+
throw new errors.PaidError({
|
|
2498
|
+
message: _response.error.errorMessage,
|
|
2499
|
+
rawResponse: _response.rawResponse,
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* 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.
|
|
2506
|
+
*
|
|
2507
|
+
* @param {Paid.ListCustomerUnitAliasesByExternalIdRequest} request
|
|
2508
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2509
|
+
*
|
|
2510
|
+
* @throws {@link Paid.BadRequestError}
|
|
2511
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2512
|
+
* @throws {@link Paid.NotFoundError}
|
|
2513
|
+
* @throws {@link Paid.InternalServerError}
|
|
2514
|
+
*
|
|
2515
|
+
* @example
|
|
2516
|
+
* await client.customers.listCustomerUnitAliasesByExternalId({
|
|
2517
|
+
* externalId: "customer_123",
|
|
2518
|
+
* externalCustomerUnitId: "team-research"
|
|
2519
|
+
* })
|
|
2520
|
+
*/
|
|
2521
|
+
listCustomerUnitAliasesByExternalId(request, requestOptions) {
|
|
2522
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliasesByExternalId(request, requestOptions));
|
|
2523
|
+
}
|
|
2524
|
+
__listCustomerUnitAliasesByExternalId(request, requestOptions) {
|
|
2525
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2526
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2527
|
+
const { externalId, externalCustomerUnitId, limit, offset } = request;
|
|
2528
|
+
const _queryParams = {};
|
|
2529
|
+
if (limit != null) {
|
|
2530
|
+
_queryParams.limit = limit.toString();
|
|
2531
|
+
}
|
|
2532
|
+
if (offset != null) {
|
|
2533
|
+
_queryParams.offset = offset.toString();
|
|
2534
|
+
}
|
|
2535
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2536
|
+
const _response = yield core.fetcher({
|
|
2537
|
+
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`),
|
|
2538
|
+
method: "GET",
|
|
2539
|
+
headers: _headers,
|
|
2540
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2541
|
+
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,
|
|
2542
|
+
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,
|
|
2543
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2544
|
+
});
|
|
2545
|
+
if (_response.ok) {
|
|
2546
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2547
|
+
}
|
|
2548
|
+
if (_response.error.reason === "status-code") {
|
|
2549
|
+
switch (_response.error.statusCode) {
|
|
2550
|
+
case 400:
|
|
2551
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2552
|
+
case 403:
|
|
2553
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2554
|
+
case 404:
|
|
2555
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2556
|
+
case 500:
|
|
2557
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2558
|
+
default:
|
|
2559
|
+
throw new errors.PaidError({
|
|
2560
|
+
statusCode: _response.error.statusCode,
|
|
2561
|
+
body: _response.error.body,
|
|
2562
|
+
rawResponse: _response.rawResponse,
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
switch (_response.error.reason) {
|
|
2567
|
+
case "non-json":
|
|
2568
|
+
throw new errors.PaidError({
|
|
2569
|
+
statusCode: _response.error.statusCode,
|
|
2570
|
+
body: _response.error.rawBody,
|
|
2571
|
+
rawResponse: _response.rawResponse,
|
|
2572
|
+
});
|
|
2573
|
+
case "timeout":
|
|
2574
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
2575
|
+
case "unknown":
|
|
2576
|
+
throw new errors.PaidError({
|
|
2577
|
+
message: _response.error.errorMessage,
|
|
2578
|
+
rawResponse: _response.rawResponse,
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* 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.
|
|
2585
|
+
*
|
|
2586
|
+
* @param {Paid.CreateCustomerUnitAliasByExternalIdRequest} request
|
|
2587
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2588
|
+
*
|
|
2589
|
+
* @throws {@link Paid.BadRequestError}
|
|
2590
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2591
|
+
* @throws {@link Paid.NotFoundError}
|
|
2592
|
+
* @throws {@link Paid.ConflictError}
|
|
2593
|
+
* @throws {@link Paid.InternalServerError}
|
|
2594
|
+
*
|
|
2595
|
+
* @example
|
|
2596
|
+
* await client.customers.createCustomerUnitAliasByExternalId({
|
|
2597
|
+
* externalId: "customer_123",
|
|
2598
|
+
* externalCustomerUnitId: "team-research",
|
|
2599
|
+
* body: {
|
|
2600
|
+
* alias: "child-customer-1"
|
|
2601
|
+
* }
|
|
2602
|
+
* })
|
|
2603
|
+
*/
|
|
2604
|
+
createCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2605
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAliasByExternalId(request, requestOptions));
|
|
2606
|
+
}
|
|
2607
|
+
__createCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2608
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2609
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2610
|
+
const { externalId, externalCustomerUnitId, body: _body } = request;
|
|
2611
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2612
|
+
const _response = yield core.fetcher({
|
|
2613
|
+
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`),
|
|
2614
|
+
method: "POST",
|
|
2615
|
+
headers: _headers,
|
|
2616
|
+
contentType: "application/json",
|
|
2617
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2618
|
+
requestType: "json",
|
|
2619
|
+
body: _body,
|
|
2620
|
+
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,
|
|
2621
|
+
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,
|
|
2622
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2623
|
+
});
|
|
2624
|
+
if (_response.ok) {
|
|
2625
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2626
|
+
}
|
|
2627
|
+
if (_response.error.reason === "status-code") {
|
|
2628
|
+
switch (_response.error.statusCode) {
|
|
2629
|
+
case 400:
|
|
2630
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2631
|
+
case 403:
|
|
2632
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2633
|
+
case 404:
|
|
2634
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2635
|
+
case 409:
|
|
2636
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2637
|
+
case 500:
|
|
2638
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2639
|
+
default:
|
|
2640
|
+
throw new errors.PaidError({
|
|
2641
|
+
statusCode: _response.error.statusCode,
|
|
2642
|
+
body: _response.error.body,
|
|
2643
|
+
rawResponse: _response.rawResponse,
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
switch (_response.error.reason) {
|
|
2648
|
+
case "non-json":
|
|
2649
|
+
throw new errors.PaidError({
|
|
2650
|
+
statusCode: _response.error.statusCode,
|
|
2651
|
+
body: _response.error.rawBody,
|
|
2652
|
+
rawResponse: _response.rawResponse,
|
|
2653
|
+
});
|
|
2654
|
+
case "timeout":
|
|
2655
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
2656
|
+
case "unknown":
|
|
2657
|
+
throw new errors.PaidError({
|
|
2658
|
+
message: _response.error.errorMessage,
|
|
2659
|
+
rawResponse: _response.rawResponse,
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Deletes an alias of this unit. Signals still sent with it then resolve to nothing again. Addresses the customer by your external customer id.
|
|
2666
|
+
*
|
|
2667
|
+
* @param {Paid.DeleteCustomerUnitAliasByExternalIdRequest} request
|
|
2668
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2669
|
+
*
|
|
2670
|
+
* @throws {@link Paid.BadRequestError}
|
|
2671
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2672
|
+
* @throws {@link Paid.NotFoundError}
|
|
2673
|
+
* @throws {@link Paid.InternalServerError}
|
|
2674
|
+
*
|
|
2675
|
+
* @example
|
|
2676
|
+
* await client.customers.deleteCustomerUnitAliasByExternalId({
|
|
2677
|
+
* externalId: "customer_123",
|
|
2678
|
+
* externalCustomerUnitId: "team-research",
|
|
2679
|
+
* alias: "tenant-7-sandbox"
|
|
2680
|
+
* })
|
|
2681
|
+
*/
|
|
2682
|
+
deleteCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2683
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAliasByExternalId(request, requestOptions));
|
|
2684
|
+
}
|
|
2685
|
+
__deleteCustomerUnitAliasByExternalId(request, requestOptions) {
|
|
2686
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2687
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2688
|
+
const { externalId, externalCustomerUnitId, alias } = request;
|
|
2689
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2690
|
+
const _response = yield core.fetcher({
|
|
2691
|
+
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)}`),
|
|
2692
|
+
method: "DELETE",
|
|
2693
|
+
headers: _headers,
|
|
2694
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2695
|
+
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,
|
|
2696
|
+
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,
|
|
2697
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2698
|
+
});
|
|
2699
|
+
if (_response.ok) {
|
|
2700
|
+
return {
|
|
2701
|
+
data: _response.body,
|
|
2702
|
+
rawResponse: _response.rawResponse,
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2705
|
+
if (_response.error.reason === "status-code") {
|
|
2706
|
+
switch (_response.error.statusCode) {
|
|
2707
|
+
case 400:
|
|
2708
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2709
|
+
case 403:
|
|
2710
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2711
|
+
case 404:
|
|
2712
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2713
|
+
case 500:
|
|
2714
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2715
|
+
default:
|
|
2716
|
+
throw new errors.PaidError({
|
|
2717
|
+
statusCode: _response.error.statusCode,
|
|
2718
|
+
body: _response.error.body,
|
|
2719
|
+
rawResponse: _response.rawResponse,
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
switch (_response.error.reason) {
|
|
2724
|
+
case "non-json":
|
|
2725
|
+
throw new errors.PaidError({
|
|
2726
|
+
statusCode: _response.error.statusCode,
|
|
2727
|
+
body: _response.error.rawBody,
|
|
2728
|
+
rawResponse: _response.rawResponse,
|
|
2729
|
+
});
|
|
2730
|
+
case "timeout":
|
|
2731
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/aliases/{alias}.");
|
|
2732
|
+
case "unknown":
|
|
2733
|
+
throw new errors.PaidError({
|
|
2734
|
+
message: _response.error.errorMessage,
|
|
2735
|
+
rawResponse: _response.rawResponse,
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* 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.
|
|
2742
|
+
*
|
|
2743
|
+
* @param {Paid.ListCustomerUnitsRequest} request
|
|
2744
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2745
|
+
*
|
|
2746
|
+
* @throws {@link Paid.BadRequestError}
|
|
2747
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2748
|
+
* @throws {@link Paid.NotFoundError}
|
|
2749
|
+
* @throws {@link Paid.InternalServerError}
|
|
2750
|
+
*
|
|
2751
|
+
* @example
|
|
2752
|
+
* await client.customers.listCustomerUnits({
|
|
2753
|
+
* id: "cus_abc123",
|
|
2754
|
+
* parentExternalId: "dept-rnd"
|
|
2755
|
+
* })
|
|
2756
|
+
*/
|
|
2757
|
+
listCustomerUnits(request, requestOptions) {
|
|
2758
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnits(request, requestOptions));
|
|
2759
|
+
}
|
|
2760
|
+
__listCustomerUnits(request, requestOptions) {
|
|
2761
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2762
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2763
|
+
const { id, limit, offset, status, externalType, parentExternalId } = request;
|
|
2764
|
+
const _queryParams = {};
|
|
2765
|
+
if (limit != null) {
|
|
2766
|
+
_queryParams.limit = limit.toString();
|
|
2767
|
+
}
|
|
2768
|
+
if (offset != null) {
|
|
2769
|
+
_queryParams.offset = offset.toString();
|
|
2770
|
+
}
|
|
2771
|
+
if (status != null) {
|
|
2772
|
+
_queryParams.status = status;
|
|
2773
|
+
}
|
|
2774
|
+
if (externalType != null) {
|
|
2775
|
+
_queryParams.externalType = externalType;
|
|
2776
|
+
}
|
|
2777
|
+
if (parentExternalId != null) {
|
|
2778
|
+
_queryParams.parentExternalId = parentExternalId;
|
|
2779
|
+
}
|
|
2780
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2781
|
+
const _response = yield core.fetcher({
|
|
2782
|
+
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`),
|
|
2783
|
+
method: "GET",
|
|
2784
|
+
headers: _headers,
|
|
2785
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
2786
|
+
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,
|
|
2787
|
+
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,
|
|
2788
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2789
|
+
});
|
|
2790
|
+
if (_response.ok) {
|
|
2791
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2792
|
+
}
|
|
2793
|
+
if (_response.error.reason === "status-code") {
|
|
2794
|
+
switch (_response.error.statusCode) {
|
|
2795
|
+
case 400:
|
|
2796
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2797
|
+
case 403:
|
|
2798
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2799
|
+
case 404:
|
|
2800
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2801
|
+
case 500:
|
|
2802
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2803
|
+
default:
|
|
2804
|
+
throw new errors.PaidError({
|
|
2805
|
+
statusCode: _response.error.statusCode,
|
|
2806
|
+
body: _response.error.body,
|
|
2807
|
+
rawResponse: _response.rawResponse,
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
switch (_response.error.reason) {
|
|
2812
|
+
case "non-json":
|
|
2813
|
+
throw new errors.PaidError({
|
|
2814
|
+
statusCode: _response.error.statusCode,
|
|
2815
|
+
body: _response.error.rawBody,
|
|
2816
|
+
rawResponse: _response.rawResponse,
|
|
2817
|
+
});
|
|
2818
|
+
case "timeout":
|
|
2819
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units.");
|
|
2820
|
+
case "unknown":
|
|
2821
|
+
throw new errors.PaidError({
|
|
2822
|
+
message: _response.error.errorMessage,
|
|
2823
|
+
rawResponse: _response.rawResponse,
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* 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.
|
|
2830
|
+
*
|
|
2831
|
+
* @param {Paid.CreateCustomerUnitRequest} request
|
|
2832
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2833
|
+
*
|
|
2834
|
+
* @throws {@link Paid.BadRequestError}
|
|
2835
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2836
|
+
* @throws {@link Paid.NotFoundError}
|
|
2837
|
+
* @throws {@link Paid.ConflictError}
|
|
2838
|
+
* @throws {@link Paid.InternalServerError}
|
|
2839
|
+
*
|
|
2840
|
+
* @example
|
|
2841
|
+
* await client.customers.createCustomerUnit({
|
|
2842
|
+
* id: "cus_abc123",
|
|
2843
|
+
* body: {
|
|
2844
|
+
* externalId: "team-research"
|
|
2845
|
+
* }
|
|
2846
|
+
* })
|
|
2847
|
+
*/
|
|
2848
|
+
createCustomerUnit(request, requestOptions) {
|
|
2849
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnit(request, requestOptions));
|
|
2850
|
+
}
|
|
2851
|
+
__createCustomerUnit(request, requestOptions) {
|
|
2852
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2853
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2854
|
+
const { id, body: _body } = request;
|
|
2855
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2856
|
+
const _response = yield core.fetcher({
|
|
2857
|
+
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`),
|
|
2858
|
+
method: "POST",
|
|
2859
|
+
headers: _headers,
|
|
2860
|
+
contentType: "application/json",
|
|
2861
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2862
|
+
requestType: "json",
|
|
2863
|
+
body: _body,
|
|
2864
|
+
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,
|
|
2865
|
+
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,
|
|
2866
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2867
|
+
});
|
|
2868
|
+
if (_response.ok) {
|
|
2869
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2870
|
+
}
|
|
2871
|
+
if (_response.error.reason === "status-code") {
|
|
2872
|
+
switch (_response.error.statusCode) {
|
|
2873
|
+
case 400:
|
|
2874
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2875
|
+
case 403:
|
|
2876
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2877
|
+
case 404:
|
|
2878
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2879
|
+
case 409:
|
|
2880
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2881
|
+
case 500:
|
|
2882
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2883
|
+
default:
|
|
2884
|
+
throw new errors.PaidError({
|
|
2885
|
+
statusCode: _response.error.statusCode,
|
|
2886
|
+
body: _response.error.body,
|
|
2887
|
+
rawResponse: _response.rawResponse,
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
switch (_response.error.reason) {
|
|
2892
|
+
case "non-json":
|
|
2893
|
+
throw new errors.PaidError({
|
|
2894
|
+
statusCode: _response.error.statusCode,
|
|
2895
|
+
body: _response.error.rawBody,
|
|
2896
|
+
rawResponse: _response.rawResponse,
|
|
2897
|
+
});
|
|
2898
|
+
case "timeout":
|
|
2899
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/customer-units.");
|
|
2900
|
+
case "unknown":
|
|
2901
|
+
throw new errors.PaidError({
|
|
2902
|
+
message: _response.error.errorMessage,
|
|
2903
|
+
rawResponse: _response.rawResponse,
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* 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.
|
|
2910
|
+
*
|
|
2911
|
+
* @param {Paid.GetCustomerUnitRequest} request
|
|
2912
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2913
|
+
*
|
|
2914
|
+
* @throws {@link Paid.BadRequestError}
|
|
2915
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2916
|
+
* @throws {@link Paid.NotFoundError}
|
|
2917
|
+
* @throws {@link Paid.InternalServerError}
|
|
2918
|
+
*
|
|
2919
|
+
* @example
|
|
2920
|
+
* await client.customers.getCustomerUnit({
|
|
2921
|
+
* id: "cus_abc123",
|
|
2922
|
+
* externalCustomerUnitId: "team-research"
|
|
2923
|
+
* })
|
|
2924
|
+
*/
|
|
2925
|
+
getCustomerUnit(request, requestOptions) {
|
|
2926
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnit(request, requestOptions));
|
|
2927
|
+
}
|
|
2928
|
+
__getCustomerUnit(request, requestOptions) {
|
|
2929
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2930
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2931
|
+
const { id, externalCustomerUnitId } = request;
|
|
2932
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2933
|
+
const _response = yield core.fetcher({
|
|
2934
|
+
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)}`),
|
|
2935
|
+
method: "GET",
|
|
2936
|
+
headers: _headers,
|
|
2937
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
2938
|
+
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,
|
|
2939
|
+
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,
|
|
2940
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2941
|
+
});
|
|
2942
|
+
if (_response.ok) {
|
|
2943
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2944
|
+
}
|
|
2945
|
+
if (_response.error.reason === "status-code") {
|
|
2946
|
+
switch (_response.error.statusCode) {
|
|
2947
|
+
case 400:
|
|
2948
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2949
|
+
case 403:
|
|
2950
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2951
|
+
case 404:
|
|
2952
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2953
|
+
case 500:
|
|
2954
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2955
|
+
default:
|
|
2956
|
+
throw new errors.PaidError({
|
|
2957
|
+
statusCode: _response.error.statusCode,
|
|
2958
|
+
body: _response.error.body,
|
|
2959
|
+
rawResponse: _response.rawResponse,
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
switch (_response.error.reason) {
|
|
2964
|
+
case "non-json":
|
|
2965
|
+
throw new errors.PaidError({
|
|
2966
|
+
statusCode: _response.error.statusCode,
|
|
2967
|
+
body: _response.error.rawBody,
|
|
2968
|
+
rawResponse: _response.rawResponse,
|
|
2969
|
+
});
|
|
2970
|
+
case "timeout":
|
|
2971
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
2972
|
+
case "unknown":
|
|
2973
|
+
throw new errors.PaidError({
|
|
2974
|
+
message: _response.error.errorMessage,
|
|
2975
|
+
rawResponse: _response.rawResponse,
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* 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.
|
|
2982
|
+
*
|
|
2983
|
+
* @param {Paid.DeleteCustomerUnitRequest} request
|
|
2984
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
2985
|
+
*
|
|
2986
|
+
* @throws {@link Paid.BadRequestError}
|
|
2987
|
+
* @throws {@link Paid.ForbiddenError}
|
|
2988
|
+
* @throws {@link Paid.NotFoundError}
|
|
2989
|
+
* @throws {@link Paid.ConflictError}
|
|
2990
|
+
* @throws {@link Paid.InternalServerError}
|
|
2991
|
+
*
|
|
2992
|
+
* @example
|
|
2993
|
+
* await client.customers.deleteCustomerUnit({
|
|
2994
|
+
* id: "cus_abc123",
|
|
2995
|
+
* externalCustomerUnitId: "team-research"
|
|
2996
|
+
* })
|
|
2997
|
+
*/
|
|
2998
|
+
deleteCustomerUnit(request, requestOptions) {
|
|
2999
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnit(request, requestOptions));
|
|
3000
|
+
}
|
|
3001
|
+
__deleteCustomerUnit(request, requestOptions) {
|
|
3002
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3003
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3004
|
+
const { id, externalCustomerUnitId } = request;
|
|
3005
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3006
|
+
const _response = yield core.fetcher({
|
|
3007
|
+
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)}`),
|
|
3008
|
+
method: "DELETE",
|
|
3009
|
+
headers: _headers,
|
|
3010
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3011
|
+
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,
|
|
3012
|
+
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,
|
|
3013
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3014
|
+
});
|
|
3015
|
+
if (_response.ok) {
|
|
3016
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3017
|
+
}
|
|
3018
|
+
if (_response.error.reason === "status-code") {
|
|
3019
|
+
switch (_response.error.statusCode) {
|
|
3020
|
+
case 400:
|
|
3021
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3022
|
+
case 403:
|
|
3023
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3024
|
+
case 404:
|
|
3025
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3026
|
+
case 409:
|
|
3027
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3028
|
+
case 500:
|
|
3029
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3030
|
+
default:
|
|
3031
|
+
throw new errors.PaidError({
|
|
3032
|
+
statusCode: _response.error.statusCode,
|
|
3033
|
+
body: _response.error.body,
|
|
3034
|
+
rawResponse: _response.rawResponse,
|
|
3035
|
+
});
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
switch (_response.error.reason) {
|
|
3039
|
+
case "non-json":
|
|
3040
|
+
throw new errors.PaidError({
|
|
3041
|
+
statusCode: _response.error.statusCode,
|
|
3042
|
+
body: _response.error.rawBody,
|
|
3043
|
+
rawResponse: _response.rawResponse,
|
|
3044
|
+
});
|
|
3045
|
+
case "timeout":
|
|
3046
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
3047
|
+
case "unknown":
|
|
3048
|
+
throw new errors.PaidError({
|
|
3049
|
+
message: _response.error.errorMessage,
|
|
3050
|
+
rawResponse: _response.rawResponse,
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* 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.
|
|
3057
|
+
*
|
|
3058
|
+
* @param {Paid.UpdateCustomerUnitRequest} request
|
|
3059
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3060
|
+
*
|
|
3061
|
+
* @throws {@link Paid.BadRequestError}
|
|
3062
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3063
|
+
* @throws {@link Paid.NotFoundError}
|
|
3064
|
+
* @throws {@link Paid.ConflictError}
|
|
3065
|
+
* @throws {@link Paid.InternalServerError}
|
|
3066
|
+
*
|
|
3067
|
+
* @example
|
|
3068
|
+
* await client.customers.updateCustomerUnit({
|
|
3069
|
+
* id: "cus_abc123",
|
|
3070
|
+
* externalCustomerUnitId: "team-research",
|
|
3071
|
+
* body: {}
|
|
3072
|
+
* })
|
|
3073
|
+
*/
|
|
3074
|
+
updateCustomerUnit(request, requestOptions) {
|
|
3075
|
+
return core.HttpResponsePromise.fromPromise(this.__updateCustomerUnit(request, requestOptions));
|
|
3076
|
+
}
|
|
3077
|
+
__updateCustomerUnit(request, requestOptions) {
|
|
3078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3079
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3080
|
+
const { id, externalCustomerUnitId, body: _body } = request;
|
|
3081
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3082
|
+
const _response = yield core.fetcher({
|
|
3083
|
+
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)}`),
|
|
3084
|
+
method: "PATCH",
|
|
3085
|
+
headers: _headers,
|
|
3086
|
+
contentType: "application/json",
|
|
3087
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3088
|
+
requestType: "json",
|
|
3089
|
+
body: _body,
|
|
3090
|
+
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,
|
|
3091
|
+
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,
|
|
3092
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3093
|
+
});
|
|
3094
|
+
if (_response.ok) {
|
|
3095
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3096
|
+
}
|
|
3097
|
+
if (_response.error.reason === "status-code") {
|
|
3098
|
+
switch (_response.error.statusCode) {
|
|
3099
|
+
case 400:
|
|
3100
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3101
|
+
case 403:
|
|
3102
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3103
|
+
case 404:
|
|
3104
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3105
|
+
case 409:
|
|
3106
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3107
|
+
case 500:
|
|
3108
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3109
|
+
default:
|
|
3110
|
+
throw new errors.PaidError({
|
|
3111
|
+
statusCode: _response.error.statusCode,
|
|
3112
|
+
body: _response.error.body,
|
|
3113
|
+
rawResponse: _response.rawResponse,
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
switch (_response.error.reason) {
|
|
3118
|
+
case "non-json":
|
|
3119
|
+
throw new errors.PaidError({
|
|
3120
|
+
statusCode: _response.error.statusCode,
|
|
3121
|
+
body: _response.error.rawBody,
|
|
3122
|
+
rawResponse: _response.rawResponse,
|
|
3123
|
+
});
|
|
3124
|
+
case "timeout":
|
|
3125
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PATCH /customers/{id}/customer-units/{externalCustomerUnitId}.");
|
|
3126
|
+
case "unknown":
|
|
3127
|
+
throw new errors.PaidError({
|
|
3128
|
+
message: _response.error.errorMessage,
|
|
3129
|
+
rawResponse: _response.rawResponse,
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* 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.
|
|
3136
|
+
*
|
|
3137
|
+
* @param {Paid.ListCustomerUnitAliasesRequest} request
|
|
3138
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3139
|
+
*
|
|
3140
|
+
* @throws {@link Paid.BadRequestError}
|
|
3141
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3142
|
+
* @throws {@link Paid.NotFoundError}
|
|
3143
|
+
* @throws {@link Paid.InternalServerError}
|
|
3144
|
+
*
|
|
3145
|
+
* @example
|
|
3146
|
+
* await client.customers.listCustomerUnitAliases({
|
|
3147
|
+
* id: "cus_abc123",
|
|
3148
|
+
* externalCustomerUnitId: "team-research"
|
|
3149
|
+
* })
|
|
3150
|
+
*/
|
|
3151
|
+
listCustomerUnitAliases(request, requestOptions) {
|
|
3152
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliases(request, requestOptions));
|
|
3153
|
+
}
|
|
3154
|
+
__listCustomerUnitAliases(request, requestOptions) {
|
|
3155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3156
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3157
|
+
const { id, externalCustomerUnitId, limit, offset } = request;
|
|
3158
|
+
const _queryParams = {};
|
|
3159
|
+
if (limit != null) {
|
|
3160
|
+
_queryParams.limit = limit.toString();
|
|
3161
|
+
}
|
|
3162
|
+
if (offset != null) {
|
|
3163
|
+
_queryParams.offset = offset.toString();
|
|
3164
|
+
}
|
|
3165
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3166
|
+
const _response = yield core.fetcher({
|
|
3167
|
+
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`),
|
|
3168
|
+
method: "GET",
|
|
3169
|
+
headers: _headers,
|
|
3170
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3171
|
+
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,
|
|
3172
|
+
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,
|
|
3173
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3174
|
+
});
|
|
3175
|
+
if (_response.ok) {
|
|
3176
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3177
|
+
}
|
|
3178
|
+
if (_response.error.reason === "status-code") {
|
|
3179
|
+
switch (_response.error.statusCode) {
|
|
3180
|
+
case 400:
|
|
3181
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3182
|
+
case 403:
|
|
3183
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3184
|
+
case 404:
|
|
3185
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3186
|
+
case 500:
|
|
3187
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3188
|
+
default:
|
|
3189
|
+
throw new errors.PaidError({
|
|
3190
|
+
statusCode: _response.error.statusCode,
|
|
3191
|
+
body: _response.error.body,
|
|
3192
|
+
rawResponse: _response.rawResponse,
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
switch (_response.error.reason) {
|
|
3197
|
+
case "non-json":
|
|
3198
|
+
throw new errors.PaidError({
|
|
3199
|
+
statusCode: _response.error.statusCode,
|
|
3200
|
+
body: _response.error.rawBody,
|
|
3201
|
+
rawResponse: _response.rawResponse,
|
|
3202
|
+
});
|
|
3203
|
+
case "timeout":
|
|
3204
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
3205
|
+
case "unknown":
|
|
3206
|
+
throw new errors.PaidError({
|
|
3207
|
+
message: _response.error.errorMessage,
|
|
3208
|
+
rawResponse: _response.rawResponse,
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* 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.
|
|
3215
|
+
*
|
|
3216
|
+
* @param {Paid.CreateCustomerUnitAliasRequest} request
|
|
3217
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3218
|
+
*
|
|
3219
|
+
* @throws {@link Paid.BadRequestError}
|
|
3220
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3221
|
+
* @throws {@link Paid.NotFoundError}
|
|
3222
|
+
* @throws {@link Paid.ConflictError}
|
|
3223
|
+
* @throws {@link Paid.InternalServerError}
|
|
3224
|
+
*
|
|
3225
|
+
* @example
|
|
3226
|
+
* await client.customers.createCustomerUnitAlias({
|
|
3227
|
+
* id: "cus_abc123",
|
|
3228
|
+
* externalCustomerUnitId: "team-research",
|
|
3229
|
+
* body: {
|
|
3230
|
+
* alias: "child-customer-1"
|
|
3231
|
+
* }
|
|
3232
|
+
* })
|
|
3233
|
+
*/
|
|
3234
|
+
createCustomerUnitAlias(request, requestOptions) {
|
|
3235
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAlias(request, requestOptions));
|
|
3236
|
+
}
|
|
3237
|
+
__createCustomerUnitAlias(request, requestOptions) {
|
|
3238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3240
|
+
const { id, externalCustomerUnitId, body: _body } = request;
|
|
3241
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3242
|
+
const _response = yield core.fetcher({
|
|
3243
|
+
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`),
|
|
3244
|
+
method: "POST",
|
|
3245
|
+
headers: _headers,
|
|
3246
|
+
contentType: "application/json",
|
|
3247
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3248
|
+
requestType: "json",
|
|
3249
|
+
body: _body,
|
|
3250
|
+
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,
|
|
3251
|
+
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,
|
|
3252
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3253
|
+
});
|
|
3254
|
+
if (_response.ok) {
|
|
3255
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3256
|
+
}
|
|
3257
|
+
if (_response.error.reason === "status-code") {
|
|
3258
|
+
switch (_response.error.statusCode) {
|
|
3259
|
+
case 400:
|
|
3260
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3261
|
+
case 403:
|
|
3262
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3263
|
+
case 404:
|
|
3264
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3265
|
+
case 409:
|
|
3266
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3267
|
+
case 500:
|
|
3268
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3269
|
+
default:
|
|
3270
|
+
throw new errors.PaidError({
|
|
3271
|
+
statusCode: _response.error.statusCode,
|
|
3272
|
+
body: _response.error.body,
|
|
3273
|
+
rawResponse: _response.rawResponse,
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
switch (_response.error.reason) {
|
|
3278
|
+
case "non-json":
|
|
3279
|
+
throw new errors.PaidError({
|
|
3280
|
+
statusCode: _response.error.statusCode,
|
|
3281
|
+
body: _response.error.rawBody,
|
|
3282
|
+
rawResponse: _response.rawResponse,
|
|
3283
|
+
});
|
|
3284
|
+
case "timeout":
|
|
3285
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/customer-units/{externalCustomerUnitId}/aliases.");
|
|
3286
|
+
case "unknown":
|
|
3287
|
+
throw new errors.PaidError({
|
|
3288
|
+
message: _response.error.errorMessage,
|
|
3289
|
+
rawResponse: _response.rawResponse,
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3294
|
+
/**
|
|
3295
|
+
* 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.
|
|
3296
|
+
*
|
|
3297
|
+
* @param {Paid.DeleteCustomerUnitAliasRequest} request
|
|
3298
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3299
|
+
*
|
|
3300
|
+
* @throws {@link Paid.BadRequestError}
|
|
3301
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3302
|
+
* @throws {@link Paid.NotFoundError}
|
|
3303
|
+
* @throws {@link Paid.InternalServerError}
|
|
3304
|
+
*
|
|
3305
|
+
* @example
|
|
3306
|
+
* await client.customers.deleteCustomerUnitAlias({
|
|
3307
|
+
* id: "cus_abc123",
|
|
3308
|
+
* externalCustomerUnitId: "team-research",
|
|
3309
|
+
* alias: "tenant-7-sandbox"
|
|
3310
|
+
* })
|
|
3311
|
+
*/
|
|
3312
|
+
deleteCustomerUnitAlias(request, requestOptions) {
|
|
3313
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAlias(request, requestOptions));
|
|
3314
|
+
}
|
|
3315
|
+
__deleteCustomerUnitAlias(request, requestOptions) {
|
|
3316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3317
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3318
|
+
const { id, externalCustomerUnitId, alias } = request;
|
|
3319
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3320
|
+
const _response = yield core.fetcher({
|
|
3321
|
+
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)}`),
|
|
3322
|
+
method: "DELETE",
|
|
3323
|
+
headers: _headers,
|
|
3324
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3325
|
+
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,
|
|
3326
|
+
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,
|
|
3327
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3328
|
+
});
|
|
3329
|
+
if (_response.ok) {
|
|
3330
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3331
|
+
}
|
|
3332
|
+
if (_response.error.reason === "status-code") {
|
|
3333
|
+
switch (_response.error.statusCode) {
|
|
3334
|
+
case 400:
|
|
3335
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3336
|
+
case 403:
|
|
3337
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3338
|
+
case 404:
|
|
3339
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3340
|
+
case 500:
|
|
3341
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3342
|
+
default:
|
|
3343
|
+
throw new errors.PaidError({
|
|
3344
|
+
statusCode: _response.error.statusCode,
|
|
3345
|
+
body: _response.error.body,
|
|
3346
|
+
rawResponse: _response.rawResponse,
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
switch (_response.error.reason) {
|
|
3351
|
+
case "non-json":
|
|
3352
|
+
throw new errors.PaidError({
|
|
3353
|
+
statusCode: _response.error.statusCode,
|
|
3354
|
+
body: _response.error.rawBody,
|
|
3355
|
+
rawResponse: _response.rawResponse,
|
|
3356
|
+
});
|
|
3357
|
+
case "timeout":
|
|
3358
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/customer-units/{externalCustomerUnitId}/aliases/{alias}.");
|
|
3359
|
+
case "unknown":
|
|
3360
|
+
throw new errors.PaidError({
|
|
3361
|
+
message: _response.error.errorMessage,
|
|
3362
|
+
rawResponse: _response.rawResponse,
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
/**
|
|
3368
|
+
* 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.
|
|
3369
|
+
*
|
|
3370
|
+
* @param {Paid.GetCustomerUnitByKeyRequest} request
|
|
3371
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3372
|
+
*
|
|
3373
|
+
* @throws {@link Paid.BadRequestError}
|
|
3374
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3375
|
+
* @throws {@link Paid.NotFoundError}
|
|
3376
|
+
* @throws {@link Paid.ConflictError}
|
|
3377
|
+
* @throws {@link Paid.InternalServerError}
|
|
3378
|
+
*
|
|
3379
|
+
* @example
|
|
3380
|
+
* await client.customers.getCustomerUnitByKey({
|
|
3381
|
+
* externalCustomerUnitId: "team-research"
|
|
3382
|
+
* })
|
|
3383
|
+
*/
|
|
3384
|
+
getCustomerUnitByKey(request, requestOptions) {
|
|
3385
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitByKey(request, requestOptions));
|
|
3386
|
+
}
|
|
3387
|
+
__getCustomerUnitByKey(request, requestOptions) {
|
|
3388
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3389
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3390
|
+
const { externalCustomerUnitId } = request;
|
|
3391
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3392
|
+
const _response = yield core.fetcher({
|
|
3393
|
+
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)}`),
|
|
3394
|
+
method: "GET",
|
|
3395
|
+
headers: _headers,
|
|
3396
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3397
|
+
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,
|
|
3398
|
+
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,
|
|
3399
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3400
|
+
});
|
|
3401
|
+
if (_response.ok) {
|
|
3402
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3403
|
+
}
|
|
3404
|
+
if (_response.error.reason === "status-code") {
|
|
3405
|
+
switch (_response.error.statusCode) {
|
|
3406
|
+
case 400:
|
|
3407
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3408
|
+
case 403:
|
|
3409
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3410
|
+
case 404:
|
|
3411
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3412
|
+
case 409:
|
|
3413
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3414
|
+
case 500:
|
|
3415
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3416
|
+
default:
|
|
3417
|
+
throw new errors.PaidError({
|
|
3418
|
+
statusCode: _response.error.statusCode,
|
|
3419
|
+
body: _response.error.body,
|
|
3420
|
+
rawResponse: _response.rawResponse,
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
switch (_response.error.reason) {
|
|
3425
|
+
case "non-json":
|
|
3426
|
+
throw new errors.PaidError({
|
|
3427
|
+
statusCode: _response.error.statusCode,
|
|
3428
|
+
body: _response.error.rawBody,
|
|
3429
|
+
rawResponse: _response.rawResponse,
|
|
3430
|
+
});
|
|
3431
|
+
case "timeout":
|
|
3432
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customer-units/external/{externalCustomerUnitId}.");
|
|
3433
|
+
case "unknown":
|
|
3434
|
+
throw new errors.PaidError({
|
|
3435
|
+
message: _response.error.errorMessage,
|
|
3436
|
+
rawResponse: _response.rawResponse,
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
}
|
|
3441
|
+
/**
|
|
3442
|
+
* 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.
|
|
3443
|
+
*
|
|
3444
|
+
* @param {Paid.ListCustomerUnitAliasesByKeyRequest} request
|
|
3445
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3446
|
+
*
|
|
3447
|
+
* @throws {@link Paid.BadRequestError}
|
|
3448
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3449
|
+
* @throws {@link Paid.NotFoundError}
|
|
3450
|
+
* @throws {@link Paid.ConflictError}
|
|
3451
|
+
* @throws {@link Paid.InternalServerError}
|
|
3452
|
+
*
|
|
3453
|
+
* @example
|
|
3454
|
+
* await client.customers.listCustomerUnitAliasesByKey({
|
|
3455
|
+
* externalCustomerUnitId: "team-research"
|
|
3456
|
+
* })
|
|
3457
|
+
*/
|
|
3458
|
+
listCustomerUnitAliasesByKey(request, requestOptions) {
|
|
3459
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerUnitAliasesByKey(request, requestOptions));
|
|
3460
|
+
}
|
|
3461
|
+
__listCustomerUnitAliasesByKey(request, requestOptions) {
|
|
3462
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3463
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3464
|
+
const { externalCustomerUnitId, limit, offset } = request;
|
|
3465
|
+
const _queryParams = {};
|
|
3466
|
+
if (limit != null) {
|
|
3467
|
+
_queryParams.limit = limit.toString();
|
|
3468
|
+
}
|
|
3469
|
+
if (offset != null) {
|
|
3470
|
+
_queryParams.offset = offset.toString();
|
|
3471
|
+
}
|
|
3472
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3473
|
+
const _response = yield core.fetcher({
|
|
3474
|
+
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`),
|
|
3475
|
+
method: "GET",
|
|
3476
|
+
headers: _headers,
|
|
3477
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3478
|
+
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,
|
|
3479
|
+
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,
|
|
3480
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3481
|
+
});
|
|
3482
|
+
if (_response.ok) {
|
|
3483
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3484
|
+
}
|
|
3485
|
+
if (_response.error.reason === "status-code") {
|
|
3486
|
+
switch (_response.error.statusCode) {
|
|
3487
|
+
case 400:
|
|
3488
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3489
|
+
case 403:
|
|
3490
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3491
|
+
case 404:
|
|
3492
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3493
|
+
case 409:
|
|
3494
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3495
|
+
case 500:
|
|
3496
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3497
|
+
default:
|
|
3498
|
+
throw new errors.PaidError({
|
|
3499
|
+
statusCode: _response.error.statusCode,
|
|
3500
|
+
body: _response.error.body,
|
|
3501
|
+
rawResponse: _response.rawResponse,
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
switch (_response.error.reason) {
|
|
3506
|
+
case "non-json":
|
|
3507
|
+
throw new errors.PaidError({
|
|
3508
|
+
statusCode: _response.error.statusCode,
|
|
3509
|
+
body: _response.error.rawBody,
|
|
3510
|
+
rawResponse: _response.rawResponse,
|
|
3511
|
+
});
|
|
3512
|
+
case "timeout":
|
|
3513
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customer-units/external/{externalCustomerUnitId}/aliases.");
|
|
3514
|
+
case "unknown":
|
|
3515
|
+
throw new errors.PaidError({
|
|
3516
|
+
message: _response.error.errorMessage,
|
|
3517
|
+
rawResponse: _response.rawResponse,
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
/**
|
|
3523
|
+
* 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.
|
|
3524
|
+
*
|
|
3525
|
+
* @param {Paid.CreateCustomerUnitAliasByKeyRequest} request
|
|
3526
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3527
|
+
*
|
|
3528
|
+
* @throws {@link Paid.BadRequestError}
|
|
3529
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3530
|
+
* @throws {@link Paid.NotFoundError}
|
|
3531
|
+
* @throws {@link Paid.ConflictError}
|
|
3532
|
+
* @throws {@link Paid.InternalServerError}
|
|
3533
|
+
*
|
|
3534
|
+
* @example
|
|
3535
|
+
* await client.customers.createCustomerUnitAliasByKey({
|
|
3536
|
+
* externalCustomerUnitId: "team-research",
|
|
3537
|
+
* body: {
|
|
3538
|
+
* alias: "child-customer-1"
|
|
3539
|
+
* }
|
|
3540
|
+
* })
|
|
3541
|
+
*/
|
|
3542
|
+
createCustomerUnitAliasByKey(request, requestOptions) {
|
|
3543
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitAliasByKey(request, requestOptions));
|
|
3544
|
+
}
|
|
3545
|
+
__createCustomerUnitAliasByKey(request, requestOptions) {
|
|
3546
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3548
|
+
const { externalCustomerUnitId, body: _body } = request;
|
|
3549
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3550
|
+
const _response = yield core.fetcher({
|
|
3551
|
+
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`),
|
|
3552
|
+
method: "POST",
|
|
3553
|
+
headers: _headers,
|
|
3554
|
+
contentType: "application/json",
|
|
3555
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3556
|
+
requestType: "json",
|
|
3557
|
+
body: _body,
|
|
3558
|
+
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,
|
|
3559
|
+
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,
|
|
3560
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3561
|
+
});
|
|
3562
|
+
if (_response.ok) {
|
|
3563
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3564
|
+
}
|
|
3565
|
+
if (_response.error.reason === "status-code") {
|
|
3566
|
+
switch (_response.error.statusCode) {
|
|
3567
|
+
case 400:
|
|
3568
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3569
|
+
case 403:
|
|
3570
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3571
|
+
case 404:
|
|
3572
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3573
|
+
case 409:
|
|
3574
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3575
|
+
case 500:
|
|
3576
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3577
|
+
default:
|
|
3578
|
+
throw new errors.PaidError({
|
|
3579
|
+
statusCode: _response.error.statusCode,
|
|
3580
|
+
body: _response.error.body,
|
|
3581
|
+
rawResponse: _response.rawResponse,
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
switch (_response.error.reason) {
|
|
3586
|
+
case "non-json":
|
|
3587
|
+
throw new errors.PaidError({
|
|
3588
|
+
statusCode: _response.error.statusCode,
|
|
3589
|
+
body: _response.error.rawBody,
|
|
3590
|
+
rawResponse: _response.rawResponse,
|
|
3591
|
+
});
|
|
3592
|
+
case "timeout":
|
|
3593
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customer-units/external/{externalCustomerUnitId}/aliases.");
|
|
3594
|
+
case "unknown":
|
|
3595
|
+
throw new errors.PaidError({
|
|
3596
|
+
message: _response.error.errorMessage,
|
|
3597
|
+
rawResponse: _response.rawResponse,
|
|
3598
|
+
});
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
/**
|
|
3603
|
+
* 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.
|
|
3604
|
+
*
|
|
3605
|
+
* @param {Paid.DeleteCustomerUnitAliasByKeyRequest} request
|
|
3606
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3607
|
+
*
|
|
3608
|
+
* @throws {@link Paid.BadRequestError}
|
|
3609
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3610
|
+
* @throws {@link Paid.NotFoundError}
|
|
3611
|
+
* @throws {@link Paid.ConflictError}
|
|
3612
|
+
* @throws {@link Paid.InternalServerError}
|
|
3613
|
+
*
|
|
3614
|
+
* @example
|
|
3615
|
+
* await client.customers.deleteCustomerUnitAliasByKey({
|
|
3616
|
+
* externalCustomerUnitId: "team-research",
|
|
3617
|
+
* alias: "tenant-7"
|
|
3618
|
+
* })
|
|
3619
|
+
*/
|
|
3620
|
+
deleteCustomerUnitAliasByKey(request, requestOptions) {
|
|
3621
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomerUnitAliasByKey(request, requestOptions));
|
|
3622
|
+
}
|
|
3623
|
+
__deleteCustomerUnitAliasByKey(request, requestOptions) {
|
|
3624
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3625
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3626
|
+
const { externalCustomerUnitId, alias } = request;
|
|
3627
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3628
|
+
const _response = yield core.fetcher({
|
|
3629
|
+
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)}`),
|
|
3630
|
+
method: "DELETE",
|
|
3631
|
+
headers: _headers,
|
|
3632
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3633
|
+
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,
|
|
3634
|
+
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,
|
|
3635
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3636
|
+
});
|
|
3637
|
+
if (_response.ok) {
|
|
3638
|
+
return {
|
|
3639
|
+
data: _response.body,
|
|
3640
|
+
rawResponse: _response.rawResponse,
|
|
3641
|
+
};
|
|
3642
|
+
}
|
|
3643
|
+
if (_response.error.reason === "status-code") {
|
|
3644
|
+
switch (_response.error.statusCode) {
|
|
3645
|
+
case 400:
|
|
3646
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3647
|
+
case 403:
|
|
3648
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3649
|
+
case 404:
|
|
3650
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3651
|
+
case 409:
|
|
3652
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3653
|
+
case 500:
|
|
3654
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3655
|
+
default:
|
|
3656
|
+
throw new errors.PaidError({
|
|
3657
|
+
statusCode: _response.error.statusCode,
|
|
3658
|
+
body: _response.error.body,
|
|
3659
|
+
rawResponse: _response.rawResponse,
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
switch (_response.error.reason) {
|
|
3664
|
+
case "non-json":
|
|
3665
|
+
throw new errors.PaidError({
|
|
3666
|
+
statusCode: _response.error.statusCode,
|
|
3667
|
+
body: _response.error.rawBody,
|
|
3668
|
+
rawResponse: _response.rawResponse,
|
|
3669
|
+
});
|
|
3670
|
+
case "timeout":
|
|
3671
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customer-units/external/{externalCustomerUnitId}/aliases/{alias}.");
|
|
3672
|
+
case "unknown":
|
|
3673
|
+
throw new errors.PaidError({
|
|
3674
|
+
message: _response.error.errorMessage,
|
|
3675
|
+
rawResponse: _response.rawResponse,
|
|
3676
|
+
});
|
|
3677
|
+
}
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
/**
|
|
3681
|
+
* 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.
|
|
3682
|
+
*
|
|
3683
|
+
* @param {Paid.CustomerUnitCreateUnderParent} request
|
|
3684
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3685
|
+
*
|
|
3686
|
+
* @throws {@link Paid.BadRequestError}
|
|
3687
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3688
|
+
* @throws {@link Paid.ConflictError}
|
|
3689
|
+
* @throws {@link Paid.InternalServerError}
|
|
3690
|
+
*
|
|
3691
|
+
* @example
|
|
3692
|
+
* await client.customers.createCustomerUnitUnderParent({
|
|
3693
|
+
* externalId: "team-research",
|
|
3694
|
+
* parentExternalId: "dept-rnd"
|
|
3695
|
+
* })
|
|
3696
|
+
*/
|
|
3697
|
+
createCustomerUnitUnderParent(request, requestOptions) {
|
|
3698
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerUnitUnderParent(request, requestOptions));
|
|
3699
|
+
}
|
|
3700
|
+
__createCustomerUnitUnderParent(request, requestOptions) {
|
|
3701
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3702
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3703
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3704
|
+
const _response = yield core.fetcher({
|
|
3705
|
+
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/"),
|
|
3706
|
+
method: "POST",
|
|
3707
|
+
headers: _headers,
|
|
3708
|
+
contentType: "application/json",
|
|
3709
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3710
|
+
requestType: "json",
|
|
3711
|
+
body: request,
|
|
3712
|
+
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,
|
|
3713
|
+
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,
|
|
3714
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3715
|
+
});
|
|
3716
|
+
if (_response.ok) {
|
|
3717
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3718
|
+
}
|
|
3719
|
+
if (_response.error.reason === "status-code") {
|
|
3720
|
+
switch (_response.error.statusCode) {
|
|
3721
|
+
case 400:
|
|
3722
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3723
|
+
case 403:
|
|
3724
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3725
|
+
case 409:
|
|
3726
|
+
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
3727
|
+
case 500:
|
|
3728
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3729
|
+
default:
|
|
3730
|
+
throw new errors.PaidError({
|
|
3731
|
+
statusCode: _response.error.statusCode,
|
|
3732
|
+
body: _response.error.body,
|
|
3733
|
+
rawResponse: _response.rawResponse,
|
|
3734
|
+
});
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
switch (_response.error.reason) {
|
|
3738
|
+
case "non-json":
|
|
3739
|
+
throw new errors.PaidError({
|
|
3740
|
+
statusCode: _response.error.statusCode,
|
|
3741
|
+
body: _response.error.rawBody,
|
|
3742
|
+
rawResponse: _response.rawResponse,
|
|
3743
|
+
});
|
|
3744
|
+
case "timeout":
|
|
3745
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customer-units/.");
|
|
3746
|
+
case "unknown":
|
|
3747
|
+
throw new errors.PaidError({
|
|
3748
|
+
message: _response.error.errorMessage,
|
|
3749
|
+
rawResponse: _response.rawResponse,
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
/**
|
|
3755
|
+
* 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.
|
|
3756
|
+
*
|
|
3757
|
+
* @param {Paid.ListCustomerApiKeysByExternalIdRequest} request
|
|
3758
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3759
|
+
*
|
|
3760
|
+
* @throws {@link Paid.BadRequestError}
|
|
3761
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3762
|
+
* @throws {@link Paid.NotFoundError}
|
|
3763
|
+
* @throws {@link Paid.InternalServerError}
|
|
3764
|
+
*
|
|
3765
|
+
* @example
|
|
3766
|
+
* await client.customers.listCustomerApiKeysByExternalId({
|
|
3767
|
+
* externalId: "customer_123"
|
|
3768
|
+
* })
|
|
3769
|
+
*/
|
|
3770
|
+
listCustomerApiKeysByExternalId(request, requestOptions) {
|
|
3771
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerApiKeysByExternalId(request, requestOptions));
|
|
3772
|
+
}
|
|
3773
|
+
__listCustomerApiKeysByExternalId(request, requestOptions) {
|
|
3774
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3775
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3776
|
+
const { externalId, limit, offset } = request;
|
|
3777
|
+
const _queryParams = {};
|
|
3778
|
+
if (limit != null) {
|
|
3779
|
+
_queryParams.limit = limit.toString();
|
|
3780
|
+
}
|
|
3781
|
+
if (offset != null) {
|
|
3782
|
+
_queryParams.offset = offset.toString();
|
|
3783
|
+
}
|
|
3784
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3785
|
+
const _response = yield core.fetcher({
|
|
3786
|
+
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`),
|
|
3787
|
+
method: "GET",
|
|
3788
|
+
headers: _headers,
|
|
3789
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3790
|
+
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,
|
|
3791
|
+
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,
|
|
3792
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3793
|
+
});
|
|
3794
|
+
if (_response.ok) {
|
|
3795
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3796
|
+
}
|
|
3797
|
+
if (_response.error.reason === "status-code") {
|
|
3798
|
+
switch (_response.error.statusCode) {
|
|
3799
|
+
case 400:
|
|
3800
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3801
|
+
case 403:
|
|
3802
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3803
|
+
case 404:
|
|
3804
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3805
|
+
case 500:
|
|
3806
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3807
|
+
default:
|
|
3808
|
+
throw new errors.PaidError({
|
|
3809
|
+
statusCode: _response.error.statusCode,
|
|
3810
|
+
body: _response.error.body,
|
|
3811
|
+
rawResponse: _response.rawResponse,
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
switch (_response.error.reason) {
|
|
3816
|
+
case "non-json":
|
|
3817
|
+
throw new errors.PaidError({
|
|
3818
|
+
statusCode: _response.error.statusCode,
|
|
3819
|
+
body: _response.error.rawBody,
|
|
3820
|
+
rawResponse: _response.rawResponse,
|
|
3821
|
+
});
|
|
3822
|
+
case "timeout":
|
|
3823
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/api-keys.");
|
|
3824
|
+
case "unknown":
|
|
3825
|
+
throw new errors.PaidError({
|
|
3826
|
+
message: _response.error.errorMessage,
|
|
3827
|
+
rawResponse: _response.rawResponse,
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
/**
|
|
3833
|
+
* 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.
|
|
3834
|
+
*
|
|
3835
|
+
* @param {Paid.CreateCustomerApiKeyByExternalIdRequest} request
|
|
3836
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3837
|
+
*
|
|
3838
|
+
* @throws {@link Paid.BadRequestError}
|
|
3839
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3840
|
+
* @throws {@link Paid.NotFoundError}
|
|
3841
|
+
* @throws {@link Paid.InternalServerError}
|
|
3842
|
+
*
|
|
3843
|
+
* @example
|
|
3844
|
+
* await client.customers.createCustomerApiKeyByExternalId({
|
|
3845
|
+
* externalId: "customer_123",
|
|
3846
|
+
* body: {
|
|
3847
|
+
* name: "Tenant runtime (production)"
|
|
3848
|
+
* }
|
|
3849
|
+
* })
|
|
3850
|
+
*/
|
|
3851
|
+
createCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3852
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerApiKeyByExternalId(request, requestOptions));
|
|
3853
|
+
}
|
|
3854
|
+
__createCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3855
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3856
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3857
|
+
const { externalId, body: _body } = request;
|
|
3858
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3859
|
+
const _response = yield core.fetcher({
|
|
3860
|
+
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`),
|
|
3861
|
+
method: "POST",
|
|
3862
|
+
headers: _headers,
|
|
3863
|
+
contentType: "application/json",
|
|
3864
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3865
|
+
requestType: "json",
|
|
3866
|
+
body: _body,
|
|
3867
|
+
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,
|
|
3868
|
+
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,
|
|
3869
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3870
|
+
});
|
|
3871
|
+
if (_response.ok) {
|
|
3872
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3873
|
+
}
|
|
3874
|
+
if (_response.error.reason === "status-code") {
|
|
3875
|
+
switch (_response.error.statusCode) {
|
|
3876
|
+
case 400:
|
|
3877
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3878
|
+
case 403:
|
|
3879
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3880
|
+
case 404:
|
|
3881
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3882
|
+
case 500:
|
|
3883
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3884
|
+
default:
|
|
3885
|
+
throw new errors.PaidError({
|
|
3886
|
+
statusCode: _response.error.statusCode,
|
|
3887
|
+
body: _response.error.body,
|
|
3888
|
+
rawResponse: _response.rawResponse,
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
switch (_response.error.reason) {
|
|
3893
|
+
case "non-json":
|
|
3894
|
+
throw new errors.PaidError({
|
|
3895
|
+
statusCode: _response.error.statusCode,
|
|
3896
|
+
body: _response.error.rawBody,
|
|
3897
|
+
rawResponse: _response.rawResponse,
|
|
3898
|
+
});
|
|
3899
|
+
case "timeout":
|
|
3900
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/api-keys.");
|
|
3901
|
+
case "unknown":
|
|
3902
|
+
throw new errors.PaidError({
|
|
3903
|
+
message: _response.error.errorMessage,
|
|
3904
|
+
rawResponse: _response.rawResponse,
|
|
3905
|
+
});
|
|
3906
|
+
}
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
/**
|
|
3910
|
+
* 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.
|
|
3911
|
+
*
|
|
3912
|
+
* @param {Paid.RevokeCustomerApiKeyByExternalIdRequest} request
|
|
3913
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3914
|
+
*
|
|
3915
|
+
* @throws {@link Paid.BadRequestError}
|
|
3916
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3917
|
+
* @throws {@link Paid.NotFoundError}
|
|
3918
|
+
* @throws {@link Paid.InternalServerError}
|
|
3919
|
+
*
|
|
3920
|
+
* @example
|
|
3921
|
+
* await client.customers.revokeCustomerApiKeyByExternalId({
|
|
3922
|
+
* externalId: "customer_123",
|
|
3923
|
+
* apiKeyId: "apiKeyId"
|
|
3924
|
+
* })
|
|
3925
|
+
*/
|
|
3926
|
+
revokeCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3927
|
+
return core.HttpResponsePromise.fromPromise(this.__revokeCustomerApiKeyByExternalId(request, requestOptions));
|
|
3928
|
+
}
|
|
3929
|
+
__revokeCustomerApiKeyByExternalId(request, requestOptions) {
|
|
3930
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3931
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3932
|
+
const { externalId, apiKeyId } = request;
|
|
3933
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3934
|
+
const _response = yield core.fetcher({
|
|
3935
|
+
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)}`),
|
|
3936
|
+
method: "DELETE",
|
|
3937
|
+
headers: _headers,
|
|
3938
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3939
|
+
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,
|
|
3940
|
+
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,
|
|
3941
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3942
|
+
});
|
|
3943
|
+
if (_response.ok) {
|
|
3944
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3945
|
+
}
|
|
3946
|
+
if (_response.error.reason === "status-code") {
|
|
3947
|
+
switch (_response.error.statusCode) {
|
|
3948
|
+
case 400:
|
|
3949
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
3950
|
+
case 403:
|
|
3951
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3952
|
+
case 404:
|
|
3953
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3954
|
+
case 500:
|
|
3955
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3956
|
+
default:
|
|
3957
|
+
throw new errors.PaidError({
|
|
3958
|
+
statusCode: _response.error.statusCode,
|
|
3959
|
+
body: _response.error.body,
|
|
3960
|
+
rawResponse: _response.rawResponse,
|
|
3961
|
+
});
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
switch (_response.error.reason) {
|
|
3965
|
+
case "non-json":
|
|
3966
|
+
throw new errors.PaidError({
|
|
3967
|
+
statusCode: _response.error.statusCode,
|
|
3968
|
+
body: _response.error.rawBody,
|
|
3969
|
+
rawResponse: _response.rawResponse,
|
|
3970
|
+
});
|
|
3971
|
+
case "timeout":
|
|
3972
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/api-keys/{apiKeyId}.");
|
|
3973
|
+
case "unknown":
|
|
3974
|
+
throw new errors.PaidError({
|
|
3975
|
+
message: _response.error.errorMessage,
|
|
3976
|
+
rawResponse: _response.rawResponse,
|
|
3977
|
+
});
|
|
3978
|
+
}
|
|
3979
|
+
});
|
|
3980
|
+
}
|
|
3981
|
+
/**
|
|
3982
|
+
* 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.
|
|
3983
|
+
*
|
|
3984
|
+
* @param {Paid.ListCustomerApiKeysRequest} request
|
|
3985
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
3986
|
+
*
|
|
3987
|
+
* @throws {@link Paid.BadRequestError}
|
|
3988
|
+
* @throws {@link Paid.ForbiddenError}
|
|
3989
|
+
* @throws {@link Paid.NotFoundError}
|
|
3990
|
+
* @throws {@link Paid.InternalServerError}
|
|
3991
|
+
*
|
|
3992
|
+
* @example
|
|
3993
|
+
* await client.customers.listCustomerApiKeys({
|
|
3994
|
+
* id: "cus_abc123"
|
|
3995
|
+
* })
|
|
3996
|
+
*/
|
|
3997
|
+
listCustomerApiKeys(request, requestOptions) {
|
|
3998
|
+
return core.HttpResponsePromise.fromPromise(this.__listCustomerApiKeys(request, requestOptions));
|
|
3999
|
+
}
|
|
4000
|
+
__listCustomerApiKeys(request, requestOptions) {
|
|
4001
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4002
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4003
|
+
const { id, limit, offset } = request;
|
|
4004
|
+
const _queryParams = {};
|
|
4005
|
+
if (limit != null) {
|
|
4006
|
+
_queryParams.limit = limit.toString();
|
|
4007
|
+
}
|
|
4008
|
+
if (offset != null) {
|
|
4009
|
+
_queryParams.offset = offset.toString();
|
|
4010
|
+
}
|
|
4011
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4012
|
+
const _response = yield core.fetcher({
|
|
4013
|
+
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`),
|
|
4014
|
+
method: "GET",
|
|
4015
|
+
headers: _headers,
|
|
4016
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4017
|
+
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,
|
|
4018
|
+
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,
|
|
4019
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4020
|
+
});
|
|
4021
|
+
if (_response.ok) {
|
|
4022
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4023
|
+
}
|
|
4024
|
+
if (_response.error.reason === "status-code") {
|
|
4025
|
+
switch (_response.error.statusCode) {
|
|
4026
|
+
case 400:
|
|
4027
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4028
|
+
case 403:
|
|
4029
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4030
|
+
case 404:
|
|
4031
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4032
|
+
case 500:
|
|
4033
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4034
|
+
default:
|
|
4035
|
+
throw new errors.PaidError({
|
|
4036
|
+
statusCode: _response.error.statusCode,
|
|
4037
|
+
body: _response.error.body,
|
|
4038
|
+
rawResponse: _response.rawResponse,
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
switch (_response.error.reason) {
|
|
4043
|
+
case "non-json":
|
|
4044
|
+
throw new errors.PaidError({
|
|
4045
|
+
statusCode: _response.error.statusCode,
|
|
4046
|
+
body: _response.error.rawBody,
|
|
4047
|
+
rawResponse: _response.rawResponse,
|
|
4048
|
+
});
|
|
4049
|
+
case "timeout":
|
|
4050
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/api-keys.");
|
|
4051
|
+
case "unknown":
|
|
4052
|
+
throw new errors.PaidError({
|
|
4053
|
+
message: _response.error.errorMessage,
|
|
4054
|
+
rawResponse: _response.rawResponse,
|
|
4055
|
+
});
|
|
4056
|
+
}
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
/**
|
|
4060
|
+
* 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.
|
|
4061
|
+
*
|
|
4062
|
+
* @param {Paid.CreateCustomerApiKeyRequest} request
|
|
4063
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4064
|
+
*
|
|
4065
|
+
* @throws {@link Paid.BadRequestError}
|
|
4066
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4067
|
+
* @throws {@link Paid.NotFoundError}
|
|
4068
|
+
* @throws {@link Paid.InternalServerError}
|
|
4069
|
+
*
|
|
4070
|
+
* @example
|
|
4071
|
+
* await client.customers.createCustomerApiKey({
|
|
4072
|
+
* id: "cus_abc123",
|
|
4073
|
+
* body: {
|
|
4074
|
+
* name: "Tenant runtime (production)"
|
|
4075
|
+
* }
|
|
4076
|
+
* })
|
|
4077
|
+
*/
|
|
4078
|
+
createCustomerApiKey(request, requestOptions) {
|
|
4079
|
+
return core.HttpResponsePromise.fromPromise(this.__createCustomerApiKey(request, requestOptions));
|
|
4080
|
+
}
|
|
4081
|
+
__createCustomerApiKey(request, requestOptions) {
|
|
4082
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4084
|
+
const { id, body: _body } = request;
|
|
2514
4085
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2515
4086
|
const _response = yield core.fetcher({
|
|
2516
|
-
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)}/
|
|
2517
|
-
method: "
|
|
4087
|
+
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`),
|
|
4088
|
+
method: "POST",
|
|
2518
4089
|
headers: _headers,
|
|
2519
4090
|
contentType: "application/json",
|
|
2520
4091
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -2535,8 +4106,6 @@ class Customers {
|
|
|
2535
4106
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2536
4107
|
case 404:
|
|
2537
4108
|
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2538
|
-
case 409:
|
|
2539
|
-
throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
|
|
2540
4109
|
case 500:
|
|
2541
4110
|
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2542
4111
|
default:
|
|
@@ -2555,7 +4124,79 @@ class Customers {
|
|
|
2555
4124
|
rawResponse: _response.rawResponse,
|
|
2556
4125
|
});
|
|
2557
4126
|
case "timeout":
|
|
2558
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling
|
|
4127
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/{id}/api-keys.");
|
|
4128
|
+
case "unknown":
|
|
4129
|
+
throw new errors.PaidError({
|
|
4130
|
+
message: _response.error.errorMessage,
|
|
4131
|
+
rawResponse: _response.rawResponse,
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
});
|
|
4135
|
+
}
|
|
4136
|
+
/**
|
|
4137
|
+
* 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.
|
|
4138
|
+
*
|
|
4139
|
+
* @param {Paid.RevokeCustomerApiKeyRequest} request
|
|
4140
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4141
|
+
*
|
|
4142
|
+
* @throws {@link Paid.BadRequestError}
|
|
4143
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4144
|
+
* @throws {@link Paid.NotFoundError}
|
|
4145
|
+
* @throws {@link Paid.InternalServerError}
|
|
4146
|
+
*
|
|
4147
|
+
* @example
|
|
4148
|
+
* await client.customers.revokeCustomerApiKey({
|
|
4149
|
+
* id: "cus_abc123",
|
|
4150
|
+
* apiKeyId: "apiKeyId"
|
|
4151
|
+
* })
|
|
4152
|
+
*/
|
|
4153
|
+
revokeCustomerApiKey(request, requestOptions) {
|
|
4154
|
+
return core.HttpResponsePromise.fromPromise(this.__revokeCustomerApiKey(request, requestOptions));
|
|
4155
|
+
}
|
|
4156
|
+
__revokeCustomerApiKey(request, requestOptions) {
|
|
4157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4159
|
+
const { id, apiKeyId } = request;
|
|
4160
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4161
|
+
const _response = yield core.fetcher({
|
|
4162
|
+
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)}`),
|
|
4163
|
+
method: "DELETE",
|
|
4164
|
+
headers: _headers,
|
|
4165
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
4166
|
+
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,
|
|
4167
|
+
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,
|
|
4168
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4169
|
+
});
|
|
4170
|
+
if (_response.ok) {
|
|
4171
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4172
|
+
}
|
|
4173
|
+
if (_response.error.reason === "status-code") {
|
|
4174
|
+
switch (_response.error.statusCode) {
|
|
4175
|
+
case 400:
|
|
4176
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4177
|
+
case 403:
|
|
4178
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4179
|
+
case 404:
|
|
4180
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4181
|
+
case 500:
|
|
4182
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4183
|
+
default:
|
|
4184
|
+
throw new errors.PaidError({
|
|
4185
|
+
statusCode: _response.error.statusCode,
|
|
4186
|
+
body: _response.error.body,
|
|
4187
|
+
rawResponse: _response.rawResponse,
|
|
4188
|
+
});
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
switch (_response.error.reason) {
|
|
4192
|
+
case "non-json":
|
|
4193
|
+
throw new errors.PaidError({
|
|
4194
|
+
statusCode: _response.error.statusCode,
|
|
4195
|
+
body: _response.error.rawBody,
|
|
4196
|
+
rawResponse: _response.rawResponse,
|
|
4197
|
+
});
|
|
4198
|
+
case "timeout":
|
|
4199
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{id}/api-keys/{apiKeyId}.");
|
|
2559
4200
|
case "unknown":
|
|
2560
4201
|
throw new errors.PaidError({
|
|
2561
4202
|
message: _response.error.errorMessage,
|
|
@@ -2642,7 +4283,7 @@ class Customers {
|
|
|
2642
4283
|
});
|
|
2643
4284
|
}
|
|
2644
4285
|
/**
|
|
2645
|
-
* Sets the cap on this customer unit for one credits currency
|
|
4286
|
+
* 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.
|
|
2646
4287
|
*
|
|
2647
4288
|
* @param {Paid.SetCustomerUnitCapByExternalIdRequest} request
|
|
2648
4289
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2802,6 +4443,91 @@ class Customers {
|
|
|
2802
4443
|
}
|
|
2803
4444
|
});
|
|
2804
4445
|
}
|
|
4446
|
+
/**
|
|
4447
|
+
* 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.
|
|
4448
|
+
*
|
|
4449
|
+
* @param {Paid.GetCustomerUnitSpendByExternalIdRequest} request
|
|
4450
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4451
|
+
*
|
|
4452
|
+
* @throws {@link Paid.BadRequestError}
|
|
4453
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4454
|
+
* @throws {@link Paid.NotFoundError}
|
|
4455
|
+
* @throws {@link Paid.InternalServerError}
|
|
4456
|
+
*
|
|
4457
|
+
* @example
|
|
4458
|
+
* await client.customers.getCustomerUnitSpendByExternalId({
|
|
4459
|
+
* externalId: "customer_123",
|
|
4460
|
+
* externalCustomerUnitId: "tenant-a",
|
|
4461
|
+
* creditsCurrencyId: "7f4f5d4c-55e9-4d5b-a3e7-c9eb3d2d01bf",
|
|
4462
|
+
* start: "2026-10-01T00:00:00Z",
|
|
4463
|
+
* end: "2026-11-01T00:00:00Z"
|
|
4464
|
+
* })
|
|
4465
|
+
*/
|
|
4466
|
+
getCustomerUnitSpendByExternalId(request, requestOptions) {
|
|
4467
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitSpendByExternalId(request, requestOptions));
|
|
4468
|
+
}
|
|
4469
|
+
__getCustomerUnitSpendByExternalId(request, requestOptions) {
|
|
4470
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4471
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4472
|
+
const { externalId, externalCustomerUnitId, creditsCurrencyId, start, end } = request;
|
|
4473
|
+
const _queryParams = {};
|
|
4474
|
+
if (creditsCurrencyId != null) {
|
|
4475
|
+
_queryParams.creditsCurrencyId = creditsCurrencyId;
|
|
4476
|
+
}
|
|
4477
|
+
if (start != null) {
|
|
4478
|
+
_queryParams.start = start;
|
|
4479
|
+
}
|
|
4480
|
+
if (end != null) {
|
|
4481
|
+
_queryParams.end = end;
|
|
4482
|
+
}
|
|
4483
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4484
|
+
const _response = yield core.fetcher({
|
|
4485
|
+
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`),
|
|
4486
|
+
method: "GET",
|
|
4487
|
+
headers: _headers,
|
|
4488
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4489
|
+
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,
|
|
4490
|
+
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,
|
|
4491
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4492
|
+
});
|
|
4493
|
+
if (_response.ok) {
|
|
4494
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4495
|
+
}
|
|
4496
|
+
if (_response.error.reason === "status-code") {
|
|
4497
|
+
switch (_response.error.statusCode) {
|
|
4498
|
+
case 400:
|
|
4499
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4500
|
+
case 403:
|
|
4501
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4502
|
+
case 404:
|
|
4503
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4504
|
+
case 500:
|
|
4505
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4506
|
+
default:
|
|
4507
|
+
throw new errors.PaidError({
|
|
4508
|
+
statusCode: _response.error.statusCode,
|
|
4509
|
+
body: _response.error.body,
|
|
4510
|
+
rawResponse: _response.rawResponse,
|
|
4511
|
+
});
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
switch (_response.error.reason) {
|
|
4515
|
+
case "non-json":
|
|
4516
|
+
throw new errors.PaidError({
|
|
4517
|
+
statusCode: _response.error.statusCode,
|
|
4518
|
+
body: _response.error.rawBody,
|
|
4519
|
+
rawResponse: _response.rawResponse,
|
|
4520
|
+
});
|
|
4521
|
+
case "timeout":
|
|
4522
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/customer-units/{externalCustomerUnitId}/spend.");
|
|
4523
|
+
case "unknown":
|
|
4524
|
+
throw new errors.PaidError({
|
|
4525
|
+
message: _response.error.errorMessage,
|
|
4526
|
+
rawResponse: _response.rawResponse,
|
|
4527
|
+
});
|
|
4528
|
+
}
|
|
4529
|
+
});
|
|
4530
|
+
}
|
|
2805
4531
|
/**
|
|
2806
4532
|
* 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.
|
|
2807
4533
|
*
|
|
@@ -2880,7 +4606,7 @@ class Customers {
|
|
|
2880
4606
|
});
|
|
2881
4607
|
}
|
|
2882
4608
|
/**
|
|
2883
|
-
* Sets the cap on this customer unit for one credits currency
|
|
4609
|
+
* 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.
|
|
2884
4610
|
*
|
|
2885
4611
|
* @param {Paid.SetCustomerUnitCapRequest} request
|
|
2886
4612
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3040,6 +4766,91 @@ class Customers {
|
|
|
3040
4766
|
}
|
|
3041
4767
|
});
|
|
3042
4768
|
}
|
|
4769
|
+
/**
|
|
4770
|
+
* 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.
|
|
4771
|
+
*
|
|
4772
|
+
* @param {Paid.GetCustomerUnitSpendRequest} request
|
|
4773
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
4774
|
+
*
|
|
4775
|
+
* @throws {@link Paid.BadRequestError}
|
|
4776
|
+
* @throws {@link Paid.ForbiddenError}
|
|
4777
|
+
* @throws {@link Paid.NotFoundError}
|
|
4778
|
+
* @throws {@link Paid.InternalServerError}
|
|
4779
|
+
*
|
|
4780
|
+
* @example
|
|
4781
|
+
* await client.customers.getCustomerUnitSpend({
|
|
4782
|
+
* id: "cus_abc123",
|
|
4783
|
+
* externalCustomerUnitId: "tenant-a",
|
|
4784
|
+
* creditsCurrencyId: "7f4f5d4c-55e9-4d5b-a3e7-c9eb3d2d01bf",
|
|
4785
|
+
* start: "2026-10-01T00:00:00Z",
|
|
4786
|
+
* end: "2026-11-01T00:00:00Z"
|
|
4787
|
+
* })
|
|
4788
|
+
*/
|
|
4789
|
+
getCustomerUnitSpend(request, requestOptions) {
|
|
4790
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerUnitSpend(request, requestOptions));
|
|
4791
|
+
}
|
|
4792
|
+
__getCustomerUnitSpend(request, requestOptions) {
|
|
4793
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4794
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4795
|
+
const { id, externalCustomerUnitId, creditsCurrencyId, start, end } = request;
|
|
4796
|
+
const _queryParams = {};
|
|
4797
|
+
if (creditsCurrencyId != null) {
|
|
4798
|
+
_queryParams.creditsCurrencyId = creditsCurrencyId;
|
|
4799
|
+
}
|
|
4800
|
+
if (start != null) {
|
|
4801
|
+
_queryParams.start = start;
|
|
4802
|
+
}
|
|
4803
|
+
if (end != null) {
|
|
4804
|
+
_queryParams.end = end;
|
|
4805
|
+
}
|
|
4806
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
4807
|
+
const _response = yield core.fetcher({
|
|
4808
|
+
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`),
|
|
4809
|
+
method: "GET",
|
|
4810
|
+
headers: _headers,
|
|
4811
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4812
|
+
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,
|
|
4813
|
+
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,
|
|
4814
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4815
|
+
});
|
|
4816
|
+
if (_response.ok) {
|
|
4817
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4818
|
+
}
|
|
4819
|
+
if (_response.error.reason === "status-code") {
|
|
4820
|
+
switch (_response.error.statusCode) {
|
|
4821
|
+
case 400:
|
|
4822
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
4823
|
+
case 403:
|
|
4824
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
4825
|
+
case 404:
|
|
4826
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4827
|
+
case 500:
|
|
4828
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4829
|
+
default:
|
|
4830
|
+
throw new errors.PaidError({
|
|
4831
|
+
statusCode: _response.error.statusCode,
|
|
4832
|
+
body: _response.error.body,
|
|
4833
|
+
rawResponse: _response.rawResponse,
|
|
4834
|
+
});
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
switch (_response.error.reason) {
|
|
4838
|
+
case "non-json":
|
|
4839
|
+
throw new errors.PaidError({
|
|
4840
|
+
statusCode: _response.error.statusCode,
|
|
4841
|
+
body: _response.error.rawBody,
|
|
4842
|
+
rawResponse: _response.rawResponse,
|
|
4843
|
+
});
|
|
4844
|
+
case "timeout":
|
|
4845
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/customer-units/{externalCustomerUnitId}/spend.");
|
|
4846
|
+
case "unknown":
|
|
4847
|
+
throw new errors.PaidError({
|
|
4848
|
+
message: _response.error.errorMessage,
|
|
4849
|
+
rawResponse: _response.rawResponse,
|
|
4850
|
+
});
|
|
4851
|
+
}
|
|
4852
|
+
});
|
|
4853
|
+
}
|
|
3043
4854
|
_getAuthorizationHeader() {
|
|
3044
4855
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3045
4856
|
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|