@paid-ai/paid-node 0.5.1 → 1.0.1-alpha0
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/README.md +11 -11
- package/dist/cjs/BaseClient.d.ts +26 -0
- package/dist/cjs/BaseClient.js +3 -0
- package/dist/cjs/Client.d.ts +6 -69
- package/dist/cjs/Client.js +20 -88
- package/dist/cjs/api/errors/BadRequestError.d.ts +2 -5
- package/dist/cjs/api/errors/BadRequestError.js +1 -3
- package/dist/cjs/api/errors/ForbiddenError.d.ts +2 -5
- package/dist/cjs/api/errors/ForbiddenError.js +1 -3
- package/dist/cjs/api/errors/InternalServerError.d.ts +2 -5
- package/dist/cjs/api/errors/InternalServerError.js +1 -3
- package/dist/cjs/api/errors/NotFoundError.d.ts +2 -5
- package/dist/cjs/api/errors/NotFoundError.js +1 -3
- package/dist/cjs/api/errors/index.d.ts +2 -2
- package/dist/cjs/api/errors/index.js +2 -2
- package/dist/cjs/api/index.d.ts +1 -1
- package/dist/cjs/api/index.js +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +4 -21
- package/dist/cjs/api/resources/agents/client/Client.js +59 -49
- package/dist/cjs/api/resources/agents/client/requests/AgentCreate.d.ts +0 -3
- package/dist/cjs/api/resources/agents/client/requests/AgentCreate.js +1 -3
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +4 -21
- package/dist/cjs/api/resources/contacts/client/Client.js +45 -39
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +1 -4
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.js +1 -3
- package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/customers/client/Client.d.ts +84 -21
- package/dist/cjs/api/resources/customers/client/Client.js +376 -76
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +17 -5
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.ts +14 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.ts +18 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +4 -15
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +4 -15
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +5 -3
- package/dist/cjs/api/resources/customers/index.d.ts +1 -0
- package/dist/cjs/api/resources/customers/index.js +1 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.ts +5 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.js +8 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.js +3 -0
- package/dist/cjs/api/resources/customers/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/customers/types/index.js +18 -0
- package/dist/cjs/api/resources/index.d.ts +12 -11
- package/dist/cjs/api/resources/index.js +16 -15
- package/dist/cjs/api/resources/orders/client/Client.d.ts +82 -20
- package/dist/cjs/api/resources/orders/client/Client.js +325 -34
- package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.d.ts +13 -0
- package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +1 -4
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.js +1 -3
- package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.ts +13 -0
- package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.d.ts +24 -0
- package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/index.d.ts +4 -1
- package/dist/cjs/api/resources/orders/resources/index.d.ts +1 -1
- package/dist/cjs/api/resources/orders/resources/index.js +4 -4
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +4 -21
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +10 -14
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +1 -4
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.js +1 -3
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/plans/client/Client.d.ts +3 -20
- package/dist/cjs/api/resources/plans/client/Client.js +30 -31
- package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +5 -18
- package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.js +1 -3
- package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/products/client/Client.d.ts +4 -21
- package/dist/cjs/api/resources/products/client/Client.js +59 -49
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +1 -4
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +1 -3
- package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/traces/client/Client.d.ts +3 -20
- package/dist/cjs/api/resources/traces/client/Client.js +19 -24
- package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +8 -27
- package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.js +1 -3
- package/dist/cjs/api/resources/traces/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/usage/client/Client.d.ts +3 -20
- package/dist/cjs/api/resources/usage/client/Client.js +25 -25
- package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +0 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +1 -4
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +1 -4
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/index.d.ts +3 -3
- package/dist/cjs/api/resources/usage/index.d.ts +1 -1
- package/dist/cjs/api/resources/usage/index.js +1 -1
- package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +0 -3
- package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.js +1 -3
- package/dist/cjs/api/types/Address.d.ts +0 -3
- package/dist/cjs/api/types/Address.js +1 -3
- package/dist/cjs/api/types/Agent.d.ts +1 -4
- package/dist/cjs/api/types/Agent.js +1 -3
- package/dist/cjs/api/types/AgentAttribute.d.ts +1 -4
- package/dist/cjs/api/types/AgentAttribute.js +1 -3
- package/dist/cjs/api/types/AgentPricePoint.d.ts +1 -4
- package/dist/cjs/api/types/AgentPricePoint.js +1 -3
- package/dist/cjs/api/types/AgentPricePointTiers.d.ts +0 -3
- package/dist/cjs/api/types/AgentPricePointTiers.js +1 -3
- package/dist/cjs/api/types/AgentUpdate.d.ts +1 -4
- package/dist/cjs/api/types/AgentUpdate.js +1 -3
- package/dist/cjs/api/types/ApiError.d.ts +0 -3
- package/dist/cjs/api/types/ApiError.js +1 -3
- package/dist/cjs/api/types/BillingFrequency.d.ts +1 -4
- package/dist/cjs/api/types/BillingFrequency.js +1 -3
- package/dist/cjs/api/types/CancelRenewalResponse.d.ts +15 -0
- package/dist/cjs/api/types/CancelRenewalResponse.js +3 -0
- package/dist/cjs/api/types/ChargeType.d.ts +1 -4
- package/dist/cjs/api/types/ChargeType.js +1 -3
- package/dist/cjs/api/types/Contact.d.ts +1 -4
- package/dist/cjs/api/types/Contact.js +1 -3
- package/dist/cjs/api/types/ContactCreateForCustomer.d.ts +15 -0
- package/dist/cjs/api/types/ContactCreateForCustomer.js +3 -0
- package/dist/cjs/api/types/CostAmount.d.ts +0 -3
- package/dist/cjs/api/types/CostAmount.js +1 -3
- package/dist/cjs/api/types/CostTrace.d.ts +1 -4
- package/dist/cjs/api/types/CostTrace.js +1 -3
- package/dist/cjs/api/types/CostTracesResponse.d.ts +1 -4
- package/dist/cjs/api/types/CostTracesResponse.js +1 -3
- package/dist/cjs/api/types/CreationSource.d.ts +1 -4
- package/dist/cjs/api/types/CreationSource.js +1 -3
- package/dist/cjs/api/types/CreationState.d.ts +1 -4
- package/dist/cjs/api/types/CreationState.js +1 -3
- package/dist/cjs/api/types/Customer.d.ts +1 -4
- package/dist/cjs/api/types/Customer.js +1 -3
- package/dist/cjs/api/types/CustomerUpdate.d.ts +1 -4
- package/dist/cjs/api/types/CustomerUpdate.js +1 -3
- package/dist/cjs/api/types/EntitlementUsage.d.ts +0 -3
- package/dist/cjs/api/types/EntitlementUsage.js +1 -3
- package/dist/cjs/api/types/Error_.d.ts +1 -4
- package/dist/cjs/api/types/Error_.js +1 -3
- package/dist/cjs/api/types/Invoice.d.ts +40 -0
- package/dist/cjs/api/types/Invoice.js +14 -0
- package/dist/cjs/api/types/Order.d.ts +1 -4
- package/dist/cjs/api/types/Order.js +1 -3
- package/dist/cjs/api/types/OrderLine.d.ts +1 -4
- package/dist/cjs/api/types/OrderLine.js +1 -3
- package/dist/cjs/api/types/OrderLineAttribute.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineAttribute.js +1 -3
- package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +0 -3
- package/dist/cjs/api/types/OrderLineAttributeCreateOne.js +1 -3
- package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineAttributePricing.js +1 -3
- package/dist/cjs/api/types/OrderLineCreate.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineCreate.js +1 -3
- package/dist/cjs/api/types/PaginationMeta.d.ts +0 -3
- package/dist/cjs/api/types/PaginationMeta.js +1 -3
- package/dist/cjs/api/types/PaymentMethod.d.ts +54 -0
- package/dist/cjs/api/types/PaymentMethod.js +20 -0
- package/dist/cjs/api/types/Plan.d.ts +3 -3
- package/dist/cjs/api/types/Plan.js +1 -3
- package/dist/cjs/api/types/PlanGroup.d.ts +1 -4
- package/dist/cjs/api/types/PlanGroup.js +1 -3
- package/dist/cjs/api/types/PricePoint.d.ts +1 -4
- package/dist/cjs/api/types/PricePoint.js +1 -3
- package/dist/cjs/api/types/Pricing.d.ts +1 -4
- package/dist/cjs/api/types/Pricing.js +1 -3
- package/dist/cjs/api/types/PricingModelType.d.ts +1 -4
- package/dist/cjs/api/types/PricingModelType.js +1 -3
- package/dist/cjs/api/types/Product.d.ts +3 -8
- package/dist/cjs/api/types/Product.js +2 -3
- package/dist/cjs/api/types/ProductUpdate.d.ts +2 -5
- package/dist/cjs/api/types/ProductUpdate.js +1 -3
- package/dist/cjs/api/types/ProrationAttributeUpdate.d.ts +11 -0
- package/dist/cjs/api/types/ProrationAttributeUpdate.js +3 -0
- package/dist/cjs/api/types/ProrationDetail.d.ts +16 -0
- package/dist/cjs/api/types/ProrationDetail.js +3 -0
- package/dist/cjs/api/types/ProrationUpgradeResponse.d.ts +22 -0
- package/dist/cjs/api/types/ProrationUpgradeResponse.js +3 -0
- package/dist/cjs/api/types/Salutation.d.ts +1 -4
- package/dist/cjs/api/types/Salutation.js +1 -3
- package/dist/cjs/api/types/Signal.d.ts +0 -3
- package/dist/cjs/api/types/Signal.js +1 -3
- package/dist/cjs/api/types/SignalV2.d.ts +0 -3
- package/dist/cjs/api/types/SignalV2.js +1 -3
- package/dist/cjs/api/types/TaxExemptStatus.d.ts +1 -4
- package/dist/cjs/api/types/TaxExemptStatus.js +1 -3
- package/dist/cjs/api/types/Tier.d.ts +0 -3
- package/dist/cjs/api/types/Tier.js +1 -3
- package/dist/cjs/api/types/Trace.d.ts +1 -4
- package/dist/cjs/api/types/Trace.js +1 -3
- package/dist/cjs/api/types/TracesResponse.d.ts +1 -4
- package/dist/cjs/api/types/TracesResponse.js +1 -3
- package/dist/cjs/api/types/UsagePaginationMeta.d.ts +0 -3
- package/dist/cjs/api/types/UsagePaginationMeta.js +1 -3
- package/dist/cjs/api/types/UsageSummariesResponse.d.ts +1 -4
- package/dist/cjs/api/types/UsageSummariesResponse.js +1 -3
- package/dist/cjs/api/types/UsageSummary.d.ts +0 -3
- package/dist/cjs/api/types/UsageSummary.js +1 -3
- package/dist/cjs/api/types/index.d.ts +33 -26
- package/dist/cjs/api/types/index.js +33 -26
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.js +5 -4
- package/dist/cjs/core/auth/index.d.ts +2 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +20 -0
- package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/{esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs → cjs/core/fetcher/EndpointSupplier.js} +10 -11
- package/dist/cjs/core/fetcher/Fetcher.d.ts +7 -5
- package/dist/cjs/core/fetcher/Fetcher.js +9 -7
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +1 -1
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/cjs/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/cjs/core/fetcher/createRequestUrl.js +3 -7
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -4
- package/dist/cjs/core/fetcher/getFetchFn.js +1 -52
- package/dist/cjs/core/fetcher/getResponseBody.js +34 -33
- package/dist/cjs/core/fetcher/index.d.ts +7 -4
- package/dist/cjs/core/fetcher/index.js +7 -5
- package/dist/cjs/core/fetcher/makeRequest.js +2 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
- package/dist/cjs/core/headers.d.ts +2 -3
- package/dist/cjs/core/index.d.ts +3 -1
- package/dist/cjs/core/index.js +26 -1
- package/dist/cjs/core/runtime/runtime.js +0 -1
- package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
- package/dist/cjs/core/url/encodePathParam.js +21 -0
- package/dist/cjs/core/url/index.d.ts +3 -0
- package/dist/cjs/core/url/index.js +9 -0
- package/dist/cjs/core/url/join.d.ts +1 -0
- package/dist/cjs/core/url/join.js +69 -0
- package/dist/cjs/core/url/qs.d.ts +6 -0
- package/dist/cjs/core/url/qs.js +64 -0
- package/dist/cjs/environments.d.ts +0 -3
- package/dist/cjs/environments.js +1 -3
- package/dist/cjs/errors/PaidError.d.ts +1 -4
- package/dist/cjs/errors/PaidError.js +2 -4
- package/dist/cjs/errors/PaidTimeoutError.d.ts +0 -3
- package/dist/cjs/errors/PaidTimeoutError.js +1 -3
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +1 -6
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +8 -5
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +6 -11
- package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +14 -12
- package/dist/cjs/integrations/adapters/expressjs/routes.js +18 -9
- package/dist/cjs/integrations/adapters/nextjs/base-adapter.d.ts +3 -2
- package/dist/cjs/integrations/adapters/nextjs/routes.d.ts +13 -11
- package/dist/cjs/integrations/adapters/nextjs/routes.js +18 -9
- package/dist/cjs/integrations/controllers/billing.d.ts +3 -17
- package/dist/cjs/integrations/controllers/contacts.d.ts +1 -1
- package/dist/cjs/integrations/controllers/customers.d.ts +2 -2
- package/dist/cjs/integrations/controllers/invoices.d.ts +2 -6
- package/dist/cjs/integrations/controllers/orders.d.ts +1 -5
- package/dist/cjs/integrations/controllers/provision-users.d.ts +1 -1
- package/dist/cjs/integrations/utils/create-adapter.d.ts +2 -1
- package/dist/cjs/integrations/utils/create-adapter.js +2 -1
- package/dist/cjs/tracing/autoInstrumentation.js +5 -5
- package/dist/cjs/tracing/spanProcessor.d.ts +2 -2
- package/dist/cjs/tracing/spanProcessor.js +0 -5
- package/dist/cjs/tracing/tracing.d.ts +1 -1
- package/dist/cjs/tracing/tracing.js +2 -0
- package/dist/cjs/tracing/wrappers/anthropicWrapper.d.ts +2 -2
- package/dist/cjs/tracing/wrappers/mistralWrapper.d.ts +3 -3
- package/dist/cjs/tracing/wrappers/openAiWrapper.d.ts +5 -5
- package/dist/cjs/tracing/wrappers/vercelAIWrapper.d.ts +2 -2
- package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +8 -7
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +26 -0
- package/dist/esm/BaseClient.mjs +2 -0
- package/dist/esm/Client.d.mts +6 -69
- package/dist/esm/Client.mjs +9 -77
- package/dist/esm/api/errors/BadRequestError.d.mts +2 -5
- package/dist/esm/api/errors/BadRequestError.mjs +1 -3
- package/dist/esm/api/errors/ForbiddenError.d.mts +2 -5
- package/dist/esm/api/errors/ForbiddenError.mjs +1 -3
- package/dist/esm/api/errors/InternalServerError.d.mts +2 -5
- package/dist/esm/api/errors/InternalServerError.mjs +1 -3
- package/dist/esm/api/errors/NotFoundError.d.mts +2 -5
- package/dist/esm/api/errors/NotFoundError.mjs +1 -3
- package/dist/esm/api/errors/index.d.mts +2 -2
- package/dist/esm/api/errors/index.mjs +2 -2
- package/dist/esm/api/index.d.mts +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +4 -21
- package/dist/esm/api/resources/agents/client/Client.mjs +59 -46
- package/dist/esm/api/resources/agents/client/requests/AgentCreate.d.mts +0 -3
- package/dist/esm/api/resources/agents/client/requests/AgentCreate.mjs +1 -3
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/contacts/client/Client.d.mts +4 -21
- package/dist/esm/api/resources/contacts/client/Client.mjs +45 -36
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +1 -4
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.mjs +1 -3
- package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/customers/client/Client.d.mts +84 -21
- package/dist/esm/api/resources/customers/client/Client.mjs +376 -73
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +17 -5
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.mts +14 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.mts +18 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +4 -15
- package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +4 -15
- package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +5 -3
- package/dist/esm/api/resources/customers/index.d.mts +1 -0
- package/dist/esm/api/resources/customers/index.mjs +1 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.mts +5 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.mjs +5 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.d.mts +4 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.mjs +2 -0
- package/dist/esm/api/resources/customers/types/index.d.mts +2 -0
- package/dist/esm/api/resources/customers/types/index.mjs +2 -0
- package/dist/esm/api/resources/index.d.mts +12 -11
- package/dist/esm/api/resources/index.mjs +12 -11
- package/dist/esm/api/resources/orders/client/Client.d.mts +82 -20
- package/dist/esm/api/resources/orders/client/Client.mjs +325 -31
- package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.d.mts +13 -0
- package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +1 -4
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.mjs +1 -3
- package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.mts +13 -0
- package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.d.mts +24 -0
- package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/index.d.mts +4 -1
- package/dist/esm/api/resources/orders/resources/index.d.mts +1 -1
- package/dist/esm/api/resources/orders/resources/index.mjs +1 -1
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +4 -21
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +10 -11
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +1 -4
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.mjs +1 -3
- package/dist/esm/api/resources/orders/resources/lines/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/plans/client/Client.d.mts +3 -20
- package/dist/esm/api/resources/plans/client/Client.mjs +30 -28
- package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +5 -18
- package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.mjs +1 -3
- package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/products/client/Client.d.mts +4 -21
- package/dist/esm/api/resources/products/client/Client.mjs +59 -46
- package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +1 -4
- package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +1 -3
- package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/traces/client/Client.d.mts +3 -20
- package/dist/esm/api/resources/traces/client/Client.mjs +19 -21
- package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +8 -27
- package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.mjs +1 -3
- package/dist/esm/api/resources/traces/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/usage/client/Client.d.mts +3 -20
- package/dist/esm/api/resources/usage/client/Client.mjs +25 -22
- package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +0 -3
- package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +1 -4
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +1 -4
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/index.d.mts +3 -3
- package/dist/esm/api/resources/usage/index.d.mts +1 -1
- package/dist/esm/api/resources/usage/index.mjs +1 -1
- package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +0 -3
- package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.mjs +1 -3
- package/dist/esm/api/types/Address.d.mts +0 -3
- package/dist/esm/api/types/Address.mjs +1 -3
- package/dist/esm/api/types/Agent.d.mts +1 -4
- package/dist/esm/api/types/Agent.mjs +1 -3
- package/dist/esm/api/types/AgentAttribute.d.mts +1 -4
- package/dist/esm/api/types/AgentAttribute.mjs +1 -3
- package/dist/esm/api/types/AgentPricePoint.d.mts +1 -4
- package/dist/esm/api/types/AgentPricePoint.mjs +1 -3
- package/dist/esm/api/types/AgentPricePointTiers.d.mts +0 -3
- package/dist/esm/api/types/AgentPricePointTiers.mjs +1 -3
- package/dist/esm/api/types/AgentUpdate.d.mts +1 -4
- package/dist/esm/api/types/AgentUpdate.mjs +1 -3
- package/dist/esm/api/types/ApiError.d.mts +0 -3
- package/dist/esm/api/types/ApiError.mjs +1 -3
- package/dist/esm/api/types/BillingFrequency.d.mts +1 -4
- package/dist/esm/api/types/BillingFrequency.mjs +1 -3
- package/dist/esm/api/types/CancelRenewalResponse.d.mts +15 -0
- package/dist/esm/api/types/CancelRenewalResponse.mjs +2 -0
- package/dist/esm/api/types/ChargeType.d.mts +1 -4
- package/dist/esm/api/types/ChargeType.mjs +1 -3
- package/dist/esm/api/types/Contact.d.mts +1 -4
- package/dist/esm/api/types/Contact.mjs +1 -3
- package/dist/esm/api/types/ContactCreateForCustomer.d.mts +15 -0
- package/dist/esm/api/types/ContactCreateForCustomer.mjs +2 -0
- package/dist/esm/api/types/CostAmount.d.mts +0 -3
- package/dist/esm/api/types/CostAmount.mjs +1 -3
- package/dist/esm/api/types/CostTrace.d.mts +1 -4
- package/dist/esm/api/types/CostTrace.mjs +1 -3
- package/dist/esm/api/types/CostTracesResponse.d.mts +1 -4
- package/dist/esm/api/types/CostTracesResponse.mjs +1 -3
- package/dist/esm/api/types/CreationSource.d.mts +1 -4
- package/dist/esm/api/types/CreationSource.mjs +1 -3
- package/dist/esm/api/types/CreationState.d.mts +1 -4
- package/dist/esm/api/types/CreationState.mjs +1 -3
- package/dist/esm/api/types/Customer.d.mts +1 -4
- package/dist/esm/api/types/Customer.mjs +1 -3
- package/dist/esm/api/types/CustomerUpdate.d.mts +1 -4
- package/dist/esm/api/types/CustomerUpdate.mjs +1 -3
- package/dist/esm/api/types/EntitlementUsage.d.mts +0 -3
- package/dist/esm/api/types/EntitlementUsage.mjs +1 -3
- package/dist/esm/api/types/Error_.d.mts +1 -4
- package/dist/esm/api/types/Error_.mjs +1 -3
- package/dist/esm/api/types/Invoice.d.mts +40 -0
- package/dist/esm/api/types/Invoice.mjs +11 -0
- package/dist/esm/api/types/Order.d.mts +1 -4
- package/dist/esm/api/types/Order.mjs +1 -3
- package/dist/esm/api/types/OrderLine.d.mts +1 -4
- package/dist/esm/api/types/OrderLine.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttribute.d.mts +1 -4
- package/dist/esm/api/types/OrderLineAttribute.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +0 -3
- package/dist/esm/api/types/OrderLineAttributeCreateOne.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttributePricing.d.mts +1 -4
- package/dist/esm/api/types/OrderLineAttributePricing.mjs +1 -3
- package/dist/esm/api/types/OrderLineCreate.d.mts +1 -4
- package/dist/esm/api/types/OrderLineCreate.mjs +1 -3
- package/dist/esm/api/types/PaginationMeta.d.mts +0 -3
- package/dist/esm/api/types/PaginationMeta.mjs +1 -3
- package/dist/esm/api/types/PaymentMethod.d.mts +54 -0
- package/dist/esm/api/types/PaymentMethod.mjs +17 -0
- package/dist/esm/api/types/Plan.d.mts +3 -3
- package/dist/esm/api/types/Plan.mjs +1 -3
- package/dist/esm/api/types/PlanGroup.d.mts +1 -4
- package/dist/esm/api/types/PlanGroup.mjs +1 -3
- package/dist/esm/api/types/PricePoint.d.mts +1 -4
- package/dist/esm/api/types/PricePoint.mjs +1 -3
- package/dist/esm/api/types/Pricing.d.mts +1 -4
- package/dist/esm/api/types/Pricing.mjs +1 -3
- package/dist/esm/api/types/PricingModelType.d.mts +1 -4
- package/dist/esm/api/types/PricingModelType.mjs +1 -3
- package/dist/esm/api/types/Product.d.mts +3 -8
- package/dist/esm/api/types/Product.mjs +2 -3
- package/dist/esm/api/types/ProductUpdate.d.mts +2 -5
- package/dist/esm/api/types/ProductUpdate.mjs +1 -3
- package/dist/esm/api/types/ProrationAttributeUpdate.d.mts +11 -0
- package/dist/esm/api/types/ProrationAttributeUpdate.mjs +2 -0
- package/dist/esm/api/types/ProrationDetail.d.mts +16 -0
- package/dist/esm/api/types/ProrationDetail.mjs +2 -0
- package/dist/esm/api/types/ProrationUpgradeResponse.d.mts +22 -0
- package/dist/esm/api/types/ProrationUpgradeResponse.mjs +2 -0
- package/dist/esm/api/types/Salutation.d.mts +1 -4
- package/dist/esm/api/types/Salutation.mjs +1 -3
- package/dist/esm/api/types/Signal.d.mts +0 -3
- package/dist/esm/api/types/Signal.mjs +1 -3
- package/dist/esm/api/types/SignalV2.d.mts +0 -3
- package/dist/esm/api/types/SignalV2.mjs +1 -3
- package/dist/esm/api/types/TaxExemptStatus.d.mts +1 -4
- package/dist/esm/api/types/TaxExemptStatus.mjs +1 -3
- package/dist/esm/api/types/Tier.d.mts +0 -3
- package/dist/esm/api/types/Tier.mjs +1 -3
- package/dist/esm/api/types/Trace.d.mts +1 -4
- package/dist/esm/api/types/Trace.mjs +1 -3
- package/dist/esm/api/types/TracesResponse.d.mts +1 -4
- package/dist/esm/api/types/TracesResponse.mjs +1 -3
- package/dist/esm/api/types/UsagePaginationMeta.d.mts +0 -3
- package/dist/esm/api/types/UsagePaginationMeta.mjs +1 -3
- package/dist/esm/api/types/UsageSummariesResponse.d.mts +1 -4
- package/dist/esm/api/types/UsageSummariesResponse.mjs +1 -3
- package/dist/esm/api/types/UsageSummary.d.mts +0 -3
- package/dist/esm/api/types/UsageSummary.mjs +1 -3
- package/dist/esm/api/types/index.d.mts +33 -26
- package/dist/esm/api/types/index.mjs +33 -26
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.mjs +5 -4
- package/dist/esm/core/auth/index.d.mts +2 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +20 -0
- package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +7 -5
- package/dist/esm/core/fetcher/Fetcher.mjs +9 -7
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +1 -1
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +4 -0
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +3 -0
- package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -1
- package/dist/esm/core/fetcher/createRequestUrl.mjs +3 -4
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -4
- package/dist/esm/core/fetcher/getFetchFn.mjs +1 -19
- package/dist/esm/core/fetcher/getResponseBody.mjs +34 -33
- package/dist/esm/core/fetcher/index.d.mts +7 -4
- package/dist/esm/core/fetcher/index.mjs +3 -2
- package/dist/esm/core/fetcher/makeRequest.mjs +2 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
- package/dist/esm/core/headers.d.mts +2 -3
- package/dist/esm/core/index.d.mts +3 -1
- package/dist/esm/core/index.mjs +3 -1
- package/dist/esm/core/runtime/runtime.mjs +0 -1
- package/dist/esm/core/url/encodePathParam.d.mts +1 -0
- package/dist/esm/core/url/encodePathParam.mjs +18 -0
- package/dist/esm/core/url/index.d.mts +3 -0
- package/dist/esm/core/url/index.mjs +3 -0
- package/dist/esm/core/url/join.d.mts +1 -0
- package/dist/esm/core/url/join.mjs +66 -0
- package/dist/esm/core/url/qs.d.mts +6 -0
- package/dist/esm/core/url/qs.mjs +61 -0
- package/dist/esm/environments.d.mts +0 -3
- package/dist/esm/environments.mjs +1 -3
- package/dist/esm/errors/PaidError.d.mts +1 -4
- package/dist/esm/errors/PaidError.mjs +2 -4
- package/dist/esm/errors/PaidTimeoutError.d.mts +0 -3
- package/dist/esm/errors/PaidTimeoutError.mjs +1 -3
- package/dist/esm/index.d.mts +1 -2
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +8 -5
- package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +6 -11
- package/dist/esm/integrations/adapters/expressjs/routes.d.mts +14 -12
- package/dist/esm/integrations/adapters/expressjs/routes.mjs +18 -9
- package/dist/esm/integrations/adapters/nextjs/base-adapter.d.mts +3 -2
- package/dist/esm/integrations/adapters/nextjs/base-adapter.mjs +1 -1
- package/dist/esm/integrations/adapters/nextjs/routes.d.mts +13 -11
- package/dist/esm/integrations/adapters/nextjs/routes.mjs +18 -9
- package/dist/esm/integrations/controllers/billing.d.mts +3 -17
- package/dist/esm/integrations/controllers/contacts.d.mts +1 -1
- package/dist/esm/integrations/controllers/contacts.mjs +1 -0
- package/dist/esm/integrations/controllers/customers.d.mts +2 -2
- package/dist/esm/integrations/controllers/customers.mjs +1 -0
- package/dist/esm/integrations/controllers/invoices.d.mts +2 -6
- package/dist/esm/integrations/controllers/orders.d.mts +1 -5
- package/dist/esm/integrations/controllers/provision-users.d.mts +1 -1
- package/dist/esm/integrations/utils/create-adapter.d.mts +2 -1
- package/dist/esm/integrations/utils/create-adapter.mjs +2 -1
- package/dist/esm/tracing/autoInstrumentation.mjs +1 -1
- package/dist/esm/tracing/spanProcessor.d.mts +2 -2
- package/dist/esm/tracing/spanProcessor.mjs +0 -5
- package/dist/esm/tracing/tracing.d.mts +1 -1
- package/dist/esm/tracing/tracing.mjs +3 -0
- package/dist/esm/tracing/wrappers/anthropicWrapper.d.mts +2 -2
- package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/mistralWrapper.d.mts +3 -3
- package/dist/esm/tracing/wrappers/mistralWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/openAiWrapper.d.mts +5 -5
- package/dist/esm/tracing/wrappers/openAiWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/vercelAIWrapper.d.mts +2 -2
- package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +8 -7
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +40 -28
- package/reference.md +985 -396
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/dist/cjs/wrapper/BatchUsage.d.ts +0 -8
- package/dist/cjs/wrapper/BatchUsage.js +0 -62
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +0 -30
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +0 -243
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +0 -21
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +0 -122
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +0 -31
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +0 -225
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +0 -18
- package/dist/esm/wrapper/BatchUsage.d.mts +0 -8
- package/dist/esm/wrapper/BatchUsage.mjs +0 -25
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -44,17 +42,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
43
|
});
|
|
46
44
|
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
46
|
exports.Customers = void 0;
|
|
52
|
-
const environments = __importStar(require("../../../../environments.js"));
|
|
53
|
-
const core = __importStar(require("../../../../core/index.js"));
|
|
54
|
-
const Paid = __importStar(require("../../../index.js"));
|
|
55
47
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
56
|
-
const
|
|
48
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
49
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
57
50
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
|
+
const Paid = __importStar(require("../../../index.js"));
|
|
58
52
|
class Customers {
|
|
59
53
|
constructor(_options = {}) {
|
|
60
54
|
this._options = _options;
|
|
@@ -70,13 +64,15 @@ class Customers {
|
|
|
70
64
|
}
|
|
71
65
|
__list(requestOptions) {
|
|
72
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var _a, _b, _c;
|
|
67
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
68
|
+
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);
|
|
74
69
|
const _response = yield core.fetcher({
|
|
75
|
-
url:
|
|
70
|
+
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.Production, "customers"),
|
|
76
71
|
method: "GET",
|
|
77
|
-
headers:
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
headers: _headers,
|
|
73
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
74
|
+
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,
|
|
75
|
+
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,
|
|
80
76
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
81
77
|
});
|
|
82
78
|
if (_response.ok) {
|
|
@@ -113,7 +109,20 @@ class Customers {
|
|
|
113
109
|
* @example
|
|
114
110
|
* await client.customers.create({
|
|
115
111
|
* name: "Acme, Inc.",
|
|
116
|
-
* externalId: "acme-inc"
|
|
112
|
+
* externalId: "acme-inc",
|
|
113
|
+
* contacts: [{
|
|
114
|
+
* salutation: "Mr.",
|
|
115
|
+
* firstName: "John",
|
|
116
|
+
* lastName: "Doe",
|
|
117
|
+
* accountName: "Acme, Inc.",
|
|
118
|
+
* email: "john.doe@acme.com",
|
|
119
|
+
* phone: "+1-555-0100",
|
|
120
|
+
* billingStreet: "123 Main Street",
|
|
121
|
+
* billingCity: "San Francisco",
|
|
122
|
+
* billingStateProvince: "CA",
|
|
123
|
+
* billingCountry: "USA",
|
|
124
|
+
* billingPostalCode: "94102"
|
|
125
|
+
* }]
|
|
117
126
|
* })
|
|
118
127
|
*/
|
|
119
128
|
create(request, requestOptions) {
|
|
@@ -121,16 +130,18 @@ class Customers {
|
|
|
121
130
|
}
|
|
122
131
|
__create(request, requestOptions) {
|
|
123
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
var _a, _b, _c;
|
|
133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
134
|
+
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);
|
|
125
135
|
const _response = yield core.fetcher({
|
|
126
|
-
url:
|
|
136
|
+
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.Production, "customers"),
|
|
127
137
|
method: "POST",
|
|
128
|
-
headers:
|
|
138
|
+
headers: _headers,
|
|
129
139
|
contentType: "application/json",
|
|
140
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
130
141
|
requestType: "json",
|
|
131
142
|
body: request,
|
|
132
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
133
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
143
|
+
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,
|
|
144
|
+
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,
|
|
134
145
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
135
146
|
});
|
|
136
147
|
if (_response.ok) {
|
|
@@ -172,13 +183,15 @@ class Customers {
|
|
|
172
183
|
}
|
|
173
184
|
__get(customerId, requestOptions) {
|
|
174
185
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
var _a, _b, _c;
|
|
186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
187
|
+
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);
|
|
176
188
|
const _response = yield core.fetcher({
|
|
177
|
-
url:
|
|
189
|
+
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.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
178
190
|
method: "GET",
|
|
179
|
-
headers:
|
|
180
|
-
|
|
181
|
-
|
|
191
|
+
headers: _headers,
|
|
192
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
193
|
+
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,
|
|
194
|
+
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,
|
|
182
195
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
183
196
|
});
|
|
184
197
|
if (_response.ok) {
|
|
@@ -226,16 +239,18 @@ class Customers {
|
|
|
226
239
|
}
|
|
227
240
|
__update(customerId, request, requestOptions) {
|
|
228
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
-
var _a, _b, _c;
|
|
242
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
243
|
+
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);
|
|
230
244
|
const _response = yield core.fetcher({
|
|
231
|
-
url:
|
|
245
|
+
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.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
232
246
|
method: "PUT",
|
|
233
|
-
headers:
|
|
247
|
+
headers: _headers,
|
|
234
248
|
contentType: "application/json",
|
|
249
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
235
250
|
requestType: "json",
|
|
236
251
|
body: request,
|
|
237
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
238
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
252
|
+
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,
|
|
253
|
+
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,
|
|
239
254
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
240
255
|
});
|
|
241
256
|
if (_response.ok) {
|
|
@@ -277,13 +292,15 @@ class Customers {
|
|
|
277
292
|
}
|
|
278
293
|
__delete(customerId, requestOptions) {
|
|
279
294
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
-
var _a, _b, _c;
|
|
295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
296
|
+
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);
|
|
281
297
|
const _response = yield core.fetcher({
|
|
282
|
-
url:
|
|
298
|
+
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.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
283
299
|
method: "DELETE",
|
|
284
|
-
headers:
|
|
285
|
-
|
|
286
|
-
|
|
300
|
+
headers: _headers,
|
|
301
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
302
|
+
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,
|
|
303
|
+
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,
|
|
287
304
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
288
305
|
});
|
|
289
306
|
if (_response.ok) {
|
|
@@ -313,6 +330,79 @@ class Customers {
|
|
|
313
330
|
}
|
|
314
331
|
});
|
|
315
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* @param {string} customerId - The customer ID
|
|
335
|
+
* @param {Paid.CustomersCheckEntitlementRequest} request
|
|
336
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
337
|
+
*
|
|
338
|
+
* @throws {@link Paid.BadRequestError}
|
|
339
|
+
* @throws {@link Paid.NotFoundError}
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* await client.customers.checkEntitlement("customerId", {
|
|
343
|
+
* event_name: "event_name",
|
|
344
|
+
* view: "all"
|
|
345
|
+
* })
|
|
346
|
+
*/
|
|
347
|
+
checkEntitlement(customerId, request, requestOptions) {
|
|
348
|
+
return core.HttpResponsePromise.fromPromise(this.__checkEntitlement(customerId, request, requestOptions));
|
|
349
|
+
}
|
|
350
|
+
__checkEntitlement(customerId, request, requestOptions) {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
353
|
+
const { event_name: eventName, view } = request;
|
|
354
|
+
const _queryParams = {};
|
|
355
|
+
_queryParams.event_name = eventName;
|
|
356
|
+
if (view != null) {
|
|
357
|
+
_queryParams.view = view;
|
|
358
|
+
}
|
|
359
|
+
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);
|
|
360
|
+
const _response = yield core.fetcher({
|
|
361
|
+
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.Production, `customers/${core.url.encodePathParam(customerId)}/entitlement`),
|
|
362
|
+
method: "GET",
|
|
363
|
+
headers: _headers,
|
|
364
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
365
|
+
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,
|
|
366
|
+
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,
|
|
367
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
368
|
+
});
|
|
369
|
+
if (_response.ok) {
|
|
370
|
+
return {
|
|
371
|
+
data: _response.body,
|
|
372
|
+
rawResponse: _response.rawResponse,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
if (_response.error.reason === "status-code") {
|
|
376
|
+
switch (_response.error.statusCode) {
|
|
377
|
+
case 400:
|
|
378
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
379
|
+
case 404:
|
|
380
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
381
|
+
default:
|
|
382
|
+
throw new errors.PaidError({
|
|
383
|
+
statusCode: _response.error.statusCode,
|
|
384
|
+
body: _response.error.body,
|
|
385
|
+
rawResponse: _response.rawResponse,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
switch (_response.error.reason) {
|
|
390
|
+
case "non-json":
|
|
391
|
+
throw new errors.PaidError({
|
|
392
|
+
statusCode: _response.error.statusCode,
|
|
393
|
+
body: _response.error.rawBody,
|
|
394
|
+
rawResponse: _response.rawResponse,
|
|
395
|
+
});
|
|
396
|
+
case "timeout":
|
|
397
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}/entitlement.");
|
|
398
|
+
case "unknown":
|
|
399
|
+
throw new errors.PaidError({
|
|
400
|
+
message: _response.error.errorMessage,
|
|
401
|
+
rawResponse: _response.rawResponse,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
316
406
|
/**
|
|
317
407
|
* @param {string} customerId - The customer ID
|
|
318
408
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -327,13 +417,15 @@ class Customers {
|
|
|
327
417
|
}
|
|
328
418
|
__getEntitlements(customerId, requestOptions) {
|
|
329
419
|
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
-
var _a, _b, _c;
|
|
420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
421
|
+
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);
|
|
331
422
|
const _response = yield core.fetcher({
|
|
332
|
-
url:
|
|
423
|
+
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.Production, `customers/${core.url.encodePathParam(customerId)}/credit-bundles`),
|
|
333
424
|
method: "GET",
|
|
334
|
-
headers:
|
|
335
|
-
|
|
336
|
-
|
|
425
|
+
headers: _headers,
|
|
426
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
427
|
+
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,
|
|
428
|
+
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,
|
|
337
429
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
338
430
|
});
|
|
339
431
|
if (_response.ok) {
|
|
@@ -380,13 +472,15 @@ class Customers {
|
|
|
380
472
|
}
|
|
381
473
|
__getByExternalId(externalId, requestOptions) {
|
|
382
474
|
return __awaiter(this, void 0, void 0, function* () {
|
|
383
|
-
var _a, _b, _c;
|
|
475
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
476
|
+
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);
|
|
384
477
|
const _response = yield core.fetcher({
|
|
385
|
-
url:
|
|
478
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
386
479
|
method: "GET",
|
|
387
|
-
headers:
|
|
388
|
-
|
|
389
|
-
|
|
480
|
+
headers: _headers,
|
|
481
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
482
|
+
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,
|
|
483
|
+
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,
|
|
390
484
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
391
485
|
});
|
|
392
486
|
if (_response.ok) {
|
|
@@ -429,16 +523,18 @@ class Customers {
|
|
|
429
523
|
}
|
|
430
524
|
__updateByExternalId(externalId, request, requestOptions) {
|
|
431
525
|
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
-
var _a, _b, _c;
|
|
526
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
527
|
+
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);
|
|
433
528
|
const _response = yield core.fetcher({
|
|
434
|
-
url:
|
|
529
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
435
530
|
method: "PUT",
|
|
436
|
-
headers:
|
|
531
|
+
headers: _headers,
|
|
437
532
|
contentType: "application/json",
|
|
533
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
438
534
|
requestType: "json",
|
|
439
535
|
body: request,
|
|
440
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
441
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
536
|
+
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,
|
|
537
|
+
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,
|
|
442
538
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
443
539
|
});
|
|
444
540
|
if (_response.ok) {
|
|
@@ -480,13 +576,15 @@ class Customers {
|
|
|
480
576
|
}
|
|
481
577
|
__deleteByExternalId(externalId, requestOptions) {
|
|
482
578
|
return __awaiter(this, void 0, void 0, function* () {
|
|
483
|
-
var _a, _b, _c;
|
|
579
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
580
|
+
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);
|
|
484
581
|
const _response = yield core.fetcher({
|
|
485
|
-
url:
|
|
582
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
486
583
|
method: "DELETE",
|
|
487
|
-
headers:
|
|
488
|
-
|
|
489
|
-
|
|
584
|
+
headers: _headers,
|
|
585
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
586
|
+
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,
|
|
587
|
+
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,
|
|
490
588
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
491
589
|
});
|
|
492
590
|
if (_response.ok) {
|
|
@@ -538,28 +636,29 @@ class Customers {
|
|
|
538
636
|
}
|
|
539
637
|
__getCostsByExternalId(externalId_1) {
|
|
540
638
|
return __awaiter(this, arguments, void 0, function* (externalId, request = {}, requestOptions) {
|
|
541
|
-
var _a, _b, _c;
|
|
639
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
542
640
|
const { limit, offset, startTime, endTime } = request;
|
|
543
641
|
const _queryParams = {};
|
|
544
642
|
if (limit != null) {
|
|
545
|
-
_queryParams
|
|
643
|
+
_queryParams.limit = limit.toString();
|
|
546
644
|
}
|
|
547
645
|
if (offset != null) {
|
|
548
|
-
_queryParams
|
|
646
|
+
_queryParams.offset = offset.toString();
|
|
549
647
|
}
|
|
550
648
|
if (startTime != null) {
|
|
551
|
-
_queryParams
|
|
649
|
+
_queryParams.startTime = startTime;
|
|
552
650
|
}
|
|
553
651
|
if (endTime != null) {
|
|
554
|
-
_queryParams
|
|
652
|
+
_queryParams.endTime = endTime;
|
|
555
653
|
}
|
|
654
|
+
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);
|
|
556
655
|
const _response = yield core.fetcher({
|
|
557
|
-
url:
|
|
656
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}/costs`),
|
|
558
657
|
method: "GET",
|
|
559
|
-
headers:
|
|
560
|
-
queryParameters: _queryParams,
|
|
561
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
562
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
658
|
+
headers: _headers,
|
|
659
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
660
|
+
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,
|
|
661
|
+
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,
|
|
563
662
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
564
663
|
});
|
|
565
664
|
if (_response.ok) {
|
|
@@ -620,28 +719,29 @@ class Customers {
|
|
|
620
719
|
}
|
|
621
720
|
__getUsageByExternalId(externalId_1) {
|
|
622
721
|
return __awaiter(this, arguments, void 0, function* (externalId, request = {}, requestOptions) {
|
|
623
|
-
var _a, _b, _c;
|
|
722
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
624
723
|
const { limit, offset, startTime, endTime } = request;
|
|
625
724
|
const _queryParams = {};
|
|
626
725
|
if (limit != null) {
|
|
627
|
-
_queryParams
|
|
726
|
+
_queryParams.limit = limit.toString();
|
|
628
727
|
}
|
|
629
728
|
if (offset != null) {
|
|
630
|
-
_queryParams
|
|
729
|
+
_queryParams.offset = offset.toString();
|
|
631
730
|
}
|
|
632
731
|
if (startTime != null) {
|
|
633
|
-
_queryParams
|
|
732
|
+
_queryParams.startTime = startTime;
|
|
634
733
|
}
|
|
635
734
|
if (endTime != null) {
|
|
636
|
-
_queryParams
|
|
735
|
+
_queryParams.endTime = endTime;
|
|
637
736
|
}
|
|
737
|
+
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);
|
|
638
738
|
const _response = yield core.fetcher({
|
|
639
|
-
url:
|
|
739
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}/usage`),
|
|
640
740
|
method: "GET",
|
|
641
|
-
headers:
|
|
642
|
-
queryParameters: _queryParams,
|
|
643
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds)
|
|
644
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
741
|
+
headers: _headers,
|
|
742
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
743
|
+
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,
|
|
744
|
+
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,
|
|
645
745
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
646
746
|
});
|
|
647
747
|
if (_response.ok) {
|
|
@@ -680,6 +780,206 @@ class Customers {
|
|
|
680
780
|
}
|
|
681
781
|
});
|
|
682
782
|
}
|
|
783
|
+
/**
|
|
784
|
+
* Retrieves all payment methods associated with a customer identified by their external ID.
|
|
785
|
+
*
|
|
786
|
+
* @param {string} externalId - The external ID of the customer
|
|
787
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
788
|
+
*
|
|
789
|
+
* @throws {@link Paid.ForbiddenError}
|
|
790
|
+
* @throws {@link Paid.NotFoundError}
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* await client.customers.listPaymentMethods("externalId")
|
|
794
|
+
*/
|
|
795
|
+
listPaymentMethods(externalId, requestOptions) {
|
|
796
|
+
return core.HttpResponsePromise.fromPromise(this.__listPaymentMethods(externalId, requestOptions));
|
|
797
|
+
}
|
|
798
|
+
__listPaymentMethods(externalId, requestOptions) {
|
|
799
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
800
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
801
|
+
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);
|
|
802
|
+
const _response = yield core.fetcher({
|
|
803
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods`),
|
|
804
|
+
method: "GET",
|
|
805
|
+
headers: _headers,
|
|
806
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
807
|
+
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,
|
|
808
|
+
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,
|
|
809
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
810
|
+
});
|
|
811
|
+
if (_response.ok) {
|
|
812
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
813
|
+
}
|
|
814
|
+
if (_response.error.reason === "status-code") {
|
|
815
|
+
switch (_response.error.statusCode) {
|
|
816
|
+
case 403:
|
|
817
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
818
|
+
case 404:
|
|
819
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
820
|
+
default:
|
|
821
|
+
throw new errors.PaidError({
|
|
822
|
+
statusCode: _response.error.statusCode,
|
|
823
|
+
body: _response.error.body,
|
|
824
|
+
rawResponse: _response.rawResponse,
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
switch (_response.error.reason) {
|
|
829
|
+
case "non-json":
|
|
830
|
+
throw new errors.PaidError({
|
|
831
|
+
statusCode: _response.error.statusCode,
|
|
832
|
+
body: _response.error.rawBody,
|
|
833
|
+
rawResponse: _response.rawResponse,
|
|
834
|
+
});
|
|
835
|
+
case "timeout":
|
|
836
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/payment-methods.");
|
|
837
|
+
case "unknown":
|
|
838
|
+
throw new errors.PaidError({
|
|
839
|
+
message: _response.error.errorMessage,
|
|
840
|
+
rawResponse: _response.rawResponse,
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Creates a new payment method for a customer using a Stripe confirmation token.
|
|
847
|
+
*
|
|
848
|
+
* @param {string} externalId - The external ID of the customer
|
|
849
|
+
* @param {Paid.CustomersCreatePaymentMethodRequest} request
|
|
850
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
851
|
+
*
|
|
852
|
+
* @throws {@link Paid.BadRequestError}
|
|
853
|
+
* @throws {@link Paid.ForbiddenError}
|
|
854
|
+
* @throws {@link Paid.NotFoundError}
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* await client.customers.createPaymentMethod("externalId", {
|
|
858
|
+
* confirmationToken: "ctoken_1234567890",
|
|
859
|
+
* returnUrl: "https://example.com/payment-method-added",
|
|
860
|
+
* metadata: {
|
|
861
|
+
* "source": "api"
|
|
862
|
+
* }
|
|
863
|
+
* })
|
|
864
|
+
*/
|
|
865
|
+
createPaymentMethod(externalId, request, requestOptions) {
|
|
866
|
+
return core.HttpResponsePromise.fromPromise(this.__createPaymentMethod(externalId, request, requestOptions));
|
|
867
|
+
}
|
|
868
|
+
__createPaymentMethod(externalId, request, requestOptions) {
|
|
869
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
870
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
871
|
+
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);
|
|
872
|
+
const _response = yield core.fetcher({
|
|
873
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods`),
|
|
874
|
+
method: "POST",
|
|
875
|
+
headers: _headers,
|
|
876
|
+
contentType: "application/json",
|
|
877
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
878
|
+
requestType: "json",
|
|
879
|
+
body: request,
|
|
880
|
+
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,
|
|
881
|
+
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,
|
|
882
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
883
|
+
});
|
|
884
|
+
if (_response.ok) {
|
|
885
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
886
|
+
}
|
|
887
|
+
if (_response.error.reason === "status-code") {
|
|
888
|
+
switch (_response.error.statusCode) {
|
|
889
|
+
case 400:
|
|
890
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
891
|
+
case 403:
|
|
892
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
893
|
+
case 404:
|
|
894
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
895
|
+
default:
|
|
896
|
+
throw new errors.PaidError({
|
|
897
|
+
statusCode: _response.error.statusCode,
|
|
898
|
+
body: _response.error.body,
|
|
899
|
+
rawResponse: _response.rawResponse,
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
switch (_response.error.reason) {
|
|
904
|
+
case "non-json":
|
|
905
|
+
throw new errors.PaidError({
|
|
906
|
+
statusCode: _response.error.statusCode,
|
|
907
|
+
body: _response.error.rawBody,
|
|
908
|
+
rawResponse: _response.rawResponse,
|
|
909
|
+
});
|
|
910
|
+
case "timeout":
|
|
911
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/payment-methods.");
|
|
912
|
+
case "unknown":
|
|
913
|
+
throw new errors.PaidError({
|
|
914
|
+
message: _response.error.errorMessage,
|
|
915
|
+
rawResponse: _response.rawResponse,
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Deletes a specific payment method from a customer's account.
|
|
922
|
+
*
|
|
923
|
+
* @param {string} externalId - The external ID of the customer
|
|
924
|
+
* @param {string} paymentMethodId - The ID of the payment method to delete
|
|
925
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
926
|
+
*
|
|
927
|
+
* @throws {@link Paid.ForbiddenError}
|
|
928
|
+
* @throws {@link Paid.NotFoundError}
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* await client.customers.deletePaymentMethod("externalId", "paymentMethodId")
|
|
932
|
+
*/
|
|
933
|
+
deletePaymentMethod(externalId, paymentMethodId, requestOptions) {
|
|
934
|
+
return core.HttpResponsePromise.fromPromise(this.__deletePaymentMethod(externalId, paymentMethodId, requestOptions));
|
|
935
|
+
}
|
|
936
|
+
__deletePaymentMethod(externalId, paymentMethodId, requestOptions) {
|
|
937
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
938
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
939
|
+
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);
|
|
940
|
+
const _response = yield core.fetcher({
|
|
941
|
+
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.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods/${core.url.encodePathParam(paymentMethodId)}`),
|
|
942
|
+
method: "DELETE",
|
|
943
|
+
headers: _headers,
|
|
944
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
945
|
+
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,
|
|
946
|
+
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,
|
|
947
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
948
|
+
});
|
|
949
|
+
if (_response.ok) {
|
|
950
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
951
|
+
}
|
|
952
|
+
if (_response.error.reason === "status-code") {
|
|
953
|
+
switch (_response.error.statusCode) {
|
|
954
|
+
case 403:
|
|
955
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
956
|
+
case 404:
|
|
957
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
958
|
+
default:
|
|
959
|
+
throw new errors.PaidError({
|
|
960
|
+
statusCode: _response.error.statusCode,
|
|
961
|
+
body: _response.error.body,
|
|
962
|
+
rawResponse: _response.rawResponse,
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
switch (_response.error.reason) {
|
|
967
|
+
case "non-json":
|
|
968
|
+
throw new errors.PaidError({
|
|
969
|
+
statusCode: _response.error.statusCode,
|
|
970
|
+
body: _response.error.rawBody,
|
|
971
|
+
rawResponse: _response.rawResponse,
|
|
972
|
+
});
|
|
973
|
+
case "timeout":
|
|
974
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/payment-methods/{paymentMethodId}.");
|
|
975
|
+
case "unknown":
|
|
976
|
+
throw new errors.PaidError({
|
|
977
|
+
message: _response.error.errorMessage,
|
|
978
|
+
rawResponse: _response.rawResponse,
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
683
983
|
_getAuthorizationHeader() {
|
|
684
984
|
return __awaiter(this, void 0, void 0, function* () {
|
|
685
985
|
const bearer = yield core.Supplier.get(this._options.token);
|