@schematichq/schematic-typescript-node 1.4.5 → 1.4.7
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 +118 -2
- package/dist/BaseClient.d.ts +3 -0
- package/dist/Client.d.ts +8 -20
- package/dist/api/resources/accounts/client/Client.d.ts +35 -0
- package/dist/api/resources/accounts/client/requests/ListAccountMembersRequest.d.ts +18 -0
- package/dist/api/resources/accounts/client/requests/ListEnvironmentsRequest.d.ts +1 -0
- package/dist/api/resources/accounts/client/requests/index.d.ts +1 -0
- package/dist/api/resources/accounts/types/GetAccountMemberResponse.d.ts +6 -0
- package/dist/api/resources/accounts/types/ListAccountMembersParams.d.ts +12 -0
- package/dist/api/resources/accounts/types/ListAccountMembersResponse.d.ts +6 -0
- package/dist/api/resources/accounts/types/index.d.ts +3 -0
- package/dist/api/resources/billing/client/Client.d.ts +33 -6
- package/dist/api/resources/billing/client/requests/CountBillingProductsRequest.d.ts +5 -1
- package/dist/api/resources/billing/client/requests/CountCustomersRequest.d.ts +2 -1
- package/dist/api/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +2 -0
- package/dist/api/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +1 -0
- package/dist/api/resources/billing/client/requests/CreateMeterRequestBody.d.ts +2 -0
- package/dist/api/resources/billing/client/requests/ListBillingPricesRequest.d.ts +6 -1
- package/dist/api/resources/billing/client/requests/ListBillingProductPricesRequest.d.ts +6 -1
- package/dist/api/resources/billing/client/requests/ListBillingProductsRequest.d.ts +5 -1
- package/dist/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.d.ts +2 -1
- package/dist/api/resources/billing/types/CountBillingProductsParams.d.ts +2 -0
- package/dist/api/resources/billing/types/DeletePaymentMethodByExternalIdResponse.d.ts +6 -0
- package/dist/api/resources/billing/types/ListBillingPricesParams.d.ts +2 -0
- package/dist/api/resources/billing/types/ListBillingProductPricesParams.d.ts +2 -0
- package/dist/api/resources/billing/types/ListBillingProductsParams.d.ts +2 -0
- package/dist/api/resources/billing/types/index.d.ts +1 -0
- package/dist/api/resources/checkout/client/Client.d.ts +6 -0
- package/dist/api/resources/companies/client/Client.d.ts +31 -55
- package/dist/api/resources/companies/client/requests/CountCompaniesRequest.d.ts +11 -0
- package/dist/api/resources/companies/client/requests/CountEntityKeyDefinitionsRequest.d.ts +1 -0
- package/dist/api/resources/companies/client/requests/CountEntityTraitDefinitionsRequest.d.ts +2 -0
- package/dist/api/resources/companies/client/requests/CountPlanTraitsRequest.d.ts +2 -0
- package/dist/api/resources/companies/client/requests/CountUsersRequest.d.ts +1 -0
- package/dist/api/resources/companies/client/requests/GetActiveCompanySubscriptionRequest.d.ts +1 -0
- package/dist/api/resources/companies/client/requests/ListCompaniesRequest.d.ts +11 -0
- package/dist/api/resources/companies/client/requests/ListEntityKeyDefinitionsRequest.d.ts +1 -0
- package/dist/api/resources/companies/client/requests/ListEntityTraitDefinitionsRequest.d.ts +2 -0
- package/dist/api/resources/companies/client/requests/ListPlanChangesRequest.d.ts +7 -4
- package/dist/api/resources/companies/client/requests/ListPlanTraitsRequest.d.ts +2 -0
- package/dist/api/resources/companies/client/requests/ListUsersRequest.d.ts +1 -0
- package/dist/api/resources/companies/client/requests/index.d.ts +0 -2
- package/dist/api/resources/companies/types/CountCompaniesParams.d.ts +4 -0
- package/dist/api/resources/companies/types/ListCompaniesParams.d.ts +4 -0
- package/dist/api/resources/companies/types/ListPlanChangesParams.d.ts +3 -2
- package/dist/api/resources/companies/types/index.d.ts +0 -3
- package/dist/api/resources/credits/client/Client.d.ts +99 -1
- package/dist/api/resources/credits/client/requests/AcquireCreditLeaseRequestBody.d.ts +14 -0
- package/dist/api/resources/credits/client/requests/CountBillingCreditsGrantsRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/CountBillingCreditsRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/CountBillingPlanCreditGrantsRequest.d.ts +4 -0
- package/dist/api/resources/credits/client/requests/CountCreditBundlesRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +2 -1
- package/dist/api/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/ExtendCreditLeaseRequestBody.d.ts +10 -0
- package/dist/api/resources/credits/client/requests/ListBillingCreditsRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/ListBillingPlanCreditGrantsRequest.d.ts +4 -0
- package/dist/api/resources/credits/client/requests/ListCompanyCreditBalancesRequest.d.ts +9 -0
- package/dist/api/resources/credits/client/requests/ListCreditBundlesRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/ListGrantsForCreditRequest.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +1 -0
- package/dist/api/resources/credits/client/requests/index.d.ts +3 -0
- package/dist/api/resources/credits/types/AcquireCreditLeaseResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +1 -0
- package/dist/api/resources/credits/types/ExtendCreditLeaseResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +1 -0
- package/dist/api/resources/credits/types/ListCompanyCreditBalancesParams.d.ts +6 -0
- package/dist/api/resources/credits/types/ListCompanyCreditBalancesResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/ReleaseCreditLeaseResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/index.d.ts +6 -0
- package/dist/api/resources/entitlements/client/Client.d.ts +39 -0
- package/dist/api/resources/entitlements/client/requests/CountCompanyOverridesRequest.d.ts +3 -0
- package/dist/api/resources/entitlements/client/requests/CountFeatureUsageRequest.d.ts +5 -0
- package/dist/api/resources/entitlements/client/requests/CountPlanEntitlementsRequest.d.ts +4 -0
- package/dist/api/resources/entitlements/client/requests/CreateBillingLinkedPlanEntitlementRequestBody.d.ts +50 -0
- package/dist/api/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +2 -2
- package/dist/api/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +9 -2
- package/dist/api/resources/entitlements/client/requests/ListCompanyOverridesRequest.d.ts +3 -0
- package/dist/api/resources/entitlements/client/requests/ListFeatureUsageRequest.d.ts +5 -0
- package/dist/api/resources/entitlements/client/requests/ListPlanEntitlementsRequest.d.ts +4 -0
- package/dist/api/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +2 -2
- package/dist/api/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +9 -2
- package/dist/api/resources/entitlements/client/requests/index.d.ts +1 -0
- package/dist/api/resources/entitlements/types/CountFeatureUsageParams.d.ts +3 -0
- package/dist/api/resources/entitlements/types/ListFeatureUsageParams.d.ts +3 -0
- package/dist/api/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.d.ts +6 -0
- package/dist/api/resources/entitlements/types/index.d.ts +1 -8
- package/dist/api/resources/events/client/Client.d.ts +3 -0
- package/dist/api/resources/events/client/requests/GetEventSummariesRequest.d.ts +1 -0
- package/dist/api/resources/events/client/requests/ListEventsRequest.d.ts +3 -0
- package/dist/api/resources/events/types/ListEventsParams.d.ts +1 -0
- package/dist/api/resources/features/client/Client.d.ts +35 -6
- package/dist/api/resources/features/client/requests/CountFeaturesRequest.d.ts +13 -8
- package/dist/api/resources/features/client/requests/CountFlagsRequest.d.ts +1 -0
- package/dist/api/resources/features/client/requests/CreateBillingLinkedFeatureRequestBody.d.ts +26 -0
- package/dist/api/resources/features/client/requests/CreateFeatureRequestBody.d.ts +1 -1
- package/dist/api/resources/features/client/requests/ListFeaturesRequest.d.ts +13 -8
- package/dist/api/resources/features/client/requests/ListFlagsRequest.d.ts +1 -0
- package/dist/api/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +1 -1
- package/dist/api/resources/features/client/requests/UpdateFlagRulesRequestBody.d.ts +2 -2
- package/dist/api/resources/features/client/requests/index.d.ts +1 -0
- package/dist/api/resources/features/types/CountFeaturesParams.d.ts +2 -0
- package/dist/api/resources/features/types/ListFeaturesParams.d.ts +2 -0
- package/dist/api/resources/features/types/UpsertFeatureForBillingProductResponse.d.ts +6 -0
- package/dist/api/resources/features/types/index.d.ts +1 -0
- package/dist/api/resources/index.d.ts +6 -0
- package/dist/api/resources/insights/client/Client.d.ts +114 -0
- package/dist/api/resources/insights/client/index.d.ts +1 -0
- package/dist/api/resources/insights/client/requests/GetActivityRequest.d.ts +9 -0
- package/dist/api/resources/insights/client/requests/GetEnvironmentFeatureUsageTimeSeriesRequest.d.ts +16 -0
- package/dist/api/resources/insights/client/requests/GetEnvironmentTraitUsageTimeSeriesRequest.d.ts +16 -0
- package/dist/api/resources/insights/client/requests/GetPlanGrowthRequest.d.ts +9 -0
- package/dist/api/resources/insights/client/requests/GetTopFeaturesByUsageRequest.d.ts +13 -0
- package/dist/api/resources/insights/client/requests/index.d.ts +5 -0
- package/dist/api/resources/insights/exports.d.ts +2 -0
- package/dist/api/resources/insights/index.d.ts +2 -0
- package/dist/api/resources/insights/types/GetActivityParams.d.ts +6 -0
- package/dist/api/resources/insights/types/GetActivityResponse.d.ts +6 -0
- package/dist/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.d.ts +10 -0
- package/dist/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.d.ts +6 -0
- package/dist/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.d.ts +10 -0
- package/dist/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.d.ts +6 -0
- package/dist/api/resources/insights/types/GetPlanGrowthParams.d.ts +6 -0
- package/dist/api/resources/insights/types/GetPlanGrowthResponse.d.ts +6 -0
- package/dist/api/resources/{companies/types/UpdatePlanTraitResponse.d.ts → insights/types/GetSummaryResponse.d.ts} +2 -2
- package/dist/api/resources/insights/types/GetTopFeaturesByUsageParams.d.ts +8 -0
- package/dist/api/resources/insights/types/GetTopFeaturesByUsageResponse.d.ts +6 -0
- package/dist/api/resources/insights/types/index.d.ts +11 -0
- package/dist/api/resources/integrationsapi/client/Client.d.ts +109 -0
- package/dist/api/resources/integrationsapi/client/index.d.ts +1 -0
- package/dist/api/resources/integrationsapi/client/requests/ListIntegrationsRequest.d.ts +24 -0
- package/dist/api/resources/integrationsapi/client/requests/StartDataImportRequestBody.d.ts +12 -0
- package/dist/api/resources/integrationsapi/client/requests/index.d.ts +2 -0
- package/dist/api/resources/integrationsapi/exports.d.ts +2 -0
- package/dist/api/resources/integrationsapi/index.d.ts +2 -0
- package/dist/api/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.d.ts +6 -0
- package/dist/api/resources/integrationsapi/types/ListIntegrationsParams.d.ts +15 -0
- package/dist/api/resources/integrationsapi/types/ListIntegrationsResponse.d.ts +6 -0
- package/dist/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.d.ts +6 -0
- package/dist/api/resources/{companies/types/CreatePlanTraitResponse.d.ts → integrationsapi/types/RunIntegrationResponse.d.ts} +2 -2
- package/dist/api/resources/integrationsapi/types/StartDataImportResponse.d.ts +6 -0
- package/dist/api/resources/{companies/types/DeletePlanTraitResponse.d.ts → integrationsapi/types/UninstallIntegrationResponse.d.ts} +1 -1
- package/dist/api/resources/integrationsapi/types/index.d.ts +7 -0
- package/dist/api/resources/planbundle/client/Client.d.ts +19 -0
- package/dist/api/resources/planbundle/client/requests/CreateCustomPlanBundleRequestBody.d.ts +14 -0
- package/dist/api/resources/planbundle/client/requests/index.d.ts +1 -0
- package/dist/api/resources/planbundle/types/CreateCustomPlanBundleResponse.d.ts +6 -0
- package/dist/api/resources/planbundle/types/index.d.ts +1 -0
- package/dist/api/resources/planmigrations/client/Client.d.ts +56 -0
- package/dist/api/resources/planmigrations/client/requests/CreateMigrationInput.d.ts +22 -0
- package/dist/api/resources/planmigrations/client/requests/RetryMigrationRequestBody.d.ts +10 -0
- package/dist/api/resources/planmigrations/client/requests/index.d.ts +2 -0
- package/dist/api/resources/planmigrations/types/CreateMigrationResponse.d.ts +6 -0
- package/dist/api/resources/planmigrations/types/RetryCompanyMigrationResponse.d.ts +6 -0
- package/dist/api/resources/planmigrations/types/RetryMigrationResponse.d.ts +6 -0
- package/dist/api/resources/planmigrations/types/index.d.ts +3 -0
- package/dist/api/resources/plans/client/Client.d.ts +162 -3
- package/dist/api/resources/plans/client/requests/CountBillingProductMatchCompaniesRequest.d.ts +19 -0
- package/dist/api/resources/plans/client/requests/CountPlansRequest.d.ts +13 -0
- package/dist/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.d.ts +20 -0
- package/dist/api/resources/plans/client/requests/CreateCustomPlanRequestBody.d.ts +16 -0
- package/dist/api/resources/plans/client/requests/DeletePlanVersionRequest.d.ts +9 -0
- package/dist/api/resources/plans/client/requests/ListBillingProductMatchCompaniesRequest.d.ts +19 -0
- package/dist/api/resources/plans/client/requests/ListCustomPlanBillingsRequest.d.ts +26 -0
- package/dist/api/resources/plans/client/requests/ListPlansRequest.d.ts +13 -0
- package/dist/api/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +9 -1
- package/dist/api/resources/plans/client/requests/RetryCustomPlanBillingRequestBody.d.ts +17 -0
- package/dist/api/resources/plans/client/requests/index.d.ts +7 -0
- package/dist/api/resources/plans/types/CountBillingProductMatchCompaniesParams.d.ts +13 -0
- package/dist/api/resources/plans/types/CountBillingProductMatchCompaniesResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/CountPlansParams.d.ts +8 -0
- package/dist/api/resources/plans/types/CreateCustomPlanResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/DeletePlanVersionParams.d.ts +6 -0
- package/dist/api/resources/plans/types/DeletePlanVersionResponse.d.ts +1 -1
- package/dist/api/resources/plans/types/ListBillingProductMatchCompaniesParams.d.ts +13 -0
- package/dist/api/resources/plans/types/ListBillingProductMatchCompaniesResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/ListCustomPlanBillingsParams.d.ts +18 -0
- package/dist/api/resources/plans/types/ListCustomPlanBillingsResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/ListPlansParams.d.ts +8 -0
- package/dist/api/resources/plans/types/MarkCustomPlanBillingPaidResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/RetryCustomPlanBillingResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/UpsertPlanForBillingProductResponse.d.ts +6 -0
- package/dist/api/resources/plans/types/index.d.ts +11 -0
- package/dist/api/resources/webhooks/client/Client.d.ts +2 -0
- package/dist/api/resources/webhooks/client/requests/CountWebhookEventsRequest.d.ts +1 -0
- package/dist/api/resources/webhooks/client/requests/ListWebhookEventsRequest.d.ts +1 -0
- package/dist/api/types/AccountMemberPermission.d.ts +18 -0
- package/dist/api/types/AccountMemberResponseData.d.ts +11 -0
- package/dist/api/types/AccountMemberRole.d.ts +5 -0
- package/dist/api/types/ActivityEntryResponseData.d.ts +8 -0
- package/dist/api/types/ActivityResponseResponseData.d.ts +4 -0
- package/dist/api/types/ApiKeyCreateResponseData.d.ts +2 -0
- package/dist/api/types/ApiKeyIntegrationResponseData.d.ts +6 -0
- package/dist/api/types/ApiKeyResponseData.d.ts +2 -0
- package/dist/api/types/AuditLogListResponseData.d.ts +2 -0
- package/dist/api/types/AuditLogResponseData.d.ts +2 -0
- package/dist/api/types/BillingCreditBundleResponseData.d.ts +2 -0
- package/dist/api/types/BillingCreditBundleView.d.ts +1 -0
- package/dist/api/types/BillingCreditGrantReason.d.ts +1 -0
- package/dist/api/types/BillingCreditGrantResponseData.d.ts +1 -0
- package/dist/api/types/BillingCreditResponseData.d.ts +1 -0
- package/dist/api/types/BillingCreditView.d.ts +1 -0
- package/dist/api/types/BillingLinkedResourceResponseData.d.ts +6 -0
- package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +2 -0
- package/dist/api/types/BillingPriceResponseData.d.ts +2 -0
- package/dist/api/types/BillingPriceView.d.ts +2 -0
- package/dist/api/types/BillingProductForSubscriptionResponseData.d.ts +1 -0
- package/dist/api/types/BillingProductPlanResponseData.d.ts +2 -1
- package/dist/api/types/BillingProductPriceResponseData.d.ts +2 -0
- package/dist/api/types/BillingProviderType.d.ts +1 -0
- package/dist/api/types/BillingStrategy.d.ts +6 -0
- package/dist/api/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -0
- package/dist/api/types/ChangeSubscriptionRequestBody.d.ts +1 -0
- package/dist/api/types/ChargeType.d.ts +1 -0
- package/dist/api/types/CheckFlagResponseData.d.ts +2 -2
- package/dist/api/types/CheckoutSubscription.d.ts +2 -0
- package/dist/api/types/ClerkIntegrationConfig.d.ts +6 -0
- package/dist/api/types/CompanyCreditBalanceResponseData.d.ts +7 -0
- package/dist/api/types/CompanyDetailResponseData.d.ts +1 -0
- package/dist/api/types/CompanyEventPeriodMetricsResponseData.d.ts +3 -2
- package/dist/api/types/CompanyMatchingCriteria.d.ts +5 -0
- package/dist/api/types/CompanyOverrideResponseData.d.ts +2 -2
- package/dist/api/types/CompanyPlanCreditGrantView.d.ts +40 -0
- package/dist/api/types/CompanyPlanDetailResponseData.d.ts +13 -4
- package/dist/api/types/CompanyPlanWithBillingSubView.d.ts +1 -1
- package/dist/api/types/CompanySubscriptionResponseData.d.ts +1 -0
- package/dist/api/types/{ConditionOperator.d.ts → ComparableOperator.d.ts} +5 -5
- package/dist/api/types/Condition.d.ts +4 -4
- package/dist/api/types/ConditionResponseData.d.ts +4 -4
- package/dist/api/types/{ConditionConditionType.d.ts → ConditionType.d.ts} +2 -2
- package/dist/api/types/ConditionView.d.ts +4 -4
- package/dist/api/types/CreateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/api/types/CreateCustomPlanBundlePlanRequestBody.d.ts +7 -0
- package/dist/api/types/CreateEntitlementInBundleRequestBody.d.ts +9 -2
- package/dist/api/types/CreateEntitlementReqCommon.d.ts +2 -2
- package/dist/api/types/CreateEventRequestBody.d.ts +6 -0
- package/dist/api/types/CreateFlagRequestBody.d.ts +1 -1
- package/dist/api/types/CreateOrUpdateConditionRequestBody.d.ts +4 -4
- package/dist/api/types/CreateOrUpdateFlagRequestBody.d.ts +1 -1
- package/dist/api/types/CreateOrUpdateRuleRequestBody.d.ts +1 -1
- package/dist/api/types/CreatePlanRequestBody.d.ts +1 -1
- package/dist/api/types/CreditBundleCurrencyPrice.d.ts +5 -0
- package/dist/api/types/CreditBundleCurrencyPriceRequestBody.d.ts +5 -0
- package/dist/api/types/CreditBundleCurrencyPriceResponseData.d.ts +5 -0
- package/dist/api/types/CreditCompanyGrantView.d.ts +1 -0
- package/dist/api/types/CreditCurrencyPrice.d.ts +5 -0
- package/dist/api/types/CreditCurrencyPriceRequestBody.d.ts +5 -0
- package/dist/api/types/CreditCurrencyPriceResponseData.d.ts +5 -0
- package/dist/api/types/CreditLeaseResponseData.d.ts +10 -0
- package/dist/api/types/CurrencyPriceRequestBody.d.ts +13 -0
- package/dist/api/types/CustomPlanActivationStrategy.d.ts +5 -0
- package/dist/api/types/CustomPlanBillingResponseData.d.ts +15 -0
- package/dist/api/types/CustomPlanBillingStatus.d.ts +7 -0
- package/dist/api/types/DataEventPayload.d.ts +3 -0
- package/dist/api/types/DatastreamCompanyPlan.d.ts +2 -0
- package/dist/api/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +1 -0
- package/dist/api/types/EntitlementCurrencyPricesResponseData.d.ts +7 -0
- package/dist/api/types/EnvironmentFeatureUsageTimeSeriesResponseData.d.ts +6 -0
- package/dist/api/types/EnvironmentTraitUsageTimeSeriesResponseData.d.ts +6 -0
- package/dist/api/types/EnvironmentUsagePointResponseData.d.ts +4 -0
- package/dist/api/types/EventBodyTrack.d.ts +2 -0
- package/dist/api/types/EventDetailResponseData.d.ts +2 -0
- package/dist/api/types/EventResponseData.d.ts +1 -0
- package/dist/api/types/FeatureCompanyResponseData.d.ts +4 -3
- package/dist/api/types/FeatureCompanyUserResponseData.d.ts +2 -2
- package/dist/api/types/FeatureDetailResponseData.d.ts +3 -1
- package/dist/api/types/FeatureEntitlement.d.ts +2 -2
- package/dist/api/types/FeatureInPlanResponseData.d.ts +21 -0
- package/dist/api/types/FeatureResponseData.d.ts +1 -1
- package/dist/api/types/FeatureUsageResponseData.d.ts +4 -3
- package/dist/api/types/FeatureView.d.ts +2 -1
- package/dist/api/types/FlagDetailResponseData.d.ts +2 -1
- package/dist/api/types/FlagInPlanResponseData.d.ts +16 -0
- package/dist/api/types/FlagResponseData.d.ts +1 -1
- package/dist/api/types/FlagView.d.ts +0 -1
- package/dist/api/types/InsightsSummaryResponseData.d.ts +9 -0
- package/dist/api/types/IntegrationCapabilities.d.ts +5 -0
- package/dist/api/types/IntegrationConfig.d.ts +16 -0
- package/dist/api/types/IntegrationResponseData.d.ts +8 -0
- package/dist/api/types/IntegrationState.d.ts +6 -0
- package/dist/api/types/IntegrationType.d.ts +8 -0
- package/dist/api/types/IntegrationWebhookUrlResponseData.d.ts +5 -0
- package/dist/api/types/IntegrationsDataSetResponseData.d.ts +3 -0
- package/dist/api/types/IntegrationsListResponseData.d.ts +10 -0
- package/dist/api/types/IntegrationsResponseData.d.ts +8 -0
- package/dist/api/types/MarkCustomPlanBillingPaidRequestBody.d.ts +1 -0
- package/dist/api/types/{ConditionMetricPeriod.d.ts → MetricPeriod.d.ts} +2 -2
- package/dist/api/types/MetricPeriodMonthReset.d.ts +5 -0
- package/dist/api/types/MigrationErrorCode.d.ts +14 -0
- package/dist/api/types/MrrResponseData.d.ts +4 -0
- package/dist/api/types/OrbIntegrationConfig.d.ts +4 -0
- package/dist/api/types/PlanCreditGrantView.d.ts +2 -0
- package/dist/api/types/PlanCurrencyPriceRequestBody.d.ts +7 -0
- package/dist/api/types/PlanCurrencyPricesResponseData.d.ts +8 -0
- package/dist/api/types/PlanDetailResponseData.d.ts +12 -3
- package/dist/api/types/PlanEntitlementResponseData.d.ts +7 -2
- package/dist/api/types/PlanGroupPlanDetailResponseData.d.ts +13 -4
- package/dist/api/types/PlanGrowthPointResponseData.d.ts +6 -0
- package/dist/api/types/PlanGrowthResponseData.d.ts +4 -0
- package/dist/api/types/PlanIcon.d.ts +28 -0
- package/dist/api/types/PlanPriceCadence.d.ts +6 -0
- package/dist/api/types/PlanResponseData.d.ts +3 -1
- package/dist/api/types/PlanVersionCompanyMigrationResponseData.d.ts +1 -0
- package/dist/api/types/PlanVersionMigrationResponseData.d.ts +1 -0
- package/dist/api/types/PlanVersionResponseData.d.ts +1 -1
- package/dist/api/types/PlanViewPublicResponseData.d.ts +13 -4
- package/dist/api/types/ReleaseCreditLeaseRequestBody.d.ts +1 -0
- package/dist/api/types/Rule.d.ts +1 -1
- package/dist/api/types/RuleConditionDetailResponseData.d.ts +4 -4
- package/dist/api/types/RuleConditionResponseData.d.ts +4 -4
- package/dist/api/types/RuleDetailResponseData.d.ts +1 -1
- package/dist/api/types/RuleResponseData.d.ts +2 -1
- package/dist/api/types/{RuleRuleType.d.ts → RuleType.d.ts} +4 -4
- package/dist/api/types/RuleView.d.ts +1 -1
- package/dist/api/types/RulesEngineSchemaVersion.d.ts +1 -1
- package/dist/api/types/RulesengineCheckFlagResult.d.ts +2 -2
- package/dist/api/types/RulesengineCompanyMetric.d.ts +2 -2
- package/dist/api/types/RulesengineCondition.d.ts +4 -4
- package/dist/api/types/{RulesengineConditionConditionType.d.ts → RulesengineConditionType.d.ts} +2 -2
- package/dist/api/types/RulesengineFeatureEntitlement.d.ts +2 -2
- package/dist/api/types/RulesengineMetricPeriod.d.ts +7 -0
- package/dist/api/types/RulesengineMetricPeriodMonthReset.d.ts +5 -0
- package/dist/api/types/RulesengineRule.d.ts +1 -1
- package/dist/api/types/{RulesengineRuleRuleType.d.ts → RulesengineRuleType.d.ts} +4 -4
- package/dist/api/types/StripeIntegrationConfig.d.ts +14 -0
- package/dist/api/types/TopFeatureByUsageResponseData.d.ts +8 -0
- package/dist/api/types/TopFeaturesByUsageResponseData.d.ts +4 -0
- package/dist/api/types/TrialStatus.d.ts +6 -0
- package/dist/api/types/UpdateAutoTopupOverrideRequestBody.d.ts +6 -0
- package/dist/api/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/api/types/UpdateEntitlementReqCommon.d.ts +2 -2
- package/dist/api/types/UpdatePlanRequestBody.d.ts +2 -1
- package/dist/api/types/UpsertBillingProductRequestBody.d.ts +4 -0
- package/dist/api/types/UsageBasedEntitlementRequestBody.d.ts +7 -0
- package/dist/api/types/UsageBasedEntitlementResponseData.d.ts +5 -2
- package/dist/api/types/WebhookUrl.d.ts +5 -0
- package/dist/api/types/WorkOsIntegrationConfig.d.ts +6 -0
- package/dist/api/types/index.d.ts +67 -30
- package/dist/core/auth/AuthProvider.d.ts +1 -0
- package/dist/core/auth/BasicAuth.d.ts +2 -2
- package/dist/core/auth/index.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.d.ts +8 -0
- package/dist/core/schemas/builders/enum/enum.d.ts +1 -0
- package/dist/core/schemas/builders/enum/index.d.ts +1 -1
- package/dist/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/core/url/index.d.ts +1 -0
- package/dist/core/url/qs.d.ts +2 -1
- package/dist/datastream/merge.d.ts +11 -7
- package/dist/datastream/types.d.ts +1 -0
- package/dist/datastream/websocket-client.d.ts +1 -1
- package/dist/errors/SchematicError.d.ts +3 -1
- package/dist/errors/SchematicTimeoutError.d.ts +4 -1
- package/dist/event-capture.d.ts +28 -0
- package/dist/events.d.ts +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/logger.d.ts +20 -0
- package/dist/rules-engine.d.ts +3 -3
- package/dist/serialization/resources/accounts/types/GetAccountMemberResponse.d.ts +11 -0
- package/dist/serialization/resources/accounts/types/ListAccountMembersParams.d.ts +12 -0
- package/dist/serialization/resources/accounts/types/ListAccountMembersResponse.d.ts +12 -0
- package/dist/serialization/resources/accounts/types/index.d.ts +3 -0
- package/dist/serialization/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +2 -0
- package/dist/serialization/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +2 -0
- package/dist/serialization/resources/billing/client/requests/CreateMeterRequestBody.d.ts +2 -0
- package/dist/serialization/resources/billing/types/CountBillingProductsParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/DeletePaymentMethodByExternalIdResponse.d.ts +11 -0
- package/dist/serialization/resources/billing/types/ListBillingPricesParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/ListBillingProductPricesParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/ListBillingProductsParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/index.d.ts +1 -0
- package/dist/serialization/resources/companies/client/requests/index.d.ts +0 -2
- package/dist/serialization/resources/companies/types/CountCompaniesParams.d.ts +2 -0
- package/dist/serialization/resources/companies/types/ListCompaniesParams.d.ts +2 -0
- package/dist/serialization/resources/companies/types/ListPlanChangesParams.d.ts +4 -2
- package/dist/serialization/resources/companies/types/index.d.ts +0 -3
- package/dist/serialization/resources/credits/client/requests/AcquireCreditLeaseRequestBody.d.ts +12 -0
- package/dist/serialization/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +2 -0
- package/dist/serialization/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +1 -0
- package/dist/serialization/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +2 -0
- package/dist/serialization/resources/credits/client/requests/ExtendCreditLeaseRequestBody.d.ts +10 -0
- package/dist/serialization/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +2 -0
- package/dist/serialization/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +2 -0
- package/dist/serialization/resources/credits/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/credits/types/AcquireCreditLeaseResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +1 -0
- package/dist/serialization/resources/credits/types/ExtendCreditLeaseResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +1 -0
- package/dist/serialization/resources/credits/types/ListCompanyCreditBalancesParams.d.ts +9 -0
- package/dist/serialization/resources/credits/types/ListCompanyCreditBalancesResponse.d.ts +12 -0
- package/dist/serialization/resources/credits/types/ReleaseCreditLeaseResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/index.d.ts +6 -0
- package/dist/serialization/resources/entitlements/client/requests/CreateBillingLinkedPlanEntitlementRequestBody.d.ts +51 -0
- package/dist/serialization/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +4 -4
- package/dist/serialization/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +11 -4
- package/dist/serialization/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +4 -4
- package/dist/serialization/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +11 -4
- package/dist/serialization/resources/entitlements/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/entitlements/types/CountFeatureUsageParams.d.ts +2 -0
- package/dist/serialization/resources/entitlements/types/ListFeatureUsageParams.d.ts +2 -0
- package/dist/serialization/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.d.ts +11 -0
- package/dist/serialization/resources/entitlements/types/index.d.ts +1 -8
- package/dist/serialization/resources/events/types/ListEventsParams.d.ts +1 -0
- package/dist/serialization/resources/features/client/requests/CreateBillingLinkedFeatureRequestBody.d.ts +25 -0
- package/dist/serialization/resources/features/client/requests/CreateFeatureRequestBody.d.ts +1 -1
- package/dist/serialization/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +1 -1
- package/dist/serialization/resources/features/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/features/types/CountFeaturesParams.d.ts +2 -0
- package/dist/serialization/resources/features/types/ListFeaturesParams.d.ts +2 -0
- package/dist/serialization/resources/features/types/UpsertFeatureForBillingProductResponse.d.ts +11 -0
- package/dist/serialization/resources/features/types/index.d.ts +1 -0
- package/dist/serialization/resources/index.d.ts +6 -0
- package/dist/serialization/resources/insights/index.d.ts +1 -0
- package/dist/serialization/resources/insights/types/GetActivityParams.d.ts +9 -0
- package/dist/serialization/resources/insights/types/GetActivityResponse.d.ts +12 -0
- package/dist/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.d.ts +13 -0
- package/dist/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.d.ts +12 -0
- package/dist/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.d.ts +13 -0
- package/dist/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.d.ts +12 -0
- package/dist/serialization/resources/insights/types/GetPlanGrowthParams.d.ts +9 -0
- package/dist/serialization/resources/insights/types/GetPlanGrowthResponse.d.ts +12 -0
- package/dist/serialization/resources/insights/types/GetSummaryResponse.d.ts +11 -0
- package/dist/serialization/resources/insights/types/GetTopFeaturesByUsageParams.d.ts +11 -0
- package/dist/serialization/resources/insights/types/GetTopFeaturesByUsageResponse.d.ts +12 -0
- package/dist/serialization/resources/insights/types/index.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/client/index.d.ts +1 -0
- package/dist/serialization/resources/integrationsapi/client/requests/StartDataImportRequestBody.d.ts +12 -0
- package/dist/serialization/resources/integrationsapi/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/integrationsapi/index.d.ts +2 -0
- package/dist/serialization/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/ListIntegrationsParams.d.ts +17 -0
- package/dist/serialization/resources/integrationsapi/types/ListIntegrationsResponse.d.ts +12 -0
- package/dist/serialization/resources/integrationsapi/types/LoadSampleDataSetV2Response.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/RunIntegrationResponse.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/StartDataImportResponse.d.ts +11 -0
- package/dist/serialization/resources/{companies/types/DeletePlanTraitResponse.d.ts → integrationsapi/types/UninstallIntegrationResponse.d.ts} +2 -2
- package/dist/serialization/resources/integrationsapi/types/index.d.ts +7 -0
- package/dist/serialization/resources/planbundle/client/requests/CreateCustomPlanBundleRequestBody.d.ts +14 -0
- package/dist/serialization/resources/planbundle/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/planbundle/types/CreateCustomPlanBundleResponse.d.ts +11 -0
- package/dist/serialization/resources/planbundle/types/index.d.ts +1 -0
- package/dist/serialization/resources/planmigrations/client/index.d.ts +1 -0
- package/dist/serialization/resources/planmigrations/client/requests/CreateMigrationInput.d.ts +17 -0
- package/dist/serialization/resources/planmigrations/client/requests/RetryMigrationRequestBody.d.ts +10 -0
- package/dist/serialization/resources/planmigrations/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/planmigrations/index.d.ts +1 -0
- package/dist/serialization/resources/planmigrations/types/CreateMigrationResponse.d.ts +11 -0
- package/dist/serialization/resources/planmigrations/types/RetryCompanyMigrationResponse.d.ts +11 -0
- package/dist/serialization/resources/planmigrations/types/RetryMigrationResponse.d.ts +11 -0
- package/dist/serialization/resources/planmigrations/types/index.d.ts +3 -0
- package/dist/serialization/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.d.ts +18 -0
- package/dist/serialization/resources/plans/client/requests/CreateCustomPlanRequestBody.d.ts +14 -0
- package/dist/serialization/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +6 -0
- package/dist/serialization/resources/plans/client/requests/RetryCustomPlanBillingRequestBody.d.ts +14 -0
- package/dist/serialization/resources/plans/client/requests/index.d.ts +3 -0
- package/dist/serialization/resources/plans/types/CountBillingProductMatchCompaniesParams.d.ts +12 -0
- package/dist/serialization/resources/plans/types/CountBillingProductMatchCompaniesResponse.d.ts +12 -0
- package/dist/serialization/resources/plans/types/CountPlansParams.d.ts +4 -0
- package/dist/serialization/resources/plans/types/CreateCustomPlanResponse.d.ts +11 -0
- package/dist/serialization/resources/plans/types/DeletePlanVersionParams.d.ts +9 -0
- package/dist/serialization/resources/plans/types/DeletePlanVersionResponse.d.ts +2 -1
- package/dist/serialization/resources/plans/types/ListBillingProductMatchCompaniesParams.d.ts +12 -0
- package/dist/serialization/resources/plans/types/ListBillingProductMatchCompaniesResponse.d.ts +12 -0
- package/dist/serialization/resources/plans/types/ListCustomPlanBillingsParams.d.ts +15 -0
- package/dist/serialization/resources/plans/types/ListCustomPlanBillingsResponse.d.ts +12 -0
- package/dist/serialization/resources/plans/types/ListPlansParams.d.ts +4 -0
- package/dist/serialization/resources/plans/types/MarkCustomPlanBillingPaidResponse.d.ts +11 -0
- package/dist/serialization/resources/plans/types/RetryCustomPlanBillingResponse.d.ts +11 -0
- package/dist/serialization/resources/plans/types/UpsertPlanForBillingProductResponse.d.ts +11 -0
- package/dist/serialization/resources/plans/types/index.d.ts +11 -0
- package/dist/serialization/types/AccountMemberPermission.d.ts +7 -0
- package/dist/serialization/types/AccountMemberResponseData.d.ts +18 -0
- package/dist/serialization/types/AccountMemberRole.d.ts +7 -0
- package/dist/serialization/types/ActivityEntryResponseData.d.ts +14 -0
- package/dist/serialization/types/ActivityResponseResponseData.d.ts +10 -0
- package/dist/serialization/types/ApiKeyCreateResponseData.d.ts +4 -0
- package/dist/serialization/types/ApiKeyIntegrationResponseData.d.ts +13 -0
- package/dist/serialization/types/ApiKeyResponseData.d.ts +4 -0
- package/dist/serialization/types/AuditLogListResponseData.d.ts +4 -0
- package/dist/serialization/types/AuditLogResponseData.d.ts +4 -0
- package/dist/serialization/types/BillingCreditBundleResponseData.d.ts +3 -0
- package/dist/serialization/types/BillingCreditBundleView.d.ts +2 -0
- package/dist/serialization/types/BillingCreditGrantReason.d.ts +1 -1
- package/dist/serialization/types/BillingCreditGrantResponseData.d.ts +1 -0
- package/dist/serialization/types/BillingCreditResponseData.d.ts +2 -0
- package/dist/serialization/types/BillingCreditView.d.ts +2 -0
- package/dist/serialization/types/BillingLinkedResourceResponseData.d.ts +12 -0
- package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +2 -0
- package/dist/serialization/types/BillingPriceResponseData.d.ts +2 -0
- package/dist/serialization/types/BillingPriceView.d.ts +2 -0
- package/dist/serialization/types/BillingProductForSubscriptionResponseData.d.ts +1 -0
- package/dist/serialization/types/BillingProductPlanResponseData.d.ts +4 -2
- package/dist/serialization/types/BillingProductPriceResponseData.d.ts +2 -0
- package/dist/serialization/types/BillingProviderType.d.ts +1 -1
- package/dist/serialization/types/BillingStrategy.d.ts +7 -0
- package/dist/serialization/types/ChangeSubscriptionInternalRequestBody.d.ts +2 -0
- package/dist/serialization/types/ChangeSubscriptionRequestBody.d.ts +2 -0
- package/dist/serialization/types/ChargeType.d.ts +1 -1
- package/dist/serialization/types/CheckFlagResponseData.d.ts +4 -2
- package/dist/serialization/types/CheckoutSubscription.d.ts +2 -0
- package/dist/serialization/types/ClerkIntegrationConfig.d.ts +10 -0
- package/dist/serialization/types/CompanyCreditBalanceResponseData.d.ts +13 -0
- package/dist/serialization/types/CompanyDetailResponseData.d.ts +2 -0
- package/dist/serialization/types/CompanyEventPeriodMetricsResponseData.d.ts +4 -2
- package/dist/serialization/types/CompanyMatchingCriteria.d.ts +7 -0
- package/dist/serialization/types/CompanyOverrideResponseData.d.ts +4 -2
- package/dist/serialization/types/CompanyPlanCreditGrantView.d.ts +47 -0
- package/dist/serialization/types/CompanyPlanDetailResponseData.d.ts +19 -6
- package/dist/serialization/types/CompanyPlanWithBillingSubView.d.ts +2 -2
- package/dist/serialization/types/CompanySubscriptionResponseData.d.ts +2 -0
- package/dist/serialization/types/ComparableOperator.d.ts +7 -0
- package/dist/serialization/types/Condition.d.ts +8 -8
- package/dist/serialization/types/ConditionResponseData.d.ts +8 -4
- package/dist/serialization/types/{ConditionConditionType.d.ts → ConditionType.d.ts} +2 -2
- package/dist/serialization/types/ConditionView.d.ts +8 -4
- package/dist/serialization/types/CreateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/serialization/types/CreateCustomPlanBundlePlanRequestBody.d.ts +13 -0
- package/dist/serialization/types/CreateEntitlementInBundleRequestBody.d.ts +11 -4
- package/dist/serialization/types/CreateEntitlementReqCommon.d.ts +4 -4
- package/dist/serialization/types/CreateEventRequestBody.d.ts +3 -0
- package/dist/serialization/types/CreateFlagRequestBody.d.ts +1 -1
- package/dist/serialization/types/CreateOrUpdateConditionRequestBody.d.ts +8 -8
- package/dist/serialization/types/CreateOrUpdateFlagRequestBody.d.ts +1 -1
- package/dist/serialization/types/CreateOrUpdateRuleRequestBody.d.ts +2 -2
- package/dist/serialization/types/CreatePlanRequestBody.d.ts +2 -1
- package/dist/serialization/types/CreditBundleCurrencyPrice.d.ts +11 -0
- package/dist/serialization/types/CreditBundleCurrencyPriceRequestBody.d.ts +11 -0
- package/dist/serialization/types/CreditBundleCurrencyPriceResponseData.d.ts +11 -0
- package/dist/serialization/types/CreditCompanyGrantView.d.ts +1 -0
- package/dist/serialization/types/CreditCurrencyPrice.d.ts +11 -0
- package/dist/serialization/types/CreditCurrencyPriceRequestBody.d.ts +11 -0
- package/dist/serialization/types/CreditCurrencyPriceResponseData.d.ts +11 -0
- package/dist/serialization/types/CreditLeaseResponseData.d.ts +16 -0
- package/dist/serialization/types/CurrencyPriceRequestBody.d.ts +19 -0
- package/dist/serialization/types/CustomPlanActivationStrategy.d.ts +7 -0
- package/dist/serialization/types/CustomPlanBillingResponseData.d.ts +22 -0
- package/dist/serialization/types/CustomPlanBillingStatus.d.ts +7 -0
- package/dist/serialization/types/DataEventPayload.d.ts +3 -0
- package/dist/serialization/types/DatastreamCompanyPlan.d.ts +2 -0
- package/dist/serialization/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +2 -0
- package/dist/serialization/types/EntitlementCurrencyPricesResponseData.d.ts +13 -0
- package/dist/serialization/types/EnvironmentFeatureUsageTimeSeriesResponseData.d.ts +12 -0
- package/dist/serialization/types/EnvironmentTraitUsageTimeSeriesResponseData.d.ts +12 -0
- package/dist/serialization/types/EnvironmentUsagePointResponseData.d.ts +10 -0
- package/dist/serialization/types/EventBodyTrack.d.ts +1 -0
- package/dist/serialization/types/EventDetailResponseData.d.ts +3 -0
- package/dist/serialization/types/EventResponseData.d.ts +1 -0
- package/dist/serialization/types/FeatureCompanyResponseData.d.ts +7 -4
- package/dist/serialization/types/FeatureCompanyUserResponseData.d.ts +4 -2
- package/dist/serialization/types/FeatureDetailResponseData.d.ts +5 -1
- package/dist/serialization/types/FeatureEntitlement.d.ts +4 -4
- package/dist/serialization/types/FeatureInPlanResponseData.d.ts +33 -0
- package/dist/serialization/types/FeatureResponseData.d.ts +1 -1
- package/dist/serialization/types/FeatureUsageResponseData.d.ts +7 -4
- package/dist/serialization/types/FeatureView.d.ts +3 -1
- package/dist/serialization/types/FlagDetailResponseData.d.ts +3 -1
- package/dist/serialization/types/FlagInPlanResponseData.d.ts +24 -0
- package/dist/serialization/types/FlagResponseData.d.ts +1 -1
- package/dist/serialization/types/FlagView.d.ts +0 -1
- package/dist/serialization/types/InsightsSummaryResponseData.d.ts +15 -0
- package/dist/serialization/types/IntegrationCapabilities.d.ts +11 -0
- package/dist/serialization/types/IntegrationConfig.d.ts +23 -0
- package/dist/serialization/types/IntegrationResponseData.d.ts +15 -0
- package/dist/serialization/types/IntegrationState.d.ts +7 -0
- package/dist/serialization/types/IntegrationType.d.ts +7 -0
- package/dist/serialization/types/IntegrationWebhookUrlResponseData.d.ts +11 -0
- package/dist/serialization/types/IntegrationsDataSetResponseData.d.ts +9 -0
- package/dist/serialization/types/IntegrationsListResponseData.d.ts +19 -0
- package/dist/serialization/types/IntegrationsResponseData.d.ts +15 -0
- package/dist/serialization/types/MarkCustomPlanBillingPaidRequestBody.d.ts +7 -0
- package/dist/serialization/types/{ConditionMetricPeriod.d.ts → MetricPeriod.d.ts} +2 -2
- package/dist/serialization/types/MetricPeriodMonthReset.d.ts +7 -0
- package/dist/serialization/types/MigrationErrorCode.d.ts +7 -0
- package/dist/serialization/types/MrrResponseData.d.ts +10 -0
- package/dist/serialization/types/OrbIntegrationConfig.d.ts +9 -0
- package/dist/serialization/types/PlanCreditGrantView.d.ts +2 -0
- package/dist/serialization/types/PlanCurrencyPriceRequestBody.d.ts +13 -0
- package/dist/serialization/types/PlanCurrencyPricesResponseData.d.ts +14 -0
- package/dist/serialization/types/PlanDetailResponseData.d.ts +18 -5
- package/dist/serialization/types/PlanEntitlementResponseData.d.ts +10 -2
- package/dist/serialization/types/PlanGroupPlanDetailResponseData.d.ts +19 -6
- package/dist/serialization/types/PlanGrowthPointResponseData.d.ts +12 -0
- package/dist/serialization/types/PlanGrowthResponseData.d.ts +10 -0
- package/dist/serialization/types/PlanIcon.d.ts +7 -0
- package/dist/serialization/types/PlanPriceCadence.d.ts +7 -0
- package/dist/serialization/types/PlanResponseData.d.ts +4 -1
- package/dist/serialization/types/PlanVersionCompanyMigrationResponseData.d.ts +2 -0
- package/dist/serialization/types/PlanVersionMigrationResponseData.d.ts +1 -0
- package/dist/serialization/types/PlanVersionResponseData.d.ts +2 -1
- package/dist/serialization/types/PlanViewPublicResponseData.d.ts +19 -6
- package/dist/serialization/types/ReleaseCreditLeaseRequestBody.d.ts +7 -0
- package/dist/serialization/types/Rule.d.ts +2 -2
- package/dist/serialization/types/RuleConditionDetailResponseData.d.ts +8 -4
- package/dist/serialization/types/RuleConditionResponseData.d.ts +8 -4
- package/dist/serialization/types/RuleDetailResponseData.d.ts +2 -1
- package/dist/serialization/types/RuleResponseData.d.ts +2 -1
- package/dist/serialization/types/RuleType.d.ts +7 -0
- package/dist/serialization/types/RuleView.d.ts +2 -1
- package/dist/serialization/types/RulesEngineSchemaVersion.d.ts +1 -1
- package/dist/serialization/types/RulesengineCheckFlagResult.d.ts +4 -4
- package/dist/serialization/types/RulesengineCompanyMetric.d.ts +4 -4
- package/dist/serialization/types/RulesengineCondition.d.ts +8 -8
- package/dist/serialization/types/{RulesengineConditionConditionType.d.ts → RulesengineConditionType.d.ts} +2 -2
- package/dist/serialization/types/RulesengineFeatureEntitlement.d.ts +4 -4
- package/dist/serialization/types/RulesengineMetricPeriod.d.ts +7 -0
- package/dist/serialization/types/RulesengineMetricPeriodMonthReset.d.ts +7 -0
- package/dist/serialization/types/RulesengineRule.d.ts +2 -2
- package/dist/serialization/types/RulesengineRuleType.d.ts +7 -0
- package/dist/serialization/types/StripeIntegrationConfig.d.ts +14 -0
- package/dist/serialization/types/TopFeatureByUsageResponseData.d.ts +14 -0
- package/dist/serialization/types/TopFeaturesByUsageResponseData.d.ts +10 -0
- package/dist/serialization/types/TrialStatus.d.ts +7 -0
- package/dist/serialization/types/UpdateAutoTopupOverrideRequestBody.d.ts +12 -0
- package/dist/serialization/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/serialization/types/UpdateEntitlementReqCommon.d.ts +4 -4
- package/dist/serialization/types/UpdatePlanRequestBody.d.ts +2 -1
- package/dist/serialization/types/UpsertBillingProductRequestBody.d.ts +6 -0
- package/dist/serialization/types/UsageBasedEntitlementRequestBody.d.ts +7 -0
- package/dist/serialization/types/UsageBasedEntitlementResponseData.d.ts +6 -2
- package/dist/serialization/types/WebhookUrl.d.ts +11 -0
- package/dist/serialization/types/WorkOsIntegrationConfig.d.ts +10 -0
- package/dist/serialization/types/index.d.ts +67 -30
- package/dist/version.d.ts +2 -0
- package/dist/wasm/rulesengine.d.ts +1 -0
- package/dist/wasm/rulesengine.js +41 -9
- package/dist/wasm/rulesengine_bg.wasm +0 -0
- package/dist/wasm/rulesengine_bg.wasm.d.ts +1 -0
- package/dist/wrapper.d.ts +40 -5
- package/package.json +9 -9
- package/dist/api/resources/companies/client/requests/CreatePlanTraitRequestBody.d.ts +0 -13
- package/dist/api/resources/companies/client/requests/UpdatePlanTraitRequestBody.d.ts +0 -11
- package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/types/ConditionMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/types/CreateEntitlementReqCommonMetricPeriod.d.ts +0 -7
- package/dist/api/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +0 -10
- package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +0 -8
- package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +0 -6
- package/dist/api/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +0 -11
- package/dist/api/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +0 -8
- package/dist/api/types/FeatureEntitlementMetricPeriod.d.ts +0 -8
- package/dist/api/types/FeatureEntitlementMonthReset.d.ts +0 -6
- package/dist/api/types/PlanControlledByType.d.ts +0 -5
- package/dist/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +0 -7
- package/dist/api/types/RulesengineCheckFlagResultRuleType.d.ts +0 -10
- package/dist/api/types/RulesengineCompanyMetricMonthReset.d.ts +0 -5
- package/dist/api/types/RulesengineCompanyMetricPeriod.d.ts +0 -7
- package/dist/api/types/RulesengineConditionMetricPeriod.d.ts +0 -7
- package/dist/api/types/RulesengineConditionMetricPeriodMonthReset.d.ts +0 -5
- package/dist/api/types/RulesengineConditionOperator.d.ts +0 -11
- package/dist/api/types/RulesengineFeatureEntitlementMetricPeriod.d.ts +0 -8
- package/dist/api/types/RulesengineFeatureEntitlementMonthReset.d.ts +0 -6
- package/dist/api/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +0 -7
- package/dist/api/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +0 -5
- package/dist/serialization/resources/companies/client/requests/CreatePlanTraitRequestBody.d.ts +0 -11
- package/dist/serialization/resources/companies/client/requests/UpdatePlanTraitRequestBody.d.ts +0 -10
- package/dist/serialization/resources/companies/types/CreatePlanTraitResponse.d.ts +0 -11
- package/dist/serialization/resources/companies/types/UpdatePlanTraitResponse.d.ts +0 -11
- package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/ConditionMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/ConditionOperator.d.ts +0 -7
- package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +0 -7
- package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +0 -7
- package/dist/serialization/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +0 -7
- package/dist/serialization/types/FeatureEntitlementMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/FeatureEntitlementMonthReset.d.ts +0 -7
- package/dist/serialization/types/PlanControlledByType.d.ts +0 -7
- package/dist/serialization/types/RuleRuleType.d.ts +0 -7
- package/dist/serialization/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +0 -7
- package/dist/serialization/types/RulesengineCheckFlagResultRuleType.d.ts +0 -7
- package/dist/serialization/types/RulesengineCompanyMetricMonthReset.d.ts +0 -7
- package/dist/serialization/types/RulesengineCompanyMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/RulesengineConditionMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/RulesengineConditionMetricPeriodMonthReset.d.ts +0 -7
- package/dist/serialization/types/RulesengineConditionOperator.d.ts +0 -7
- package/dist/serialization/types/RulesengineFeatureEntitlementMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/RulesengineFeatureEntitlementMonthReset.d.ts +0 -7
- package/dist/serialization/types/RulesengineRuleRuleType.d.ts +0 -7
- package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +0 -7
- package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var vh=Object.create;var Pt=Object.defineProperty;var Th=Object.getOwnPropertyDescriptor;var Oh=Object.getOwnPropertyNames;var kh=Object.getPrototypeOf,jh=Object.prototype.hasOwnProperty;var lt=(p,o)=>()=>(p&&(o=p(p=0)),o);var Ae=(p,o)=>{for(var t in o)Pt(p,t,{get:o[t],enumerable:!0})},Na=(p,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Oh(o))!jh.call(p,s)&&s!==t&&Pt(p,s,{get:()=>o[s],enumerable:!(i=Th(o,s))||i.enumerable});return p};var xt=(p,o,t)=>(t=p!=null?vh(kh(p)):{},Na(o||!p||!p.__esModule?Pt(t,"default",{value:p,enumerable:!0}):t,p)),$a=p=>Na(Pt({},"__esModule",{value:!0}),p);var Pn={};Ae(Pn,{Node18UniversalStreamWrapper:()=>wi});var wi,xn=lt(()=>{"use strict";wi=class p{constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,t){this.events[o]?.push(t)}off(o,t){this.events[o]=this.events[o]?.filter(i=>i!==t)}pipe(o){return this.on("data",async t=>{if(o instanceof p)o._write(t);else if(o instanceof WritableStream){let i=o.getWriter();i.write(t).then(()=>i.releaseLock())}else o.write(t)}),this.on("end",async()=>{o instanceof p?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.on("error",async t=>{o instanceof p?o._error(t):o instanceof WritableStream?o.getWriter().abort(t):o.destroy(t)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",async t=>{if(o instanceof p)o._write(t);else if(o instanceof WritableStream){let i=o.getWriter();i.write(t).then(()=>i.releaseLock())}else o.write(t)}),this.off("end",async()=>{o instanceof p?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.off("error",async t=>{o instanceof p?o._error(t):o instanceof WritableStream?o.getWriter().abort(t):o.destroy(t)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(t=>{this._emit("error",t)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();if(!o)return t}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:i,value:s}=await this.reader.read();if(i)break;s&&o.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,t){if(this.events[o])for(let i of this.events[o]||[])i(t)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}t&&this._emit("data",t)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:t}},[Symbol.asyncIterator](){return this}}}}});var Cn={};Ae(Cn,{UndiciStreamWrapper:()=>bi});var bi,En=lt(()=>{"use strict";bi=class p{constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,t){this.events[o]?.push(t)}off(o,t){this.events[o]=this.events[o]?.filter(i=>i!==t)}pipe(o){return this.on("data",t=>{if(o instanceof p)o._write(t);else{let i=o.getWriter();i.write(t).then(()=>i.releaseLock())}}),this.on("end",()=>{o instanceof p?o._end():o.getWriter().close()}),this.on("error",t=>{o instanceof p?o._error(t):o.getWriter().abort(t)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",t=>{if(o instanceof p)o._write(t);else{let i=o.getWriter();i.write(t).then(()=>i.releaseLock())}}),this.off("end",()=>{o instanceof p?o._end():o.getWriter().close()}),this.off("error",t=>{o instanceof p?o._error(t):o.getWriter().abort(t)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(t=>{this._emit("error",t)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();if(!o)return t}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:i,value:s}=await this.reader.read();if(i)break;s&&o.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,t){if(this.events[o])for(let i of this.events[o]||[])i(t)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}t&&this._emit("data",t)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(i=>{this.resumeCallback=i});let{done:o,value:t}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:t}},[Symbol.asyncIterator](){return this}}}}});var Un={};Ae(Un,{NodePre18StreamWrapper:()=>zi});var zi,vn=lt(()=>{"use strict";zi=class{constructor(o){this.readableStream=o}on(o,t){this.readableStream.on(o,t)}off(o,t){this.readableStream.off(o,t)}pipe(o){return this.readableStream.pipe(o),o}pipeTo(o){return this.pipe(o)}unpipe(o){o?this.readableStream.unpipe(o):this.readableStream.unpipe()}destroy(o){this.readableStream.destroy(o)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((o,t)=>{let i=this.readableStream.read();i?o(i):(this.readableStream.once("readable",()=>{let s=this.readableStream.read();o(s)}),this.readableStream.once("error",t))})}setEncoding(o){this.readableStream.setEncoding(o),this.encoding=o}async text(){let o=[],t=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let s of this.readableStream)o.push(t.encode(s));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(o))}async json(){let o=await this.text();return JSON.parse(o)}[Symbol.asyncIterator](){let t=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:i,done:s}=await t.next();return{value:i,done:s}},[Symbol.asyncIterator](){return this}}}}});var ct,Ma=lt(()=>{"use strict";ct=class{constructor(){this._emitter=null}ensureEmitter(){if(!this._emitter){let{EventEmitter:o}=require("events");this._emitter=new o}return this._emitter}on(o,t){return this.ensureEmitter().on(o,t),this}emit(o,...t){return this._emitter?.emit(o,...t)??!1}removeAllListeners(o){return this._emitter?.removeAllListeners(o),this}}});var Ph={};Ae(Ph,{DatastreamWSClient:()=>Ka});function rw(p){let o=new URL(p);switch(o.protocol){case"https:":o.protocol="wss:";break;case"http:":o.protocol="ws:";break;default:throw new Error(`Unsupported scheme: ${o.protocol} (must be http: or https:)`)}if(o.hostname){let t=o.hostname.split(".");t.length>1&&t[0]==="api"&&(t[0]="datastream",o.hostname=t.join("."))}return o.pathname="/datastream",o.toString()}var _h,Zy,Sh,Yy,Qy,Xy,ew,Ka,xh=lt(()=>{"use strict";_h=xt(require("ws"));Ma();Zy=10*1e3,Sh=60*1e3,Yy=Sh*9/10,Qy=10,Xy=1*1e3,ew=30*1e3;Ka=class extends ct{constructor(t){super();this.connected=!1;this.ready=!1;this.shouldReconnect=!0;this.reconnectAttempts=0;if(!t.url)throw new Error("URL is required");if(!t.apiKey)throw new Error("ApiKey is required");if(!t.messageHandler)throw new Error("MessageHandler is required");t.url.startsWith("http://")||t.url.startsWith("https://")?this.url=rw(t.url):this.url=t.url,this.headers={"X-Schematic-Api-Key":t.apiKey},this.logger=t.logger,this.messageHandler=t.messageHandler,this.connectionReadyHandler=t.connectionReadyHandler,this.maxReconnectAttempts=t.maxReconnectAttempts??Qy,this.minReconnectDelay=t.minReconnectDelay??Xy,this.maxReconnectDelay=t.maxReconnectDelay??ew}start(){this.shouldReconnect=!0,this.reconnectAttempts=0,this.connectAndRead()}isConnected(){return this.connected}isReady(){return this.ready&&this.connected}async sendMessage(t){if(!this.isConnected()||!this.ws)throw new Error("WebSocket connection is not available!");return new Promise((i,s)=>{if(!this.ws){s(new Error("WebSocket connection is not available!"));return}let r=setTimeout(()=>{s(new Error("Write timeout"))},Zy);try{this.ws.send(JSON.stringify(t),n=>{clearTimeout(r),n?s(n):i()})}catch(n){clearTimeout(r),s(n)}})}close(){this.logger.info("Closing WebSocket connection"),this.shouldReconnect=!1,this.setReady(!1),this.setConnected(!1),this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.ws&&(this.ws.close(),this.ws=void 0)}async connectAndRead(){try{for(;this.shouldReconnect;)try{let t=await this.connect();if(this.reconnectAttempts=0,this.ws=t,this.setConnected(!0),this.setupWebSocketHandlers(t),this.connectionReadyHandler)try{await this.connectionReadyHandler(),this.logger.debug("Connection ready handler completed successfully")}catch(i){this.logger.error(`Connection ready handler failed: ${i}`),this.setConnected(!1),this.setReady(!1),t.close();continue}if(this.setReady(!0),this.logger.debug("WebSocket client is ready"),this.startPingPong(),await new Promise(i=>{let s=()=>{this.logger.info("WebSocket connection closed"),this.cleanup(),i()},r=n=>{this.logger.error(`WebSocket error: ${n.message}`),this.emit("error",n),this.cleanup(),i()};t.on("close",s),t.on("error",r)}),!this.shouldReconnect)break}catch(t){this.reconnectAttempts++,this.setConnected(!1),this.setReady(!1);let i=t instanceof Error?t.message:String(t);if(this.logger.warn(`WebSocket connection failed: ${i}, attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}`),this.reconnectAttempts>=this.maxReconnectAttempts){this.logger.error("Max reconnection attempts reached"),this.emit("error",new Error("Max reconnection attempts reached"));break}let s=this.calculateBackoffDelay(this.reconnectAttempts);this.logger.debug(`Waiting ${s}ms before reconnecting...`),await new Promise(r=>{this.reconnectTimeout=setTimeout(r,s),this.reconnectTimeout.unref()})}}catch(t){this.emit("error",t)}}connect(){return new Promise((t,i)=>{this.logger.debug(`Connecting to WebSocket: ${this.url}`);let s=new _h.default(this.url,{headers:this.headers,handshakeTimeout:3e4}),r=setTimeout(()=>{s.close(),i(new Error("Connection timeout"))},3e4);s.on("open",()=>{clearTimeout(r),t(s)}),s.on("error",n=>{clearTimeout(r),i(n)})})}setupWebSocketHandlers(t){t.on("message",i=>{this.handleMessage(i)}),t.on("pong",()=>{this.handlePong()}),t.on("close",i=>{this.handleClose(i)}),t.on("error",i=>{this.handleError(i)})}async handleMessage(t){try{let i;Buffer.isBuffer(t)?i=t.toString():Array.isArray(t)?i=Buffer.concat(t).toString():i=String(t);let s;try{s=JSON.parse(i)}catch(r){this.emit("error",new Error(`Failed to parse datastream message: ${r}`));return}try{await this.messageHandler(s)}catch(r){this.emit("error",new Error(`Message handler error: ${r}`))}}catch(i){this.emit("error",i)}}handleClose(t){this.logger.info(`WebSocket connection closed with code ${t}`),this.setConnected(!1),this.setReady(!1),this.cleanup()}handleError(t){this.logger.error(`WebSocket error: ${t.message}`),this.setConnected(!1),this.setReady(!1),this.cleanup()}startPingPong(){this.logger.debug("Starting ping/pong keepalive mechanism"),this.pingInterval=setInterval(()=>{this.sendPing()},Yy),this.pingInterval.unref()}sendPing(){if(this.ws){this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0),this.pongTimeout=setTimeout(()=>{this.logger.warn("Pong timeout - closing connection"),this.setConnected(!1),this.ws&&this.ws.close()},Sh),this.pongTimeout.unref();try{this.ws.ping()}catch(t){this.logger.error(`Failed to send ping: ${t}`),this.setConnected(!1)}}}handlePong(){this.logger.debug("Received pong from server"),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0)}calculateBackoffDelay(t){let i=Math.floor(Math.random()*this.minReconnectDelay),s=Math.pow(2,t-1)*this.minReconnectDelay+i;return Math.min(s,this.maxReconnectDelay+i)}setConnected(t){let i=this.connected;this.connected=t,t||(this.ready=!1),i!==t&&(this.logger.debug(`Connection state changed: ${t}`),t?this.emit("connected"):this.emit("disconnected"))}setReady(t){let i=this.ready;this.ready=t,i!==t&&(this.logger.debug(`Ready state changed: ${t}`),t?this.emit("ready"):this.emit("not-ready"))}cleanup(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0)}}});var aw={};Ae(aw,{LocalCache:()=>De,RedisCacheProvider:()=>Cr,RulesEngineClient:()=>st,Schematic:()=>X,SchematicClient:()=>li,SchematicEnvironment:()=>_,SchematicError:()=>z,SchematicTimeoutError:()=>xr,WEBHOOK_SIGNATURE_HEADER:()=>Ga,WEBHOOK_TIMESTAMP_HEADER:()=>Wa,WebhookSignatureError:()=>$e,computeHexSignature:()=>Eh,computeSignature:()=>ui,verifySignature:()=>Ha,verifyWebhookSignature:()=>Uh});module.exports=$a(aw);var X={};Ae(X,{ActorType:()=>Vh,ApiKeyScope:()=>Ah,BadRequestError:()=>T,BillingCreditBundleStatus:()=>Dh,BillingCreditBurnStrategy:()=>qh,BillingCreditExpiryType:()=>Mh,BillingCreditExpiryUnit:()=>Ih,BillingCreditGrantReason:()=>Fh,BillingCreditGrantZeroedOutReason:()=>Kh,BillingCreditRolloverPolicy:()=>Lh,BillingPlanCreditGrantResetCadence:()=>Gh,BillingPlanCreditGrantResetStart:()=>Wh,BillingPlanCreditGrantResetType:()=>Hh,BillingPriceScheme:()=>Nh,BillingPriceUsageType:()=>$h,BillingProductPriceInterval:()=>Jh,BillingProviderType:()=>Zh,BillingSubscriptionTrialEndSetting:()=>Yh,BillingTiersMode:()=>Qh,ChargeType:()=>Xh,CompanyPlanInvalidReason:()=>eg,ComponentEntityType:()=>rg,ComponentState:()=>tg,ConditionConditionType:()=>og,ConditionMetricPeriod:()=>ig,ConditionMetricPeriodMonthReset:()=>ag,ConditionOperator:()=>ng,CreateCompanyOverrideRequestBodyMetricPeriod:()=>an,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>nn,CreateEntitlementInBundleRequestBodyMetricPeriod:()=>sg,CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset:()=>cg,CreateEntitlementReqCommonMetricPeriod:()=>lg,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>pg,CreateOrUpdateConditionRequestBodyConditionType:()=>ug,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>dg,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>mg,CreateOrUpdateConditionRequestBodyOperator:()=>hg,CreateOrUpdateRuleRequestBodyRuleType:()=>gg,CreatePlanEntitlementRequestBodyMetricPeriod:()=>sn,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>cn,CreditEventType:()=>yg,CreditGrantSortOrder:()=>wg,CreditLedgerPeriod:()=>bg,DataExportStatus:()=>zg,EntitlementPriceBehavior:()=>Rg,EntitlementType:()=>fg,EntitlementValueType:()=>_g,EntityType:()=>Sg,EnvironmentType:()=>Pg,EventStatus:()=>xg,EventType:()=>gi,FeatureEntitlementMetricPeriod:()=>Cg,FeatureEntitlementMonthReset:()=>Eg,FeatureLifecyclePhase:()=>Ug,FeatureType:()=>vg,ForbiddenError:()=>P,InternalServerError:()=>x,InvoiceStatus:()=>Tg,NotFoundError:()=>C,PlanBundleAction:()=>Og,PlanChangeAction:()=>kg,PlanChangeBasePlanAction:()=>jg,PlanChangeSubscriptionAction:()=>Bg,PlanControlledByType:()=>Vg,PlanType:()=>Ag,PlanVersionCompanyMigrationStatus:()=>Dg,PlanVersionMigrationStatus:()=>qg,PlanVersionMigrationStrategy:()=>Mg,PlanVersionStatus:()=>Ig,ProrationBehavior:()=>Fg,RuleRuleType:()=>Kg,RulesEngineSchemaVersion:()=>Lg,RulesengineCheckFlagResultFeatureUsagePeriod:()=>Gg,RulesengineCheckFlagResultRuleType:()=>Wg,RulesengineCompanyMetricMonthReset:()=>Hg,RulesengineCompanyMetricPeriod:()=>Ng,RulesengineConditionConditionType:()=>$g,RulesengineConditionMetricPeriod:()=>Jg,RulesengineConditionMetricPeriodMonthReset:()=>Zg,RulesengineConditionOperator:()=>Yg,RulesengineEntitlementValueType:()=>Qg,RulesengineEntityType:()=>Xg,RulesengineFeatureEntitlementMetricPeriod:()=>ey,RulesengineFeatureEntitlementMonthReset:()=>ry,RulesengineRuleRuleType:()=>ty,RulesengineTraitDefinitionComparableType:()=>oy,ScheduledCheckoutStatus:()=>iy,ScheduledDowngradeConfigBehavior:()=>ay,SortDirection:()=>ny,SubscriptionStatus:()=>sy,SubscriptionType:()=>cy,TimeSeriesGranularity:()=>ly,TraitDefinitionComparableType:()=>py,TraitType:()=>uy,UnauthorizedError:()=>E,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ln,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>pn,UpdateEntitlementReqCommonMetricPeriod:()=>dy,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>my,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>un,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>dn,WebhookEventStatus:()=>hy,WebhookRequestType:()=>gy,WebhookStatus:()=>yy,accesstokens:()=>Ja,accounts:()=>Za,billing:()=>Ya,checkout:()=>Qa,companies:()=>Xa,components:()=>en,componentspublic:()=>rn,credits:()=>tn,dataexports:()=>on,entitlements:()=>hi,events:()=>mn,features:()=>hn,planbundle:()=>gn,plangroups:()=>yn,planmigrations:()=>wn,plans:()=>bn,scheduledcheckout:()=>zn,webhooks:()=>Rn});var ze=(p,o,t)=>JSON.stringify(p,o,t);function pt(p,o){return JSON.parse(p,o)}var z=class extends Error{constructor({message:o,statusCode:t,body:i,rawResponse:s}){super(Bh({message:o,statusCode:t,body:i})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=t,this.body=i,this.rawResponse=s}};function Bh({message:p,statusCode:o,body:t}){let i=[];return p!=null&&i.push(p),o!=null&&i.push(`Status code: ${o.toString()}`),t!=null&&i.push(`Body: ${ze(t,void 0,2)}`),i.join(`
|
|
2
|
-
`)}var xr=class extends Error{constructor(o){super(o),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var T=class extends z{constructor(o,t){super({message:"BadRequestError",statusCode:400,body:o,rawResponse:t}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var P=class extends z{constructor(o,t){super({message:"ForbiddenError",statusCode:403,body:o,rawResponse:t}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var x=class extends z{constructor(o,t){super({message:"InternalServerError",statusCode:500,body:o,rawResponse:t}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var C=class extends z{constructor(o,t){super({message:"NotFoundError",statusCode:404,body:o,rawResponse:t}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var E=class extends z{constructor(o,t){super({message:"UnauthorizedError",statusCode:401,body:o,rawResponse:t}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Ja={};var Za={};var Ya={};var Qa={};var Xa={};var en={};var rn={};var tn={};var on={};var hi={};Ae(hi,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>an,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>nn,CreatePlanEntitlementRequestBodyMetricPeriod:()=>sn,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>cn,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ln,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>pn,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>un,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>dn});var an={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var nn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var sn={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var cn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ln={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var pn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var un={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var dn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var mn={};var hn={};var gn={};var yn={};var wn={};var bn={};var zn={};var Rn={};var Vh={ApiKey:"api_key",AppUser:"app_user",StripeApp:"stripe_app",System:"system",TemporaryAccessToken:"temporary_access_token"};var Ah={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var Dh={Active:"active",Inactive:"inactive"};var qh={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var Mh={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var Ih={BillingPeriods:"billing_periods",Days:"days"};var Fh={BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var Kh={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var Lh={Expire:"expire",None:"none",Rollover:"rollover"};var Gh={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var Wh={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var Hh={NoReset:"no_reset",PlanPeriod:"plan_period"};var Nh={PerUnit:"per_unit",Tiered:"tiered"};var $h={Licensed:"licensed",Metered:"metered"};var Jh={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var Zh={Schematic:"schematic",Stripe:"stripe"};var Yh={Cancel:"cancel",Subscribe:"subscribe"};var Qh={Graduated:"graduated",Volume:"volume"};var Xh={Free:"free",OneTime:"one_time",Recurring:"recurring"};var eg={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var rg={Billing:"billing",Entitlement:"entitlement"};var tg={Draft:"draft",Live:"live"};var og={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var ig={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var ag={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ng={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var sg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var cg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var lg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var pg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ug={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",BasePlan:"base_plan"};var dg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var mg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var hg={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var gg={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var yg={Grant:"grant",Transfer:"transfer",Usage:"usage",ZeroOut:"zero_out"};var wg={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var bg={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var zg={Failure:"failure",Pending:"pending",Success:"success"};var Rg={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var fg={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var _g={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Sg={Company:"company",User:"user"};var Pg={Development:"development",Production:"production",Staging:"staging"};var xg={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var gi={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var Cg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Eg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ug={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var vg={Boolean:"boolean",Event:"event",Trait:"trait"};var Tg={Draft:"draft",Open:"open",Paid:"paid",Uncollectible:"uncollectible",Void:"void"};var Og={Create:"create",Update:"update",Delete:"delete"};var kg={Checkout:"checkout",CompanyUpsert:"company_upsert",FallbackPlan:"fallback_plan",ManagePlan:"manage_plan",Migration:"migration",PlanBillingProductChanged:"plan_billing_product_changed",PlanDeleted:"plan_deleted",PlanTraitChange:"plan_trait_change",PlanVersionMigration:"plan_version_migration",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var jg={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var Bg={Adjustment:"adjustment",Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var Vg={Schematic:"schematic",Stripe:"stripe"};var Ag={Plan:"plan",AddOn:"add_on"};var Dg={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending",Skipped:"skipped"};var qg={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending"};var Mg={Immediate:"immediate",Leave:"leave"};var Ig={Published:"published",Draft:"draft",Archived:"archived"};var Fg={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};var Kg={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Lg={V5F633Cc3:"v5f633cc3",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var Gg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Wg={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Hg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ng={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var $g={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var Jg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Zg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Yg={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Qg={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Xg={Company:"company",User:"user"};var ey={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var ry={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ty={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var oy={Bool:"bool",Date:"date",Int:"int",String:"string"};var iy={Cancelled:"cancelled",Error:"error",Executing:"executing",Pending:"pending",Success:"success"};var ay={EndOfBillingPeriod:"end_of_billing_period",None:"none"};var ny={Asc:"asc",Desc:"desc"};var sy={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var cy={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var ly={Daily:"daily",Hourly:"hourly",Monthly:"monthly",Weekly:"weekly"};var py={Bool:"bool",Date:"date",Int:"int",String:"string"};var uy={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var dy={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var my={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var hy={Failure:"failure",Pending:"pending",Success:"success"};var gy={SubscriptionTrialEnded:"subscription.trial.ended",CompanyCreated:"company.created",CompanyDeleted:"company.deleted",CompanyOverrideCreated:"company.override.created",CompanyOverrideDeleted:"company.override.deleted",CompanyOverrideExpired:"company.override.expired",CompanyOverrideUpdated:"company.override.updated",CompanyPlanChanged:"company.plan_changed",CompanyScheduledDowngrade:"company.scheduled_downgrade",CompanyUpdated:"company.updated",CreditLimitReached:"credit.limit.reached",CreditLimitWarning:"credit.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",FeatureCreated:"feature.created",FeatureDeleted:"feature.deleted",FeatureUpdated:"feature.updated",FlagCreated:"flag.created",FlagDeleted:"flag.deleted",FlagRulesUpdated:"flag_rules.updated",FlagUpdated:"flag.updated",PlanCreated:"plan.created",PlanDeleted:"plan.deleted",PlanEntitlementCreated:"plan.entitlement.created",PlanEntitlementDeleted:"plan.entitlement.deleted",PlanEntitlementUpdated:"plan.entitlement.updated",PlanUpdated:"plan.updated",PlanVersionDeleted:"plan_version.deleted",RuleDeleted:"rule.deleted",TestSend:"test.send",UserCreated:"user.created",UserDeleted:"user.deleted",UserUpdated:"user.updated",AutoTopupHardFailure:"auto.topup.hard.failure",AutoTopupRetryExceeded:"auto.topup.retry.exceeded"};var yy={Active:"active",Inactive:"inactive"};var wy=2147483647,De=class{constructor({maxItems:o=1e3,ttl:t=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=o,this.defaultTTL=t}async get(o){let t=this.cache.get(o);return t?t.expiration<=Date.now()?(this.evictItem(o,t),null):(this.accessCounter++,t.accessCounter=this.accessCounter,this.cache.set(o,t),t.value):null}async set(o,t,i){if(this.maxItems===0)return;let s=i??this.defaultTTL,r=this.cache.get(o);r&&this.evictItem(o,r),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let n={value:t,accessCounter:this.accessCounter,expiration:Date.now()+s};n.timeoutId=setTimeout(()=>this.evictItem(o,n),Math.min(s,wy)),this.cache.set(o,n)}async delete(o){let t=this.cache.get(o);t&&this.evictItem(o,t)}async deleteMissing(o,t){let i=new Set(o);for(let[s,r]of this.cache)i.has(s)||this.evictItem(s,r)}evictItem(o,t){t.timeoutId&&clearTimeout(t.timeoutId),this.cache.delete(o)}evictExpiredItems(){this.cache.forEach((o,t)=>{o.expiration<=Date.now()&&this.evictItem(t,o)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let o,t=Number.MAX_SAFE_INTEGER;this.cache.forEach((i,s)=>{i.accessCounter<t&&(o=s,t=i.accessCounter)}),o&&this.evictItem(o,this.cache.get(o))}}};var Cr=class{constructor(o){this.client=o.client,this.defaultTTL=Math.floor((o.ttl||5e3)/1e3),this.keyPrefix=o.keyPrefix||"schematic:"}getFullKey(o){return this.keyPrefix+o}async get(o){let t=this.getFullKey(o),i=await this.client.get(t);return i===null?null:JSON.parse(i)}async set(o,t,i){let s=this.getFullKey(o),r=JSON.stringify(t),n=i?Math.floor(i/1e3):this.defaultTTL;n>0?await this.client.setEx(s,n,r):await this.client.set(s,r)}async delete(o){let t=this.getFullKey(o);await this.client.del(t)}async deleteMissing(o,t){let i=t?.scanPattern?this.keyPrefix+t.scanPattern:this.keyPrefix+"*",s=new Set(o.map(u=>this.getFullKey(u))),r=[],n=1e3;for await(let u of this.client.scanIterator({MATCH:i,COUNT:1e3}))s.has(u)||(r.push(u),r.length>=n&&(await this.client.del(r),r.length=0));r.length>0&&await this.client.del(r)}};var ut=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var Ct={get:async(p,o)=>typeof p=="function"?p(o):p};var ke={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},fn={[ke.Debug]:1,[ke.Info]:2,[ke.Warn]:3,[ke.Error]:4},dt=class{debug(o,...t){console.debug(o,...t)}info(o,...t){console.info(o,...t)}warn(o,...t){console.warn(o,...t)}error(o,...t){console.error(o,...t)}},kr=class{constructor(o){this.level=fn[o.level],this.logger=o.logger,this.silent=o.silent}shouldLog(o){return!this.silent&&this.level<=fn[o]}isDebug(){return this.shouldLog(ke.Debug)}debug(o,...t){this.isDebug()&&this.logger.debug(o,...t)}isInfo(){return this.shouldLog(ke.Info)}info(o,...t){this.isInfo()&&this.logger.info(o,...t)}isWarn(){return this.shouldLog(ke.Warn)}warn(o,...t){this.isWarn()&&this.logger.warn(o,...t)}isError(){return this.shouldLog(ke.Error)}error(o,...t){this.isError()&&this.logger.error(o,...t)}};function mt(p){return p==null?by:p instanceof kr?p:(p=p??{},p.level??=ke.Info,p.logger??=new dt,p.silent??=!0,new kr(p))}var by=new kr({level:ke.Info,logger:new dt,silent:!0});var zy={arrayFormat:"indices",encode:!0};function _n(p,o){if(p===void 0||p===null)return"";let t=String(p);return o?encodeURIComponent(t):t}function yi(p,o="",t){let i=[];for(let[s,r]of Object.entries(p)){let n=o?`${o}[${s}]`:s;if(r!==void 0)if(Array.isArray(r)){if(r.length===0)continue;for(let u=0;u<r.length;u++){let m=r[u];if(m!==void 0)if(typeof m=="object"&&!Array.isArray(m)&&m!==null){let h=t.arrayFormat==="indices"?`${n}[${u}]`:n;i.push(...yi(m,h,t))}else{let h=t.arrayFormat==="indices"?`${n}[${u}]`:n,l=t.encode?encodeURIComponent(h):h;i.push(`${l}=${_n(m,t.encode)}`)}}}else if(typeof r=="object"&&r!==null){if(Object.keys(r).length===0)continue;i.push(...yi(r,n,t))}else{let u=t.encode?encodeURIComponent(n):n;i.push(`${u}=${_n(r,t.encode)}`)}}return i}function jr(p,o){return p==null||typeof p!="object"?"":yi(p,"",{...zy,...o}).join("&")}function Et(p,o){let t=jr(o,{arrayFormat:"repeat"});return t?`${p}?${t}`:p}function Sn(p){let o={get bodyUsed(){return p.bodyUsed},stream:()=>p.body,arrayBuffer:p.arrayBuffer.bind(p),blob:p.blob.bind(p)};return"bytes"in p&&typeof p.bytes=="function"&&(o.bytes=p.bytes.bind(p)),o}var de=Ry();function Ry(){if(typeof window<"u"&&typeof window.document<"u")return{type:"browser",version:window.navigator.userAgent};if(typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers")return{type:"workerd"};if(typeof EdgeRuntime=="string")return{type:"edge-runtime"};if(typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope"))return{type:"web-worker"};if(typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u")return{type:"deno",version:Deno.version.deno};if(typeof Bun<"u"&&typeof Bun.version<"u")return{type:"bun",version:Bun.version};if(typeof navigator<"u"&&navigator?.product==="ReactNative")return{type:"react-native"};let u=typeof process<"u"?process:void 0;return typeof u<"u"&&typeof u.versions?.node=="string"?{type:"node",version:u.versions.node,parsedVersion:Number(u.versions.node.split(".")[0])}:{type:"unknown"}}async function Tn(p){return de.type==="node"&&de.parsedVersion!=null&&de.parsedVersion>=18?new(await Promise.resolve().then(()=>(xn(),Pn))).Node18UniversalStreamWrapper(p):de.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(En(),Cn))).UndiciStreamWrapper(p):new(await Promise.resolve().then(()=>(vn(),Un))).NodePre18StreamWrapper(p)}async function Br(p,o){switch(o){case"binary-response":return Sn(p);case"blob":return await p.blob();case"arrayBuffer":return await p.arrayBuffer();case"sse":return p.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:p.status}}:p.body;case"streaming":return p.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:p.status}}:Tn(p.body);case"text":return await p.text()}let t=await p.text();if(t.length>0)try{return pt(t)}catch{return{ok:!1,error:{reason:"non-json",statusCode:p.status,rawBody:t}}}}async function On(p){let o=p.headers.get("Content-Type")?.toLowerCase();if(o==null||o.length===0)return Br(p);switch(o.indexOf(";")!==-1&&(o=o.split(";")[0]?.trim()??""),o){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":{let t=await p.text();return t.length>0?pt(t):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let t=await p.text();return t.length>0?pt(t):void 0}return await p.text()}}async function Vr(){return de.type==="node"&&de.parsedVersion!=null&&de.parsedVersion>=18?fetch:de.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function Ut({body:p,type:o}){return o==="form"?jr(p,{arrayFormat:"repeat",encode:!0}):o.includes("json")?ze(p):p}var qe;typeof globalThis.Headers<"u"?qe=globalThis.Headers:qe=class kn{constructor(o){if(this.headers=new Map,o)if(o instanceof kn)o.forEach((t,i)=>this.append(i,t));else if(Array.isArray(o))for(let[t,i]of o)if(typeof t=="string"&&typeof i=="string")this.append(t,i);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[t,i]of Object.entries(o))if(typeof i=="string")this.append(t,i);else throw new TypeError("Header values must be strings")}append(o,t){let i=o.toLowerCase(),s=this.headers.get(i)||[];this.headers.set(i,[...s,t])}delete(o){let t=o.toLowerCase();this.headers.delete(t)}get(o){let t=o.toLowerCase(),i=this.headers.get(t);return i?i.join(", "):null}has(o){let t=o.toLowerCase();return this.headers.has(t)}set(o,t){let i=o.toLowerCase();this.headers.set(i,[t])}forEach(o,t){let i=t?o.bind(t):o;this.headers.forEach((s,r)=>i(s.join(", "),r,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[o,t]of this.headers.entries())yield[o,t.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let o of this.headers.values())yield o.join(", ")}[Symbol.iterator](){return this.entries()}};var fy="timeout";function jn(p){let o=new AbortController,t=setTimeout(()=>o.abort(fy),p);return{signal:o.signal,abortId:t}}function Bn(...p){let o=p.length===1&&Array.isArray(p[0])?p[0]:p,t=new AbortController;for(let i of o){if(i.aborted){t.abort(i?.reason);break}i.addEventListener("abort",()=>t.abort(i?.reason),{signal:t.signal})}return t.signal}var ht;function _y(){if(ht!=null)return ht;try{new Request("http://localhost",{cache:"no-store"}),ht=!0}catch{ht=!1}return ht}var Ar=async(p,o,t,i,s,r,n,u,m,h)=>{let l=[],g;if(r!=null){let{signal:v,abortId:O}=jn(r);g=O,l.push(v)}n!=null&&l.push(n);let w=Bn(l),b=await p(o,{method:t,headers:i,body:s,signal:w,credentials:u?"include":void 0,duplex:m,...h&&_y()?{cache:"no-store"}:{}});return g!=null&&clearTimeout(g),b};var Dr={headers:new qe,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},qr={headers:new qe,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function gt(p){return{headers:p.headers,redirected:p.redirected,status:p.status,statusText:p.statusText,type:p.type,url:p.url}}function Sy(p){let o=1+Math.random()*.2;return p*o}function Py(p){let o=1+(Math.random()-.5)*.2;return p*o}function xy(p,o){let t=p.headers.get("Retry-After");if(t){let s=parseInt(t,10);if(!Number.isNaN(s)&&s>0)return Math.min(s*1e3,6e4);let r=new Date(t);if(!Number.isNaN(r.getTime())){let n=r.getTime()-Date.now();if(n>0)return Math.min(Math.max(n,0),6e4)}}let i=p.headers.get("X-RateLimit-Reset");if(i){let s=parseInt(i,10);if(!Number.isNaN(s)){let r=s*1e3-Date.now();if(r>0)return Sy(Math.min(r,6e4))}}return Py(Math.min(1e3*2**o,6e4))}async function Mr(p,o=2){let t=await p();for(let i=0;i<o&&([408,429].includes(t.status)||t.status>=500);++i){let s=xy(t,i);await new Promise(r=>setTimeout(r,s)),t=await p()}return t}var Cy=new Set(["authorization","www-authenticate","x-api-key","api-key","apikey","x-api-token","x-auth-token","auth-token","cookie","set-cookie","proxy-authorization","proxy-authenticate","x-csrf-token","x-xsrf-token","x-session-token","x-access-token"]);function Ri(p){let o={};for(let[t,i]of p instanceof qe?p.entries():Object.entries(p))Cy.has(t.toLowerCase())?o[t]="[REDACTED]":o[t]=i;return o}var fi=new Set(["api_key","api-key","apikey","token","access_token","access-token","auth_token","auth-token","password","passwd","secret","api_secret","api-secret","apisecret","key","session","session_id","session-id"]);function Ey(p){if(p==null)return p;let o={};for(let[t,i]of Object.entries(p))fi.has(t.toLowerCase())?o[t]="[REDACTED]":o[t]=i;return o}function Er(p){let o=p.indexOf("://");if(o===-1)return p;let t=o+3,i=p.indexOf("/",t),s=p.indexOf("?",t),r=p.indexOf("#",t),n=Math.min(i===-1?p.length:i,s===-1?p.length:s,r===-1?p.length:r),u=-1;for(let v=t;v<n;v++)p[v]==="@"&&(u=v);if(u!==-1&&(p=`${p.slice(0,t)}[REDACTED]@${p.slice(u+1)}`),s=p.indexOf("?"),s===-1)return p;r=p.indexOf("#",s);let m=r!==-1?r:p.length,h=p.slice(s+1,m);if(h.length===0)return p;let l=h.toLowerCase();if(!(l.includes("token")||l.includes("key")||l.includes("password")||l.includes("passwd")||l.includes("secret")||l.includes("session")||l.includes("auth")))return p;let w=[],b=h.split("&");for(let v of b){let O=v.indexOf("=");if(O===-1){w.push(v);continue}let I=v.slice(0,O),k=fi.has(I.toLowerCase());if(!k&&I.includes("%"))try{let j=decodeURIComponent(I);k=fi.has(j.toLowerCase())}catch{}w.push(k?`${I}=[REDACTED]`:v)}return p.slice(0,s+1)+w.join("&")+p.slice(m)}async function Uy(p){let o=new qe;if(o.set("Accept",p.responseType==="json"?"application/json":p.responseType==="text"?"text/plain":p.responseType==="sse"?"text/event-stream":"*/*"),p.body!==void 0&&p.contentType!=null&&o.set("Content-Type",p.contentType),p.headers==null)return o;for(let[t,i]of Object.entries(p.headers)){let s=await Ct.get(i,{endpointMetadata:p.endpointMetadata??{}});if(typeof s=="string"){o.set(t,s);continue}s!=null&&o.set(t,`${s}`)}return o}async function vy(p){let o=Et(p.url,p.queryParameters),t=await Ut({body:p.body,type:p.requestType??"other"}),i=p.fetchFn??await Vr(),s=await Uy(p),r=mt(p.logging);if(r.isDebug()){let n={method:p.method,url:Er(o),headers:Ri(s),queryParameters:Ey(p.queryParameters),hasBody:t!=null};r.debug("Making HTTP request",n)}try{let n=await Mr(async()=>Ar(i,o,p.method,s,t,p.timeoutMs,p.abortSignal,p.withCredentials,p.duplex,p.responseType==="streaming"||p.responseType==="sse"),p.maxRetries);if(n.status>=200&&n.status<400){if(r.isDebug()){let m={method:p.method,url:Er(o),statusCode:n.status,responseHeaders:Ri(n.headers)};r.debug("HTTP request succeeded",m)}return{ok:!0,body:await Br(n,p.responseType),headers:n.headers,rawResponse:gt(n)}}else{if(r.isError()){let u={method:p.method,url:Er(o),statusCode:n.status,responseHeaders:Ri(Object.fromEntries(n.headers.entries()))};r.error("HTTP request failed with error status",u)}return{ok:!1,error:{reason:"status-code",statusCode:n.status,body:await On(n)},rawResponse:gt(n)}}}catch(n){if(p.abortSignal?.aborted){if(r.isError()){let u={method:p.method,url:Er(o)};r.error("HTTP request was aborted",u)}return{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Dr}}else if(n instanceof Error&&n.name==="AbortError"){if(r.isError()){let u={method:p.method,url:Er(o),timeoutMs:p.timeoutMs};r.error("HTTP request timed out",u)}return{ok:!1,error:{reason:"timeout"},rawResponse:Dr}}else if(n instanceof Error){if(r.isError()){let u={method:p.method,url:Er(o),errorMessage:n.message};r.error("HTTP request failed with error",u)}return{ok:!1,error:{reason:"unknown",errorMessage:n.message},rawResponse:qr}}if(r.isError()){let u={method:p.method,url:Er(o),error:ze(n)};r.error("HTTP request failed with unknown error",u)}return{ok:!1,error:{reason:"unknown",errorMessage:ze(n)},rawResponse:qr}}}var S=vy;var R=class p extends Promise{constructor(o){super(t=>{t(void 0)}),this.innerPromise=o}static fromFunction(o,...t){return new p(o(...t))}static interceptFunction(o){return(...t)=>p.fromPromise(o(...t))}static fromPromise(o){return new p(o)}static fromExecutor(o){let t=new Promise(o);return new p(t)}static fromResult(o){let t=Promise.resolve(o);return new p(t)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:o})=>o)),this.unwrappedPromise}then(o,t){return this.unwrap().then(o,t)}catch(o){return this.unwrap().catch(o)}finally(o){return this.unwrap().finally(o)}async withRawResponse(){return await this.innerPromise}};function vt(p,...o){if(!p)return"";if(o.length===0)return p;if(p.includes("://")){let t;try{t=new URL(p)}catch{return Vn(p,...o)}let s=o[o.length-1]?.endsWith("/");for(let r of o){let n=Dn(r);n&&(t.pathname=An(t.pathname,n))}return s&&!t.pathname.endsWith("/")&&(t.pathname+="/"),t.toString()}return Vn(p,...o)}function Vn(p,...o){if(o.length===0)return p;let t=p,s=o[o.length-1]?.endsWith("/");for(let r of o){let n=Dn(r);n&&(t=An(t,n))}return s&&!t.endsWith("/")&&(t+="/"),t}function An(p,o){return p.endsWith("/")?p+o:`${p}/${o}`}function Dn(p){if(!p)return p;let o=0,t=p.length;return p.startsWith("/")&&(o=1),p.endsWith("/")&&(t=p.length-1),o===0&&t===p.length?p:p.slice(o,t)}var d={get:async p=>typeof p=="function"?p():p};async function _i(p,o,t,i){let s=mt(t.logging),r,n=o;p instanceof Request?(r=p.url,o==null&&(n={method:p.method,headers:Object.fromEntries(p.headers.entries()),body:p.body,signal:p.signal,credentials:p.credentials,cache:p.cache,redirect:p.redirect,referrer:p.referrer,integrity:p.integrity,mode:p.mode})):r=p instanceof URL?p.toString():p;let u=(t.baseUrl!=null?await d.get(t.baseUrl):void 0)??(t.environment!=null?await d.get(t.environment):void 0),m;r.startsWith("http://")||r.startsWith("https://")?m=r:u!=null?m=vt(u,r):m=r;let h={};if(t.headers!=null)for(let[j,V]of Object.entries(t.headers)){let ge=await Ct.get(V,{endpointMetadata:{}});ge!=null&&(h[j.toLowerCase()]=`${ge}`)}if(t.getAuthHeaders!=null){let j=await t.getAuthHeaders();for(let[V,ge]of Object.entries(j))h[V.toLowerCase()]=ge}if(n?.headers!=null){let j=n.headers instanceof Headers?Object.fromEntries(n.headers.entries()):Array.isArray(n.headers)?Object.fromEntries(n.headers):n.headers;for(let[V,ge]of Object.entries(j))ge!=null&&(h[V.toLowerCase()]=ge)}if(i?.headers!=null)for(let[j,V]of Object.entries(i.headers))h[j.toLowerCase()]=V;let l=n?.method??"GET",g=n?.body,w=i?.timeoutInSeconds??t.timeoutInSeconds,b=w!=null?w*1e3:void 0,v=i?.maxRetries??t.maxRetries,O=i?.abortSignal??n?.signal??void 0,I=t.fetch??await Vr();s.isDebug()&&s.debug("Making passthrough HTTP request",{method:l,url:m,hasBody:g!=null});let k=await Mr(async()=>Ar(I,m,l,h,g??void 0,b,O,n?.credentials==="include",void 0,!1),v);return s.isDebug()&&s.debug("Passthrough HTTP request completed",{method:l,url:m,statusCode:k.status}),k}var Tt={};Ae(Tt,{ConsoleLogger:()=>dt,LogLevel:()=>ke,Logger:()=>kr,createLogger:()=>mt});var e={};Ae(e,{JsonError:()=>Ir,ParseError:()=>Fr,any:()=>Yn,bigint:()=>Mn,boolean:()=>Qn,booleanLiteral:()=>Jn,date:()=>In,discriminant:()=>cs,enum_:()=>kt,getObjectLikeUtils:()=>je,getObjectUtils:()=>Ur,getSchemaUtils:()=>W,isProperty:()=>Ze,lazy:()=>Fn,lazyObject:()=>Nn,list:()=>Bt,never:()=>Xn,number:()=>es,object:()=>jt,objectWithoutOptionalProperties:()=>Hn,optional:()=>Si,partialRecord:()=>is,property:()=>Ln,record:()=>os,set:()=>as,string:()=>rs,stringLiteral:()=>Zn,transform:()=>Pi,undiscriminatedUnion:()=>ss,union:()=>ps,unknown:()=>ts,withParsedProperties:()=>Ei});var D={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function G(p,o){return`Expected ${o}. Received ${Ty(p)}.`}function Ty(p){if(Array.isArray(p))return"list";if(p===null)return"null";if(p instanceof BigInt)return"BigInt";switch(typeof p){case"string":return`"${p}"`;case"bigint":case"number":case"boolean":case"undefined":return`${p}`}return typeof p}function ae(p){return{...p,json:qn(p.json),parse:qn(p.parse)}}function qn(p){return(o,t)=>{let i=p(o,t),{skipValidation:s=!1}=t??{};return!i.ok&&s?(console.warn(["Failed to validate.",...i.errors.map(r=>" - "+(r.path.length>0?`${r.path.join(".")}: ${r.message}`:r.message))].join(`
|
|
3
|
-
`)),{ok:!0,value:o}):i}}function Ot(p){return p.path.length===0?p.message:`${p.path.join(" -> ")}: ${p.message}`}var Ir=class p extends Error{constructor(t){super(t.map(Ot).join("; "));this.errors=t;Object.setPrototypeOf(this,p.prototype)}};var Fr=class p extends Error{constructor(t){super(t.map(Ot).join("; "));this.errors=t;Object.setPrototypeOf(this,p.prototype)}};function W(p){return{nullable:()=>Oy(p),optional:()=>Si(p),optionalNullable:()=>ky(p),transform:o=>Pi(p,o),parseOrThrow:(o,t)=>{let i=p.parse(o,t);if(i.ok)return i.value;throw new Fr(i.errors)},jsonOrThrow:(o,t)=>{let i=p.json(o,t);if(i.ok)return i.value;throw new Ir(i.errors)}}}function Oy(p){let o={parse:(t,i)=>t==null?{ok:!0,value:null}:p.parse(t,i),json:(t,i)=>t==null?{ok:!0,value:null}:p.json(t,i),getType:()=>D.NULLABLE};return{...o,...W(o)}}function Si(p){let o={parse:(t,i)=>t==null?{ok:!0,value:void 0}:p.parse(t,i),json:(t,i)=>i?.omitUndefined&&t===void 0?{ok:!0,value:void 0}:t==null?{ok:!0,value:null}:p.json(t,i),getType:()=>D.OPTIONAL};return{...o,...W(o)}}function ky(p){let o={parse:(t,i)=>t===void 0?{ok:!0,value:void 0}:t===null?{ok:!0,value:null}:p.parse(t,i),json:(t,i)=>t===void 0?{ok:!0,value:void 0}:t===null?{ok:!0,value:null}:p.json(t,i),getType:()=>D.OPTIONAL_NULLABLE};return{...o,...W(o)}}function Pi(p,o){let t={parse:(i,s)=>{let r=p.parse(i,s);return r.ok?{ok:!0,value:o.transform(r.value)}:r},json:(i,s)=>{let r=o.untransform(i);return p.json(r,s)},getType:()=>p.getType()};return{...t,...W(t)}}function Mn(){let p={parse:(o,{breadcrumbsPrefix:t=[]}={})=>typeof o=="bigint"?{ok:!0,value:o}:typeof o=="number"?{ok:!0,value:BigInt(o)}:{ok:!1,errors:[{path:t,message:G(o,"bigint | number")}]},json:(o,{breadcrumbsPrefix:t=[]}={})=>typeof o!="bigint"?{ok:!1,errors:[{path:t,message:G(o,"bigint")}]}:{ok:!0,value:o},getType:()=>D.BIGINT};return{...ae(p),...W(p)}}var jy=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function In(){let p={parse:(o,{breadcrumbsPrefix:t=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:t,message:G(o,"string")}]}:jy.test(o)?{ok:!0,value:new Date(o)}:{ok:!1,errors:[{path:t,message:G(o,"ISO 8601 date string")}]},json:(o,{breadcrumbsPrefix:t=[]}={})=>o instanceof Date?{ok:!0,value:o.toISOString()}:{ok:!1,errors:[{path:t,message:G(o,"Date object")}]},getType:()=>D.DATE};return{...ae(p),...W(p)}}function pe(p,o){return()=>{let t={parse:o,json:o,getType:()=>p};return{...ae(t),...W(t)}}}function kt(p){let o=new Set(p);return pe(D.ENUM,(i,{allowUnrecognizedEnumValues:s,breadcrumbsPrefix:r=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:r,message:G(i,"string")}]}:!o.has(i)&&!s?{ok:!1,errors:[{path:r,message:G(i,"enum")}]}:{ok:!0,value:i})()}function Fn(p){let o=xi(p);return{...o,...W(o)}}function xi(p){return{parse:(o,t)=>Kr(p).parse(o,t),json:(o,t)=>Kr(p).json(o,t),getType:()=>Kr(p).getType()}}function Kr(p){let o=p;return o.__zurg_memoized==null&&(o.__zurg_memoized=p()),o.__zurg_memoized}function Ci(p){return Object.entries(p)}function yt(p,o){let t=new Set(o);return Object.entries(p).reduce((i,[s,r])=>(t.has(s)&&(i[s]=r),i),{})}function Je(p){if(typeof p!="object"||p===null)return!1;let o=Object.getPrototypeOf(p);return o===null?!0:Object.getPrototypeOf(o)===null}function wt(p){return Object.keys(p)}function Kn(p,o){let t=[],i=[];for(let s of p)o(s)?t.push(s):i.push(s);return[t,i]}var By=Object.prototype.hasOwnProperty;function je(p){return{withParsedProperties:o=>Ei(p,o)}}function Ei(p,o){let t={parse:(i,s)=>{let r=p.parse(i,s);if(!r.ok)return r;let n={};for(let u in o)if(By.call(o,u)){let m=o[u];n[u]=typeof m=="function"?m(r.value):m}return{ok:!0,value:{...r.value,...n}}},json:(i,s)=>{if(!Je(i))return{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:G(i,"object")}]};let r=new Set(Object.keys(o)),n=yt(i,Object.keys(i).filter(u=>!r.has(u)));return p.json(n,s)},getType:()=>p.getType()};return{...t,...W(t),...je(t)}}function Ln(p,o){return{rawKey:p,valueSchema:o,isProperty:!0}}function Ze(p){return p.isProperty}var Vy=Object.prototype.hasOwnProperty;function jt(p){let o;function t(){if(o==null){o={};for(let[w,b]of Ci(p)){let v=Ze(b)?b.rawKey:w,O=Ze(b)?b.valueSchema:b;o[v]={rawKey:v,parsedKey:w,valueSchema:O}}}return o}let i,s,r,n;function u(){if(i==null){i=[],s=[];for(let[w,b]of Ci(p)){let v=Ze(b)?b.rawKey:w,O=Ze(b)?b.valueSchema:b;Ay(O)&&(i.push(v),s.push(w))}r=new Set(i),n=new Set(s)}return i}function m(){return s==null&&u(),s}function h(){return r==null&&u(),r}function l(){return n==null&&u(),n}let g={_getRawProperties:()=>Object.entries(p).map(([w,b])=>Ze(b)?b.rawKey:w),_getParsedProperties:()=>wt(p),parse:(w,b)=>{let v=b?.breadcrumbsPrefix??[];return Gn({value:w,requiredKeys:u(),requiredKeysSet:h(),getProperty:O=>{let I=t()[O];if(I!=null)return{transformedKey:I.parsedKey,transform:k=>{let j=[...v,O];return I.valueSchema.parse(k,{...b,breadcrumbsPrefix:j})}}},unrecognizedObjectKeys:b?.unrecognizedObjectKeys,skipValidation:b?.skipValidation,breadcrumbsPrefix:v,omitUndefined:b?.omitUndefined})},json:(w,b)=>{let v=b?.breadcrumbsPrefix??[];return Gn({value:w,requiredKeys:m(),requiredKeysSet:l(),getProperty:O=>{let I=p[O];if(I!=null)return Ze(I)?{transformedKey:I.rawKey,transform:k=>{let j=[...v,O];return I.valueSchema.json(k,{...b,breadcrumbsPrefix:j})}}:{transformedKey:O,transform:k=>{let j=[...v,O];return I.json(k,{...b,breadcrumbsPrefix:j})}}},unrecognizedObjectKeys:b?.unrecognizedObjectKeys,skipValidation:b?.skipValidation,breadcrumbsPrefix:v,omitUndefined:b?.omitUndefined})},getType:()=>D.OBJECT};return{...ae(g),...W(g),...je(g),...Ur(g)}}function Gn({value:p,requiredKeys:o,requiredKeysSet:t,getProperty:i,unrecognizedObjectKeys:s="fail",skipValidation:r=!1,breadcrumbsPrefix:n=[]}){if(!Je(p))return{ok:!1,errors:[{path:n,message:G(p,"object")}]};let u=o.length,m=[],h={};for(let l in p){if(!Vy.call(p,l))continue;let g=p[l],w=i(l);if(w!=null){u>0&&t.has(l)&&u--;let b=w.transform(g);b.ok?h[w.transformedKey]=b.value:(h[l]=g,m.push(...b.errors))}else switch(s){case"fail":m.push({path:[...n,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":h[l]=g;break}}if(u>0)for(let l of o)l in p||m.push({path:n,message:`Missing required key "${l}"`});return m.length===0||r?{ok:!0,value:h}:{ok:!1,errors:m}}function Ur(p){return{extend:o=>{let t={_getParsedProperties:()=>[...p._getParsedProperties(),...o._getParsedProperties()],_getRawProperties:()=>[...p._getRawProperties(),...o._getRawProperties()],parse:(i,s)=>Wn({extensionKeys:o._getRawProperties(),value:i,transformBase:r=>p.parse(r,s),transformExtension:r=>o.parse(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(i,s)=>Wn({extensionKeys:o._getParsedProperties(),value:i,transformBase:r=>p.json(r,s),transformExtension:r=>o.json(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.OBJECT};return{...t,...W(t),...je(t),...Ur(t)}},passthrough:()=>{let o=new Set(p._getRawProperties()),t=new Set(p._getParsedProperties()),i={_getParsedProperties:()=>p._getParsedProperties(),_getRawProperties:()=>p._getRawProperties(),parse:(s,r)=>{let n=p.parse(s,{...r,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let u={};if(typeof s=="object"&&s!=null)for(let[m,h]of Object.entries(s))o.has(m)||(u[m]=h);return{ok:!0,value:{...u,...n.value}}},json:(s,r)=>{let n=p.json(s,{...r,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let u={};if(typeof s=="object"&&s!=null)for(let[m,h]of Object.entries(s))t.has(m)||(u[m]=h);return{ok:!0,value:{...u,...n.value}}},getType:()=>D.OBJECT};return{...i,...W(i),...je(i),...Ur(i)}}}}function Wn({extensionKeys:p,value:o,transformBase:t,transformExtension:i,breadcrumbsPrefix:s=[]}){if(!Je(o))return{ok:!1,errors:[{path:s,message:G(o,"object")}]};let r=new Set(p),[n,u]=Kn(wt(o),l=>r.has(l)),m=t(yt(o,u)),h=i(yt(o,n));return m.ok&&h.ok?{ok:!0,value:{...m.value,...h.value}}:{ok:!1,errors:[...m.ok?[]:m.errors,...h.ok?[]:h.errors]}}function Ay(p){return!Dy(p)}function Dy(p){switch(p.getType()){case D.ANY:case D.UNKNOWN:case D.OPTIONAL:case D.OPTIONAL_NULLABLE:return!0;default:return!1}}function Hn(p){return jt(p)}function Nn(p){let o={...xi(p),_getRawProperties:()=>Kr(p)._getRawProperties(),_getParsedProperties:()=>Kr(p)._getParsedProperties()};return{...o,...W(o),...je(o),...Ur(o)}}function Bt(p){let o={parse:(t,i)=>$n(t,(s,r)=>p.parse(s,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${r}]`]})),json:(t,i)=>$n(t,(s,r)=>p.json(s,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${r}]`]})),getType:()=>D.LIST};return{...ae(o),...W(o)}}function $n(p,o){if(!Array.isArray(p))return{ok:!1,errors:[{message:G(p,"list"),path:[]}]};let t=[],i=[];for(let s=0;s<p.length;s++){let r=o(p[s],s);r.ok?t.push(r.value):i.push(...r.errors)}return i.length===0?{ok:!0,value:t}:{ok:!1,errors:i}}function Jn(p){return pe(D.BOOLEAN_LITERAL,(t,{breadcrumbsPrefix:i=[]}={})=>t===p?{ok:!0,value:p}:{ok:!1,errors:[{path:i,message:G(t,`${p.toString()}`)}]})()}function Zn(p){return pe(D.STRING_LITERAL,(t,{breadcrumbsPrefix:i=[]}={})=>t===p?{ok:!0,value:p}:{ok:!1,errors:[{path:i,message:G(t,`"${p}"`)}]})()}var Yn=pe(D.ANY,p=>({ok:!0,value:p}));var Qn=pe(D.BOOLEAN,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="boolean"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:G(p,"boolean")}]});var Xn=pe(D.NEVER,(p,{breadcrumbsPrefix:o=[]}={})=>({ok:!1,errors:[{path:o,message:"Expected never"}]}));var es=pe(D.NUMBER,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="number"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:G(p,"number")}]});var rs=pe(D.STRING,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="string"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:G(p,"string")}]});var ts=pe(D.UNKNOWN,p=>({ok:!0,value:p}));var qy=Object.prototype.hasOwnProperty;function os(p,o){let t={parse:(i,s)=>Vt({value:i,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(i,s)=>Vt({value:i,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.RECORD};return{...ae(t),...W(t)}}function is(p,o){let t={parse:(i,s)=>Vt({value:i,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(i,s)=>Vt({value:i,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.RECORD};return{...ae(t),...W(t)}}function Vt({value:p,isKeyNumeric:o,transformKey:t,transformValue:i,breadcrumbsPrefix:s=[]}){if(!Je(p))return{ok:!1,errors:[{path:s,message:G(p,"object")}]};let r={},n=[];for(let u in p){if(!qy.call(p,u))continue;let m=p[u];if(m===void 0)continue;let h=u;if(o){let w=u.length>0?Number(u):NaN;Number.isNaN(w)||(h=w)}let l=t(h),g=i(m,h);l.ok&&g.ok?r[l.value]=g.value:(l.ok||n.push(...l.errors),g.ok||n.push(...g.errors))}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function as(p){let o=Bt(p),t={parse:(i,s)=>{let r=o.parse(i,s);return r.ok?{ok:!0,value:new Set(r.value)}:r},json:(i,s)=>i instanceof Set?o.json([...i],s):{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:G(i,"Set")}]},getType:()=>D.SET};return{...ae(t),...W(t)}}function ss(p){let o={parse:(t,i)=>ns((s,r)=>s.parse(t,r),p,i),json:(t,i)=>ns((s,r)=>s.json(t,r),p,i),getType:()=>D.UNDISCRIMINATED_UNION};return{...ae(o),...W(o)}}function ns(p,o,t){let i=[];for(let[s,r]of o.entries()){let n=p(r,{...t,skipValidation:!1});if(n.ok)return n;for(let u of n.errors)i.push({path:u.path,message:`[Variant ${s}] ${u.message}`})}return{ok:!1,errors:i}}function cs(p,o){return{parsedDiscriminant:p,rawDiscriminant:o}}var My=Object.prototype.hasOwnProperty;function ps(p,o){let t=typeof p=="string"?p:p.rawDiscriminant,i=typeof p=="string"?p:p.parsedDiscriminant,s=kt(wt(o)),r={parse:(n,u)=>ls({value:n,discriminant:t,transformedDiscriminant:i,transformDiscriminantValue:m=>s.parse(m,{allowUnrecognizedEnumValues:u?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...u?.breadcrumbsPrefix??[],t]}),getAdditionalPropertiesSchema:m=>o[m],allowUnrecognizedUnionMembers:u?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(m,h)=>h.parse(m,u),breadcrumbsPrefix:u?.breadcrumbsPrefix}),json:(n,u)=>ls({value:n,discriminant:i,transformedDiscriminant:t,transformDiscriminantValue:m=>s.json(m,{allowUnrecognizedEnumValues:u?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...u?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:m=>o[m],allowUnrecognizedUnionMembers:u?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(m,h)=>h.json(m,u),breadcrumbsPrefix:u?.breadcrumbsPrefix}),getType:()=>D.UNION};return{...ae(r),...W(r),...je(r)}}function ls({value:p,discriminant:o,transformedDiscriminant:t,transformDiscriminantValue:i,getAdditionalPropertiesSchema:s,allowUnrecognizedUnionMembers:r=!1,transformAdditionalProperties:n,breadcrumbsPrefix:u=[]}){if(!Je(p))return{ok:!1,errors:[{path:u,message:G(p,"object")}]};let m=p[o],h={};for(let b in p)My.call(p,b)&&b!==o&&(h[b]=p[b]);if(m==null)return{ok:!1,errors:[{path:u,message:`Missing discriminant ("${o}")`}]};let l=i(m);if(!l.ok)return{ok:!1,errors:l.errors};let g=s(l.value);if(g==null)return r?{ok:!0,value:{[t]:l.value,...h}}:{ok:!1,errors:[{path:[...u,o],message:"Unexpected discriminant value"}]};let w=n(h,g);return w.ok?{ok:!0,value:{[t]:m,...w.value}}:w}var y={};Ae(y,{encodePathParam:()=>us,join:()=>vt,toQueryString:()=>jr});function us(p){if(p===null)return"null";switch(typeof p){case"undefined":return"undefined";case"string":case"number":case"boolean":break;default:p=String(p);break}return encodeURIComponent(p)}var Ui="apiKey",Iy="X-Schematic-Api-Key",Lr=class p{constructor(o){this.options=o}static canCreate(o){return o?.[Ui]!=null}async getAuthRequest({endpointMetadata:o}={}){let t=await d.get(this.options[Ui]);if(t==null)throw new z({message:p.AUTH_CONFIG_ERROR_MESSAGE});return{headers:{[Iy]:t}}}};(i=>{i.AUTH_SCHEME="ApiKeyAuth",i.AUTH_CONFIG_ERROR_MESSAGE=`Please provide '${Ui}' when initializing the client`;function t(s){return new i(s)}i.createInstance=t})(Lr||={});function f(...p){let o={};for(let[t,i]of p.filter(s=>s!=null).flatMap(s=>Object.entries(s))){let s=t.toLowerCase();i!=null?o[s]=i:s in o&&delete o[s]}return o}function Fy(p){let o=f({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.4.5","User-Agent":"@schematichq/schematic-typescript-node/1.4.5","X-Fern-Runtime":de.type,"X-Fern-Runtime-Version":de.version},p?.headers);return{...p,logging:Tt.createLogger(p?.logging),headers:o}}function F(p){let o=Fy(p),t=Ky(o);return o.authProvider??=new Lr(t),o}function Ky(p){return{...p,authProvider:new ut}}var _={Default:"https://api.schematichq.com"};function U(p,o,t,i){switch(p.reason){case"non-json":throw new z({statusCode:p.statusCode,body:p.rawBody,rawResponse:o});case"body-is-null":throw new z({statusCode:p.statusCode,rawResponse:o});case"timeout":throw new xr(`Timeout exceeded when calling ${t} ${i}.`);case"unknown":throw new z({message:p.errorMessage,rawResponse:o});default:throw new z({message:"Unknown error",rawResponse:o})}}var vi=e.object({lookup:e.record(e.string(),e.string())});var ds=e.stringLiteral("company");var ms=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",ds),token:e.string(),updatedAt:e.property("updated_at",e.date())});var hs=e.object({data:ms,params:e.record(e.string(),e.unknown())});var Ti=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string(),readonly:e.boolean().optional()});var nr=e.enum_(["development","production","staging"]);var Oi=e.object({environmentType:e.property("environment_type",nr),name:e.string()});var ki=e.object({description:e.string().optional(),name:e.string().optional()});var ji=e.object({environmentType:e.property("environment_type",nr.optional()),name:e.string().optional()});var gs=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var B=e.object({count:e.number().optional()});var ys=e.object({data:B,params:gs});var ye=e.enum_(["api_key","app_user","stripe_app","system","temporary_access_token"]);var ws=e.object({actorType:e.property("actor_type",ye.optional()),endTime:e.property("end_time",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),startTime:e.property("start_time",e.date().optional())});var bs=e.object({data:B,params:ws});var At=e.enum_(["admin","capture","read","write"]);var zs=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),readonly:e.boolean(),scopes:e.list(At),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var Rs=e.object({data:zs,params:e.record(e.string(),e.unknown())});var Me=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),readonly:e.boolean(),scopes:e.list(At),updatedAt:e.property("updated_at",e.date())});var fs=e.object({apiKeys:e.property("api_keys",e.list(Me)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",nr),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var _s=e.object({data:fs,params:e.record(e.string(),e.unknown())});var K=e.object({deleted:e.boolean().optional()});var Ss=e.object({data:K,params:e.record(e.string(),e.unknown())});var Ps=e.object({data:K,params:e.record(e.string(),e.unknown())});var xs=e.object({data:Me,params:e.record(e.string(),e.unknown())});var Cs=e.object({actorType:e.property("actor_type",ye),apiKeyId:e.property("api_key_id",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respBody:e.property("resp_body",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Es=e.object({data:Cs,params:e.record(e.string(),e.unknown())});var sr=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",nr),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Us=e.object({data:sr,params:e.record(e.string(),e.unknown())});var vs=e.object({accountId:e.property("account_id",e.string()),accountName:e.property("account_name",e.string()),actorType:e.property("actor_type",ye),apiKeyId:e.property("api_key_id",e.string().optional()),environmentId:e.property("environment_id",e.string().optional()),environments:e.list(sr),stripeUserId:e.property("stripe_user_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Ts=e.object({data:vs,params:e.record(e.string(),e.unknown())});var Os=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var ks=e.object({data:e.list(Me),params:Os});var js=e.object({actorType:e.property("actor_type",ye.optional()),endTime:e.property("end_time",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),startTime:e.property("start_time",e.date().optional())});var Dt=e.object({actorType:e.property("actor_type",ye),apiKeyId:e.property("api_key_id",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userName:e.property("user_name",e.string().optional())});var Bs=e.object({data:e.list(Dt),params:js});var Vs=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var As=e.object({data:e.list(sr),params:Vs});var Ds=e.object({ok:e.boolean()});var qs=e.object({data:Ds,params:e.record(e.string(),e.unknown())});var Ms=e.object({data:Me,params:e.record(e.string(),e.unknown())});var Is=e.object({data:sr,params:e.record(e.string(),e.unknown())});var A=e.enum_(["schematic","stripe"]);var Bi=e.object({companyId:e.property("company_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),email:e.string(),externalId:e.property("external_id",e.string()),meta:e.record(e.string(),e.string()),name:e.string(),providerType:e.property("provider_type",A.optional())});var Ie=e.enum_(["per_unit","tiered"]);var Q=e.enum_(["licensed","metered"]);var se=e.enum_(["graduated","volume"]);var Fs=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitDecimal:e.property("per_unit_decimal",e.string().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),priceExternalId:e.property("price_external_id",e.string()),providerType:e.property("provider_type",A.optional()),upTo:e.property("up_to",e.number().optional())});var Vi=e.object({billingScheme:e.property("billing_scheme",Ie),currency:e.string(),externalAccountId:e.property("external_account_id",e.string()),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceTiers:e.property("price_tiers",e.list(Fs)),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",A.optional()),tiersMode:e.property("tiers_mode",se.optional()),usageType:e.property("usage_type",Q)});var Ai=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string().optional(),price:e.number(),providerType:e.property("provider_type",A.optional())});var Ks=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),usageType:e.property("usage_type",Q)});var Ls=e.object({couponExternalId:e.property("coupon_external_id",e.string()),customerFacingCode:e.property("customer_facing_code",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date())});var cr=e.enum_(["cancel","subscribe"]);var Di=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodExternalId:e.property("default_payment_method_external_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Ls),expiredAt:e.property("expired_at",e.date()),interval:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number().optional()),periodStart:e.property("period_start",e.number().optional()),productExternalIds:e.property("product_external_ids",e.list(Ks)),status:e.string().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",cr.optional())});var qi=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),externalId:e.property("external_id",e.string()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var qt=e.enum_(["draft","open","paid","uncollectible","void"]);var Mi=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),externalId:e.property("external_id",e.string().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),status:qt.optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var Ii=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalId:e.property("external_id",e.string())});var Fi=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),externalId:e.property("external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var Gs=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",Q.optional()),providerType:e.property("provider_type",A.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Ws=e.object({data:B,params:Gs});var Hs=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",A.optional()),q:e.string().optional()});var Ns=e.object({data:B,params:Hs});var $s=e.object({data:K,params:e.record(e.string(),e.unknown())});var Js=e.object({data:K,params:e.record(e.string(),e.unknown())});var Zs=e.object({forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),productIds:e.property("product_ids",e.list(e.string()).optional()),providerType:e.property("provider_type",A.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",se.optional()),usageType:e.property("usage_type",Q.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Gr=e.enum_(["day","month","one-time","year"]);var Mt=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var ee=e.object({billingScheme:e.property("billing_scheme",Ie),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Gr,isActive:e.property("is_active",e.boolean()),meterEventName:e.property("meter_event_name",e.string().optional()),meterEventPayloadKey:e.property("meter_event_payload_key",e.string().optional()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Mt)),productExternalId:e.property("product_external_id",e.string()),productId:e.property("product_id",e.string()),productName:e.property("product_name",e.string()),providerType:e.property("provider_type",A),tiersMode:e.property("tiers_mode",se.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Q)});var Ys=e.object({data:e.list(ee),params:Zs});var Qs=e.object({forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),productIds:e.property("product_ids",e.list(e.string()).optional()),providerType:e.property("provider_type",A.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",se.optional()),usageType:e.property("usage_type",Q.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Xs=e.object({data:e.list(ee),params:Qs});var ec=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",Q.optional()),providerType:e.property("provider_type",A.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var H=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:Gr,price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),providerType:e.property("provider_type",A),scheme:Ie});var Fe=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),prices:e.list(H),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",A),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var rc=e.object({data:e.list(Fe),params:ec});var tc=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var It=e.object({accountId:e.property("account_id",e.string()),amountOff:e.property("amount_off",e.number().optional()),currency:e.string().optional(),duration:e.string().optional(),durationInMonths:e.property("duration_in_months",e.number().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),isActive:e.property("is_active",e.boolean()),maxRedemptions:e.property("max_redemptions",e.number().optional()),metadata:e.record(e.string(),e.unknown()),name:e.string(),percentOff:e.property("percent_off",e.number().optional()),providerType:e.property("provider_type",A),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var oc=e.object({data:e.list(It),params:tc});var ic=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",A.optional()),q:e.string().optional()});var ac=e.object({currency:e.string(),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),meteredUsage:e.property("metered_usage",e.boolean()),perUnitPrice:e.property("per_unit_price",e.number()),totalPrice:e.property("total_price",e.number())});var nc=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",A),subscriptions:e.list(ac),updatedAt:e.property("updated_at",e.date())});var sc=e.object({data:e.list(nc),params:ic});var cc=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional())});var Be=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string().optional()),id:e.string(),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),providerType:e.property("provider_type",A),status:qt.optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var lc=e.object({data:e.list(Be),params:cc});var pc=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Ft=e.object({dispalyName:e.property("dispaly_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),providerType:e.property("provider_type",A)});var uc=e.object({data:e.list(Ft),params:pc});var dc=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Ve=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),customerExternalId:e.property("customer_external_id",e.string()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),paymentMethodType:e.property("payment_method_type",e.string()),providerType:e.property("provider_type",A),updatedAt:e.property("updated_at",e.date())});var mc=e.object({data:e.list(Ve),params:dc});var hc=e.object({data:It,params:e.record(e.string(),e.unknown())});var gc=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",A),updatedAt:e.property("updated_at",e.date())});var yc=e.object({data:gc,params:e.record(e.string(),e.unknown())});var wc=e.object({data:Ft,params:e.record(e.string(),e.unknown())});var bc=e.object({data:H,params:e.record(e.string(),e.unknown())});var lr=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",A),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var zc=e.object({data:lr,params:e.record(e.string(),e.unknown())});var Rc=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),providerType:e.property("provider_type",A),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",cr.optional())});var fc=e.object({data:Rc,params:e.record(e.string(),e.unknown())});var _c=e.object({data:Be,params:e.record(e.string(),e.unknown())});var Sc=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var Ki=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var Li=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var Gi=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Kt=e.object({billingScheme:e.property("billing_scheme",Ie),billingThreshold:e.property("billing_threshold",e.number().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),name:e.string(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Mt)),providerType:e.property("provider_type",A),quantity:e.number(),subscriptionId:e.property("subscription_id",e.string()),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Q)});var Lt=e.object({amountOff:e.property("amount_off",e.number().optional()),couponId:e.property("coupon_id",e.string()),couponName:e.property("coupon_name",e.string()),currency:e.string().optional(),customerFacingCode:e.property("customer_facing_code",e.string().optional()),discountExternalId:e.property("discount_external_id",e.string()),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number().optional()),endedAt:e.property("ended_at",e.date().optional()),isActive:e.property("is_active",e.boolean()),percentOff:e.property("percent_off",e.number().optional()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date()),subscriptionExternalId:e.property("subscription_external_id",e.string())});var bt=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Lt),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",Be.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",Ve.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(Kt),providerType:e.property("provider_type",A),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",cr.optional())});var Pc=e.object({accountId:e.property("account_id",e.string()),capturedAtMax:e.property("captured_at_max",e.date()),capturedAtMin:e.property("captured_at_min",e.date()),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string()),monthReset:e.property("month_reset",e.string()),period:e.string(),validUntil:e.property("valid_until",e.date().optional()),value:e.number()});var $=e.enum_(["duration","end_of_billing_period","end_of_next_billing_period","end_of_trial","no_expiry"]);var L=e.enum_(["billing_periods","days"]);var pr=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var ur=e.enum_(["expire","none","rollover"]);var xc=e.object({accountId:e.property("account_id",e.string()),burnStrategy:e.property("burn_strategy",pr),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",L),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",ur),description:e.string(),environmentId:e.property("environment_id",e.string()),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:ee.optional(),pricePerUnit:e.property("price_per_unit",e.number().optional()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),product:lr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Se=e.enum_(["daily","monthly","weekly","yearly"]);var Ke=e.enum_(["billing_period","first_of_month"]);var dr=e.enum_(["no_reset","plan_period"]);var Gt=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Wr=e.object({billingCreditAutoTopupAmount:e.property("billing_credit_auto_topup_amount",e.number().optional()),billingCreditAutoTopupAmountType:e.property("billing_credit_auto_topup_amount_type",e.string().optional()),billingCreditAutoTopupEnabled:e.property("billing_credit_auto_topup_enabled",e.boolean()),billingCreditAutoTopupExpiryType:e.property("billing_credit_auto_topup_expiry_type",$.optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",L.optional()),billingCreditAutoTopupExpiryUnitCount:e.property("billing_credit_auto_topup_expiry_unit_count",e.number().optional()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),credit:xc.optional(),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:Gt.optional(),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",Se.optional()),resetStart:e.property("reset_start",Ke.optional()),resetType:e.property("reset_type",dr),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Wi=e.object({addedOn:e.property("added_on",e.date().optional()),billingProductExternalId:e.property("billing_product_external_id",e.string().optional()),billingProductId:e.property("billing_product_id",e.string().optional()),description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),includedCreditGrants:e.property("included_credit_grants",e.list(Wr)),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var Z=e.enum_(["company","user"]);var Wt=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",Z),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var Ht=e.object({createdAt:e.property("created_at",e.date()),definition:Wt.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",Z),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var oe=e.enum_(["boolean","currency","date","number","string","url"]);var ce=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",Z),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",oe),updatedAt:e.property("updated_at",e.date())});var Nt=e.object({createdAt:e.property("created_at",e.date()),definition:ce.optional(),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Y=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var Cc=e.enum_(["all_time","current_day","current_month","current_week"]);var Ec=e.enum_(["first_of_month","billing_cycle"]);var $t=e.object({allocation:e.number().optional(),creditId:e.property("credit_id",e.string().optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditUsed:e.property("credit_used",e.number().optional()),eventName:e.property("event_name",e.string().optional()),featureId:e.property("feature_id",e.string()),featureKey:e.property("feature_key",e.string()),metricPeriod:e.property("metric_period",Cc.optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",Ec.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),valueType:e.property("value_type",Y)});var Uc=e.enum_(["base_plan","billing_product","company","credit","metric","plan","plan_version","trait","user"]);var vc=e.enum_(["all_time","current_day","current_month","current_week"]);var Tc=e.enum_(["first_of_month","billing_cycle"]);var Oc=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var kc=e.enum_(["bool","date","int","string"]);var Hi=e.object({comparableType:e.property("comparable_type",kc),entityType:e.property("entity_type",Z),id:e.string()});var Jt=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",Hi.optional()),conditionType:e.property("condition_type",Uc),consumptionRate:e.property("consumption_rate",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",vc.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Tc.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Oc,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",Hi.optional()),traitValue:e.property("trait_value",e.string())});var jc=e.object({conditions:e.list(Jt)});var Bc=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Vc=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(jc)),conditions:e.list(Jt),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Bc),value:e.boolean()});var Zt=e.object({currency:e.string(),effectiveAfter:e.property("effective_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),fromPlanName:e.property("from_plan_name",e.string()),fromSubscriptionPrice:e.property("from_subscription_price",e.number()),id:e.string(),interval:e.string(),scheduledInterval:e.property("scheduled_interval",e.string().optional()),scheduledPrice:e.property("scheduled_price",e.number().optional()),toPlanId:e.property("to_plan_id",e.string()),toPlanName:e.property("to_plan_name",e.string())});var J=e.object({addOns:e.property("add_ons",e.list(Wi)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",bt.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(bt)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",Ve.optional()),entitlements:e.list($t),entityTraits:e.property("entity_traits",e.list(Nt)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Ht),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Pc),name:e.string(),paymentMethods:e.property("payment_methods",e.list(Ve)),plan:Wi.optional(),plans:e.list(Gt),rules:e.list(Vc),scheduledDowngrade:e.property("scheduled_downgrade",Zt.optional()),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Yt=e.object({company:J.optional(),success:e.boolean()});var Ac=e.object({data:Yt,params:e.record(e.string(),e.unknown())});var Dc=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),confirmPaymentIntentClientSecret:e.property("confirm_payment_intent_client_secret",e.string().optional()),confirmPaymentIntentId:e.property("confirm_payment_intent_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),providerType:e.property("provider_type",A),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",cr.optional())});var qc=e.object({data:Dc,params:e.record(e.string(),e.unknown())});var we=e.enum_(["active","inactive"]);var _e=e.stringLiteral("fixed");var Pe=e.object({bundleType:e.property("bundle_type",_e),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",$),expiryUnit:e.property("expiry_unit",L),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:H.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:we,unitPrice:e.property("unit_price",H.optional()),updatedAt:e.property("updated_at",e.date())});var Hr=e.object({cancelAt:e.property("cancel_at",e.date().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),discounts:e.list(Lt),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",Be.optional()),paymentMethod:e.property("payment_method",Ve.optional()),products:e.list(Kt),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.date().optional())});var Mc=e.object({bundle:Pe.optional(),quantity:e.number(),total:e.number()});var Re=e.enum_(["billing_credit_auto_topup","free","plan","purchased"]);var Ic=e.object({createdAt:e.property("created_at",e.date()),externalUserId:e.property("external_user_id",e.string()),externalUserName:e.property("external_user_name",e.string()),id:e.string(),note:e.string(),updatedAt:e.property("updated_at",e.date())});var mr=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var le=e.enum_(["boolean","event","trait"]);var Nr=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",le),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",mr.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var xe=e.object({company:J.optional(),companyId:e.property("company_id",e.string()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expirationDate:e.property("expiration_date",e.date().optional()),feature:Nr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),notes:e.list(Ic),ruleId:e.property("rule_id",e.string().optional()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),updatedAt:e.property("updated_at",e.date()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",ce.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var $r=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Re),quantity:e.number()});var Jr=e.object({usageThisBillingPeriod:e.property("usage_this_billing_period",e.number().optional()),usageThisCalendarMonth:e.property("usage_this_calendar_month",e.number().optional()),usageThisWeek:e.property("usage_this_week",e.number().optional()),usageToday:e.property("usage_today",e.number().optional())});var he=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var hr=e.enum_(["company_override","plan_entitlement","unknown"]);var Qt=e.object({companyCount:e.property("company_count",e.number()),environmentId:e.property("environment_id",e.string()),eventCount:e.property("event_count",e.number()),eventSubtype:e.property("event_subtype",e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),userCount:e.property("user_count",e.number())});var gr=e.stringLiteral("boolean");var Xt=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var eo=e.object({comparisonTrait:e.property("comparison_trait",ce.optional()),comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),resourceIds:e.property("resource_ids",e.list(e.string())),resources:e.list(Xt),ruleId:e.property("rule_id",e.string()),trait:ce.optional(),traitEntityType:e.property("trait_entity_type",Z.optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Fc=e.object({conditions:e.list(eo),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var ro=e.object({conditionGroups:e.property("condition_groups",e.list(Fc)),conditions:e.list(eo),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var Le=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:Nr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",gr),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),rules:e.list(ro),updatedAt:e.property("updated_at",e.date())});var Zr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var re=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),eventSummary:e.property("event_summary",Qt.optional()),featureType:e.property("feature_type",le),flags:e.list(Le),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",mr.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(Zr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:ce.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ce=e.object({burnStrategy:e.property("burn_strategy",pr),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",L),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",ur),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:H.optional(),product:lr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ie=e.enum_(["plan","add_on"]);var Ge=e.object({audienceType:e.property("audience_type",e.string().optional()),createdAt:e.property("created_at",e.date()),description:e.string(),icon:e.string(),id:e.string(),name:e.string(),planType:e.property("plan_type",ie),updatedAt:e.property("updated_at",e.date())});var te=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),feature:Nr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",ee.optional()),meteredYearlyPrice:e.property("metered_yearly_price",ee.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:Ge.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",he.optional()),ruleId:e.property("rule_id",e.string()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageBasedProduct:e.property("usage_based_product",lr.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",Ce.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",ce.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var yr=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),companyOverride:e.property("company_override",xe.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list($r).optional()),creditGrantReason:e.property("credit_grant_reason",Re.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsageAggregation:e.property("credit_usage_aggregation",Jr.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",hr),feature:re.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:Ge.optional(),planEntitlement:e.property("plan_entitlement",te.optional()),priceBehavior:e.property("price_behavior",he.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var Yr=e.object({features:e.list(yr)});var Ee=e.object({autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",e.string().optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean()),autoTopupExpiryType:e.property("auto_topup_expiry_type",$.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",L.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),credit:Ce.optional(),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),creditPluralName:e.property("credit_plural_name",e.string().optional()),creditSingularName:e.property("credit_singular_name",e.string().optional()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:Xt.optional(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),resetCadence:e.property("reset_cadence",Se.optional()),resetStart:e.property("reset_start",Ke.optional()),resetType:e.property("reset_type",dr.optional()),updatedAt:e.property("updated_at",e.date())});var Ue=e.enum_(["free","one_time","recurring"]);var We=e.enum_(["schematic","stripe"]);var Kc=e.enum_(["published","draft","archived"]);var ue=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),environmentId:e.property("environment_id",e.string()),icon:e.string(),id:e.string(),name:e.string(),originalPlanId:e.property("original_plan_id",e.string().optional()),planType:e.property("plan_type",ie),status:Kc,updatedAt:e.property("updated_at",e.date()),version:e.number()});var be=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Fe.optional()),chargeType:e.property("charge_type",Ue),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",We),createdAt:e.property("created_at",e.date()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),features:e.list(re),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ee).optional()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",H.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",H.optional()),planType:e.property("plan_type",ie),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",H.optional())});var zt=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),meteredPrice:e.property("metered_price",ee.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),priceBehavior:e.property("price_behavior",he.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",Y),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var Lc=e.object({activeAddOns:e.property("active_add_ons",e.list(be)),activePlan:e.property("active_plan",be.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(zt)),availableCreditBundles:e.property("available_credit_bundles",e.list(Pe)),company:J.optional(),featureUsage:e.property("feature_usage",Yr.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Mc)),selectedPlan:e.property("selected_plan",be.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(zt)),subscription:Hr.optional()});var Gc=e.object({data:Lc,params:e.record(e.string(),e.unknown())});var Wc=e.object({data:Yt,params:e.record(e.string(),e.unknown())});var Hc=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Nc=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),newCharges:e.property("new_charges",e.number()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),taxAmount:e.property("tax_amount",e.number().optional()),taxDisplayName:e.property("tax_display_name",e.string().optional()),taxRequireBillingDetails:e.property("tax_require_billing_details",e.boolean()),totalPerBillingPeriod:e.property("total_per_billing_period",e.number()),trialEnd:e.property("trial_end",e.date().optional()),upcomingInvoiceLineItems:e.property("upcoming_invoice_line_items",e.list(Hc))});var to=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Nc.optional(),isScheduledDowngrade:e.property("is_scheduled_downgrade",e.boolean()),newCharges:e.property("new_charges",e.number()),paymentMethodRequired:e.property("payment_method_required",e.boolean()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),scheduledChangeTime:e.property("scheduled_change_time",e.date().optional()),trialEnd:e.property("trial_end",e.date().optional()),usageViolations:e.property("usage_violations",e.list(yr))});var $c=e.object({data:to,params:e.record(e.string(),e.unknown())});var Jc=e.object({subscriptionChangePreview:e.property("subscription_change_preview",to.optional())});var Zc=e.object({data:Jc,params:e.record(e.string(),e.unknown())});var Yc=e.object({data:bt,params:e.record(e.string(),e.unknown())});var Ni=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",Z),hierarchy:e.list(e.string()),traitType:e.property("trait_type",oe)});var $i=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Ji=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Zi=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",oe)});var Qr=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Yi=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(Qr)});var Qi=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var fe=e.enum_(["asc","desc"]);var Ye=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var Qe=e.enum_(["free","one_time","paid","trial"]);var Qc=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",fe.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Ye).optional()),subscriptionTypes:e.property("subscription_types",e.list(Qe).optional()),withEntitlementFor:e.property("with_entitlement_for",e.string().optional()),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Xc=e.object({data:B,params:Qc});var el=e.object({entityType:e.property("entity_type",Z.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var rl=e.object({data:B,params:el});var tl=e.object({entityType:e.property("entity_type",Z.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",oe.optional()),traitTypes:e.property("trait_types",e.list(oe).optional())});var ol=e.object({data:B,params:tl});var il=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var al=e.object({data:B,params:il});var nl=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var sl=e.object({data:B,params:nl});var cl=e.object({data:J,params:e.record(e.string(),e.unknown())});var ve=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),planId:e.property("plan_id",e.string()),planType:e.property("plan_type",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var ll=e.object({data:ve,params:e.record(e.string(),e.unknown())});var Xr=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var et=e.object({company:Xr.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var Te=e.object({companyMemberships:e.property("company_memberships",e.list(et)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(Nt)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Ht),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date())});var pl=e.object({data:Te,params:e.record(e.string(),e.unknown())});var ul=e.object({data:Xr,params:e.record(e.string(),e.unknown())});var dl=e.object({data:K,params:e.record(e.string(),e.unknown())});var ml=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var hl=e.object({data:K,params:ml});var gl=e.object({data:K,params:e.record(e.string(),e.unknown())});var oo=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var yl=e.object({data:oo,params:e.record(e.string(),e.unknown())});var wl=e.object({data:K,params:e.record(e.string(),e.unknown())});var bl=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional()});var zl=e.object({data:e.list(Hr),params:bl});var Rl=e.object({data:J,params:e.record(e.string(),e.unknown())});var fl=e.object({data:ce,params:e.record(e.string(),e.unknown())});var _l=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Sl=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var Pl=e.object({data:e.list(Sl),params:_l});var xl=e.object({data:et,params:e.record(e.string(),e.unknown())});var Cl=e.object({data:ce,params:e.record(e.string(),e.unknown())});var El=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","plan_trait_change","plan_version_migration","quickstart","subscription_change"]);var Ul=e.enum_(["fallback","initial","trait","trial_expiry"]);var vl=e.enum_(["adjustment","downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var Rt=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Xi=e.object({id:e.string(),name:e.string(),version:e.number()});var Tl=e.object({featureId:e.property("feature_id",e.string()),hierarchy:e.list(e.string()),reason:e.string(),traitId:e.property("trait_id",e.string()),traitName:e.property("trait_name",e.string()),traitType:e.property("trait_type",oe),value:e.string()});var io=e.object({action:El,actorType:e.property("actor_type",ye),addOnsAdded:e.property("add_ons_added",e.list(Rt)),addOnsRemoved:e.property("add_ons_removed",e.list(Rt)),apiKey:e.property("api_key",Me.optional()),auditLog:e.property("audit_log",Dt.optional()),basePlan:e.property("base_plan",Rt.optional()),basePlanAction:e.property("base_plan_action",Ul.optional()),basePlanVersion:e.property("base_plan_version",Xi.optional()),company:Xr.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),previousBasePlan:e.property("previous_base_plan",Rt.optional()),previousBasePlanVersion:e.property("previous_base_plan_version",Xi.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",vl.optional()),traitsUpdated:e.property("traits_updated",e.list(Tl)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Ol=e.object({data:io,params:e.record(e.string(),e.unknown())});var kl=e.object({data:ve,params:e.record(e.string(),e.unknown())});var jl=e.object({data:Te,params:e.record(e.string(),e.unknown())});var Bl=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",fe.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Ye).optional()),subscriptionTypes:e.property("subscription_types",e.list(Qe).optional()),withEntitlementFor:e.property("with_entitlement_for",e.string().optional()),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Vl=e.object({data:e.list(J),params:Bl});var Al=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var Dl=e.object({data:e.list(et),params:Al});var ql=e.object({entityType:e.property("entity_type",Z.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ml=e.object({data:e.list(Wt),params:ql});var Il=e.object({entityType:e.property("entity_type",Z.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",oe.optional()),traitTypes:e.property("trait_types",e.list(oe).optional())});var Fl=e.object({data:e.list(ce),params:Il});var Kl=e.object({action:e.string().optional(),basePlanAction:e.property("base_plan_action",e.string().optional()),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional())});var Ll=e.object({data:e.list(io),params:Kl});var Gl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var Wl=e.object({data:e.list(ve),params:Gl});var Hl=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var Nl=e.object({data:e.list(Te),params:Hl});var $l=e.object({keys:e.record(e.string(),e.string()).optional()});var Jl=e.object({data:J,params:$l});var Zl=e.object({keys:e.record(e.string(),e.string()).optional()});var Yl=e.object({data:Te,params:Zl});var Ql=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Xl=e.object({data:ve,params:e.record(e.string(),e.unknown())});var ep=e.object({data:e.list(ve),params:e.record(e.string(),e.unknown())});var rp=e.object({data:J,params:e.record(e.string(),e.unknown())});var tp=e.object({data:J,params:e.record(e.string(),e.unknown())});var op=e.object({data:Te,params:e.record(e.string(),e.unknown())});var ip=e.object({data:Te,params:e.record(e.string(),e.unknown())});var rt=e.enum_(["billing","entitlement"]);var ea=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",rt),name:e.string()});var ao=e.enum_(["draft","live"]);var ra=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",rt.optional()),name:e.string().optional(),state:ao.optional()});var ap=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var np=e.object({data:B,params:ap});var He=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:ao,type:rt,updatedAt:e.property("updated_at",e.date())});var sp=e.object({data:He,params:e.record(e.string(),e.unknown())});var cp=e.object({data:K,params:e.record(e.string(),e.unknown())});var lp=e.object({data:He,params:e.record(e.string(),e.unknown())});var pp=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var up=e.object({data:e.list(He),params:pp});var dp=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var ft=e.object({billingScheme:e.property("billing_scheme",Ie),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Gr,isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",A),tiersMode:e.property("tiers_mode",se.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Q)});var mp=e.object({bundleType:e.property("bundle_type",_e),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",$),expiryUnit:e.property("expiry_unit",L),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:ft.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:we,unitPrice:e.property("unit_price",ft.optional()),updatedAt:e.property("updated_at",e.date())});var hp=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var wr=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var ta=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Fe.optional()),chargeType:e.property("charge_type",Ue),companyCanTrial:e.property("company_can_trial",e.boolean()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",We),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",wr.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(te),features:e.list(re),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Wr)),invalidReason:e.property("invalid_reason",hp.optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",H.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",H.optional()),planType:e.property("plan_type",ie),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(yr)),valid:e.boolean(),versions:e.list(ue),yearlyPrice:e.property("yearly_price",H.optional())});var br=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var no=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var gp=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean())});var so=e.object({showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var zr=e.enum_(["expired","manual","plan_change","plan_period_reset"]);var yp=e.object({amount:e.number(),createdAt:e.property("created_at",e.date()),direction:e.string(),id:e.string(),reason:e.string(),relatedGrantId:e.property("related_grant_id",e.string())});var wp=e.object({billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditName:e.property("credit_name",e.string()),exhaustedAt:e.property("exhausted_at",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",Re),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),price:ft.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",Se.optional()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(yp).optional(),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",zr.optional())});var bp=e.object({accountId:e.property("account_id",e.string().optional()),publishableKey:e.property("publishable_key",e.string().optional()),schematicPublishableKey:e.property("schematic_publishable_key",e.string()),setupIntentClientSecret:e.property("setup_intent_client_secret",e.string().optional())});var zp=e.object({activeAddOns:e.property("active_add_ons",e.list(ta)),activePlans:e.property("active_plans",e.list(ta)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(zt)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(br)),capabilities:no.optional(),checkoutSettings:e.property("checkout_settings",gp),company:J.optional(),component:He.optional(),creditBundles:e.property("credit_bundles",e.list(mp)),creditGrants:e.property("credit_grants",e.list(wp)),defaultPlan:e.property("default_plan",be.optional()),displaySettings:e.property("display_settings",so),featureUsage:e.property("feature_usage",Yr.optional()),invoices:e.list(Be),postTrialPlan:e.property("post_trial_plan",be.optional()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),scheduledDowngrade:e.property("scheduled_downgrade",Zt.optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",bp.optional()),subscription:Hr.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Be.optional())});var Rp=e.object({data:zp,params:dp});var fp=e.object({data:He,params:e.record(e.string(),e.unknown())});var oa=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Fe.optional()),chargeType:e.property("charge_type",Ue),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",We),createdAt:e.property("created_at",e.date()),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",wr.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(te),features:e.list(re),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Wr)),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",H.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",H.optional()),planType:e.property("plan_type",ie),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",H.optional())});var _p=e.object({activeAddOns:e.property("active_add_ons",e.list(oa)),activePlans:e.property("active_plans",e.list(oa)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(br)),capabilities:no.optional(),displaySettings:e.property("display_settings",so),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var Sp=e.object({data:_p,params:e.record(e.string(),e.unknown())});var ia=e.object({burnStrategy:e.property("burn_strategy",pr.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",L.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",ur.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var aa=e.object({billingPeriodsCount:e.property("billing_periods_count",e.number().optional()),companyId:e.property("company_id",e.string()),creditId:e.property("credit_id",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:Re,renewalEnabled:e.property("renewal_enabled",e.boolean().optional()),renewalPeriod:e.property("renewal_period",Ke.optional())});var na=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",_e.optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:we.optional()});var sa=e.object({burnStrategy:e.property("burn_strategy",pr.optional()),defaultExpiryUnit:e.property("default_expiry_unit",L.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",ur.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var ca=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:we.optional()});var la=e.object({reason:zr.optional()});var Pp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var xp=e.object({data:B,params:Pp});var Cp=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Ep=e.object({data:B,params:Cp});var Up=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var vp=e.object({data:B,params:Up});var vr=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Tp=e.object({companyId:e.property("company_id",e.string().optional()),dir:fe.optional(),limit:e.number().optional(),offset:e.number().optional(),order:vr.optional()});var Op=e.object({data:B,params:Tp});var kp=e.object({bundleType:e.property("bundle_type",_e.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:we.optional()});var jp=e.object({data:B,params:kp});var Xe=e.enum_(["grant","transfer","usage","zero_out"]);var Bp=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),eventType:e.property("event_type",Xe.optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),startTime:e.property("start_time",e.string().optional())});var Vp=e.object({data:B,params:Bp});var Tr=e.enum_(["daily","monthly","raw","weekly"]);var Ap=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Tr.optional(),startTime:e.property("start_time",e.string().optional())});var Dp=e.object({data:B,params:Ap});var qp=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var Mp=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var Ip=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Fp=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Kp=e.object({data:K,params:Fp});var Lp=e.object({data:K,params:e.record(e.string(),e.unknown())});var Gp=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Wp=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Tr.optional(),startTime:e.property("start_time",e.string().optional())});var co=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var lo=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var po=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var Hp=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:lo.optional(),companyId:e.property("company_id",e.string()),credit:co.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:po.optional(),featureId:e.property("feature_id",e.string().optional()),firstTransactionAt:e.property("first_transaction_at",e.date()),freeGrantCount:e.property("free_grant_count",e.number()),grantCount:e.property("grant_count",e.number()),lastTransactionAt:e.property("last_transaction_at",e.date()),manuallyZeroedCount:e.property("manually_zeroed_count",e.number()),netChange:e.property("net_change",e.number()),planGrantCount:e.property("plan_grant_count",e.number()),purchasedGrantCount:e.property("purchased_grant_count",e.number()),timeBucket:e.property("time_bucket",e.date()),totalConsumed:e.property("total_consumed",e.number()),totalGranted:e.property("total_granted",e.number()),transactionCount:e.property("transaction_count",e.number()),usageCount:e.property("usage_count",e.number()),zeroedOutCount:e.property("zeroed_out_count",e.number())});var Np=e.object({data:e.list(Hp),params:Wp});var $p=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var Jp=e.object({amount:e.number(),createdAt:e.property("created_at",e.date()),direction:e.string(),id:e.string(),reason:e.string(),relatedGrantId:e.property("related_grant_id",e.string())});var Rr=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Re),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:H.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",Se.optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(Jp).optional(),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",zr.optional())});var Zp=e.object({data:Rr,params:e.record(e.string(),e.unknown())});var Yp=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Qp=e.object({data:e.list(Ce),params:Yp});var Xp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var eu=e.object({data:e.list(Ee),params:Xp});var ru=e.object({companyId:e.property("company_id",e.string().optional()),dir:fe.optional(),limit:e.number().optional(),offset:e.number().optional(),order:vr.optional()});var tu=e.object({data:e.list(Rr),params:ru});var ou=e.object({bundleType:e.property("bundle_type",_e.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:we.optional()});var iu=e.object({data:e.list(Pe),params:ou});var au=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),eventType:e.property("event_type",Xe.optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),startTime:e.property("start_time",e.string().optional())});var nu=e.object({amount:e.number(),autoTopupLogId:e.property("auto_topup_log_id",e.string().optional()),billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),company:lo.optional(),companyId:e.property("company_id",e.string()),credit:co.optional(),creditName:e.property("credit_name",e.string()),environmentId:e.property("environment_id",e.string()),eventAt:e.property("event_at",e.date()),eventId:e.property("event_id",e.string()),eventType:e.property("event_type",Xe),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),feature:po.optional(),featureId:e.property("feature_id",e.string().optional()),fromGrantId:e.property("from_grant_id",e.string().optional()),grantExpiresAt:e.property("grant_expires_at",e.date().optional()),grantId:e.property("grant_id",e.string().optional()),grantQuantity:e.property("grant_quantity",e.number().optional()),grantQuantityRemaining:e.property("grant_quantity_remaining",e.number().optional()),grantReason:e.property("grant_reason",Re.optional()),grantValidFrom:e.property("grant_valid_from",e.date().optional()),planId:e.property("plan_id",e.string().optional()),quantityConsumed:e.property("quantity_consumed",e.number().optional()),quantityRemainingAtZeroOut:e.property("quantity_remaining_at_zero_out",e.number().optional()),sourceId:e.property("source_id",e.number()),toGrantId:e.property("to_grant_id",e.string().optional()),usageEventId:e.property("usage_event_id",e.string().optional()),zeroedOutReason:e.property("zeroed_out_reason",zr.optional())});var su=e.object({data:e.list(nu),params:au});var cu=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var lu=e.object({data:e.list(Rr),params:cu});var pu=e.object({data:K,params:e.record(e.string(),e.unknown())});var uu=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var du=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var mu=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var hu=e.object({data:Rr,params:e.record(e.string(),e.unknown())});var pa=e.object({metadata:e.string()});var gu=e.stringLiteral("csv");var yu=e.enum_(["failure","pending","success"]);var wu=e.stringLiteral("company-feature-usage");var bu=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),exportType:e.property("export_type",wu),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",gu),status:yu,updatedAt:e.property("updated_at",e.date())});var zu=e.object({data:bu,params:e.record(e.string(),e.unknown())});var Ru=e.enum_(["all_time","current_month","current_week","current_day"]);var fu=e.enum_(["first_of_month","billing_cycle"]);var ua=e.object({companyId:e.property("company_id",e.string()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",Ru.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",fu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var Oe=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var _u=e.enum_(["all_time","current_month","current_week","current_day"]);var Su=e.enum_(["first_of_month","billing_cycle"]);var da=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",_u.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Su.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Oe).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),priceBehavior:e.property("price_behavior",he.optional()),priceTiers:e.property("price_tiers",e.list(Oe).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",se.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Oe).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var ma=e.object({sourcePlanId:e.property("source_plan_id",e.string()),targetPlanId:e.property("target_plan_id",e.string())});var Pu=e.enum_(["all_time","current_month","current_week","current_day"]);var xu=e.enum_(["first_of_month","billing_cycle"]);var ha=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",Pu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",xu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var Cu=e.enum_(["all_time","current_month","current_week","current_day"]);var Eu=e.enum_(["first_of_month","billing_cycle"]);var ga=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),metricPeriod:e.property("metric_period",Cu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Eu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Oe).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",he.optional()),priceTiers:e.property("price_tiers",e.list(Oe).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",se.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Oe).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Uu=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var vu=e.object({data:B,params:Uu});var Tu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ou=e.object({data:B,params:Tu});var ku=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),includeUsageAggregation:e.property("include_usage_aggregation",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var ju=e.object({data:B,params:ku});var Bu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Vu=e.object({data:B,params:Bu});var Au=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var Du=e.object({data:B,params:Au});var qu=e.object({data:xe,params:e.record(e.string(),e.unknown())});var Mu=e.object({data:te,params:e.record(e.string(),e.unknown())});var Iu=e.object({data:K,params:e.record(e.string(),e.unknown())});var Fu=e.object({data:K,params:e.record(e.string(),e.unknown())});var Ku=e.object({message:e.string()});var Lu=e.object({entitlementId:e.property("entitlement_id",e.string()),errors:e.list(Ku),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string())});var Gu=e.object({data:e.list(te),skipped:e.list(Lu)});var Wu=e.object({data:Gu,params:e.record(e.string(),e.unknown())});var Hu=e.object({data:xe,params:e.record(e.string(),e.unknown())});var Nu=e.object({keys:e.record(e.string(),e.string()).optional()});var $u=e.object({data:Yr,params:Nu});var uo=e.enum_(["daily","hourly","monthly","weekly"]);var Ju=e.object({companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),featureId:e.property("feature_id",e.string().optional()),granularity:uo.optional(),startTime:e.property("start_time",e.date().optional())});var Zu=e.object({effectiveAt:e.property("effective_at",e.date()),isSoftLimit:e.property("is_soft_limit",e.boolean()),limitSource:e.property("limit_source",hr),limitValue:e.property("limit_value",e.number().optional()),planId:e.property("plan_id",e.string().optional()),priceBehavior:e.property("price_behavior",he.optional())});var Yu=e.object({periodEnd:e.property("period_end",e.date().optional()),periodStart:e.property("period_start",e.date().optional()),timestamp:e.date(),usage:e.number()});var Qu=e.object({featureId:e.property("feature_id",e.string()),featureType:e.property("feature_type",le),limits:e.list(Zu),periodType:e.property("period_type",e.string().optional()),usagePoints:e.property("usage_points",e.list(Yu))});var Xu=e.object({data:Qu,params:Ju});var ed=e.object({data:te,params:e.record(e.string(),e.unknown())});var rd=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var td=e.object({data:e.list(xe),params:rd});var od=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var id=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list($r).optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional()),usageAggregation:e.property("usage_aggregation",Jr.optional())});var ad=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),company:J.optional(),companyOverride:e.property("company_override",xe.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list($r).optional()),creditGrantReason:e.property("credit_grant_reason",Re.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsage:e.property("credit_usage",id.optional()),creditUsageAggregation:e.property("credit_usage_aggregation",Jr.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",hr),feature:re.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:Ge.optional(),planEntitlement:e.property("plan_entitlement",te.optional()),priceBehavior:e.property("price_behavior",he.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var nd=e.object({data:e.list(ad),params:od});var sd=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),includeUsageAggregation:e.property("include_usage_aggregation",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var cd=e.object({data:e.list(yr),params:sd});var ld=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var pd=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),company:J.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",hr),feature:re.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:Ge.optional(),usage:e.number().optional(),user:oo.optional()});var ud=e.object({data:e.list(pd),params:ld});var dd=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var md=e.object({data:e.list(te),params:dd});var hd=e.object({data:xe,params:e.record(e.string(),e.unknown())});var gd=e.object({data:te,params:e.record(e.string(),e.unknown())});var yd=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),flagId:e.property("flag_id",e.string().optional()),flagKey:e.property("flag_key",e.string()),reason:e.string(),reqCompany:e.property("req_company",e.record(e.string(),e.string()).optional()),reqUser:e.property("req_user",e.record(e.string(),e.string()).optional()),ruleId:e.property("rule_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var wd=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var bd=e.object({company:wd.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var zd=e.object({company:e.record(e.string(),e.string()).optional(),event:e.string(),quantity:e.number().optional(),traits:e.record(e.string(),e.unknown()).optional(),user:e.record(e.string(),e.string()).optional()});var Rd=e.undiscriminatedUnion([zd,yd,bd]);var er=e.enum_(["flag_check","identify","track"]);var mo=e.object({body:Rd.optional(),eventType:e.property("event_type",er),sentAt:e.property("sent_at",e.date().optional())});var ya=e.object({events:e.list(mo)});var ho=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string().optional()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var fd=e.object({events:e.list(ho)});var _d=e.object({data:fd,params:e.record(e.string(),e.unknown())});var Sd=e.object({data:ho,params:e.record(e.string(),e.unknown())});var Pd=e.enum_(["enriched","failed","pending","processed","unknown"]);var go=e.object({apiKey:e.property("api_key",e.string().optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),company:Zr.optional(),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),features:e.list(Zr),id:e.string(),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:Pd,subtype:e.string().optional(),type:er,updatedAt:e.property("updated_at",e.date().optional()),user:Zr.optional(),userId:e.property("user_id",e.string().optional())});var xd=e.object({data:go,params:e.record(e.string(),e.unknown())});var Cd=e.object({eventSubtypes:e.property("event_subtypes",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ed=e.object({data:e.list(Qt),params:Cd});var Ud=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var vd=e.object({data:Ud,params:e.record(e.string(),e.unknown())});var Td=e.object({companyId:e.property("company_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),eventTypes:e.property("event_types",e.list(er).optional()),flagId:e.property("flag_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var Od=e.object({data:e.list(go),params:Td});var _t=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var wa=e.object({contexts:e.list(_t)});var yo=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",gr),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var ba=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",le),flag:yo.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",mr.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var za=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",le.optional()),flag:yo.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",mr.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string().optional(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var kd=e.enum_(["company","metric","trait","user","plan","billing_product","base_plan"]);var jd=e.enum_(["all_time","current_month","current_week","current_day"]);var Bd=e.enum_(["first_of_month","billing_cycle"]);var Vd=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var wo=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",kd),creditCost:e.property("credit_cost",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string().optional(),metricPeriod:e.property("metric_period",jd.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Bd.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Vd,resourceIds:e.property("resource_ids",e.list(e.string())),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string().optional())});var Ad=e.object({conditions:e.list(wo),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Dd=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var qd=e.object({conditionGroups:e.property("condition_groups",e.list(Ad)),conditions:e.list(wo),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Dd.optional()),value:e.boolean()});var Ra=e.object({rules:e.list(qd)});var bo=e.object({companyId:e.property("company_id",e.string().optional()),entitlement:$t.optional(),error:e.string().optional(),featureAllocation:e.property("feature_allocation",e.number().optional()),featureUsage:e.property("feature_usage",e.number().optional()),featureUsageEvent:e.property("feature_usage_event",e.string().optional()),featureUsagePeriod:e.property("feature_usage_period",e.string().optional()),featureUsageResetAt:e.property("feature_usage_reset_at",e.date().optional()),flag:e.string(),flagId:e.property("flag_id",e.string().optional()),reason:e.string(),ruleId:e.property("rule_id",e.string().optional()),ruleType:e.property("rule_type",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var Md=e.object({data:bo,params:e.record(e.string(),e.unknown())});var Id=e.object({id:e.string(),name:e.string(),trialEndDate:e.property("trial_end_date",e.date().optional())});var zo=e.object({flags:e.list(bo),plan:Id.optional()});var Fd=e.object({data:e.list(zo)});var Kd=e.object({data:Fd,params:e.record(e.string(),e.unknown())});var Ld=e.object({data:zo,params:e.record(e.string(),e.unknown())});var Gd=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(le).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var Wd=e.object({data:B,params:Gd});var Hd=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Nd=e.object({data:B,params:Hd});var $d=e.object({data:re,params:e.record(e.string(),e.unknown())});var Jd=e.object({data:Le,params:e.record(e.string(),e.unknown())});var Zd=e.object({data:K,params:e.record(e.string(),e.unknown())});var Yd=e.object({data:K,params:e.record(e.string(),e.unknown())});var Qd=e.object({data:re,params:e.record(e.string(),e.unknown())});var Xd=e.object({data:Le,params:e.record(e.string(),e.unknown())});var em=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(le).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var rm=e.object({data:e.list(re),params:em});var tm=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var om=e.object({data:e.list(Le),params:tm});var im=e.object({data:re,params:e.record(e.string(),e.unknown())});var am=e.object({data:Le,params:e.record(e.string(),e.unknown())});var nm=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",gr),id:e.string(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var sm=e.object({flag:nm.optional(),rules:e.list(ro)});var cm=e.object({data:sm,params:e.record(e.string(),e.unknown())});var Ro=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",ie)});var fo=e.stringLiteral("credit");var _o=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",fo.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",$.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",L.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),resetCadence:e.property("reset_cadence",Se),resetStart:e.property("reset_start",Ke),resetType:e.property("reset_type",dr.optional())});var lm=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var So=e.enum_(["create","update","delete"]);var Po=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",fo.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",$.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",L.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number().optional()),expiryType:e.property("expiry_type",$.optional()),expiryUnit:e.property("expiry_unit",L.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Se),resetStart:e.property("reset_start",Ke),resetType:e.property("reset_type",dr.optional())});var xo=e.object({action:So,createReq:e.property("create_req",_o.optional()),creditGrantId:e.property("credit_grant_id",e.string().optional()),deleteReq:e.property("delete_req",lm.optional()),updateReq:e.property("update_req",Po.optional())});var pm=e.enum_(["all_time","current_month","current_week","current_day"]);var um=e.enum_(["first_of_month","billing_cycle"]);var dm=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",pm.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",um.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Oe).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),priceBehavior:e.property("price_behavior",he.optional()),priceTiers:e.property("price_tiers",e.list(Oe).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",se.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Oe).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Co=e.object({action:So,entitlementId:e.property("entitlement_id",e.string().optional()),req:dm.optional()});var tt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",Ue),currency:e.string().optional(),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",e.number().optional()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePrice:e.property("one_time_price",e.number().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),trialDays:e.property("trial_days",e.number().optional()),yearlyPrice:e.property("yearly_price",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var fa=e.object({billingProduct:e.property("billing_product",tt.optional()),creditGrants:e.property("credit_grants",e.list(xo).optional()),entitlements:e.list(Co),plan:Ro.optional(),traits:e.list(Qr).optional()});var Eo=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var _a=e.object({billingProduct:e.property("billing_product",tt.optional()),creditGrants:e.property("credit_grants",e.list(xo).optional()),entitlements:e.list(Co),plan:Eo.optional(),planVersionId:e.property("plan_version_id",e.string().optional()),traits:e.list(Qr).optional()});var Uo=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",Ue),controlledBy:e.property("controlled_by",We),environmentId:e.property("environment_id",e.string()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),planId:e.property("plan_id",e.string()),trialDays:e.property("trial_days",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var vo=e.object({billingProduct:e.property("billing_product",Uo.optional()),creditGrants:e.property("credit_grants",e.list(Ee).optional()),entitlements:e.list(te).optional(),plan:Ge.optional(),traits:e.list(ve).optional()});var mm=e.object({data:vo,params:e.record(e.string(),e.unknown())});var hm=e.object({data:vo,params:e.record(e.string(),e.unknown())});var gm=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var rr=e.object({entitlements:e.list(gm).optional(),planId:e.property("plan_id",e.string())});var ot=e.object({bundleId:e.string()});var To=e.enum_(["create_prorations","invoice_immediately"]);var Oo=e.enum_(["end_of_billing_period","none"]);var Sa=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(br).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",wr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(rr)),orderedBundleList:e.property("ordered_bundle_list",e.list(ot)),orderedPlans:e.property("ordered_plans",e.list(rr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",To),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",Oo.optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Pa=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(br).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",wr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(rr)),orderedBundleList:e.property("ordered_bundle_list",e.list(ot)),orderedPlans:e.property("ordered_plans",e.list(rr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",To),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",Oo.optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var ko=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var ym=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var jo=e.object({showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var Bo=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(ym)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",ko),componentSettings:e.property("component_settings",jo),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnIds:e.property("ordered_add_on_ids",e.list(rr)),planIds:e.property("plan_ids",e.list(rr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",e.string()),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",e.string().optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var wm=e.object({data:Bo,params:e.record(e.string(),e.unknown())});var bm=e.object({includeCompanyCounts:e.property("include_company_counts",e.boolean().optional())});var Vo=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var Or=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Fe.optional()),chargeType:e.property("charge_type",Ue),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",We),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",Vo.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(te),features:e.list(re),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ee).optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",H.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",H.optional()),planType:e.property("plan_type",ie),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",H.optional())});var zm=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var xa=e.object({entitlements:e.list(zm).optional(),planId:e.property("plan_id",e.string())});var Rm=e.object({addOns:e.property("add_ons",e.list(Or)),checkoutSettings:e.property("checkout_settings",ko),componentSettings:e.property("component_settings",jo),customPlanConfig:e.property("custom_plan_config",Vo.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",Or.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",Or.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",Or.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",ee.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(xa)),orderedBundleList:e.property("ordered_bundle_list",e.list(ot)),orderedPlanList:e.property("ordered_plan_list",e.list(xa)),plans:e.list(Or),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",e.string()),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",e.string().optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlan:e.property("trial_expiry_plan",Or.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",ee.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var fm=e.object({data:Rm,params:bm});var _m=e.object({data:Bo,params:e.record(e.string(),e.unknown())});var tr=e.enum_(["completed","failed","in_progress","pending","skipped"]);var Sm=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:tr.optional()});var Pm=e.object({data:B,params:Sm});var or=e.enum_(["completed","failed","in_progress","pending"]);var xm=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:or.optional()});var Cm=e.object({data:B,params:xm});var Ao=e.enum_(["immediate","leave"]);var Do=e.object({completedAt:e.property("completed_at",e.date().optional()),completedCompanies:e.property("completed_companies",e.number()),createdAt:e.property("created_at",e.date()),error:e.string().optional(),failedCompanies:e.property("failed_companies",e.number()),id:e.string(),planId:e.property("plan_id",e.string()),planVersionIdFrom:e.property("plan_version_id_from",e.string().optional()),planVersionIdTo:e.property("plan_version_id_to",e.string()),skippedCompanies:e.property("skipped_companies",e.number()),startedAt:e.property("started_at",e.date().optional()),status:or,strategy:Ao,totalCompanies:e.property("total_companies",e.number()),updatedAt:e.property("updated_at",e.date())});var Em=e.object({data:Do,params:e.record(e.string(),e.unknown())});var Um=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:tr.optional()});var vm=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),completedAt:e.property("completed_at",e.date().optional()),createdAt:e.property("created_at",e.date()),error:e.string().optional(),id:e.string(),migrationId:e.property("migration_id",e.string()),planVersionIdFrom:e.property("plan_version_id_from",e.string().optional()),startedAt:e.property("started_at",e.date().optional()),status:tr,updatedAt:e.property("updated_at",e.date())});var Tm=e.object({data:e.list(vm),params:Um});var Om=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:or.optional()});var km=e.object({data:e.list(Do),params:Om});var Ca=e.object({excludedCompanyIds:e.property("excluded_company_ids",e.list(e.string())),migrationStrategy:e.property("migration_strategy",Ao)});var Ea=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var jm=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),includeDraftVersions:e.property("include_draft_versions",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",ie.optional()),q:e.string().optional(),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional())});var Bm=e.object({data:B,params:jm});var Vm=e.object({data:be,params:e.record(e.string(),e.unknown())});var Am=e.object({data:K,params:e.record(e.string(),e.unknown())});var Dm=e.object({data:K,params:e.record(e.string(),e.unknown())});var qm=e.object({planVersionId:e.property("plan_version_id",e.string().optional())});var Mm=e.object({data:be,params:qm});var Im=e.object({planId:e.property("plan_id",e.string().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var Fm=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var Km=e.object({data:e.list(Fm),params:Im});var Lm=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),includeDraftVersions:e.property("include_draft_versions",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",ie.optional()),q:e.string().optional(),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional())});var Gm=e.object({data:e.list(be),params:Lm});var Wm=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Hm=e.object({data:J,params:e.record(e.string(),e.unknown())});var Nm=e.object({data:be,params:e.record(e.string(),e.unknown())});var $m=e.object({data:Uo,params:e.record(e.string(),e.unknown())});var Ua=e.object({companyId:e.property("company_id",e.string()),executeAfter:e.property("execute_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),toPlanId:e.property("to_plan_id",e.string())});var fr=e.enum_(["cancelled","error","executing","pending","success"]);var va=e.object({executeAfter:e.property("execute_after",e.date().optional()),status:fr.optional()});var _r=e.object({actorType:e.property("actor_type",e.string()),companyId:e.property("company_id",e.string()),completedAt:e.property("completed_at",e.date().optional()),createdAt:e.property("created_at",e.date()),errorMessage:e.property("error_message",e.string().optional()),executeAfter:e.property("execute_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),id:e.string(),scheduledInterval:e.property("scheduled_interval",e.string().optional()),scheduledPrice:e.property("scheduled_price",e.number().optional()),startedAt:e.property("started_at",e.date().optional()),status:fr,toPlanId:e.property("to_plan_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Jm=e.object({data:_r,params:e.record(e.string(),e.unknown())});var Zm=e.object({data:_r,params:e.record(e.string(),e.unknown())});var Ym=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),status:fr.optional()});var Qm=e.object({data:e.list(_r),params:Ym});var Xm=e.object({data:_r,params:e.record(e.string(),e.unknown())});var it=e.object({creditId:e.property("credit_id",e.string())});var at=e.object({featureId:e.property("feature_id",e.string())});var Sr=e.enum_(["subscription.trial.ended","company.created","company.deleted","company.override.created","company.override.deleted","company.override.expired","company.override.updated","company.plan_changed","company.scheduled_downgrade","company.updated","credit.limit.reached","credit.limit.warning","entitlement.limit.reached","entitlement.limit.warning","entitlement.soft_limit.reached","entitlement.soft_limit.warning","entitlement.tier_limit.reached","entitlement.tier_limit.warning","feature.created","feature.deleted","feature.updated","flag.created","flag.deleted","flag_rules.updated","flag.updated","plan.created","plan.deleted","plan.entitlement.created","plan.entitlement.deleted","plan.entitlement.updated","plan.updated","plan_version.deleted","rule.deleted","test.send","user.created","user.deleted","user.updated","auto.topup.hard.failure","auto.topup.retry.exceeded"]);var Ta=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(it).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(at).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(Sr)),url:e.string()});var qo=e.enum_(["active","inactive"]);var Oa=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(it).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(at).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(Sr).optional()),status:qo.optional(),url:e.string().optional()});var eh=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var rh=e.object({data:B,params:eh});var th=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var oh=e.object({data:B,params:th});var Ne=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(it).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(at).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(Sr)),secret:e.string(),status:qo,updatedAt:e.property("updated_at",e.date()),url:e.string()});var ih=e.object({data:Ne,params:e.record(e.string(),e.unknown())});var ah=e.object({data:K,params:e.record(e.string(),e.unknown())});var nh=e.enum_(["failure","pending","success"]);var Mo=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",Sr),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:nh,updatedAt:e.property("updated_at",e.date()),webhook:Ne.optional(),webhookId:e.property("webhook_id",e.string())});var sh=e.object({data:Mo,params:e.record(e.string(),e.unknown())});var ch=e.object({data:Ne,params:e.record(e.string(),e.unknown())});var lh=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var ph=e.object({data:e.list(Mo),params:lh});var uh=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var dh=e.object({data:e.list(Ne),params:uh});var mh=e.object({data:Ne,params:e.record(e.string(),e.unknown())});var a=e.object({error:e.string()});var hh=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var Io=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var Fo=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var ka=e.object({addOnIds:e.property("add_on_ids",e.list(hh)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(Io)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(Fo)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var ja=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",gr),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Ba=e.object({keys:e.record(e.string(),e.string())});var gh=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional()),versionId:e.property("version_id",e.string().optional())});var Va=e.object({addOnSelections:e.property("add_on_selections",e.list(gh)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_id",e.string().optional()),basePlanVersionId:e.property("base_plan_version_id",e.string().optional()),cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(Io)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(Fo)),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),prorate:e.boolean().optional(),trialEnd:e.property("trial_end",e.date().optional())});var Aa=e.object({id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),preventKeyRemap:e.property("prevent_key_remap",e.boolean().optional()),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var Da=e.object({incr:e.number().optional(),keys:e.record(e.string(),e.string()),set:e.string().optional(),trait:e.string(),updateOnly:e.property("update_only",e.boolean().optional())});var qa=e.object({companies:e.list(e.record(e.string(),e.string())).optional(),company:e.record(e.string(),e.string()).optional(),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var Ko=class{constructor(o){this._options=F(o)}issueTemporaryAccessToken(o,t){return R.fromPromise(this.__issueTemporaryAccessToken(o,t))}async __issueTemporaryAccessToken(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"temporary-access-tokens"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:{...vi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),resource_type:"company"},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:hs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/temporary-access-tokens")}};var Lo=class{constructor(o){this._options=F(o)}listApiKeys(o,t){return R.fromPromise(this.__listApiKeys(o,t))}async __listApiKeys(o,t){let{environmentId:i,requireEnvironment:s,limit:r,offset:n}=o,u={environment_id:i,require_environment:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"api-keys"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:ks.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/api-keys")}createApiKey(o,t){return R.fromPromise(this.__createApiKey(o,t))}async __createApiKey(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"api-keys"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ti.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Rs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/api-keys")}getApiKey(o,t){return R.fromPromise(this.__getApiKey(o,t))}async __getApiKey(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`api-keys/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:xs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/api-keys/{api_key_id}")}updateApiKey(o,t={},i){return R.fromPromise(this.__updateApiKey(o,t,i))}async __updateApiKey(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`api-keys/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ki.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Ms.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/api-keys/{api_key_id}")}deleteApiKey(o,t){return R.fromPromise(this.__deleteApiKey(o,t))}async __deleteApiKey(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`api-keys/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ss.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/api-keys/{api_key_id}")}countApiKeys(o,t){return R.fromPromise(this.__countApiKeys(o,t))}async __countApiKeys(o,t){let{environmentId:i,requireEnvironment:s,limit:r,offset:n}=o,u={environment_id:i,require_environment:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"api-keys/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:ys.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/api-keys/count")}listAuditLogs(o={},t){return R.fromPromise(this.__listAuditLogs(o,t))}async __listAuditLogs(o={},t){let{actorType:i,endTime:s,environmentId:r,q:n,startTime:u,limit:m,offset:h}=o,l={actor_type:i!=null?ye.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,end_time:s?.toISOString(),environment_id:r,q:n,start_time:u?.toISOString(),limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"audit-log"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:Bs.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/audit-log")}getAuditLog(o,t){return R.fromPromise(this.__getAuditLog(o,t))}async __getAuditLog(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`audit-log/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Es.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/audit-log/{audit_log_id}")}countAuditLogs(o={},t){return R.fromPromise(this.__countAuditLogs(o,t))}async __countAuditLogs(o={},t){let{actorType:i,endTime:s,environmentId:r,q:n,startTime:u,limit:m,offset:h}=o,l={actor_type:i!=null?ye.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,end_time:s?.toISOString(),environment_id:r,q:n,start_time:u?.toISOString(),limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"audit-log/count"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:bs.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/audit-log/count")}listEnvironments(o={},t){return R.fromPromise(this.__listEnvironments(o,t))}async __listEnvironments(o={},t){let{ids:i,limit:s,offset:r}=o,n={ids:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"environments"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:As.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/environments")}createEnvironment(o,t){return R.fromPromise(this.__createEnvironment(o,t))}async __createEnvironment(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"environments"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Oi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:_s.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/environments")}getEnvironment(o,t){return R.fromPromise(this.__getEnvironment(o,t))}async __getEnvironment(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`environments/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Us.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/environments/{environment_id}")}updateEnvironment(o,t={},i){return R.fromPromise(this.__updateEnvironment(o,t,i))}async __updateEnvironment(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`environments/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ji.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Is.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/environments/{environment_id}")}deleteEnvironment(o,t){return R.fromPromise(this.__deleteEnvironment(o,t))}async __deleteEnvironment(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`environments/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ps.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/environments/{environment_id}")}quickstart(o){return R.fromPromise(this.__quickstart(o))}async __quickstart(o){let t=await this._options.authProvider.getAuthRequest(),i=f(t.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"quickstart"),method:"POST",headers:i,queryParameters:o?.queryParams,timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:qs.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new T(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new z({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return U(s.error,s.rawResponse,"POST","/quickstart")}getWhoAmI(o){return R.fromPromise(this.__getWhoAmI(o))}async __getWhoAmI(o){let t=await this._options.authProvider.getAuthRequest(),i=f(t.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"whoami"),method:"GET",headers:i,queryParameters:o?.queryParams,timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Ts.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new z({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return U(s.error,s.rawResponse,"GET","/whoami")}};var Go=class{constructor(o){this._options=F(o)}listCoupons(o={},t){return R.fromPromise(this.__listCoupons(o,t))}async __listCoupons(o={},t){let{isActive:i,q:s,limit:r,offset:n}=o,u={is_active:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/coupons"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:oc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/coupons")}upsertBillingCoupon(o,t){return R.fromPromise(this.__upsertBillingCoupon(o,t))}async __upsertBillingCoupon(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/coupons"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:qi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:hc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/coupons")}upsertBillingCustomer(o,t){return R.fromPromise(this.__upsertBillingCustomer(o,t))}async __upsertBillingCustomer(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/customer/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Bi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:yc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/customer/upsert")}listCustomersWithSubscriptions(o={},t){return R.fromPromise(this.__listCustomersWithSubscriptions(o,t))}async __listCustomersWithSubscriptions(o={},t){let{companyIds:i,name:s,providerType:r,q:n,limit:u,offset:m}=o,h={company_ids:i,name:s,provider_type:r!=null?A.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,q:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/customers"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:sc.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/billing/customers")}countCustomers(o={},t){return R.fromPromise(this.__countCustomers(o,t))}async __countCustomers(o={},t){let{companyIds:i,name:s,providerType:r,q:n,limit:u,offset:m}=o,h={company_ids:i,name:s,provider_type:r!=null?A.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,q:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/customers/count"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Ns.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/billing/customers/count")}listInvoices(o,t){return R.fromPromise(this.__listInvoices(o,t))}async __listInvoices(o,t){let{companyId:i,customerExternalId:s,subscriptionExternalId:r,limit:n,offset:u}=o,m={company_id:i,customer_external_id:s,subscription_external_id:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/invoices"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:lc.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/billing/invoices")}upsertInvoice(o,t){return R.fromPromise(this.__upsertInvoice(o,t))}async __upsertInvoice(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/invoices"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:_c.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/invoices")}listMeters(o={},t){return R.fromPromise(this.__listMeters(o,t))}async __listMeters(o={},t){let{displayName:i,limit:s,offset:r}=o,n={display_name:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/meter"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:uc.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/billing/meter")}upsertBillingMeter(o,t){return R.fromPromise(this.__upsertBillingMeter(o,t))}async __upsertBillingMeter(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/meter/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ii.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:wc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/meter/upsert")}listPaymentMethods(o,t){return R.fromPromise(this.__listPaymentMethods(o,t))}async __listPaymentMethods(o,t){let{companyId:i,customerExternalId:s,limit:r,offset:n}=o,u={company_id:i,customer_external_id:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/payment-methods"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:mc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/payment-methods")}upsertPaymentMethod(o,t){return R.fromPromise(this.__upsertPaymentMethod(o,t))}async __upsertPaymentMethod(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/payment-methods"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Fi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Sc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/payment-methods")}listBillingPrices(o={},t){return R.fromPromise(this.__listBillingPrices(o,t))}async __listBillingPrices(o={},t){let{forInitialPlan:i,forTrialExpiryPlan:s,ids:r,interval:n,isActive:u,price:m,productId:h,productIds:l,providerType:g,q:w,tiersMode:b,usageType:v,withMeter:O,limit:I,offset:k}=o,j={for_initial_plan:i,for_trial_expiry_plan:s,ids:r,interval:n,is_active:u,price:m,product_id:h,product_ids:l,provider_type:g!=null?A.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}):void 0,q:w,tiers_mode:b!=null?se.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"}):void 0,usage_type:v!=null?Q.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,with_meter:O,limit:I,offset:k},V=await this._options.authProvider.getAuthRequest(),ge=f(V.headers,this._options?.headers,t?.headers),q=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/price"),method:"GET",headers:ge,queryParameters:{...j,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(q.ok)return{data:Ys.parseOrThrow(q.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:q.rawResponse};if(q.error.reason==="status-code")switch(q.error.statusCode){case 400:throw new T(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 401:throw new E(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 403:throw new P(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 404:throw new C(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 500:throw new x(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);default:throw new z({statusCode:q.error.statusCode,body:q.error.body,rawResponse:q.rawResponse})}return U(q.error,q.rawResponse,"GET","/billing/price")}upsertBillingPrice(o,t){return R.fromPromise(this.__upsertBillingPrice(o,t))}async __upsertBillingPrice(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/price/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Vi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:bc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/price/upsert")}deleteBillingProduct(o,t){return R.fromPromise(this.__deleteBillingProduct(o,t))}async __deleteBillingProduct(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/product/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:$s.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/billing/product/{billing_id}")}listBillingProductPrices(o={},t){return R.fromPromise(this.__listBillingProductPrices(o,t))}async __listBillingProductPrices(o={},t){let{forInitialPlan:i,forTrialExpiryPlan:s,ids:r,interval:n,isActive:u,price:m,productId:h,productIds:l,providerType:g,q:w,tiersMode:b,usageType:v,withMeter:O,limit:I,offset:k}=o,j={for_initial_plan:i,for_trial_expiry_plan:s,ids:r,interval:n,is_active:u,price:m,product_id:h,product_ids:l,provider_type:g!=null?A.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}):void 0,q:w,tiers_mode:b!=null?se.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"}):void 0,usage_type:v!=null?Q.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,with_meter:O,limit:I,offset:k},V=await this._options.authProvider.getAuthRequest(),ge=f(V.headers,this._options?.headers,t?.headers),q=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/product/prices"),method:"GET",headers:ge,queryParameters:{...j,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(q.ok)return{data:Xs.parseOrThrow(q.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:q.rawResponse};if(q.error.reason==="status-code")switch(q.error.statusCode){case 400:throw new T(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 401:throw new E(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 403:throw new P(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 404:throw new C(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 500:throw new x(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);default:throw new z({statusCode:q.error.statusCode,body:q.error.body,rawResponse:q.rawResponse})}return U(q.error,q.rawResponse,"GET","/billing/product/prices")}deleteProductPrice(o,t){return R.fromPromise(this.__deleteProductPrice(o,t))}async __deleteProductPrice(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/product/prices/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Js.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/billing/product/prices/{billing_id}")}upsertBillingProduct(o,t){return R.fromPromise(this.__upsertBillingProduct(o,t))}async __upsertBillingProduct(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/product/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ai.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/product/upsert")}listBillingProducts(o={},t){return R.fromPromise(this.__listBillingProducts(o,t))}async __listBillingProducts(o={},t){let{ids:i,isActive:s,name:r,priceUsageType:n,providerType:u,q:m,withOneTimeCharges:h,withPricesOnly:l,withZeroPrice:g,withoutLinkedToPlan:w,limit:b,offset:v}=o,O={ids:i,is_active:s,name:r,price_usage_type:n!=null?Q.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,provider_type:u!=null?A.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}):void 0,q:m,with_one_time_charges:h,with_prices_only:l,with_zero_price:g,without_linked_to_plan:w,limit:b,offset:v},I=await this._options.authProvider.getAuthRequest(),k=f(I.headers,this._options?.headers,t?.headers),j=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/products"),method:"GET",headers:k,queryParameters:{...O,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(j.ok)return{data:rc.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new T(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new C(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/billing/products")}countBillingProducts(o={},t){return R.fromPromise(this.__countBillingProducts(o,t))}async __countBillingProducts(o={},t){let{ids:i,isActive:s,name:r,priceUsageType:n,providerType:u,q:m,withOneTimeCharges:h,withPricesOnly:l,withZeroPrice:g,withoutLinkedToPlan:w,limit:b,offset:v}=o,O={ids:i,is_active:s,name:r,price_usage_type:n!=null?Q.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,provider_type:u!=null?A.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}):void 0,q:m,with_one_time_charges:h,with_prices_only:l,with_zero_price:g,without_linked_to_plan:w,limit:b,offset:v},I=await this._options.authProvider.getAuthRequest(),k=f(I.headers,this._options?.headers,t?.headers),j=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/products/count"),method:"GET",headers:k,queryParameters:{...O,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(j.ok)return{data:Ws.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new T(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new C(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/billing/products/count")}upsertBillingSubscription(o,t){return R.fromPromise(this.__upsertBillingSubscription(o,t))}async __upsertBillingSubscription(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/subscription/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Di.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:fc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/subscription/upsert")}};var Wo=class{constructor(o){this._options=F(o)}internal(o,t){return R.fromPromise(this.__internal(o,t))}async __internal(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"checkout-internal"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ka.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:qc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/checkout-internal")}getCheckoutData(o,t){return R.fromPromise(this.__getCheckoutData(o,t))}async __getCheckoutData(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"checkout-internal/data"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Li.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/checkout-internal/data")}previewCheckoutInternal(o,t){return R.fromPromise(this.__previewCheckoutInternal(o,t))}async __previewCheckoutInternal(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"checkout-internal/preview"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ka.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:$c.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/checkout-internal/preview")}managePlan(o,t){return R.fromPromise(this.__managePlan(o,t))}async __managePlan(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"manage-plan"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Va.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/manage-plan")}previewManagePlan(o,t){return R.fromPromise(this.__previewManagePlan(o,t))}async __previewManagePlan(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"manage-plan/preview"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Va.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Zc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/manage-plan/preview")}cancelSubscription(o,t){return R.fromPromise(this.__cancelSubscription(o,t))}async __cancelSubscription(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"manage-plan/subscription/cancel"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ki.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ac.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/manage-plan/subscription/cancel")}updateCustomerSubscriptionTrialEnd(o,t={},i){return R.fromPromise(this.__updateCustomerSubscriptionTrialEnd(o,t,i))}async __updateCustomerSubscriptionTrialEnd(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`subscription/${y.encodePathParam(o)}/edit-trial-end`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Gi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Yc.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/subscription/{subscription_id}/edit-trial-end")}};var Ho=class{constructor(o){this._options=F(o)}listCompanies(o={},t){return R.fromPromise(this.__listCompanies(o,t))}async __listCompanies(o={},t){let{creditTypeIds:i,ids:s,monetizedSubscriptions:r,planId:n,planIds:u,planVersionId:m,q:h,sortOrderColumn:l,sortOrderDirection:g,subscriptionStatuses:w,subscriptionTypes:b,withEntitlementFor:v,withoutFeatureOverrideFor:O,withoutPlan:I,withoutSubscription:k,withSubscription:j,limit:V,offset:ge}=o,q={credit_type_ids:i,ids:s,monetized_subscriptions:r,plan_id:n,plan_ids:u,plan_version_id:m,q:h,sort_order_column:l,sort_order_direction:g!=null?fe.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}):void 0,subscription_statuses:Array.isArray(w)?w.map(Pr=>Ye.jsonOrThrow(Pr,{unrecognizedObjectKeys:"strip"})):w!=null?Ye.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,subscription_types:Array.isArray(b)?b.map(Pr=>Qe.jsonOrThrow(Pr,{unrecognizedObjectKeys:"strip"})):b!=null?Qe.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"}):void 0,with_entitlement_for:v,without_feature_override_for:O,without_plan:I,without_subscription:k,with_subscription:j,limit:V,offset:ge},di=await this._options.authProvider.getAuthRequest(),mi=f(di.headers,this._options?.headers,t?.headers),M=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies"),method:"GET",headers:mi,queryParameters:{...q,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(M.ok)return{data:Vl.parseOrThrow(M.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 400:throw new T(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new E(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new P(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new C(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new x(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);default:throw new z({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}return U(M.error,M.rawResponse,"GET","/companies")}upsertCompany(o,t){return R.fromPromise(this.__upsertCompany(o,t))}async __upsertCompany(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Aa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:rp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/companies")}getCompany(o,t){return R.fromPromise(this.__getCompany(o,t))}async __getCompany(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`companies/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Rl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/companies/{company_id}")}deleteCompany(o,t={},i){return R.fromPromise(this.__deleteCompany(o,t,i))}async __deleteCompany(o,t={},i){let{cancelSubscription:s,prorate:r}=t,n={cancel_subscription:s,prorate:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`companies/${y.encodePathParam(o)}`),method:"DELETE",headers:m,queryParameters:{...n,...i?.queryParams},timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:hl.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"DELETE","/companies/{company_id}")}countCompanies(o={},t){return R.fromPromise(this.__countCompanies(o,t))}async __countCompanies(o={},t){let{creditTypeIds:i,ids:s,monetizedSubscriptions:r,planId:n,planIds:u,planVersionId:m,q:h,sortOrderColumn:l,sortOrderDirection:g,subscriptionStatuses:w,subscriptionTypes:b,withEntitlementFor:v,withoutFeatureOverrideFor:O,withoutPlan:I,withoutSubscription:k,withSubscription:j,limit:V,offset:ge}=o,q={credit_type_ids:i,ids:s,monetized_subscriptions:r,plan_id:n,plan_ids:u,plan_version_id:m,q:h,sort_order_column:l,sort_order_direction:g!=null?fe.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}):void 0,subscription_statuses:Array.isArray(w)?w.map(Pr=>Ye.jsonOrThrow(Pr,{unrecognizedObjectKeys:"strip"})):w!=null?Ye.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,subscription_types:Array.isArray(b)?b.map(Pr=>Qe.jsonOrThrow(Pr,{unrecognizedObjectKeys:"strip"})):b!=null?Qe.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"}):void 0,with_entitlement_for:v,without_feature_override_for:O,without_plan:I,without_subscription:k,with_subscription:j,limit:V,offset:ge},di=await this._options.authProvider.getAuthRequest(),mi=f(di.headers,this._options?.headers,t?.headers),M=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies/count"),method:"GET",headers:mi,queryParameters:{...q,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(M.ok)return{data:Xc.parseOrThrow(M.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 400:throw new T(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new E(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new P(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new C(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new x(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);default:throw new z({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}return U(M.error,M.rawResponse,"GET","/companies/count")}createCompany(o,t){return R.fromPromise(this.__createCompany(o,t))}async __createCompany(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies/create"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Aa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:cl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/companies/create")}deleteCompanyByKeys(o,t){return R.fromPromise(this.__deleteCompanyByKeys(o,t))}async __deleteCompanyByKeys(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies/delete"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ba.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ul.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/companies/delete")}lookupCompany(o,t){return R.fromPromise(this.__lookupCompany(o,t))}async __lookupCompany(o,t){let{keys:i}=o,s={keys:ze(i)},r=await this._options.authProvider.getAuthRequest(),n=f(r.headers,this._options?.headers,t?.headers),u=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"companies/lookup"),method:"GET",headers:n,queryParameters:{...s,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(u.ok)return{data:Jl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 401:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new z({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}return U(u.error,u.rawResponse,"GET","/companies/lookup")}listCompanyMemberships(o={},t){return R.fromPromise(this.__listCompanyMemberships(o,t))}async __listCompanyMemberships(o={},t){let{companyId:i,userId:s,limit:r,offset:n}=o,u={company_id:i,user_id:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-memberships"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Dl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/company-memberships")}getOrCreateCompanyMembership(o,t){return R.fromPromise(this.__getOrCreateCompanyMembership(o,t))}async __getOrCreateCompanyMembership(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-memberships"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ji.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:xl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/company-memberships")}deleteCompanyMembership(o,t){return R.fromPromise(this.__deleteCompanyMembership(o,t))}async __deleteCompanyMembership(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`company-memberships/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:dl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/company-memberships/{company_membership_id}")}getActiveCompanySubscription(o={},t){return R.fromPromise(this.__getActiveCompanySubscription(o,t))}async __getActiveCompanySubscription(o={},t){let{companyId:i,companyIds:s,limit:r,offset:n}=o,u={company_id:i,company_ids:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-subscriptions"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:zl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/company-subscriptions")}upsertCompanyTrait(o,t){return R.fromPromise(this.__upsertCompanyTrait(o,t))}async __upsertCompanyTrait(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Da.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:tp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/company-traits")}listEntityKeyDefinitions(o={},t){return R.fromPromise(this.__listEntityKeyDefinitions(o,t))}async __listEntityKeyDefinitions(o={},t){let{entityType:i,ids:s,q:r,limit:n,offset:u}=o,m={entity_type:i!=null?Z.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-key-definitions"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Ml.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/entity-key-definitions")}countEntityKeyDefinitions(o={},t){return R.fromPromise(this.__countEntityKeyDefinitions(o,t))}async __countEntityKeyDefinitions(o={},t){let{entityType:i,ids:s,q:r,limit:n,offset:u}=o,m={entity_type:i!=null?Z.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-key-definitions/count"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:rl.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/entity-key-definitions/count")}listEntityTraitDefinitions(o={},t){return R.fromPromise(this.__listEntityTraitDefinitions(o,t))}async __listEntityTraitDefinitions(o={},t){let{entityType:i,ids:s,q:r,traitType:n,traitTypes:u,limit:m,offset:h}=o,l={entity_type:i!=null?Z.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,trait_type:n!=null?oe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,trait_types:Array.isArray(u)?u.map(v=>oe.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):u!=null?oe.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}):void 0,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-trait-definitions"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:Fl.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/entity-trait-definitions")}getOrCreateEntityTraitDefinition(o,t){return R.fromPromise(this.__getOrCreateEntityTraitDefinition(o,t))}async __getOrCreateEntityTraitDefinition(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-trait-definitions"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ni.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Cl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/entity-trait-definitions")}getEntityTraitDefinition(o,t){return R.fromPromise(this.__getEntityTraitDefinition(o,t))}async __getEntityTraitDefinition(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`entity-trait-definitions/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:fl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/entity-trait-definitions/{entity_trait_definition_id}")}updateEntityTraitDefinition(o,t,i){return R.fromPromise(this.__updateEntityTraitDefinition(o,t,i))}async __updateEntityTraitDefinition(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`entity-trait-definitions/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Zi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Ql.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/entity-trait-definitions/{entity_trait_definition_id}")}countEntityTraitDefinitions(o={},t){return R.fromPromise(this.__countEntityTraitDefinitions(o,t))}async __countEntityTraitDefinitions(o={},t){let{entityType:i,ids:s,q:r,traitType:n,traitTypes:u,limit:m,offset:h}=o,l={entity_type:i!=null?Z.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,trait_type:n!=null?oe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,trait_types:Array.isArray(u)?u.map(v=>oe.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):u!=null?oe.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}):void 0,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-trait-definitions/count"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:ol.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/entity-trait-definitions/count")}getEntityTraitValues(o,t){return R.fromPromise(this.__getEntityTraitValues(o,t))}async __getEntityTraitValues(o,t){let{definitionId:i,q:s,limit:r,offset:n}=o,u={definition_id:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"entity-trait-values"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Pl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/entity-trait-values")}listPlanChanges(o={},t){return R.fromPromise(this.__listPlanChanges(o,t))}async __listPlanChanges(o={},t){let{action:i,basePlanAction:s,companyId:r,companyIds:n,planIds:u,limit:m,offset:h}=o,l={action:i,base_plan_action:s,company_id:r,company_ids:n,plan_ids:u,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-changes"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:Ll.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/plan-changes")}getPlanChange(o,t){return R.fromPromise(this.__getPlanChange(o,t))}async __getPlanChange(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-changes/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ol.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/plan-changes/{plan_change_id}")}listPlanTraits(o={},t){return R.fromPromise(this.__listPlanTraits(o,t))}async __listPlanTraits(o={},t){let{ids:i,planId:s,traitId:r,traitIds:n,limit:u,offset:m}=o,h={ids:i,plan_id:s,trait_id:r,trait_ids:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-traits"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Wl.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/plan-traits")}createPlanTrait(o,t){return R.fromPromise(this.__createPlanTrait(o,t))}async __createPlanTrait(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:$i.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ll.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-traits")}getPlanTrait(o,t){return R.fromPromise(this.__getPlanTrait(o,t))}async __getPlanTrait(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-traits/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:kl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/plan-traits/{plan_trait_id}")}updatePlanTrait(o,t,i){return R.fromPromise(this.__updatePlanTrait(o,t,i))}async __updatePlanTrait(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-traits/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Qi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Xl.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plan-traits/{plan_trait_id}")}deletePlanTrait(o,t){return R.fromPromise(this.__deletePlanTrait(o,t))}async __deletePlanTrait(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-traits/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:gl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/plan-traits/{plan_trait_id}")}updatePlanTraitsBulk(o,t){return R.fromPromise(this.__updatePlanTraitsBulk(o,t))}async __updatePlanTraitsBulk(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-traits/bulk"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Yi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ep.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-traits/bulk")}countPlanTraits(o={},t){return R.fromPromise(this.__countPlanTraits(o,t))}async __countPlanTraits(o={},t){let{ids:i,planId:s,traitId:r,traitIds:n,limit:u,offset:m}=o,h={ids:i,plan_id:s,trait_id:r,trait_ids:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-traits/count"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:al.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/plan-traits/count")}upsertUserTrait(o,t){return R.fromPromise(this.__upsertUserTrait(o,t))}async __upsertUserTrait(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"user-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Da.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ip.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/user-traits")}listUsers(o={},t){return R.fromPromise(this.__listUsers(o,t))}async __listUsers(o={},t){let{companyId:i,ids:s,planId:r,q:n,limit:u,offset:m}=o,h={company_id:i,ids:s,plan_id:r,q:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Nl.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/users")}upsertUser(o,t){return R.fromPromise(this.__upsertUser(o,t))}async __upsertUser(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:op.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/users")}getUser(o,t){return R.fromPromise(this.__getUser(o,t))}async __getUser(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`users/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:jl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/users/{user_id}")}deleteUser(o,t){return R.fromPromise(this.__deleteUser(o,t))}async __deleteUser(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`users/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/users/{user_id}")}countUsers(o={},t){return R.fromPromise(this.__countUsers(o,t))}async __countUsers(o={},t){let{companyId:i,ids:s,planId:r,q:n,limit:u,offset:m}=o,h={company_id:i,ids:s,plan_id:r,q:n,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users/count"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:sl.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/users/count")}createUser(o,t){return R.fromPromise(this.__createUser(o,t))}async __createUser(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users/create"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:pl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/users/create")}deleteUserByKeys(o,t){return R.fromPromise(this.__deleteUserByKeys(o,t))}async __deleteUserByKeys(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users/delete"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ba.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:yl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/users/delete")}lookupUser(o,t){return R.fromPromise(this.__lookupUser(o,t))}async __lookupUser(o,t){let{keys:i}=o,s={keys:ze(i)},r=await this._options.authProvider.getAuthRequest(),n=f(r.headers,this._options?.headers,t?.headers),u=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"users/lookup"),method:"GET",headers:n,queryParameters:{...s,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(u.ok)return{data:Yl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 401:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new z({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}return U(u.error,u.rawResponse,"GET","/users/lookup")}};var No=class{constructor(o){this._options=F(o)}listComponents(o={},t){return R.fromPromise(this.__listComponents(o,t))}async __listComponents(o={},t){let{q:i,limit:s,offset:r}=o,n={q:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"components"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:up.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/components")}createComponent(o,t){return R.fromPromise(this.__createComponent(o,t))}async __createComponent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"components"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ea.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:sp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/components")}getComponent(o,t){return R.fromPromise(this.__getComponent(o,t))}async __getComponent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`components/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:lp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/components/{component_id}")}updateComponent(o,t={},i){return R.fromPromise(this.__updateComponent(o,t,i))}async __updateComponent(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`components/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:fp.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/components/{component_id}")}deleteComponent(o,t){return R.fromPromise(this.__deleteComponent(o,t))}async __deleteComponent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`components/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:cp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/components/{component_id}")}countComponents(o={},t){return R.fromPromise(this.__countComponents(o,t))}async __countComponents(o={},t){let{q:i,limit:s,offset:r}=o,n={q:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"components/count"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:np.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/components/count")}previewComponentData(o={},t){return R.fromPromise(this.__previewComponentData(o,t))}async __previewComponentData(o={},t){let{companyId:i,componentId:s}=o,r={company_id:i,component_id:s},n=await this._options.authProvider.getAuthRequest(),u=f(n.headers,this._options?.headers,t?.headers),m=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"components/preview-data"),method:"GET",headers:u,queryParameters:{...r,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(m.ok)return{data:Rp.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new z({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return U(m.error,m.rawResponse,"GET","/components/preview-data")}};var $o=class{constructor(o){this._options=F(o)}getPublicPlans(o){return R.fromPromise(this.__getPublicPlans(o))}async __getPublicPlans(o){let t=await this._options.authProvider.getAuthRequest(),i=f(t.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"public/plans"),method:"GET",headers:i,queryParameters:o?.queryParams,timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Sp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new z({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return U(s.error,s.rawResponse,"GET","/public/plans")}};var Jo=class{constructor(o){this._options=F(o)}listBillingCredits(o={},t){return R.fromPromise(this.__listBillingCredits(o,t))}async __listBillingCredits(o={},t){let{ids:i,name:s,limit:r,offset:n}=o,u={ids:i,name:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Qp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/credits")}createBillingCredit(o,t){return R.fromPromise(this.__createBillingCredit(o,t))}async __createBillingCredit(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ia.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:qp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/credits")}getSingleBillingCredit(o,t){return R.fromPromise(this.__getSingleBillingCredit(o,t))}async __getSingleBillingCredit(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:$p.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/billing/credits/{credit_id}")}updateBillingCredit(o,t,i){return R.fromPromise(this.__updateBillingCredit(o,t,i))}async __updateBillingCredit(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:sa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:uu.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/billing/credits/{credit_id}")}softDeleteBillingCredit(o,t){return R.fromPromise(this.__softDeleteBillingCredit(o,t))}async __softDeleteBillingCredit(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:pu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/billing/credits/{credit_id}")}listCreditBundles(o={},t){return R.fromPromise(this.__listCreditBundles(o,t))}async __listCreditBundles(o={},t){let{ids:i,creditId:s,status:r,bundleType:n,limit:u,offset:m}=o,h={ids:i,credit_id:s,status:r!=null?we.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,bundle_type:n!=null?_e.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/bundles"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:iu.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/billing/credits/bundles")}createCreditBundle(o,t){return R.fromPromise(this.__createCreditBundle(o,t))}async __createCreditBundle(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/bundles"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:na.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ip.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/credits/bundles")}getCreditBundle(o,t){return R.fromPromise(this.__getCreditBundle(o,t))}async __getCreditBundle(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/bundles/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/billing/credits/bundles/{bundle_id}")}updateCreditBundleDetails(o,t,i){return R.fromPromise(this.__updateCreditBundleDetails(o,t,i))}async __updateCreditBundleDetails(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/bundles/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ca.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:mu.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/billing/credits/bundles/{bundle_id}")}deleteCreditBundle(o,t){return R.fromPromise(this.__deleteCreditBundle(o,t))}async __deleteCreditBundle(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/bundles/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Lp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/billing/credits/bundles/{bundle_id}")}countCreditBundles(o={},t){return R.fromPromise(this.__countCreditBundles(o,t))}async __countCreditBundles(o={},t){let{ids:i,creditId:s,status:r,bundleType:n,limit:u,offset:m}=o,h={ids:i,credit_id:s,status:r!=null?we.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,bundle_type:n!=null?_e.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,limit:u,offset:m},l=await this._options.authProvider.getAuthRequest(),g=f(l.headers,this._options?.headers,t?.headers),w=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/bundles/count"),method:"GET",headers:g,queryParameters:{...h,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:jp.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new P(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new C(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new z({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return U(w.error,w.rawResponse,"GET","/billing/credits/bundles/count")}countBillingCredits(o={},t){return R.fromPromise(this.__countBillingCredits(o,t))}async __countBillingCredits(o={},t){let{ids:i,name:s,limit:r,offset:n}=o,u={ids:i,name:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Ep.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/credits/count")}zeroOutGrant(o,t={},i){return R.fromPromise(this.__zeroOutGrant(o,t,i))}async __zeroOutGrant(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/grants/${y.encodePathParam(o)}/zero-out`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:la.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:hu.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/billing/credits/grants/{grant_id}/zero-out")}grantBillingCreditsToCompany(o,t){return R.fromPromise(this.__grantBillingCreditsToCompany(o,t))}async __grantBillingCreditsToCompany(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/grants/company"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:aa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Zp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/credits/grants/company")}countCompanyGrants(o={},t){return R.fromPromise(this.__countCompanyGrants(o,t))}async __countCompanyGrants(o={},t){let{companyId:i,order:s,dir:r,limit:n,offset:u}=o,m={company_id:i,order:s!=null?vr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,dir:r!=null?fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/grants/company/count"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Op.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/billing/credits/grants/company/count")}listCompanyGrants(o={},t){return R.fromPromise(this.__listCompanyGrants(o,t))}async __listCompanyGrants(o={},t){let{companyId:i,order:s,dir:r,limit:n,offset:u}=o,m={company_id:i,order:s!=null?vr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,dir:r!=null?fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/grants/company/list"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:tu.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/billing/credits/grants/company/list")}countBillingCreditsGrants(o={},t){return R.fromPromise(this.__countBillingCreditsGrants(o,t))}async __countBillingCreditsGrants(o={},t){let{creditId:i,ids:s,limit:r,offset:n}=o,u={credit_id:i,ids:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/grants/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:xp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/credits/grants/count")}listGrantsForCredit(o={},t){return R.fromPromise(this.__listGrantsForCredit(o,t))}async __listGrantsForCredit(o={},t){let{creditId:i,ids:s,limit:r,offset:n}=o,u={credit_id:i,ids:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/grants/list"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:lu.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/billing/credits/grants/list")}getEnrichedCreditLedger(o,t){return R.fromPromise(this.__getEnrichedCreditLedger(o,t))}async __getEnrichedCreditLedger(o,t){let{companyId:i,billingCreditId:s,featureId:r,period:n,startTime:u,endTime:m,limit:h,offset:l}=o,g={company_id:i,billing_credit_id:s,feature_id:r,period:Tr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),start_time:u,end_time:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/ledger"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:Np.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/billing/credits/ledger")}countCreditLedger(o,t){return R.fromPromise(this.__countCreditLedger(o,t))}async __countCreditLedger(o,t){let{companyId:i,billingCreditId:s,featureId:r,period:n,startTime:u,endTime:m,limit:h,offset:l}=o,g={company_id:i,billing_credit_id:s,feature_id:r,period:Tr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),start_time:u,end_time:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/ledger/count"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:Dp.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/billing/credits/ledger/count")}listBillingPlanCreditGrants(o={},t){return R.fromPromise(this.__listBillingPlanCreditGrants(o,t))}async __listBillingPlanCreditGrants(o={},t){let{creditId:i,ids:s,planId:r,planIds:n,planVersionId:u,limit:m,offset:h}=o,l={credit_id:i,ids:s,plan_id:r,plan_ids:n,plan_version_id:u,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/plan-grants"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:eu.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/billing/credits/plan-grants")}createBillingPlanCreditGrant(o,t){return R.fromPromise(this.__createBillingPlanCreditGrant(o,t))}async __createBillingPlanCreditGrant(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/plan-grants"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:_o.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Mp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/billing/credits/plan-grants")}updateBillingPlanCreditGrant(o,t,i){return R.fromPromise(this.__updateBillingPlanCreditGrant(o,t,i))}async __updateBillingPlanCreditGrant(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/plan-grants/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:du.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/billing/credits/plan-grants/{plan_grant_id}")}deleteBillingPlanCreditGrant(o,t={},i){return R.fromPromise(this.__deleteBillingPlanCreditGrant(o,t,i))}async __deleteBillingPlanCreditGrant(o,t={},i){let{applyToExisting:s}=t,r={apply_to_existing:s},n=await this._options.authProvider.getAuthRequest(),u=f(n.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`billing/credits/plan-grants/${y.encodePathParam(o)}`),method:"DELETE",headers:u,queryParameters:{...r,...i?.queryParams},timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(m.ok)return{data:Kp.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 400:throw new T(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new z({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return U(m.error,m.rawResponse,"DELETE","/billing/credits/plan-grants/{plan_grant_id}")}countBillingPlanCreditGrants(o={},t){return R.fromPromise(this.__countBillingPlanCreditGrants(o,t))}async __countBillingPlanCreditGrants(o={},t){let{creditId:i,ids:s,planId:r,planIds:n,planVersionId:u,limit:m,offset:h}=o,l={credit_id:i,ids:s,plan_id:r,plan_ids:n,plan_version_id:u,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"billing/credits/plan-grants/count"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:vp.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/billing/credits/plan-grants/count")}listCreditEventLedger(o,t){return R.fromPromise(this.__listCreditEventLedger(o,t))}async __listCreditEventLedger(o,t){let{billingCreditId:i,companyId:s,endTime:r,eventType:n,featureId:u,startTime:m,limit:h,offset:l}=o,g={billing_credit_id:i,company_id:s,end_time:r,event_type:n!=null?Xe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,feature_id:u,start_time:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"v2/billing/credits/ledger"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:su.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/v2/billing/credits/ledger")}countCreditEventLedger(o,t){return R.fromPromise(this.__countCreditEventLedger(o,t))}async __countCreditEventLedger(o,t){let{billingCreditId:i,companyId:s,endTime:r,eventType:n,featureId:u,startTime:m,limit:h,offset:l}=o,g={billing_credit_id:i,company_id:s,end_time:r,event_type:n!=null?Xe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,feature_id:u,start_time:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"v2/billing/credits/ledger/count"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:Vp.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/v2/billing/credits/ledger/count")}};var Zo=class{constructor(o){this._options=F(o)}createDataExport(o,t){return R.fromPromise(this.__createDataExport(o,t))}async __createDataExport(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"data-exports"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:{...pa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),export_type:"company-feature-usage",output_file_type:"csv"},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/data-exports")}getDataExportArtifact(o,t){return R.fromPromise(this.__getDataExportArtifact(o,t))}async __getDataExportArtifact(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`data-exports/${y.encodePathParam(o)}/artifact`),method:"GET",headers:s,queryParameters:t?.queryParams,responseType:"streaming",timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/data-exports/{data_export_id}/artifact")}};var Yo=class{constructor(o){this._options=F(o)}listCompanyOverrides(o={},t){return R.fromPromise(this.__listCompanyOverrides(o,t))}async __listCompanyOverrides(o={},t){let{companyId:i,companyIds:s,featureId:r,featureIds:n,ids:u,withoutExpired:m,q:h,limit:l,offset:g}=o,w={company_id:i,company_ids:s,feature_id:r,feature_ids:n,ids:u,without_expired:m,q:h,limit:l,offset:g},b=await this._options.authProvider.getAuthRequest(),v=f(b.headers,this._options?.headers,t?.headers),O=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-overrides"),method:"GET",headers:v,queryParameters:{...w,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:td.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new E(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new z({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return U(O.error,O.rawResponse,"GET","/company-overrides")}createCompanyOverride(o,t){return R.fromPromise(this.__createCompanyOverride(o,t))}async __createCompanyOverride(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-overrides"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ua.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:qu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/company-overrides")}getCompanyOverride(o,t){return R.fromPromise(this.__getCompanyOverride(o,t))}async __getCompanyOverride(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`company-overrides/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Hu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/company-overrides/{company_override_id}")}updateCompanyOverride(o,t,i){return R.fromPromise(this.__updateCompanyOverride(o,t,i))}async __updateCompanyOverride(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`company-overrides/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ha.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:hd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/company-overrides/{company_override_id}")}deleteCompanyOverride(o,t){return R.fromPromise(this.__deleteCompanyOverride(o,t))}async __deleteCompanyOverride(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`company-overrides/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Iu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/company-overrides/{company_override_id}")}countCompanyOverrides(o={},t){return R.fromPromise(this.__countCompanyOverrides(o,t))}async __countCompanyOverrides(o={},t){let{companyId:i,companyIds:s,featureId:r,featureIds:n,ids:u,withoutExpired:m,q:h,limit:l,offset:g}=o,w={company_id:i,company_ids:s,feature_id:r,feature_ids:n,ids:u,without_expired:m,q:h,limit:l,offset:g},b=await this._options.authProvider.getAuthRequest(),v=f(b.headers,this._options?.headers,t?.headers),O=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"company-overrides/count"),method:"GET",headers:v,queryParameters:{...w,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:vu.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new E(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new z({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return U(O.error,O.rawResponse,"GET","/company-overrides/count")}listFeatureCompanies(o,t){return R.fromPromise(this.__listFeatureCompanies(o,t))}async __listFeatureCompanies(o,t){let{featureId:i,q:s,limit:r,offset:n}=o,u={feature_id:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-companies"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:nd.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/feature-companies")}countFeatureCompanies(o,t){return R.fromPromise(this.__countFeatureCompanies(o,t))}async __countFeatureCompanies(o,t){let{featureId:i,q:s,limit:r,offset:n}=o,u={feature_id:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-companies/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Ou.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/feature-companies/count")}listFeatureUsage(o={},t){return R.fromPromise(this.__listFeatureUsage(o,t))}async __listFeatureUsage(o={},t){let{companyId:i,companyKeys:s,featureIds:r,includeUsageAggregation:n,q:u,withoutNegativeEntitlements:m,limit:h,offset:l}=o,g={company_id:i,company_keys:s!=null?ze(s):void 0,feature_ids:r,include_usage_aggregation:n,q:u,without_negative_entitlements:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-usage"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:cd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/feature-usage")}getFeatureUsageTimeSeries(o,t){return R.fromPromise(this.__getFeatureUsageTimeSeries(o,t))}async __getFeatureUsageTimeSeries(o,t){let{companyId:i,endTime:s,featureId:r,granularity:n,startTime:u}=o,m={company_id:i,end_time:s.toISOString(),feature_id:r,granularity:n!=null?uo.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,start_time:u.toISOString()},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-usage-timeseries"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Xu.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/feature-usage-timeseries")}countFeatureUsage(o={},t){return R.fromPromise(this.__countFeatureUsage(o,t))}async __countFeatureUsage(o={},t){let{companyId:i,companyKeys:s,featureIds:r,includeUsageAggregation:n,q:u,withoutNegativeEntitlements:m,limit:h,offset:l}=o,g={company_id:i,company_keys:s!=null?ze(s):void 0,feature_ids:r,include_usage_aggregation:n,q:u,without_negative_entitlements:m,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),b=f(w.headers,this._options?.headers,t?.headers),v=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-usage/count"),method:"GET",headers:b,queryParameters:{...g,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:ju.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new z({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return U(v.error,v.rawResponse,"GET","/feature-usage/count")}listFeatureUsers(o,t){return R.fromPromise(this.__listFeatureUsers(o,t))}async __listFeatureUsers(o,t){let{featureId:i,q:s,limit:r,offset:n}=o,u={feature_id:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-users"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:ud.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/feature-users")}countFeatureUsers(o,t){return R.fromPromise(this.__countFeatureUsers(o,t))}async __countFeatureUsers(o,t){let{featureId:i,q:s,limit:r,offset:n}=o,u={feature_id:i,q:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"feature-users/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Vu.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/feature-users/count")}listPlanEntitlements(o={},t){return R.fromPromise(this.__listPlanEntitlements(o,t))}async __listPlanEntitlements(o={},t){let{featureId:i,featureIds:s,ids:r,planId:n,planIds:u,planVersionId:m,planVersionIds:h,q:l,withMeteredProducts:g,limit:w,offset:b}=o,v={feature_id:i,feature_ids:s,ids:r,plan_id:n,plan_ids:u,plan_version_id:m,plan_version_ids:h,q:l,with_metered_products:g,limit:w,offset:b},O=await this._options.authProvider.getAuthRequest(),I=f(O.headers,this._options?.headers,t?.headers),k=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-entitlements"),method:"GET",headers:I,queryParameters:{...v,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(k.ok)return{data:md.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new T(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new E(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);default:throw new z({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}return U(k.error,k.rawResponse,"GET","/plan-entitlements")}createPlanEntitlement(o,t){return R.fromPromise(this.__createPlanEntitlement(o,t))}async __createPlanEntitlement(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-entitlements"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:da.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Mu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-entitlements")}getPlanEntitlement(o,t){return R.fromPromise(this.__getPlanEntitlement(o,t))}async __getPlanEntitlement(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-entitlements/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ed.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/plan-entitlements/{plan_entitlement_id}")}updatePlanEntitlement(o,t,i){return R.fromPromise(this.__updatePlanEntitlement(o,t,i))}async __updatePlanEntitlement(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-entitlements/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ga.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:gd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plan-entitlements/{plan_entitlement_id}")}deletePlanEntitlement(o,t){return R.fromPromise(this.__deletePlanEntitlement(o,t))}async __deletePlanEntitlement(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-entitlements/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Fu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/plan-entitlements/{plan_entitlement_id}")}countPlanEntitlements(o={},t){return R.fromPromise(this.__countPlanEntitlements(o,t))}async __countPlanEntitlements(o={},t){let{featureId:i,featureIds:s,ids:r,planId:n,planIds:u,planVersionId:m,planVersionIds:h,q:l,withMeteredProducts:g,limit:w,offset:b}=o,v={feature_id:i,feature_ids:s,ids:r,plan_id:n,plan_ids:u,plan_version_id:m,plan_version_ids:h,q:l,with_metered_products:g,limit:w,offset:b},O=await this._options.authProvider.getAuthRequest(),I=f(O.headers,this._options?.headers,t?.headers),k=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-entitlements/count"),method:"GET",headers:I,queryParameters:{...v,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(k.ok)return{data:Du.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new T(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new E(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);default:throw new z({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}return U(k.error,k.rawResponse,"GET","/plan-entitlements/count")}duplicatePlanEntitlements(o,t){return R.fromPromise(this.__duplicatePlanEntitlements(o,t))}async __duplicatePlanEntitlements(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-entitlements/duplicate"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ma.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-entitlements/duplicate")}getFeatureUsageByCompany(o,t){return R.fromPromise(this.__getFeatureUsageByCompany(o,t))}async __getFeatureUsageByCompany(o,t){let{keys:i}=o,s={keys:ze(i)},r=await this._options.authProvider.getAuthRequest(),n=f(r.headers,this._options?.headers,t?.headers),u=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"usage-by-company"),method:"GET",headers:n,queryParameters:{...s,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(u.ok)return{data:$u.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 401:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new z({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}return U(u.error,u.rawResponse,"GET","/usage-by-company")}};var Qo=class{constructor(o){this._options=F(o)}createEventBatch(o,t){return R.fromPromise(this.__createEventBatch(o,t))}async __createEventBatch(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"event-batch"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ya.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:_d.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/event-batch")}getEventSummaries(o={},t){return R.fromPromise(this.__getEventSummaries(o,t))}async __getEventSummaries(o={},t){let{q:i,eventSubtypes:s,limit:r,offset:n}=o,u={q:i,event_subtypes:s,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"event-types"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Ed.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/event-types")}listEvents(o={},t){return R.fromPromise(this.__listEvents(o,t))}async __listEvents(o={},t){let{companyId:i,eventSubtype:s,eventTypes:r,flagId:n,userId:u,limit:m,offset:h}=o,l={company_id:i,event_subtype:s,event_types:Array.isArray(r)?r.map(v=>er.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):r!=null?er.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,flag_id:n,user_id:u,limit:m,offset:h},g=await this._options.authProvider.getAuthRequest(),w=f(g.headers,this._options?.headers,t?.headers),b=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"events"),method:"GET",headers:w,queryParameters:{...l,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(b.ok)return{data:Od.parseOrThrow(b.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new T(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new E(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(a.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);default:throw new z({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}return U(b.error,b.rawResponse,"GET","/events")}createEvent(o,t){return R.fromPromise(this.__createEvent(o,t))}async __createEvent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"events"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:mo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Sd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/events")}getEvent(o,t){return R.fromPromise(this.__getEvent(o,t))}async __getEvent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`events/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:xd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/events/{event_id}")}getSegmentIntegrationStatus(o){return R.fromPromise(this.__getSegmentIntegrationStatus(o))}async __getSegmentIntegrationStatus(o){let t=await this._options.authProvider.getAuthRequest(),i=f(t.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"segment-integration"),method:"GET",headers:i,queryParameters:o?.queryParams,timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:vd.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new z({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return U(s.error,s.rawResponse,"GET","/segment-integration")}};var Xo=class{constructor(o){this._options=F(o)}listFeatures(o={},t){return R.fromPromise(this.__listFeatures(o,t))}async __listFeatures(o={},t){let{ids:i,q:s,withoutCompanyOverrideFor:r,planVersionId:n,withoutPlanEntitlementFor:u,featureType:m,booleanRequireEvent:h,limit:l,offset:g}=o,w={ids:i,q:s,without_company_override_for:r,plan_version_id:n,without_plan_entitlement_for:u,feature_type:Array.isArray(m)?m.map(I=>le.jsonOrThrow(I,{unrecognizedObjectKeys:"strip"})):m!=null?le.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"}):void 0,boolean_require_event:h,limit:l,offset:g},b=await this._options.authProvider.getAuthRequest(),v=f(b.headers,this._options?.headers,t?.headers),O=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"features"),method:"GET",headers:v,queryParameters:{...w,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:rm.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new E(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new z({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return U(O.error,O.rawResponse,"GET","/features")}createFeature(o,t){return R.fromPromise(this.__createFeature(o,t))}async __createFeature(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"features"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ba.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:$d.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/features")}getFeature(o,t){return R.fromPromise(this.__getFeature(o,t))}async __getFeature(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`features/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Qd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/features/{feature_id}")}updateFeature(o,t={},i){return R.fromPromise(this.__updateFeature(o,t,i))}async __updateFeature(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`features/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:za.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:im.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/features/{feature_id}")}deleteFeature(o,t){return R.fromPromise(this.__deleteFeature(o,t))}async __deleteFeature(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`features/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Zd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/features/{feature_id}")}countFeatures(o={},t){return R.fromPromise(this.__countFeatures(o,t))}async __countFeatures(o={},t){let{ids:i,q:s,withoutCompanyOverrideFor:r,planVersionId:n,withoutPlanEntitlementFor:u,featureType:m,booleanRequireEvent:h,limit:l,offset:g}=o,w={ids:i,q:s,without_company_override_for:r,plan_version_id:n,without_plan_entitlement_for:u,feature_type:Array.isArray(m)?m.map(I=>le.jsonOrThrow(I,{unrecognizedObjectKeys:"strip"})):m!=null?le.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"}):void 0,boolean_require_event:h,limit:l,offset:g},b=await this._options.authProvider.getAuthRequest(),v=f(b.headers,this._options?.headers,t?.headers),O=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"features/count"),method:"GET",headers:v,queryParameters:{...w,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:Wd.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new E(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new z({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return U(O.error,O.rawResponse,"GET","/features/count")}listFlags(o={},t){return R.fromPromise(this.__listFlags(o,t))}async __listFlags(o={},t){let{featureId:i,ids:s,q:r,limit:n,offset:u}=o,m={feature_id:i,ids:s,q:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"flags"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:om.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/flags")}createFlag(o,t){return R.fromPromise(this.__createFlag(o,t))}async __createFlag(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"flags"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:ja.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Jd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/flags")}getFlag(o,t){return R.fromPromise(this.__getFlag(o,t))}async __getFlag(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`flags/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Xd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/flags/{flag_id}")}updateFlag(o,t,i){return R.fromPromise(this.__updateFlag(o,t,i))}async __updateFlag(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`flags/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ja.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:am.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/flags/{flag_id}")}deleteFlag(o,t){return R.fromPromise(this.__deleteFlag(o,t))}async __deleteFlag(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`flags/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Yd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/flags/{flag_id}")}updateFlagRules(o,t,i){return R.fromPromise(this.__updateFlagRules(o,t,i))}async __updateFlagRules(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`flags/${y.encodePathParam(o)}/rules`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:cm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/flags/{flag_id}/rules")}checkFlag(o,t,i){return R.fromPromise(this.__checkFlag(o,t,i))}async __checkFlag(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`flags/${y.encodePathParam(o)}/check`),method:"POST",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:_t.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Md.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"POST","/flags/{key}/check")}checkFlags(o,t){return R.fromPromise(this.__checkFlags(o,t))}async __checkFlags(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"flags/check"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:_t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ld.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/flags/check")}checkFlagsBulk(o,t){return R.fromPromise(this.__checkFlagsBulk(o,t))}async __checkFlagsBulk(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"flags/check-bulk"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:wa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Kd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/flags/check-bulk")}countFlags(o={},t){return R.fromPromise(this.__countFlags(o,t))}async __countFlags(o={},t){let{featureId:i,ids:s,q:r,limit:n,offset:u}=o,m={feature_id:i,ids:s,q:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"flags/count"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Nd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/flags/count")}};var ei=class{constructor(o){this._options=F(o)}createPlanBundle(o,t){return R.fromPromise(this.__createPlanBundle(o,t))}async __createPlanBundle(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-bundles"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:fa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:mm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-bundles")}updatePlanBundle(o,t,i){return R.fromPromise(this.__updatePlanBundle(o,t,i))}async __updatePlanBundle(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-bundles/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:_a.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:hm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plan-bundles/{plan_bundle_id}")}};var ri=class{constructor(o){this._options=F(o)}getPlanGroup(o={},t){return R.fromPromise(this.__getPlanGroup(o,t))}async __getPlanGroup(o={},t){let{includeCompanyCounts:i}=o,s={include_company_counts:i},r=await this._options.authProvider.getAuthRequest(),n=f(r.headers,this._options?.headers,t?.headers),u=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-groups"),method:"GET",headers:n,queryParameters:{...s,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(u.ok)return{data:fm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 401:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new z({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}return U(u.error,u.rawResponse,"GET","/plan-groups")}createPlanGroup(o,t){return R.fromPromise(this.__createPlanGroup(o,t))}async __createPlanGroup(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-groups"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Sa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:wm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plan-groups")}updatePlanGroup(o,t,i){return R.fromPromise(this.__updatePlanGroup(o,t,i))}async __updatePlanGroup(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-groups/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Pa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:_m.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plan-groups/{plan_group_id}")}};var ti=class{constructor(o){this._options=F(o)}listCompanyMigrations(o={},t){return R.fromPromise(this.__listCompanyMigrations(o,t))}async __listCompanyMigrations(o={},t){let{migrationId:i,q:s,status:r,limit:n,offset:u}=o,m={migration_id:i,q:s,status:r!=null?tr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-version-company-migrations"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Tm.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/plan-version-company-migrations")}countCompanyMigrations(o={},t){return R.fromPromise(this.__countCompanyMigrations(o,t))}async __countCompanyMigrations(o={},t){let{migrationId:i,q:s,status:r,limit:n,offset:u}=o,m={migration_id:i,q:s,status:r!=null?tr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-version-company-migrations/count"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Pm.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/plan-version-company-migrations/count")}listMigrations(o={},t){return R.fromPromise(this.__listMigrations(o,t))}async __listMigrations(o={},t){let{planVersionId:i,status:s,limit:r,offset:n}=o,u={plan_version_id:i,status:s!=null?or.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-version-migrations"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:km.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/plan-version-migrations")}getMigration(o,t){return R.fromPromise(this.__getMigration(o,t))}async __getMigration(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-version-migrations/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Em.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/plan-version-migrations/{plan_version_migration_id}")}countMigrations(o={},t){return R.fromPromise(this.__countMigrations(o,t))}async __countMigrations(o={},t){let{planVersionId:i,status:s,limit:r,offset:n}=o,u={plan_version_id:i,status:s!=null?or.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plan-version-migrations/count"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Cm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/plan-version-migrations/count")}};var oi=class{constructor(o){this._options=F(o)}updateCompanyPlans(o,t,i){return R.fromPromise(this.__updateCompanyPlans(o,t,i))}async __updateCompanyPlans(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`company-plans/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Hm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/company-plans/{company_plan_id}")}listPlans(o={},t){return R.fromPromise(this.__listPlans(o,t))}async __listPlans(o={},t){let{companyId:i,forFallbackPlan:s,forInitialPlan:r,forTrialExpiryPlan:n,hasProductId:u,ids:m,includeDraftVersions:h,planType:l,q:g,withoutEntitlementFor:w,withoutPaidProductId:b,limit:v,offset:O}=o,I={company_id:i,for_fallback_plan:s,for_initial_plan:r,for_trial_expiry_plan:n,has_product_id:u,ids:m,include_draft_versions:h,plan_type:l!=null?ie.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}):void 0,q:g,without_entitlement_for:w,without_paid_product_id:b,limit:v,offset:O},k=await this._options.authProvider.getAuthRequest(),j=f(k.headers,this._options?.headers,t?.headers),V=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plans"),method:"GET",headers:j,queryParameters:{...I,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(V.ok)return{data:Gm.parseOrThrow(V.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:V.rawResponse};if(V.error.reason==="status-code")switch(V.error.statusCode){case 400:throw new T(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 401:throw new E(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 403:throw new P(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 404:throw new C(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 500:throw new x(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);default:throw new z({statusCode:V.error.statusCode,body:V.error.body,rawResponse:V.rawResponse})}return U(V.error,V.rawResponse,"GET","/plans")}createPlan(o,t){return R.fromPromise(this.__createPlan(o,t))}async __createPlan(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plans"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ro.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Vm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/plans")}getPlan(o,t={},i){return R.fromPromise(this.__getPlan(o,t,i))}async __getPlan(o,t={},i){let{planVersionId:s}=t,r={plan_version_id:s},n=await this._options.authProvider.getAuthRequest(),u=f(n.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/${y.encodePathParam(o)}`),method:"GET",headers:u,queryParameters:{...r,...i?.queryParams},timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(m.ok)return{data:Mm.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new z({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return U(m.error,m.rawResponse,"GET","/plans/{plan_id}")}updatePlan(o,t,i){return R.fromPromise(this.__updatePlan(o,t,i))}async __updatePlan(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Eo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Nm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plans/{plan_id}")}deletePlan(o,t){return R.fromPromise(this.__deletePlan(o,t))}async __deletePlan(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Am.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/plans/{plan_id}")}upsertBillingProductPlan(o,t,i){return R.fromPromise(this.__upsertBillingProductPlan(o,t,i))}async __upsertBillingProductPlan(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/${y.encodePathParam(o)}/billing_products`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:$m.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plans/{plan_id}/billing_products")}countPlans(o={},t){return R.fromPromise(this.__countPlans(o,t))}async __countPlans(o={},t){let{companyId:i,forFallbackPlan:s,forInitialPlan:r,forTrialExpiryPlan:n,hasProductId:u,ids:m,includeDraftVersions:h,planType:l,q:g,withoutEntitlementFor:w,withoutPaidProductId:b,limit:v,offset:O}=o,I={company_id:i,for_fallback_plan:s,for_initial_plan:r,for_trial_expiry_plan:n,has_product_id:u,ids:m,include_draft_versions:h,plan_type:l!=null?ie.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}):void 0,q:g,without_entitlement_for:w,without_paid_product_id:b,limit:v,offset:O},k=await this._options.authProvider.getAuthRequest(),j=f(k.headers,this._options?.headers,t?.headers),V=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plans/count"),method:"GET",headers:j,queryParameters:{...I,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(V.ok)return{data:Bm.parseOrThrow(V.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:V.rawResponse};if(V.error.reason==="status-code")switch(V.error.statusCode){case 400:throw new T(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 401:throw new E(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 403:throw new P(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 404:throw new C(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 500:throw new x(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);default:throw new z({statusCode:V.error.statusCode,body:V.error.body,rawResponse:V.rawResponse})}return U(V.error,V.rawResponse,"GET","/plans/count")}listPlanIssues(o,t){return R.fromPromise(this.__listPlanIssues(o,t))}async __listPlanIssues(o,t){let{planId:i,planVersionId:s}=o,r={plan_id:i,plan_version_id:s},n=await this._options.authProvider.getAuthRequest(),u=f(n.headers,this._options?.headers,t?.headers),m=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"plans/issues"),method:"GET",headers:u,queryParameters:{...r,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(m.ok)return{data:Km.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 400:throw new T(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new z({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return U(m.error,m.rawResponse,"GET","/plans/issues")}deletePlanVersion(o,t){return R.fromPromise(this.__deletePlanVersion(o,t))}async __deletePlanVersion(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/version/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Dm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/plans/version/{plan_id}")}publishPlanVersion(o,t,i){return R.fromPromise(this.__publishPlanVersion(o,t,i))}async __publishPlanVersion(o,t,i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plans/version/${y.encodePathParam(o)}/publish`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ca.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Wm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/plans/version/{plan_id}/publish")}};var ii=class{constructor(o){this._options=F(o)}listScheduledCheckouts(o={},t){return R.fromPromise(this.__listScheduledCheckouts(o,t))}async __listScheduledCheckouts(o={},t){let{companyId:i,status:s,limit:r,offset:n}=o,u={company_id:i,status:s!=null?fr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},m=await this._options.authProvider.getAuthRequest(),h=f(m.headers,this._options?.headers,t?.headers),l=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"scheduled-checkout"),method:"GET",headers:h,queryParameters:{...u,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Qm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new z({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return U(l.error,l.rawResponse,"GET","/scheduled-checkout")}createScheduledCheckout(o,t){return R.fromPromise(this.__createScheduledCheckout(o,t))}async __createScheduledCheckout(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"scheduled-checkout"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ua.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/scheduled-checkout")}getScheduledCheckout(o,t){return R.fromPromise(this.__getScheduledCheckout(o,t))}async __getScheduledCheckout(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`scheduled-checkout/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Zm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/scheduled-checkout/{scheduled_checkout_id}")}updateScheduledCheckout(o,t={},i){return R.fromPromise(this.__updateScheduledCheckout(o,t,i))}async __updateScheduledCheckout(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`scheduled-checkout/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:va.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Xm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/scheduled-checkout/{scheduled_checkout_id}")}};var ai=class{constructor(o){this._options=F(o)}listWebhookEvents(o={},t){return R.fromPromise(this.__listWebhookEvents(o,t))}async __listWebhookEvents(o={},t){let{ids:i,q:s,webhookId:r,limit:n,offset:u}=o,m={ids:i,q:s,webhook_id:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"webhook-events"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:ph.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/webhook-events")}getWebhookEvent(o,t){return R.fromPromise(this.__getWebhookEvent(o,t))}async __getWebhookEvent(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`webhook-events/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:sh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/webhook-events/{webhook_event_id}")}countWebhookEvents(o={},t){return R.fromPromise(this.__countWebhookEvents(o,t))}async __countWebhookEvents(o={},t){let{ids:i,q:s,webhookId:r,limit:n,offset:u}=o,m={ids:i,q:s,webhook_id:r,limit:n,offset:u},h=await this._options.authProvider.getAuthRequest(),l=f(h.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"webhook-events/count"),method:"GET",headers:l,queryParameters:{...m,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:rh.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new z({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return U(g.error,g.rawResponse,"GET","/webhook-events/count")}listWebhooks(o={},t){return R.fromPromise(this.__listWebhooks(o,t))}async __listWebhooks(o={},t){let{q:i,limit:s,offset:r}=o,n={q:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"webhooks"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:dh.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/webhooks")}createWebhook(o,t){return R.fromPromise(this.__createWebhook(o,t))}async __createWebhook(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"webhooks"),method:"POST",headers:s,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:Ta.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ih.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"POST","/webhooks")}getWebhook(o,t){return R.fromPromise(this.__getWebhook(o,t))}async __getWebhook(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`webhooks/${y.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ch.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"GET","/webhooks/{webhook_id}")}updateWebhook(o,t={},i){return R.fromPromise(this.__updateWebhook(o,t,i))}async __updateWebhook(o,t={},i){let s=await this._options.authProvider.getAuthRequest(),r=f(s.headers,this._options?.headers,i?.headers),n=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`webhooks/${y.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Oa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:mh.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new E(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new z({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return U(n.error,n.rawResponse,"PUT","/webhooks/{webhook_id}")}deleteWebhook(o,t){return R.fromPromise(this.__deleteWebhook(o,t))}async __deleteWebhook(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`webhooks/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ah.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return U(r.error,r.rawResponse,"DELETE","/webhooks/{webhook_id}")}countWebhooks(o={},t){return R.fromPromise(this.__countWebhooks(o,t))}async __countWebhooks(o={},t){let{q:i,limit:s,offset:r}=o,n={q:i,limit:s,offset:r},u=await this._options.authProvider.getAuthRequest(),m=f(u.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,"webhooks/count"),method:"GET",headers:m,queryParameters:{...n,...t?.queryParams},timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:oh.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new E(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new P(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new x(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new z({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return U(h.error,h.rawResponse,"GET","/webhooks/count")}};var ni=class{constructor(o){this._options=F(o)}get accounts(){return this._accounts??=new Lo(this._options)}get billing(){return this._billing??=new Go(this._options)}get credits(){return this._credits??=new Jo(this._options)}get checkout(){return this._checkout??=new Wo(this._options)}get companies(){return this._companies??=new Ho(this._options)}get entitlements(){return this._entitlements??=new Yo(this._options)}get plans(){return this._plans??=new oi(this._options)}get components(){return this._components??=new No(this._options)}get dataexports(){return this._dataexports??=new Zo(this._options)}get events(){return this._events??=new Qo(this._options)}get features(){return this._features??=new Xo(this._options)}get planbundle(){return this._planbundle??=new ei(this._options)}get plangroups(){return this._plangroups??=new ri(this._options)}get planmigrations(){return this._planmigrations??=new ti(this._options)}get componentspublic(){return this._componentspublic??=new $o(this._options)}get scheduledcheckout(){return this._scheduledcheckout??=new ii(this._options)}get accesstokens(){return this._accesstokens??=new Ko(this._options)}get webhooks(){return this._webhooks??=new ai(this._options)}putPlanAudiencesPlanAudienceId(o,t){return R.fromPromise(this.__putPlanAudiencesPlanAudienceId(o,t))}async __putPlanAudiencesPlanAudienceId(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-audiences/${y.encodePathParam(o)}`),method:"PUT",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});return U(r.error,r.rawResponse,"PUT","/plan-audiences/{plan_audience_id}")}deletePlanAudiencesPlanAudienceId(o,t){return R.fromPromise(this.__deletePlanAudiencesPlanAudienceId(o,t))}async __deletePlanAudiencesPlanAudienceId(o,t){let i=await this._options.authProvider.getAuthRequest(),s=f(i.headers,this._options?.headers,t?.headers),r=await(this._options.fetcher??S)({url:y.join(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??_.Default,`plan-audiences/${y.encodePathParam(o)}`),method:"DELETE",headers:s,queryParameters:t?.queryParams,timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new z({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});return U(r.error,r.rawResponse,"DELETE","/plan-audiences/{plan_audience_id}")}async fetch(o,t,i){return _i(o,t,{baseUrl:this._options.baseUrl??this._options.environment,headers:this._options.headers,timeoutInSeconds:this._options.timeoutInSeconds,maxRetries:this._options.maxRetries,fetch:this._options.fetch,logging:this._options.logging,getAuthHeaders:async()=>(await this._options.authProvider.getAuthRequest()).headers},i)}};var nt=class{error(o,...t){console.error(o,...t)}warn(o,...t){console.warn(o,...t)}info(o,...t){console.info(o,...t)}debug(o,...t){console.debug(o,...t)}};var Ly=1e3,Gy=1e3,Wy=3,Hy=1e3,si=class{constructor(o,t){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:i=new nt,maxSize:s=Gy,interval:r=Ly,offline:n=!1,maxRetries:u=Wy,initialRetryDelay:m=Hy}=t||{};this.eventsApi=o,this.interval=r,this.logger=i,this.maxSize=s,this.offline=n,this.maxRetries=u,this.initialRetryDelay=m,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let o=[...this.events];this.events=[];let t=0,i=!1,s=null;for(;t<=this.maxRetries&&!i;)try{t>0&&this.logger.info(`Retrying event batch submission (attempt ${t} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:o}),i=!0}catch(r){if(s=r,t++,t<=this.maxRetries){let n=this.initialRetryDelay*Math.pow(2,t-1),u=Math.random()*.1*n,m=n+u;this.logger.warn(`Event batch submission failed: ${r}. Retrying in ${(m/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(h=>setTimeout(h,m))}}i?t>0&&this.logger.info(`Event batch submission succeeded after ${t} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,s)}finally{this.flushing=!1}}}async push(o){if(!this.offline){if(this.stopped){this.logger.error("Event buffer is stopped, not accepting new events");return}this.events.length>=this.maxSize&&!this.flushing&&await this.flush(),this.events.push(o)}}async stop(){this.shutdown=!0,this.stopped=!0,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),await this.flush()}startPeriodicFlush(){this.offline||this.intervalId||(this.intervalId=setInterval(async()=>{this.shutdown||await this.flush()},this.interval),this.intervalId.unref&&this.intervalId.unref())}};function yh(p){return async function(t){let i={};if(p&&Object.assign(i,p),t.body!==void 0&&t.contentType!=null&&(i["Content-Type"]=t.contentType),t.headers!=null)for(let[u,m]of Object.entries(t.headers))m!=null&&typeof m=="string"&&(i[u]=m);let s=Et(t.url,t.queryParameters),r=await Ut({body:t.body,type:t.requestType==="json"?"json":"other"}),n=await Vr();try{let u=await Mr(async()=>Ar(n,s,t.method,i,r,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex),t.maxRetries),m=await Br(u,t.responseType),h=gt(u);return u.status>=200&&u.status<400?{ok:!0,body:m,headers:u.headers,rawResponse:h}:{ok:!1,error:{reason:"status-code",statusCode:u.status,body:m},rawResponse:h}}catch(u){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Dr}:u instanceof Error&&u.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Dr}:u instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:u.message},rawResponse:qr}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(u)},rawResponse:qr}}}}async function Ny(p){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new qe,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var wh=Ny;var st=class{constructor(){this.wasmInstance=null;this.initialized=!1}async initialize(){if(!this.initialized)try{let t=require("./wasm/rulesengine.js");this.wasmInstance=new t.RulesEngineJS,this.initialized=!0}catch(o){throw new Error(`Failed to initialize WASM rules engine: ${o}`)}}async checkFlag(o,t,i){this.ensureInitialized();let s=(r,n)=>n===null?void 0:n;try{let r=JSON.stringify(o,s),n=t?JSON.stringify(t,s):void 0,u=i?JSON.stringify(i,s):void 0,m=this.wasmInstance.checkFlag(r,n,u);return JSON.parse(m)}catch(r){throw new Error(`WASM flag check failed: ${r}`)}}getVersionKey(){return this.ensureInitialized(),this.wasmInstance.getVersionKey()}isInitialized(){return this.initialized}ensureInitialized(){if(!this.initialized||!this.wasmInstance)throw new Error("WASM rules engine not initialized. Call initialize() first.")}};Ma();function ci(p,o,t){return p[o]??p[t]}function Ia(p){return JSON.parse(JSON.stringify(p))}function $y(p){return JSON.parse(JSON.stringify(p))}function Fa(p){let o=p.id;if(!o)throw new Error("partial message missing required field: id");return o}function Rh(p,o){if(!("id"in o))throw new Error("partial company message missing required field: id");let t=Ia(p);for(let i of Object.keys(o))switch(i){case"id":case"account_id":case"environment_id":t[i]=o[i];break;case"base_plan_id":t[i]=o[i]??null;break;case"billing_product_ids":case"plan_ids":case"plan_version_ids":case"entitlements":case"rules":case"traits":case"subscription":t[i]=o[i];break;case"keys":{let s=ci(t,"keys","keys")??{},r=o[i];t[i]={...s,...r};break}case"credit_balances":{let s=ci(t,"creditBalances","credit_balances")??{},r=o[i];t[i]={...s,...r};break}case"metrics":{let s=ci(t,"metrics","metrics")??[],r=o[i];t[i]=Jy(s,r);break}}return t}function fh(p,o){if(!("id"in o))throw new Error("partial user message missing required field: id");let t=$y(p);for(let i of Object.keys(o))switch(i){case"id":case"account_id":case"environment_id":t[i]=o[i];break;case"keys":{let s=ci(t,"keys","keys")??{},r=o[i];t[i]={...s,...r};break}case"traits":case"rules":t[i]=o[i];break}return t}function bh(p){return`${p.eventSubtype}|${p.period}|${p.monthReset}`}function zh(p){return{eventSubtype:(p.eventSubtype??p.event_subtype)||"",period:p.period||"",monthReset:(p.monthReset??p.month_reset)||""}}function Jy(p,o){let t=[...p],i=new Map;for(let s=0;s<t.length;s++){let r=t[s];if(r){let n=bh(zh(r));i.set(n,s)}}for(let s of o){if(!s)continue;let r=bh(zh(s)),n=i.get(r);n!==void 0?t[n]=s:t.push(s)}return t}var ir="company",ar="user",tw="flags",La=30*1e3,ow=1440*60*1e3,iw=720*60*60*1e3,St=class extends ct{constructor(t){super();this.replicatorReady=!1;this.pendingCompanyRequests=new Map;this.pendingUserRequests=new Map;if(this.apiKey=t.apiKey,this.baseURL=t.baseURL,this.logger=t.logger,this.cacheTTL=t.cacheTTL??ow,this.companyCacheProvider=this.createCacheProvider(t,"company"),this.userCacheProvider=this.createCacheProvider(t,"user"),this.flagsCacheProvider=this.createCacheProvider(t,"flag"),this.companyKeyCacheProvider=this.createKeyCacheProvider(t),this.userKeyCacheProvider=this.createKeyCacheProvider(t),this.replicatorMode=t.replicatorMode??!1,this.replicatorHealthURL=t.replicatorHealthURL,this.replicatorHealthCheck=t.replicatorHealthCheck??30*1e3,this.replicatorMode&&!t.redisClient&&!t.companyCache&&!t.userCache&&!t.flagCache)throw new Error("Replicator mode requires a Redis client or custom cache providers for shared cache access");this.rulesEngine=new st}createCacheProvider(t,i){let s;switch(i){case"company":s=t.companyCache;break;case"user":s=t.userCache;break;case"flag":s=t.flagCache;break}if(s)return this.logger.debug(`Using custom cache provider for ${i} cache`),s;let r=this.calculateCacheTTL(i);return t.redisClient?(this.logger.debug(`Using Redis cache provider for ${i} cache (TTL: ${r}ms)`),new Cr({client:t.redisClient,keyPrefix:t.redisKeyPrefix||"schematic:",ttl:r})):(this.logger.debug(`Using memory cache provider for ${i} cache (TTL: ${r}ms)`),new De({ttl:r}))}createKeyCacheProvider(t){let i=this.cacheTTL;return t.redisClient?new Cr({client:t.redisClient,keyPrefix:t.redisKeyPrefix||"schematic:",ttl:i}):new De({ttl:i})}calculateCacheTTL(t){return t==="flag"?Math.max(iw,this.cacheTTL):this.cacheTTL}async start(){try{await this.rulesEngine.initialize(),this.logger.debug("Rules engine initialized successfully")}catch(i){this.logger.warn(`Failed to initialize rules engine: ${i}`)}if(this.replicatorMode){this.logger.info("Replicator mode enabled - skipping WebSocket connection"),this.replicatorHealthURL&&this.startReplicatorHealthCheck();return}if(!this.baseURL)throw new Error("BaseURL is required when not in replicator mode");this.logger.info("Starting DataStream client");let{DatastreamWSClient:t}=(xh(),$a(Ph));this.wsClient=new t({url:this.baseURL,apiKey:this.apiKey,logger:this.logger,messageHandler:this.handleMessage.bind(this),connectionReadyHandler:this.handleConnectionReady.bind(this)}),this.wsClient.on("connected",()=>{this.emit("connected")}),this.wsClient.on("disconnected",()=>{this.emit("disconnected"),this.clearPendingRequests()}),this.wsClient.on("ready",()=>{this.emit("ready")}),this.wsClient.on("not-ready",()=>{this.emit("not-ready")}),this.wsClient.on("error",i=>{this.emit("error",i)}),this.wsClient.start()}isConnected(){return this.replicatorMode?this.isReplicatorReady():this.wsClient?.isConnected()??!1}async getCompany(t){let i=await this.getCompanyFromCache(t);if(i)return this.logger.debug(`Company found in cache for keys: ${JSON.stringify(t)}`),i;if(this.replicatorMode)throw new Error("Company not found in cache and replicator mode is enabled");if(!this.isConnected())throw new Error("DataStream client is not connected");let s=this.generateCacheKeysForCompany(t),r=!1;for(let n of s)if(this.pendingCompanyRequests.has(n)){r=!0;break}return new Promise((n,u)=>{let m=setTimeout(()=>{this.cleanupPendingCompanyRequests(s,h),u(new Error("Timeout while waiting for company data"))},La),h=l=>{clearTimeout(m),l?n(l):u(new Error("Company not found"))};for(let l of s)this.pendingCompanyRequests.has(l)||this.pendingCompanyRequests.set(l,[]),this.pendingCompanyRequests.get(l).push(h);r||this.sendDataStreamRequest({entity_type:"rulesengine.Company",keys:t}).catch(l=>{this.cleanupPendingCompanyRequests(s,h),u(l)})})}async getUser(t){let i=await this.getUserFromCache(t);if(i)return this.logger.debug(`User found in cache for keys: ${JSON.stringify(t)}`),i;if(this.replicatorMode)throw new Error("User not found in cache and replicator mode is enabled");if(!this.isConnected())throw new Error("DataStream client is not connected");let s=this.generateCacheKeysForUser(t),r=!1;for(let n of s)if(this.pendingUserRequests.has(n)){r=!0;break}return new Promise((n,u)=>{let m=setTimeout(()=>{this.cleanupPendingUserRequests(s,h),u(new Error("Timeout while waiting for user data"))},La),h=l=>{clearTimeout(m),l?n(l):u(new Error("User not found"))};for(let l of s)this.pendingUserRequests.has(l)||this.pendingUserRequests.set(l,[]),this.pendingUserRequests.get(l).push(h);r||this.sendDataStreamRequest({entity_type:"rulesengine.User",keys:t}).catch(l=>{this.cleanupPendingUserRequests(s,h),u(l)})})}async getFlag(t){let i=this.flagCacheKey(t);this.logger.debug(`Retrieving flag from cache: ${t} (cache key: ${i})`);try{return await this.flagsCacheProvider.get(i)||null}catch(s){return this.logger.warn(`Failed to retrieve flag from cache: ${s}`),null}}async getAllFlags(){return this.pendingFlagRequest?new Promise((t,i)=>{let s=this.pendingFlagRequest;this.pendingFlagRequest=r=>{s(r),r?t():i(new Error("Failed to refresh flags"))}}):new Promise((t,i)=>{let s=setTimeout(()=>{this.pendingFlagRequest=void 0,i(new Error("Timeout while waiting for flags data"))},La);this.pendingFlagRequest=r=>{clearTimeout(s),this.pendingFlagRequest=void 0,r?t():i(new Error("Failed to refresh flags"))},this.sendDataStreamRequest({entity_type:"rulesengine.Flags"}).catch(r=>{clearTimeout(s),this.pendingFlagRequest=void 0,i(r)})})}async checkFlag(t,i){let s=await this.getFlag(i);if(!s)throw new Error(`Flag not found: ${i}`);let r=t.company&&Object.keys(t.company).length>0,n=t.user&&Object.keys(t.user).length>0,u=null,m=null;if(r&&(u=await this.getCompanyFromCache(t.company),this.logger.debug(`Company ${u?"found in cache":"not found in cache"} for keys: ${JSON.stringify(t.company)}`)),n&&(m=await this.getUserFromCache(t.user),this.logger.debug(`User ${m?"found in cache":"not found in cache"} for keys: ${JSON.stringify(t.user)}`)),this.replicatorMode)return this.evaluateFlag(s,u,m);if((!r||u)&&(!n||m))return this.logger.debug(`All required resources found in cache for flag ${i} evaluation`),this.evaluateFlag(s,u,m);if(!this.isConnected())throw new Error("Datastream not connected and required entities not in cache");let h=r&&!u?this.getCompany(t.company):Promise.resolve(u),l=n&&!m?this.getUser(t.user):Promise.resolve(m),[g,w]=await Promise.all([h,l]);return this.evaluateFlag(s,g,w)}async updateCompanyMetrics(t,i,s){let r=await this.getCompanyFromCache(t);if(!r)return;let n=this.deepCopyCompany(r);if(n.metrics)for(let u of n.metrics)(u.eventSubtype??u.event_subtype)===i&&(u.value=(u.value||0)+s);await this.cacheCompanyForKeys(n)}close(){this.logger.info("Closing DataStream client"),this.replicatorHealthInterval&&(clearInterval(this.replicatorHealthInterval),this.replicatorHealthInterval=void 0),this.clearPendingRequests(),this.wsClient&&(this.wsClient.close(),this.wsClient=void 0),this.logger.info("DataStream client closed")}isReplicatorReady(){return this.replicatorReady}isReplicatorMode(){return this.replicatorMode}getReplicatorCacheVersion(){return this.replicatorCacheVersion}async getReplicatorCacheVersionAsync(t=2e3){if(this.replicatorCacheVersion)return this.replicatorCacheVersion;if(this.replicatorMode&&this.replicatorHealthURL)try{let i=new AbortController,s=setTimeout(()=>i.abort(),t),r=await fetch(this.replicatorHealthURL,{method:"GET",signal:i.signal});if(clearTimeout(s),r.ok){let n=await r.json(),u=n.cache_version||n.cacheVersion;if(u)return this.replicatorCacheVersion=u,u}}catch(i){this.logger.debug(`Failed to fetch replicator cache version: ${i}`)}}async handleMessage(t){this.logger.debug(`Processing datastream message: EntityType=${t.entity_type}, MessageType=${t.message_type}`);try{if(t.message_type==="error"){await this.handleErrorMessage(t);return}switch(t.entity_type){case"rulesengine.Company":case"rulesengine.Companies":await this.handleCompanyMessage(t);break;case"rulesengine.User":case"rulesengine.Users":await this.handleUserMessage(t);break;case"rulesengine.Flags":await this.handleFlagsMessage(t);break;case"rulesengine.Flag":await this.handleFlagMessage(t);break;default:this.logger.warn(`Unknown entity type in datastream message: ${t.entity_type}`)}}catch(i){this.logger.error(`Error processing datastream message: ${i}`),this.emit("error",i)}}async handleCompanyMessage(t){let i;if(t.message_type==="partial"){let s=t.data,r;try{r=Fa(s)}catch(m){this.logger.error(`Failed to extract company ID from partial message: ${m}`);return}let n=this.resourceIdCacheKey(ir,r),u=await this.companyCacheProvider.get(n);if(!u){this.logger.warn(`Cache miss for partial company '${r}', skipping`);return}try{i=Rh(u,s)}catch(m){this.logger.error(`Failed to merge partial company: ${m}`);return}}else i=t.data;if(i){if(t.message_type==="delete"){if(i.keys)for(let[r,n]of Object.entries(i.keys)){let u=this.resourceKeyToCacheKey(ir,r,n);try{await this.companyKeyCacheProvider.delete(u)}catch(m){this.logger.warn(`Failed to delete company key mapping from cache: ${m}`)}}let s=this.resourceIdCacheKey(ir,i.id);try{await this.companyCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete company resource from cache: ${r}`)}return}await this.cacheCompanyForKeys(i),this.notifyPendingCompanyRequests(i.keys||{},i)}}async handleUserMessage(t){let i;if(t.message_type==="partial"){let s=t.data,r;try{r=Fa(s)}catch(m){this.logger.error(`Failed to extract user ID from partial message: ${m}`);return}let n=this.resourceIdCacheKey(ar,r),u=await this.userCacheProvider.get(n);if(!u){this.logger.warn(`Cache miss for partial user '${r}', skipping`);return}try{i=fh(u,s)}catch(m){this.logger.error(`Failed to merge partial user: ${m}`);return}}else i=t.data;if(i){if(t.message_type==="delete"){if(i.keys)for(let[r,n]of Object.entries(i.keys)){let u=this.resourceKeyToCacheKey(ar,r,n);try{await this.userKeyCacheProvider.delete(u)}catch(m){this.logger.warn(`Failed to delete user key mapping from cache: ${m}`)}}let s=this.resourceIdCacheKey(ar,i.id);try{await this.userCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete user resource from cache: ${r}`)}return}await this.cacheUserForKeys(i),this.notifyPendingUserRequests(i.keys||{},i)}}async handleFlagsMessage(t){let i=t.data;if(!Array.isArray(i)){this.logger.warn("Expected flags array in bulk flags message");return}let s=await Promise.allSettled(i.filter(u=>u?.key).map(async u=>{let m=this.flagCacheKey(u.key);return await this.flagsCacheProvider.set(m,u),m})),r=s.filter(u=>u.status==="fulfilled").map(u=>u.value),n=s.filter(u=>u.status==="rejected");if(n.length>0&&this.logger.warn(`Failed to cache ${n.length} flag(s)`),this.flagsCacheProvider.deleteMissing)try{await this.flagsCacheProvider.deleteMissing(r,{scanPattern:"flags:*"})}catch(u){this.logger.warn(`Failed to delete missing flags: ${u}`)}this.pendingFlagRequest&&this.pendingFlagRequest(!0)}async handleFlagMessage(t){let i=t.data;if(!i?.key)return;let s=this.flagCacheKey(i.key);try{switch(t.message_type){case"delete":await this.flagsCacheProvider.delete(s);break;case"full":await this.flagsCacheProvider.set(s,i);break;default:this.logger.warn(`Unhandled message type for flag: ${t.message_type}`);break}}catch(r){this.logger.warn(`Failed to update flag cache: ${r}`)}this.pendingFlagRequest&&this.pendingFlagRequest(!0)}async handleErrorMessage(t){let i=t.data;if(i?.keys&&i?.entity_type)switch(i.entity_type){case"rulesengine.Company":this.notifyPendingCompanyRequests(i.keys,null);break;case"rulesengine.User":this.notifyPendingUserRequests(i.keys,null);break;default:this.logger.warn(`Received error for unsupported entity type: ${i.entity_type}`)}let s=i?.error||"Unknown datastream error";this.logger.warn(`DataStream error received: ${s}`)}async handleConnectionReady(){this.logger.info("DataStream connection is ready");try{await this.getAllFlags(),this.logger.debug("Requested initial flag data")}catch(t){throw this.logger.error(`Failed to request initial flag data: ${t}`),t}}async sendDataStreamRequest(t){if(!this.wsClient||!this.wsClient.isConnected())throw new Error("DataStream client is not connected");this.logger.debug(`Sending datastream request: EntityType=${t.entity_type}, Keys=${JSON.stringify(t.keys)}`);let i={data:t};await this.wsClient.sendMessage(i)}async getCompanyFromCache(t){for(let[i,s]of Object.entries(t)){let r=this.resourceKeyToCacheKey(ir,i,s);try{let n=await this.companyKeyCacheProvider.get(r);if(n){let u=this.resourceIdCacheKey(ir,n),m=await this.companyCacheProvider.get(u);if(m)return m}}catch(n){this.logger.warn(`Failed to retrieve company from cache: ${n}`)}}return null}async getUserFromCache(t){for(let[i,s]of Object.entries(t)){let r=this.resourceKeyToCacheKey(ar,i,s);try{let n=await this.userKeyCacheProvider.get(r);if(n){let u=this.resourceIdCacheKey(ar,n),m=await this.userCacheProvider.get(u);if(m)return m}}catch(n){this.logger.warn(`Failed to retrieve user from cache: ${n}`)}}return null}async cacheCompanyForKeys(t){if(!t.keys||Object.keys(t.keys).length===0)throw new Error("No keys provided for company lookup");let i=this.resourceIdCacheKey(ir,t.id);await this.companyCacheProvider.set(i,t,this.cacheTTL);for(let[s,r]of Object.entries(t.keys)){let n=this.resourceKeyToCacheKey(ir,s,r);try{await this.companyKeyCacheProvider.set(n,t.id,this.cacheTTL)}catch(u){this.logger.warn(`Failed to cache company key mapping '${n}': ${u}`)}}}async cacheUserForKeys(t){if(!t.keys||Object.keys(t.keys).length===0)throw new Error("No keys provided for user lookup");let i=this.resourceIdCacheKey(ar,t.id);await this.userCacheProvider.set(i,t,this.cacheTTL);for(let[s,r]of Object.entries(t.keys)){let n=this.resourceKeyToCacheKey(ar,s,r);try{await this.userKeyCacheProvider.set(n,t.id,this.cacheTTL)}catch(u){this.logger.warn(`Failed to cache user key mapping '${n}': ${u}`)}}}generateCacheKeysForCompany(t){return Object.entries(t).map(([i,s])=>this.resourceKeyToCacheKey(ir,i,s))}generateCacheKeysForUser(t){return Object.entries(t).map(([i,s])=>this.resourceKeyToCacheKey(ar,i,s))}notifyPendingCompanyRequests(t,i){for(let[s,r]of Object.entries(t)){let n=this.resourceKeyToCacheKey(ir,s,r),u=this.pendingCompanyRequests.get(n);u&&(this.pendingCompanyRequests.delete(n),u.forEach(m=>{try{m(i)}catch(h){this.logger.error(`Error in company request handler: ${h}`)}}))}}notifyPendingUserRequests(t,i){for(let[s,r]of Object.entries(t)){let n=this.resourceKeyToCacheKey(ar,s,r),u=this.pendingUserRequests.get(n);u&&(this.pendingUserRequests.delete(n),u.forEach(m=>{try{m(i)}catch(h){this.logger.error(`Error in user request handler: ${h}`)}}))}}cleanupPendingCompanyRequests(t,i){for(let s of t){let r=this.pendingCompanyRequests.get(s);if(r){let n=r.indexOf(i);n!==-1&&r.splice(n,1),r.length===0&&this.pendingCompanyRequests.delete(s)}}}cleanupPendingUserRequests(t,i){for(let s of t){let r=this.pendingUserRequests.get(s);if(r){let n=r.indexOf(i);n!==-1&&r.splice(n,1),r.length===0&&this.pendingUserRequests.delete(s)}}}clearPendingRequests(){for(let[,t]of this.pendingCompanyRequests)t.forEach(i=>{try{i(null)}catch(s){this.logger.error(`Error clearing company request: ${s}`)}});this.pendingCompanyRequests.clear();for(let[,t]of this.pendingUserRequests)t.forEach(i=>{try{i(null)}catch(s){this.logger.error(`Error clearing user request: ${s}`)}});if(this.pendingUserRequests.clear(),this.pendingFlagRequest){try{this.pendingFlagRequest(!1)}catch(t){this.logger.error(`Error clearing flag request: ${t}`)}this.pendingFlagRequest=void 0}}startReplicatorHealthCheck(){this.replicatorHealthURL&&(this.logger.info(`Starting replicator health check with URL: ${this.replicatorHealthURL}, interval: ${this.replicatorHealthCheck}ms`),this.checkReplicatorHealth(),this.replicatorHealthInterval=setInterval(()=>{this.checkReplicatorHealth()},this.replicatorHealthCheck),this.replicatorHealthInterval.unref())}async checkReplicatorHealth(){if(this.replicatorHealthURL)try{let t=new AbortController,i=setTimeout(()=>t.abort(),5e3),s=await fetch(this.replicatorHealthURL,{method:"GET",signal:t.signal});if(clearTimeout(i),!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);let r=await s.json(),n=this.replicatorReady;this.replicatorReady=r.ready??!1;let u=r.cache_version||r.cacheVersion;if(u&&u!==this.replicatorCacheVersion){let m=this.replicatorCacheVersion;this.replicatorCacheVersion=u,this.logger.info(`Cache version changed from ${m||"(null)"} to ${u}`)}this.replicatorReady&&!n?(this.logger.info("External replicator is now ready"),this.emit("replicator-health-changed",!0)):!this.replicatorReady&&n&&(this.logger.info("External replicator is no longer ready"),this.emit("replicator-health-changed",!1))}catch(t){this.replicatorReady&&(this.replicatorReady=!1,this.logger.info("External replicator is no longer ready"),this.emit("replicator-health-changed",!1)),this.logger.debug(`Replicator health check failed: ${t}`)}}flagCacheKey(t){let i=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey(),s=`${tw}:${i}:${t.toLowerCase()}`;return this.logger.debug(`Generated flag cache key - flag: ${t}, mode: ${this.replicatorMode?"replicator":"datastream"}, version: ${i}, cacheKey: ${s}`),s}resourceIdCacheKey(t,i){let s=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${t}:${s}:${i}`}resourceKeyToCacheKey(t,i,s){let r=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${t}:${r}:${i.toLowerCase()}:${s.toLowerCase()}`}deepCopyCompany(t){return Ia(t)}async evaluateFlag(t,i,s){let r=t.defaultValue??!1;try{if(this.rulesEngine.isInitialized()){this.logger.debug(`Evaluating flag with rules engine: ${JSON.stringify({flagId:t.id,flagRules:t.rules?.length||0,companyId:i?.id,userId:s?.id})}`);let n=await this.rulesEngine.checkFlag(t,i,s);return this.logger.debug(`Rules engine evaluation result: ${JSON.stringify(n)}`),{flagKey:t.key,value:n.value??r,reason:n.reason||"RULES_ENGINE_EVALUATION",companyId:i?.id,userId:s?.id,flagId:t.id,ruleId:n.ruleId,ruleType:n.ruleType,entitlement:n.entitlement?{...n.entitlement,metricResetAt:n.entitlement.metricResetAt?new Date(n.entitlement.metricResetAt):void 0}:void 0}}else return this.logger.warn("Rules engine not initialized, using default flag value"),{flagKey:t.key,value:r,reason:"RULES_ENGINE_UNAVAILABLE",companyId:i?.id,userId:s?.id,flagId:t.id}}catch(n){return this.logger.error(`Rules engine evaluation failed: ${n}`),{flagKey:t.key,value:r,reason:"RULES_ENGINE_ERROR",companyId:i?.id,userId:s?.id,flagId:t.id}}}getRulesEngineVersionKey(){try{if(this.rulesEngine.isInitialized())return this.rulesEngine.getVersionKey()}catch(t){this.logger.warn(`Failed to get rules engine version key: ${t}`)}return"1"}};var li=class extends ni{constructor(o){let{apiKey:t="",basePath:i,eventBufferInterval:s,flagDefaults:r={},logger:n=new nt,timeoutMs:u}=o??{},{offline:m=!1}=o??{},h={};if(o?.environmentId&&(h["X-Schematic-Environment-Id"]=o.environmentId),o?.headers&&Object.assign(h,o.headers),m?t!==""&&n.debug("Offline mode enabled, ignoring API key"):t===""&&!m&&(n.warn("No API key was provided, running in offline mode"),m=!0),super({apiKey:t,environment:i,fetcher:m?wh:yh(h),timeoutInSeconds:u!==void 0?u/1e3:void 0}),this.logger=n,this.eventBuffer=new si(this.events,{interval:s,logger:n,offline:m}),this.flagCheckCacheProviders=o?.cacheProviders?.flagChecks??[new De],this.flagDefaults=r,this.offline=m,o?.useDataStream&&!m){let g=["workerd","edge-runtime","browser","web-worker"].includes(de.type),w=o.dataStream?.replicatorMode===!0;if(g&&!w)n.warn(`DataStream is not supported in ${de.type} runtime and will be disabled. DataStream requires Node.js APIs (WebSocket) that are not available in edge/browser environments. Use replicatorMode for edge runtime compatibility.`);else{let b={apiKey:t,baseURL:i,logger:n,cacheTTL:o.dataStream?.cacheTTL,redisClient:o.dataStream?.redisClient,redisKeyPrefix:o.dataStream?.redisKeyPrefix,replicatorMode:o.dataStream?.replicatorMode,replicatorHealthURL:o.dataStream?.replicatorHealthURL,replicatorHealthCheck:o.dataStream?.replicatorHealthCheck};this.datastreamClient=new St(b),this.datastreamClient.start().catch(v=>{n.error(`Failed to start DataStream client: ${v}`),this.datastreamClient=void 0})}}}useDataStream(){return this.datastreamClient!==void 0}async checkFlag(o,t,i){return(await this.checkFlagWithEntitlement(o,t,i)).value}async checkFlagWithEntitlement(o,t,i){let s=()=>i?.defaultValue===void 0?this.getFlagDefault(t):typeof i.defaultValue=="function"?i.defaultValue():i.defaultValue;if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${t}`),{flagKey:t,reason:"flag default",value:s()};if(this.useDataStream())try{let r=await this.datastreamClient.checkFlag(o,t);return this.enqueueEvent(gi.FlagCheck,{flagKey:t,value:r?.value??!1,reason:r?.reason??"unknown",ruleId:r?.ruleId,companyId:r?.companyId,userId:r?.userId,flagId:r?.flagId,reqCompany:o.company,reqUser:o.user}),{companyId:r.companyId,entitlement:r.entitlement,err:r.err,flagKey:r.flagKey??t,flagId:r.flagId,reason:r.reason,ruleId:r.ruleId,ruleType:r.ruleType,userId:r.userId,value:r.value??this.getFlagDefault(t)}}catch(r){return this.logger.debug(`Datastream flag check failed (${r}), falling back to API`),this.checkFlagViaAPI(o,t,i,s)}return this.checkFlagViaAPI(o,t,i,s)}async checkFlagViaAPI(o,t,i,s){let r=s??(()=>this.getFlagDefault(t));try{let n=JSON.stringify({evalCtx:o,key:t});for(let h of this.flagCheckCacheProviders){let l=await h.get(n);if(l!=null)return this.logger.debug(`${h.constructor.name} cache hit for flag ${t}`),l}let u=await this.features.checkFlag(t,o,{timeoutInSeconds:i?.timeoutMs!==void 0?i.timeoutMs/1e3:void 0});if(u.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${t}, falling back to default`),{flagKey:t,reason:"flag default",value:r()};this.logger.debug(`Feature flag API response for ${t}: ${JSON.stringify(u.data)}`);let m={companyId:u.data.companyId,entitlement:u.data.entitlement,err:u.data.error,flagKey:u.data.flag,flagId:u.data.flagId,reason:u.data.reason,ruleId:u.data.ruleId,ruleType:u.data.ruleType,userId:u.data.userId,value:u.data.value};try{for(let h of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${t} in ${h.constructor.name}`),await h.set(n,m)}catch(h){this.logger.warn(`Cache write failed for flag ${t}: ${h}`)}return m}catch(n){return this.logger.error(`Error checking flag ${t}: ${n}`),{flagKey:t,reason:"flag default",value:r()}}}async checkFlags(o,t){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag values for flags ${t?t.join(", "):"all"}`),t&&t.length>0?t.map(i=>({flag:i,value:this.getFlagDefault(i),reason:"Offline mode - using default value"})):[];try{if(!t||t.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(o)).data.flags;let i=new Map,s=[];for(let m of t){let h=JSON.stringify({evalCtx:o,key:m}),l=!1;for(let g of this.flagCheckCacheProviders){let w=await g.get(h);if(w!=null){this.logger.debug(`${g.constructor.name} cache hit for flag ${m}`),i.set(m,{flag:m,value:w.value,reason:w.reason}),l=!0;break}}l||s.push(m)}if(s.length===0)return this.logger.debug(`All ${t.length} flags found in cache`),t.map(m=>i.get(m));this.logger.debug(`Cache miss for ${s.length} flags: ${s.join(", ")}, calling API`);let n=(await this.features.checkFlags(o)).data.flags,u=[];for(let m of t){let h=n.find(l=>l.flag===m);if(h){let l=JSON.stringify({evalCtx:o,key:m}),g={companyId:h.companyId,entitlement:h.entitlement,err:h.error,flagKey:h.flag,flagId:h.flagId,reason:h.reason,ruleId:h.ruleId,ruleType:h.ruleType,userId:h.userId,value:h.value};try{for(let w of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${l} in ${w.constructor.name}`),await w.set(l,g)}catch(w){this.logger.warn(`Cache write failed for flag ${m}: ${w}`)}u.push(h)}else{let l=i.get(m);if(l)u.push(l);else{this.logger.debug(`Flag ${m} not found in API response or cache, using default value`);let g={flag:m,value:this.getFlagDefault(m),reason:"Flag not found - using default value"};u.push(g)}}}return this.logger.debug(`Checked ${t.length} flags: used fresh API values for consistency (${s.length} were cache misses)`),u}catch(i){return this.logger.error(`Error checking flags ${t?t.join(", "):"all"}: ${i}`),t&&t.length>0?t.map(s=>({flag:s,value:this.getFlagDefault(s),reason:`Error occurred - using default value: ${i}`})):[]}}async close(){return this.datastreamClient&&this.datastreamClient.close(),this.eventBuffer.stop()}async identify(o){if(!this.offline)try{await this.enqueueEvent("identify",o)}catch(t){this.logger.error(`Error sending identify event: ${t}`)}}async track(o){if(!this.offline)try{if(await this.enqueueEvent("track",o),o.company&&this.useDataStream()&&this.datastreamClient.isConnected())try{await this.datastreamClient.updateCompanyMetrics(o.company,o.event,o.quantity||1)}catch(t){this.logger.error(`Failed to update company metrics: ${t}`)}}catch(t){this.logger.error(`Error sending track event: ${t}`)}}setFlagDefault(o,t){this.flagDefaults[o]=t}setFlagDefaults(o){Object.assign(this.flagDefaults,o)}getFlagDefault(o){return this.flagDefaults[o]??!1}async enqueueEvent(o,t){try{this.eventBuffer.push({eventType:o,body:t,sentAt:new Date})}catch(i){this.logger.error(`Error enqueueing ${o} event: ${i}`)}}};var pi=xt(require("crypto")),Ga="X-Schematic-Webhook-Signature",Wa="X-Schematic-Webhook-Timestamp",$e=class p extends Error{constructor(o){super(o),Object.setPrototypeOf(this,p.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new p("Missing webhook signature header")}static missingTimestamp(){return new p("Missing webhook timestamp header")}static invalidSignature(){return new p("Invalid webhook signature")}};function ui(p,o,t){let i=Buffer.isBuffer(p)?p:Buffer.from(p),s=Buffer.concat([i,Buffer.from(`+${o}`)]),r=pi.createHmac("sha256",t);return r.update(s),r.digest()}function Eh(p,o,t){return ui(p,o,t).toString("hex")}function Ha(p,o,t,i){if(!o)throw $e.missingSignature();if(!t)throw $e.missingTimestamp();let s;try{s=Buffer.from(o,"hex")}catch(n){throw new $e(`Invalid signature format: ${n?.message||"Unknown error"}`)}let r=ui(p,t,i);if(s.length!==r.length||!pi.timingSafeEqual(s,r))throw $e.invalidSignature()}function Uh(p,o,t,i={}){let s=p.headers,r=i.signatureHeader||Ga,n=i.timestampHeader||Wa,u=Ch(s,r),m=Ch(s,n),h;if(t!==void 0)h=t;else if("rawBody"in p&&p.rawBody)h=p.rawBody;else throw new $e("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");Ha(h,u,m,o)}function Ch(p,o){let t=p[o]||p[o.toLowerCase()];return Array.isArray(t)?t[0]||"":t||""}0&&(module.exports={LocalCache,RedisCacheProvider,RulesEngineClient,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});
|
|
1
|
+
"use strict";var Ry=Object.create;var to=Object.defineProperty;var fy=Object.getOwnPropertyDescriptor;var _y=Object.getOwnPropertyNames;var Sy=Object.getPrototypeOf,Py=Object.prototype.hasOwnProperty;var ii=(p,o)=>()=>(p&&(o=p(p=0)),o);var xy=(p,o)=>()=>(o||p((o={exports:{}}).exports,o),o.exports),pr=(p,o)=>{for(var i in o)to(p,i,{get:o[i],enumerable:!0})},Ln=(p,o,i,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of _y(o))!Py.call(p,s)&&s!==i&&to(p,s,{get:()=>o[s],enumerable:!(t=fy(o,s))||t.enumerable});return p};var ao=(p,o,i)=>(i=p!=null?Ry(Sy(p)):{},Ln(o||!p||!p.__esModule?to(i,"default",{value:p,enumerable:!0}):i,p)),Gn=p=>Ln(to({},"__esModule",{value:!0}),p);var ms={};pr(ms,{Node18UniversalStreamWrapper:()=>ra});var ra,hs=ii(()=>{"use strict";ra=class p{constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,i){this.events[o]?.push(i)}off(o,i){this.events[o]=this.events[o]?.filter(t=>t!==i)}pipe(o){return this.on("data",async i=>{if(o instanceof p)o._write(i);else if(o instanceof WritableStream){let t=o.getWriter();t.write(i).then(()=>t.releaseLock())}else o.write(i)}),this.on("end",async()=>{o instanceof p?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.on("error",async i=>{o instanceof p?o._error(i):o instanceof WritableStream?o.getWriter().abort(i):o.destroy(i)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",async i=>{if(o instanceof p)o._write(i);else if(o instanceof WritableStream){let t=o.getWriter();t.write(i).then(()=>t.releaseLock())}else o.write(i)}),this.off("end",async()=>{o instanceof p?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.off("error",async i=>{o instanceof p?o._error(i):o instanceof WritableStream?o.getWriter().abort(i):o.destroy(i)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(i=>{this._emit("error",i)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();if(!o)return i}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:t,value:s}=await this.reader.read();if(t)break;s&&o.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,i){if(this.events[o])for(let t of this.events[o]||[])t(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}i&&this._emit("data",i)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:i}},[Symbol.asyncIterator](){return this}}}}});var gs={};pr(gs,{UndiciStreamWrapper:()=>ia});var ia,ys=ii(()=>{"use strict";ia=class p{constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,i){this.events[o]?.push(i)}off(o,i){this.events[o]=this.events[o]?.filter(t=>t!==i)}pipe(o){return this.on("data",i=>{if(o instanceof p)o._write(i);else{let t=o.getWriter();t.write(i).then(()=>t.releaseLock())}}),this.on("end",()=>{o instanceof p?o._end():o.getWriter().close()}),this.on("error",i=>{o instanceof p?o._error(i):o.getWriter().abort(i)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",i=>{if(o instanceof p)o._write(i);else{let t=o.getWriter();t.write(i).then(()=>t.releaseLock())}}),this.off("end",()=>{o instanceof p?o._end():o.getWriter().close()}),this.off("error",i=>{o instanceof p?o._error(i):o.getWriter().abort(i)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(i=>{this._emit("error",i)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();if(!o)return i}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:t,value:s}=await this.reader.read();if(t)break;s&&o.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,i){if(this.events[o])for(let t of this.events[o]||[])t(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}i&&this._emit("data",i)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:i}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:i}},[Symbol.asyncIterator](){return this}}}}});var ws={};pr(ws,{NodePre18StreamWrapper:()=>oa});var oa,bs=ii(()=>{"use strict";oa=class{constructor(o){this.readableStream=o}on(o,i){this.readableStream.on(o,i)}off(o,i){this.readableStream.off(o,i)}pipe(o){return this.readableStream.pipe(o),o}pipeTo(o){return this.pipe(o)}unpipe(o){o?this.readableStream.unpipe(o):this.readableStream.unpipe()}destroy(o){this.readableStream.destroy(o)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((o,i)=>{let t=this.readableStream.read();t?o(t):(this.readableStream.once("readable",()=>{let s=this.readableStream.read();o(s)}),this.readableStream.once("error",i))})}setEncoding(o){this.readableStream.setEncoding(o),this.encoding=o}async text(){let o=[],i=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let s of this.readableStream)o.push(i.encode(s));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(o))}async json(){let o=await this.text();return JSON.parse(o)}[Symbol.asyncIterator](){let i=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:t,done:s}=await i.next();return{value:t,done:s}},[Symbol.asyncIterator](){return this}}}}});var Ki,An=ii(()=>{"use strict";Ki=class{constructor(){this._emitter=null}ensureEmitter(){if(!this._emitter){let{EventEmitter:o}=require("events");this._emitter=new o}return this._emitter}on(o,i){return this.ensureEmitter().on(o,i),this}emit(o,...i){return this._emitter?.emit(o,...i)??!1}removeAllListeners(o){return this._emitter?.removeAllListeners(o),this}}});var cy=xy((T9,Fb)=>{Fb.exports={name:"@schematichq/schematic-typescript-node",version:"1.4.7",private:!1,repository:{type:"git",url:"git+https://github.com/schematichq/schematic-node.git"},main:"./dist/index.js",types:"./dist/index.d.ts",scripts:{format:"biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","format:check":"biome format --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",lint:"biome lint --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","lint:fix":"biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",check:"biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","check:fix":"biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",build:"node build.js",prepack:"",test:"jest --config jest.config.mjs","test:unit":"jest --selectProjects unit","test:wire":"jest --selectProjects wire","build:legacy":"tsc","test:cloudflare":"node scripts/test-cloudflare.mjs"},dependencies:{"form-data":"^4.0.4","formdata-node":"^6.0.3","node-fetch":"^2.7.0","readable-stream":"^4.7.0",ws:"^8.18.1","@types/ws":"^8.18.1"},devDependencies:{"@types/node-fetch":"^2.6.12","@types/readable-stream":"^4.0.23",webpack:"^5.105.4","ts-loader":"^9.5.4",jest:"^29.7.0","@jest/globals":"^29.7.0","@types/jest":"^29.5.14","ts-jest":"^29.3.4","jest-environment-jsdom":"^29.7.0",msw:"2.11.2","@types/node":"^20.0.0",typescript:"~5.9.3","@biomejs/biome":"2.4.10",esbuild:"^0.25.9",miniflare:"^4.20260421.0"},browser:{fs:!1,os:!1,path:!1,stream:!1,crypto:!1,timers:!1},packageManager:"yarn@1.22.22",engines:{node:">=18.0.0"},sideEffects:!1,license:"MIT",files:["dist/**/*.js","dist/**/*.d.ts","dist/**/*.wasm","!dist/**/*.js.map","!dist/**/*.test.*","README.md"]}});var ly,py,uy,dy=ii(()=>{"use strict";ly=cy(),py=ly.name,uy=ly.version});var gy={};pr(gy,{DatastreamWSClient:()=>Dn});function Nb(p){let o=new URL(p);switch(o.protocol){case"https:":o.protocol="wss:";break;case"http:":o.protocol="ws:";break;default:throw new Error(`Unsupported scheme: ${o.protocol} (must be http: or https:)`)}if(o.hostname){let i=o.hostname.split(".");i.length>1&&i[0]==="api"&&(i[0]="datastream",o.hostname=i.join("."))}return o.pathname="/datastream",o.toString()}var my,Kb,hy,Lb,Gb,Wb,Hb,Dn,yy=ii(()=>{"use strict";my=ao(require("ws"));dy();An();Kb=10*1e3,hy=60*1e3,Lb=hy*9/10,Gb=10,Wb=1*1e3,Hb=30*1e3;Dn=class extends Ki{constructor(i){super();this.connected=!1;this.ready=!1;this.shouldReconnect=!0;this.reconnectAttempts=0;if(!i.url)throw new Error("URL is required");if(!i.apiKey)throw new Error("ApiKey is required");if(!i.messageHandler)throw new Error("MessageHandler is required");i.url.startsWith("http://")||i.url.startsWith("https://")?this.url=Nb(i.url):this.url=i.url,this.headers={"X-Schematic-Api-Key":i.apiKey,"X-Schematic-Client":py,"X-Schematic-Client-Version":uy,"X-Schematic-Datastream-Mode":"datastream"},this.logger=i.logger,this.messageHandler=i.messageHandler,this.connectionReadyHandler=i.connectionReadyHandler,this.maxReconnectAttempts=i.maxReconnectAttempts??Gb,this.minReconnectDelay=i.minReconnectDelay??Wb,this.maxReconnectDelay=i.maxReconnectDelay??Hb}start(){this.shouldReconnect=!0,this.reconnectAttempts=0,this.connectAndRead()}isConnected(){return this.connected}isReady(){return this.ready&&this.connected}async sendMessage(i){if(!this.isConnected()||!this.ws)throw new Error("WebSocket connection is not available!");return new Promise((t,s)=>{if(!this.ws){s(new Error("WebSocket connection is not available!"));return}let r=setTimeout(()=>{s(new Error("Write timeout"))},Kb);try{this.ws.send(JSON.stringify(i),n=>{clearTimeout(r),n?s(n):t()})}catch(n){clearTimeout(r),s(n)}})}close(){this.logger.info("Closing WebSocket connection"),this.shouldReconnect=!1,this.setReady(!1),this.setConnected(!1),this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.ws&&(this.ws.close(),this.ws=void 0)}async connectAndRead(){try{for(;this.shouldReconnect;)try{let i=await this.connect();if(this.reconnectAttempts=0,this.ws=i,this.setConnected(!0),this.setupWebSocketHandlers(i),this.connectionReadyHandler)try{await this.connectionReadyHandler(),this.logger.debug("Connection ready handler completed successfully")}catch(t){this.logger.error(`Connection ready handler failed: ${t}`),this.setConnected(!1),this.setReady(!1),i.close();continue}if(this.setReady(!0),this.logger.debug("WebSocket client is ready"),this.startPingPong(),await new Promise(t=>{let s=()=>{this.logger.info("WebSocket connection closed"),this.cleanup(),t()},r=n=>{this.logger.error(`WebSocket error: ${n.message}`),this.emit("error",n),this.cleanup(),t()};i.on("close",s),i.on("error",r)}),!this.shouldReconnect)break}catch(i){this.reconnectAttempts++,this.setConnected(!1),this.setReady(!1);let t=i instanceof Error?i.message:String(i);if(this.logger.warn(`WebSocket connection failed: ${t}, attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}`),this.reconnectAttempts>=this.maxReconnectAttempts){this.logger.error("Max reconnection attempts reached"),this.emit("error",new Error("Max reconnection attempts reached"));break}let s=this.calculateBackoffDelay(this.reconnectAttempts);this.logger.debug(`Waiting ${s}ms before reconnecting...`),await new Promise(r=>{this.reconnectTimeout=setTimeout(r,s),this.reconnectTimeout.unref()})}}catch(i){this.emit("error",i)}}connect(){return new Promise((i,t)=>{this.logger.debug(`Connecting to WebSocket: ${this.url}`);let s=new my.default(this.url,{headers:this.headers,handshakeTimeout:3e4}),r=setTimeout(()=>{s.close(),t(new Error("Connection timeout"))},3e4);s.on("open",()=>{clearTimeout(r),i(s)}),s.on("error",n=>{clearTimeout(r),t(n)})})}setupWebSocketHandlers(i){i.on("message",t=>{this.handleMessage(t)}),i.on("pong",()=>{this.handlePong()}),i.on("close",t=>{this.handleClose(t)}),i.on("error",t=>{this.handleError(t)})}async handleMessage(i){try{let t;Buffer.isBuffer(i)?t=i.toString():Array.isArray(i)?t=Buffer.concat(i).toString():t=String(i);let s;try{s=JSON.parse(t)}catch(r){this.emit("error",new Error(`Failed to parse datastream message: ${r}`));return}try{await this.messageHandler(s)}catch(r){this.emit("error",new Error(`Message handler error: ${r}`))}}catch(t){this.emit("error",t)}}handleClose(i){this.logger.info(`WebSocket connection closed with code ${i}`),this.setConnected(!1),this.setReady(!1),this.cleanup()}handleError(i){this.logger.error(`WebSocket error: ${i.message}`),this.setConnected(!1),this.setReady(!1),this.cleanup()}startPingPong(){this.logger.debug("Starting ping/pong keepalive mechanism"),this.pingInterval=setInterval(()=>{this.sendPing()},Lb),this.pingInterval.unref()}sendPing(){if(this.ws){this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0),this.pongTimeout=setTimeout(()=>{this.logger.warn("Pong timeout - closing connection"),this.setConnected(!1),this.ws&&this.ws.close()},hy),this.pongTimeout.unref();try{this.ws.ping()}catch(i){this.logger.error(`Failed to send ping: ${i}`),this.setConnected(!1)}}}handlePong(){this.logger.debug("Received pong from server"),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0)}calculateBackoffDelay(i){let t=Math.floor(Math.random()*this.minReconnectDelay),s=Math.pow(2,i-1)*this.minReconnectDelay+t;return Math.min(s,this.maxReconnectDelay+t)}setConnected(i){let t=this.connected;this.connected=i,i||(this.ready=!1),t!==i&&(this.logger.debug(`Connection state changed: ${i}`),i?this.emit("connected"):this.emit("disconnected"))}setReady(i){let t=this.ready;this.ready=i,t!==i&&(this.logger.debug(`Ready state changed: ${i}`),i?this.emit("ready"):this.emit("not-ready"))}cleanup(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0),this.pongTimeout&&(clearTimeout(this.pongTimeout),this.pongTimeout=void 0)}}});var Yb={};pr(Yb,{ConsoleLogger:()=>Nr,LocalCache:()=>Ze,LogLevel:()=>Je,RedisCacheProvider:()=>Zr,RulesEngineClient:()=>Fi,Schematic:()=>te,SchematicClient:()=>Ht,SchematicEnvironment:()=>x,SchematicError:()=>b,SchematicTimeoutError:()=>Jr,WEBHOOK_SIGNATURE_HEADER:()=>In,WEBHOOK_TIMESTAMP_HEADER:()=>Fn,WebhookSignatureError:()=>lr,computeHexSignature:()=>by,computeSignature:()=>$t,verifySignature:()=>Kn,verifyWebhookSignature:()=>zy});module.exports=Gn(Yb);var te={};pr(te,{AccountMemberPermission:()=>Cy,AccountMemberRole:()=>Uy,ActorType:()=>vy,ApiKeyScope:()=>Ty,BadRequestError:()=>T,BillingCreditBundleStatus:()=>Oy,BillingCreditBurnStrategy:()=>ky,BillingCreditExpiryType:()=>By,BillingCreditExpiryUnit:()=>jy,BillingCreditGrantReason:()=>Ay,BillingCreditGrantZeroedOutReason:()=>Vy,BillingCreditRolloverPolicy:()=>qy,BillingPlanCreditGrantResetCadence:()=>Dy,BillingPlanCreditGrantResetStart:()=>My,BillingPlanCreditGrantResetType:()=>Iy,BillingPriceScheme:()=>Fy,BillingPriceUsageType:()=>Ky,BillingProductPriceInterval:()=>Ly,BillingProviderType:()=>Gy,BillingStrategy:()=>Wy,BillingSubscriptionTrialEndSetting:()=>Hy,BillingTiersMode:()=>Ny,ChargeType:()=>$y,CompanyMatchingCriteria:()=>Jy,CompanyPlanInvalidReason:()=>Zy,ComparableOperator:()=>Yy,ComponentEntityType:()=>Qy,ComponentState:()=>Xy,ConditionType:()=>ew,CreditEventType:()=>rw,CreditGrantSortOrder:()=>iw,CreditLedgerPeriod:()=>ow,CustomPlanActivationStrategy:()=>tw,CustomPlanBillingStatus:()=>aw,DataExportStatus:()=>nw,EntitlementPriceBehavior:()=>sw,EntitlementType:()=>cw,EntitlementValueType:()=>lw,EntityType:()=>pw,EnvironmentType:()=>uw,EventStatus:()=>dw,EventType:()=>Yt,FeatureLifecyclePhase:()=>mw,FeatureType:()=>hw,ForbiddenError:()=>z,IntegrationState:()=>gw,IntegrationType:()=>yw,InternalServerError:()=>R,InvoiceStatus:()=>ww,MetricPeriod:()=>bw,MetricPeriodMonthReset:()=>zw,MigrationErrorCode:()=>Rw,NotFoundError:()=>f,PlanBundleAction:()=>fw,PlanChangeAction:()=>_w,PlanChangeBasePlanAction:()=>Sw,PlanChangeSubscriptionAction:()=>Pw,PlanIcon:()=>xw,PlanPriceCadence:()=>Ew,PlanType:()=>Cw,PlanVersionCompanyMigrationStatus:()=>Uw,PlanVersionMigrationStatus:()=>vw,PlanVersionMigrationStrategy:()=>Tw,PlanVersionStatus:()=>Ow,ProrationBehavior:()=>kw,RuleType:()=>Fw,RulesEngineSchemaVersion:()=>Bw,RulesengineConditionType:()=>jw,RulesengineEntitlementValueType:()=>Aw,RulesengineEntityType:()=>Vw,RulesengineMetricPeriod:()=>qw,RulesengineMetricPeriodMonthReset:()=>Dw,RulesengineRuleType:()=>Mw,RulesengineTraitDefinitionComparableType:()=>Iw,ScheduledCheckoutStatus:()=>Kw,ScheduledDowngradeConfigBehavior:()=>Lw,SortDirection:()=>Gw,SubscriptionStatus:()=>Ww,SubscriptionType:()=>Hw,TimeSeriesGranularity:()=>Nw,TraitDefinitionComparableType:()=>$w,TraitType:()=>Jw,TrialStatus:()=>Zw,UnauthorizedError:()=>_,WebhookEventStatus:()=>Yw,WebhookRequestType:()=>Qw,WebhookStatus:()=>Xw,accesstokens:()=>Wn,accounts:()=>Hn,billing:()=>Nn,checkout:()=>$n,companies:()=>Jn,components:()=>Zn,componentspublic:()=>Yn,credits:()=>Qn,dataexports:()=>Xn,entitlements:()=>es,events:()=>rs,features:()=>is,insights:()=>os,integrationsapi:()=>ts,planbundle:()=>as,plangroups:()=>ns,planmigrations:()=>ss,plans:()=>cs,scheduledcheckout:()=>ls,webhooks:()=>ps});var xe=(p,o,i)=>JSON.stringify(p,o,i);function Gi(p,o){return JSON.parse(p,o)}var b=class extends Error{constructor({message:o,statusCode:i,body:t,rawResponse:s,cause:r}){super(Ey({message:o,statusCode:i,body:t})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=i,this.body=t,this.rawResponse=s,r!=null&&(this.cause=r)}};function Ey({message:p,statusCode:o,body:i}){let t=[];return p!=null&&t.push(p),o!=null&&t.push(`Status code: ${o.toString()}`),i!=null&&t.push(`Body: ${xe(i,void 0,2)}`),t.join(`
|
|
2
|
+
`)}var Jr=class extends Error{constructor(o,i){super(o),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,i?.cause!=null&&(this.cause=i.cause)}};var T=class extends b{constructor(o,i){super({message:"BadRequestError",statusCode:400,body:o,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var z=class extends b{constructor(o,i){super({message:"ForbiddenError",statusCode:403,body:o,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var R=class extends b{constructor(o,i){super({message:"InternalServerError",statusCode:500,body:o,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var f=class extends b{constructor(o,i){super({message:"NotFoundError",statusCode:404,body:o,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var _=class extends b{constructor(o,i){super({message:"UnauthorizedError",statusCode:401,body:o,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Wn={};var Hn={};var Nn={};var $n={};var Jn={};var Zn={};var Yn={};var Qn={};var Xn={};var es={};var rs={};var is={};var os={};var ts={};var as={};var ns={};var ss={};var cs={};var ls={};var ps={};var Cy={BillingCreditsEdit:"billing_credits_edit",CompaniesEdit:"companies_edit",CompanyUsersEdit:"company_users_edit",ComponentsEdit:"components_edit",DataExportsEdit:"data_exports_edit",FeaturesEdit:"features_edit",FlagRulesEdit:"flag_rules_edit",FlagsEdit:"flags_edit",OverridesEdit:"overrides_edit",PlanBillingEdit:"plan_billing_edit",PlanEntitlementsEdit:"plan_entitlements_edit",PlanVersionsEdit:"plan_versions_edit",PlansEdit:"plans_edit",WebhooksEdit:"webhooks_edit",WebhooksRevealSecret:"webhooks_reveal_secret"};var Uy={Admin:"admin",Member:"member"};var vy={ApiKey:"api_key",AppUser:"app_user",StripeApp:"stripe_app",System:"system",TemporaryAccessToken:"temporary_access_token"};var Ty={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var Oy={Active:"active",Inactive:"inactive"};var ky={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var By={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var jy={BillingPeriods:"billing_periods",Days:"days"};var Ay={Adjustment:"adjustment",BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var Vy={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var qy={Expire:"expire",None:"none",Rollover:"rollover"};var Dy={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var My={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var Iy={NoReset:"no_reset",PlanPeriod:"plan_period"};var Fy={PerUnit:"per_unit",Tiered:"tiered"};var Ky={Licensed:"licensed",Metered:"metered"};var Ly={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var Gy={Orb:"orb",Schematic:"schematic",Stripe:"stripe"};var Wy={SchematicManaged:"schematic_managed",ProviderManaged:"provider_managed",NoBilling:"no_billing"};var Hy={Cancel:"cancel",Subscribe:"subscribe"};var Ny={Graduated:"graduated",Volume:"volume"};var $y={Free:"free",None:"none",OneTime:"one_time",Recurring:"recurring"};var Jy={BillingMetaObject:"billing_meta_object",ManualUpsert:"manual_upsert"};var Zy={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var Yy={Eq:"eq",Gt:"gt",Gte:"gte",IsEmpty:"is_empty",Lt:"lt",Lte:"lte",NotEmpty:"not_empty",Ne:"ne"};var Qy={Billing:"billing",Entitlement:"entitlement"};var Xy={Draft:"draft",Live:"live"};var ew={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var rw={Grant:"grant",Transfer:"transfer",Usage:"usage",ZeroOut:"zero_out"};var iw={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var ow={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var tw={OnPayment:"on_payment",OnPublish:"on_publish"};var aw={Active:"active",Expired:"expired",Paid:"paid",Pending:"pending"};var nw={Failure:"failure",Pending:"pending",Success:"success"};var sw={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var cw={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var lw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var pw={Company:"company",User:"user"};var uw={Development:"development",Production:"production",Staging:"staging"};var dw={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var Yt={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var mw={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var hw={Boolean:"boolean",Event:"event",Trait:"trait"};var gw={Active:"active",Created:"created",Pending:"pending"};var yw={Clerk:"clerk",Orb:"orb",Stripe:"stripe",Unknown:"unknown",Workos:"workos"};var ww={Draft:"draft",Open:"open",Paid:"paid",Uncollectible:"uncollectible",Void:"void"};var bw={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var zw={BillingCycle:"billing_cycle",FirstOfMonth:"first_of_month"};var Rw={AmbiguousSubscriptionItem:"ambiguous_subscription_item",MultipleSubscriptions:"multiple_subscriptions",NoPriceForInterval:"no_price_for_interval",NotOnOriginVersion:"not_on_origin_version",PermanentConfig:"permanent_config",PermanentDecline:"permanent_decline",TransientDecline:"transient_decline",TransientInfra:"transient_infra",TransientStripe:"transient_stripe",Unknown:"unknown",WouldLeaveEmptySubscription:"would_leave_empty_subscription"};var fw={Create:"create",Update:"update",Delete:"delete"};var _w={Checkout:"checkout",CompanyUpsert:"company_upsert",FallbackPlan:"fallback_plan",ManagePlan:"manage_plan",Migration:"migration",PlanBillingProductChanged:"plan_billing_product_changed",PlanDeleted:"plan_deleted",PlanTraitChange:"plan_trait_change",PlanVersionMigration:"plan_version_migration",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var Sw={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var Pw={Adjustment:"adjustment",Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var xw={Amber:"amber",Blue:"blue",BlueGray:"blueGray",BlueGreen:"blueGreen",Cyan:"cyan",Emerald:"emerald",Fuchsia:"fuchsia",Gray:"gray",Green:"green",Indigo:"indigo",LightBlue:"lightBlue",Lime:"lime",Orange:"orange",Pink:"pink",Purple:"purple",Red:"red",RedOrange:"redOrange",Rose:"rose",Sky:"sky",Slate:"slate",Teal:"teal",TrueGray:"trueGray",Violet:"violet",WarmGray:"warmGray",Yellow:"yellow"};var Ew={Monthly:"monthly",Quarterly:"quarterly",Yearly:"yearly"};var Cw={Plan:"plan",AddOn:"add_on"};var Uw={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending",Skipped:"skipped"};var vw={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending"};var Tw={Immediate:"immediate",Leave:"leave"};var Ow={Published:"published",Draft:"draft",Archived:"archived"};var kw={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};var Bw={V97288F60:"v97288f60",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var jw={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var Aw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Vw={Company:"company",User:"user"};var qw={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Dw={BillingCycle:"billing_cycle",FirstOfMonth:"first_of_month"};var Mw={CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",Default:"default",GlobalOverride:"global_override",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Iw={Bool:"bool",Date:"date",Int:"int",String:"string"};var Fw={CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",Default:"default",GlobalOverride:"global_override",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Kw={Cancelled:"cancelled",Error:"error",Executing:"executing",Pending:"pending",Success:"success"};var Lw={EndOfBillingPeriod:"end_of_billing_period",None:"none"};var Gw={Asc:"asc",Desc:"desc"};var Ww={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var Hw={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var Nw={Daily:"daily",Hourly:"hourly",Monthly:"monthly",Weekly:"weekly"};var $w={Bool:"bool",Date:"date",Int:"int",String:"string"};var Jw={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Zw={Active:"active",Converted:"converted",Expired:"expired"};var Yw={Failure:"failure",Pending:"pending",Success:"success"};var Qw={SubscriptionTrialEnded:"subscription.trial.ended",CompanyCreated:"company.created",CompanyDeleted:"company.deleted",CompanyOverrideCreated:"company.override.created",CompanyOverrideDeleted:"company.override.deleted",CompanyOverrideExpired:"company.override.expired",CompanyOverrideUpdated:"company.override.updated",CompanyPlanChanged:"company.plan_changed",CompanyScheduledDowngrade:"company.scheduled_downgrade",CompanyUpdated:"company.updated",CreditLimitReached:"credit.limit.reached",CreditLimitWarning:"credit.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",FeatureCreated:"feature.created",FeatureDeleted:"feature.deleted",FeatureUpdated:"feature.updated",FlagCreated:"flag.created",FlagDeleted:"flag.deleted",FlagRulesUpdated:"flag_rules.updated",FlagUpdated:"flag.updated",PlanCreated:"plan.created",PlanDeleted:"plan.deleted",PlanEntitlementCreated:"plan.entitlement.created",PlanEntitlementDeleted:"plan.entitlement.deleted",PlanEntitlementUpdated:"plan.entitlement.updated",PlanUpdated:"plan.updated",PlanVersionDeleted:"plan_version.deleted",RuleDeleted:"rule.deleted",TestSend:"test.send",UserCreated:"user.created",UserDeleted:"user.deleted",UserUpdated:"user.updated",AutoTopupHardFailure:"auto.topup.hard.failure",AutoTopupRetryExceeded:"auto.topup.retry.exceeded"};var Xw={Active:"active",Inactive:"inactive"};var eb=2147483647,Ze=class{constructor({maxItems:o=1e3,ttl:i=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=o,this.defaultTTL=i}async get(o){let i=this.cache.get(o);return i?i.expiration<=Date.now()?(this.evictItem(o,i),null):(this.accessCounter++,i.accessCounter=this.accessCounter,this.cache.set(o,i),i.value):null}async set(o,i,t){if(this.maxItems===0)return;let s=t??this.defaultTTL,r=this.cache.get(o);r&&this.evictItem(o,r),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let n={value:i,accessCounter:this.accessCounter,expiration:Date.now()+s};n.timeoutId=setTimeout(()=>this.evictItem(o,n),Math.min(s,eb)),this.cache.set(o,n)}async delete(o){let i=this.cache.get(o);i&&this.evictItem(o,i)}async deleteMissing(o,i){let t=new Set(o);for(let[s,r]of this.cache)t.has(s)||this.evictItem(s,r)}evictItem(o,i){i.timeoutId&&clearTimeout(i.timeoutId),this.cache.delete(o)}evictExpiredItems(){this.cache.forEach((o,i)=>{o.expiration<=Date.now()&&this.evictItem(i,o)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let o,i=Number.MAX_SAFE_INTEGER;this.cache.forEach((t,s)=>{t.accessCounter<i&&(o=s,i=t.accessCounter)}),o&&this.evictItem(o,this.cache.get(o))}}};var Zr=class{constructor(o){this.client=o.client,this.defaultTTL=Math.floor((o.ttl||5e3)/1e3),this.keyPrefix=o.keyPrefix||"schematic:"}getFullKey(o){return this.keyPrefix+o}async get(o){let i=this.getFullKey(o),t=await this.client.get(i);return t===null?null:JSON.parse(t)}async set(o,i,t){let s=this.getFullKey(o),r=JSON.stringify(i),n=t?Math.floor(t/1e3):this.defaultTTL;n>0?await this.client.setEx(s,n,r):await this.client.set(s,r)}async delete(o){let i=this.getFullKey(o);await this.client.del(i)}async deleteMissing(o,i){let t=i?.scanPattern?this.keyPrefix+i.scanPattern:this.keyPrefix+"*",s=new Set(o.map(d=>this.getFullKey(d))),r=[],n=1e3;for await(let d of this.client.scanIterator({MATCH:t,COUNT:1e3}))s.has(d)||(r.push(d),r.length>=n&&(await this.client.del(r),r.length=0));r.length>0&&await this.client.del(r)}};function Qt(p){return typeof p=="object"&&p!==null&&"getAuthRequest"in p&&typeof p.getAuthRequest=="function"}var oi=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var no={get:async(p,o)=>typeof p=="function"?p(o):p};var Ge={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},us={[Ge.Debug]:1,[Ge.Info]:2,[Ge.Warn]:3,[Ge.Error]:4},Wi=class{debug(o,...i){console.debug(o,...i)}info(o,...i){console.info(o,...i)}warn(o,...i){console.warn(o,...i)}error(o,...i){console.error(o,...i)}},ti=class{constructor(o){this.level=us[o.level],this.logger=o.logger,this.silent=o.silent}shouldLog(o){return!this.silent&&this.level<=us[o]}isDebug(){return this.shouldLog(Ge.Debug)}debug(o,...i){this.isDebug()&&this.logger.debug(o,...i)}isInfo(){return this.shouldLog(Ge.Info)}info(o,...i){this.isInfo()&&this.logger.info(o,...i)}isWarn(){return this.shouldLog(Ge.Warn)}warn(o,...i){this.isWarn()&&this.logger.warn(o,...i)}isError(){return this.shouldLog(Ge.Error)}error(o,...i){this.isError()&&this.logger.error(o,...i)}};function Hi(p){return p==null?rb:p instanceof ti?p:(p=p??{},p.level??=Ge.Info,p.logger??=new Wi,p.silent??=!0,new ti(p))}var rb=new ti({level:Ge.Info,logger:new Wi,silent:!0});var ib={arrayFormat:"indices",encode:!0};function Xt(p,o){if(p===void 0||p===null)return"";let i=String(p);return o?encodeURIComponent(i):i}function ea(p,o="",i){let t=[];for(let[s,r]of Object.entries(p)){let n=o?`${o}[${s}]`:s;if(r!==void 0)if(Array.isArray(r)){if(r.length===0)continue;let d=i.arrayFormat;if(d==="comma"){let g=i.encode?encodeURIComponent(n):n,h=r.filter(l=>l!=null).map(l=>Xt(l,i.encode));h.length>0&&t.push(`${g}=${h.join(",")}`)}else for(let g=0;g<r.length;g++){let h=r[g];if(h!==void 0)if(typeof h=="object"&&!Array.isArray(h)&&h!==null){let l=d==="indices"?`${n}[${g}]`:n;t.push(...ea(h,l,i))}else{let l=d==="indices"?`${n}[${g}]`:n,y=i.encode?encodeURIComponent(l):l;t.push(`${y}=${Xt(h,i.encode)}`)}}}else if(typeof r=="object"&&r!==null){if(Object.keys(r).length===0)continue;t.push(...ea(r,n,i))}else{let d=i.encode?encodeURIComponent(n):n;t.push(`${d}=${Xt(r,i.encode)}`)}}return t}function ur(p,o){return p==null||typeof p!="object"?"":ea(p,"",{...ib,...o}).join("&")}function so(p,o){let i=ur(o,{arrayFormat:"repeat"});return i?`${p}?${i}`:p}function ds(p){let o={get bodyUsed(){return p.bodyUsed},stream:()=>p.body,arrayBuffer:p.arrayBuffer.bind(p),blob:p.blob.bind(p)};return"bytes"in p&&typeof p.bytes=="function"&&(o.bytes=p.bytes.bind(p)),o}var Re=ob();function ob(){if(typeof window<"u"&&typeof window.document<"u")return{type:"browser",version:window.navigator.userAgent};if(typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers")return{type:"workerd"};if(typeof EdgeRuntime=="string")return{type:"edge-runtime"};if(typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope"))return{type:"web-worker"};if(typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u")return{type:"deno",version:Deno.version.deno};if(typeof Bun<"u"&&typeof Bun.version<"u")return{type:"bun",version:Bun.version};if(typeof navigator<"u"&&navigator?.product==="ReactNative")return{type:"react-native"};let d=typeof process<"u"?process:void 0;return typeof d<"u"&&typeof d.versions?.node=="string"?{type:"node",version:d.versions.node,parsedVersion:Number(d.versions.node.split(".")[0])}:{type:"unknown"}}async function zs(p){return Re.type==="node"&&Re.parsedVersion!=null&&Re.parsedVersion>=18?new(await Promise.resolve().then(()=>(hs(),ms))).Node18UniversalStreamWrapper(p):Re.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(ys(),gs))).UndiciStreamWrapper(p):new(await Promise.resolve().then(()=>(bs(),ws))).NodePre18StreamWrapper(p)}async function ai(p,o){switch(o){case"binary-response":return ds(p);case"blob":return await p.blob();case"arrayBuffer":return await p.arrayBuffer();case"sse":return p.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:p.status}}:p.body;case"streaming":return p.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:p.status}}:zs(p.body);case"text":return await p.text()}let i=await p.text();if(i.length>0)try{return Gi(i)}catch{return{ok:!1,error:{reason:"non-json",statusCode:p.status,rawBody:i}}}}async function Rs(p){let o=p.headers.get("Content-Type")?.toLowerCase();if(o==null||o.length===0)return ai(p);switch(o.indexOf(";")!==-1&&(o=o.split(";")[0]?.trim()??""),o){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":{let i=await p.text();return i.length>0?Gi(i):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let i=await p.text();return i.length>0?Gi(i):void 0}return await p.text()}}async function ni(){return Re.type==="node"&&Re.parsedVersion!=null&&Re.parsedVersion>=18?fetch:Re.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function co({body:p,type:o}){return o==="form"?ur(p,{arrayFormat:"repeat",encode:!0}):o.includes("json")?xe(p):p}var Ye;typeof globalThis.Headers<"u"?Ye=globalThis.Headers:Ye=class fs{constructor(o){if(this.headers=new Map,o)if(o instanceof fs)o.forEach((i,t)=>this.append(t,i));else if(Array.isArray(o))for(let[i,t]of o)if(typeof i=="string"&&typeof t=="string")this.append(i,t);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[i,t]of Object.entries(o))if(typeof t=="string")this.append(i,t);else throw new TypeError("Header values must be strings")}append(o,i){let t=o.toLowerCase(),s=this.headers.get(t)||[];this.headers.set(t,[...s,i])}delete(o){let i=o.toLowerCase();this.headers.delete(i)}get(o){let i=o.toLowerCase(),t=this.headers.get(i);return t?t.join(", "):null}has(o){let i=o.toLowerCase();return this.headers.has(i)}set(o,i){let t=o.toLowerCase();this.headers.set(t,[i])}forEach(o,i){let t=i?o.bind(i):o;this.headers.forEach((s,r)=>t(s.join(", "),r,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[o,i]of this.headers.entries())yield[o,i.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let o of this.headers.values())yield o.join(", ")}[Symbol.iterator](){return this.entries()}};var tb="timeout";function _s(p){let o=new AbortController,i=setTimeout(()=>o.abort(tb),p);return{signal:o.signal,abortId:i}}function Ss(...p){let o=p.length===1&&Array.isArray(p[0])?p[0]:p,i=new AbortController;for(let t of o){if(t.aborted){i.abort(t?.reason);break}t.addEventListener("abort",()=>i.abort(t?.reason),{signal:i.signal})}return i.signal}var Ni;function ab(){if(Ni!=null)return Ni;try{new Request("http://localhost",{cache:"no-store"}),Ni=!0}catch{Ni=!1}return Ni}var si=async(p,o,i,t,s,r,n,d,g,h)=>{let l=[],y;if(r!=null){let{signal:v,abortId:O}=_s(r);y=O,l.push(v)}n!=null&&l.push(n);let w=Ss(l),U=await p(o,{method:i,headers:t,body:s,signal:w,credentials:d?"include":void 0,duplex:g,...h&&ab()?{cache:"no-store"}:{}});return y!=null&&clearTimeout(y),U};var ci={headers:new Ye,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},li={headers:new Ye,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function $i(p){return{headers:p.headers,redirected:p.redirected,status:p.status,statusText:p.statusText,type:p.type,url:p.url}}function nb(p){return[408,429].includes(p)||p>=500}function sb(p){let o=1+Math.random()*.2;return p*o}function cb(p){let o=1+(Math.random()-.5)*.2;return p*o}function lb(p,o){let i=p.headers.get("Retry-After");if(i){let s=parseInt(i,10);if(!Number.isNaN(s)&&s>0)return Math.min(s*1e3,6e4);let r=new Date(i);if(!Number.isNaN(r.getTime())){let n=r.getTime()-Date.now();if(n>0)return Math.min(Math.max(n,0),6e4)}}let t=p.headers.get("X-RateLimit-Reset");if(t){let s=parseInt(t,10);if(!Number.isNaN(s)){let r=s*1e3-Date.now();if(r>0)return sb(Math.min(r,6e4))}}return cb(Math.min(1e3*2**o,6e4))}async function pi(p,o=2){let i=await p();for(let t=0;t<o&&nb(i.status);++t){let s=lb(i,t);await new Promise(r=>setTimeout(r,s)),i=await p()}return i}var pb=new Set(["authorization","www-authenticate","x-api-key","api-key","apikey","x-api-token","x-auth-token","auth-token","cookie","set-cookie","proxy-authorization","proxy-authenticate","x-csrf-token","x-xsrf-token","x-session-token","x-access-token"]);function ta(p){let o={};for(let[i,t]of p instanceof Ye?p.entries():Object.entries(p))pb.has(i.toLowerCase())?o[i]="[REDACTED]":o[i]=t;return o}var aa=new Set(["api_key","api-key","apikey","token","access_token","access-token","auth_token","auth-token","password","passwd","secret","api_secret","api-secret","apisecret","key","session","session_id","session-id"]);function ub(p){if(p==null)return;let o={};for(let[i,t]of Object.entries(p))o[i]=aa.has(i.toLowerCase())?"[REDACTED]":t;return o}function Yr(p){let o=p.indexOf("://");if(o===-1)return p;let i=o+3,t=p.indexOf("/",i),s=p.indexOf("?",i),r=p.indexOf("#",i),n=Math.min(t===-1?p.length:t,s===-1?p.length:s,r===-1?p.length:r),d=-1;for(let v=i;v<n;v++)p[v]==="@"&&(d=v);if(d!==-1&&(p=`${p.slice(0,i)}[REDACTED]@${p.slice(d+1)}`),s=p.indexOf("?"),s===-1)return p;r=p.indexOf("#",s);let g=r!==-1?r:p.length,h=p.slice(s+1,g);if(h.length===0)return p;let l=h.toLowerCase();if(!(l.includes("token")||l.includes("key")||l.includes("password")||l.includes("passwd")||l.includes("secret")||l.includes("session")||l.includes("auth")))return p;let w=[],U=h.split("&");for(let v of U){let O=v.indexOf("=");if(O===-1){w.push(v);continue}let B=v.slice(0,O),j=aa.has(B.toLowerCase());if(!j&&B.includes("%"))try{let $=decodeURIComponent(B);j=aa.has($.toLowerCase())}catch{}w.push(j?`${B}=[REDACTED]`:v)}return p.slice(0,s+1)+w.join("&")+p.slice(g)}async function db(p){let o=new Ye;if(o.set("Accept",p.responseType==="json"?"application/json":p.responseType==="text"?"text/plain":p.responseType==="sse"?"text/event-stream":"*/*"),p.body!==void 0&&p.contentType!=null&&o.set("Content-Type",p.contentType),p.headers==null)return o;for(let[i,t]of Object.entries(p.headers)){let s=await no.get(t,{endpointMetadata:p.endpointMetadata??{}});if(typeof s=="string"){o.set(i,s);continue}s!=null&&o.set(i,`${s}`)}return o}async function mb(p){let o=p.url;p.queryString!=null&&p.queryString.length>0?o=`${o}?${p.queryString}`:o=so(p.url,p.queryParameters);let i=await co({body:p.body,type:p.requestType??"other"}),t=p.fetchFn??await ni(),s=await db(p),r=Hi(p.logging);if(r.isDebug()){let n={method:p.method,url:Yr(o),headers:ta(s),queryParameters:ub(p.queryParameters),hasBody:i!=null};r.debug("Making HTTP request",n)}try{let n=await pi(async()=>si(t,o,p.method,s,i,p.timeoutMs,p.abortSignal,p.withCredentials,p.duplex,p.responseType==="streaming"||p.responseType==="sse"),p.maxRetries);if(n.status>=200&&n.status<400){if(r.isDebug()){let g={method:p.method,url:Yr(o),statusCode:n.status,responseHeaders:ta(n.headers)};r.debug("HTTP request succeeded",g)}return{ok:!0,body:await ai(n,p.responseType),headers:n.headers,rawResponse:$i(n)}}else{if(r.isError()){let d={method:p.method,url:Yr(o),statusCode:n.status,responseHeaders:ta(Object.fromEntries(n.headers.entries()))};r.error("HTTP request failed with error status",d)}return{ok:!1,error:{reason:"status-code",statusCode:n.status,body:await Rs(n)},rawResponse:$i(n)}}}catch(n){if(p.abortSignal?.aborted){if(r.isError()){let d={method:p.method,url:Yr(o)};r.error("HTTP request was aborted",d)}return{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request",cause:n},rawResponse:ci}}else if(n instanceof Error&&n.name==="AbortError"){if(r.isError()){let d={method:p.method,url:Yr(o),timeoutMs:p.timeoutMs};r.error("HTTP request timed out",d)}return{ok:!1,error:{reason:"timeout",cause:n},rawResponse:ci}}else if(n instanceof Error){if(r.isError()){let d={method:p.method,url:Yr(o),errorMessage:n.message};r.error("HTTP request failed with error",d)}return{ok:!1,error:{reason:"unknown",errorMessage:n.message,cause:n},rawResponse:li}}if(r.isError()){let d={method:p.method,url:Yr(o),error:xe(n)};r.error("HTTP request failed with unknown error",d)}return{ok:!1,error:{reason:"unknown",errorMessage:xe(n),cause:n},rawResponse:li}}}var E=mb;var S=class p extends Promise{constructor(o){super(i=>{i(void 0)}),this.innerPromise=o}static fromFunction(o,...i){return new p(o(...i))}static interceptFunction(o){return(...i)=>p.fromPromise(o(...i))}static fromPromise(o){return new p(o)}static fromExecutor(o){let i=new Promise(o);return new p(i)}static fromResult(o){let i=Promise.resolve(o);return new p(i)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:o})=>o)),this.unwrappedPromise}then(o,i){return this.unwrap().then(o,i)}catch(o){return this.unwrap().catch(o)}finally(o){return this.unwrap().finally(o)}async withRawResponse(){return await this.innerPromise}};function lo(p,...o){if(!p)return"";if(o.length===0)return p;if(p.includes("://")){let i;try{i=new URL(p)}catch{return Ps(p,...o)}let s=o[o.length-1]?.endsWith("/");for(let r of o){let n=Es(r);n&&(i.pathname=xs(i.pathname,n))}return s&&!i.pathname.endsWith("/")&&(i.pathname+="/"),i.toString()}return Ps(p,...o)}function Ps(p,...o){if(o.length===0)return p;let i=p,s=o[o.length-1]?.endsWith("/");for(let r of o){let n=Es(r);n&&(i=xs(i,n))}return s&&!i.endsWith("/")&&(i+="/"),i}function xs(p,o){return p.endsWith("/")?p+o:`${p}/${o}`}function Es(p){if(!p)return p;let o=0,i=p.length;return p.startsWith("/")&&(o=1),p.endsWith("/")&&(i=p.length-1),o===0&&i===p.length?p:p.slice(o,i)}var m={get:async p=>typeof p=="function"?p():p};async function na(p,o,i,t){let s=Hi(i.logging),r,n=o;p instanceof Request?(r=p.url,o==null&&(n={method:p.method,headers:Object.fromEntries(p.headers.entries()),body:p.body,signal:p.signal,credentials:p.credentials,cache:p.cache,redirect:p.redirect,referrer:p.referrer,integrity:p.integrity,mode:p.mode})):r=p instanceof URL?p.toString():p;let d=(i.baseUrl!=null?await m.get(i.baseUrl):void 0)??(i.environment!=null?await m.get(i.environment):void 0),g;r.startsWith("http://")||r.startsWith("https://")?g=r:d!=null?g=lo(d,r):g=r;let h={};if(i.headers!=null)for(let[$,A]of Object.entries(i.headers)){let le=await no.get(A,{endpointMetadata:{}});le!=null&&(h[$.toLowerCase()]=`${le}`)}if(i.getAuthHeaders!=null){let $=await i.getAuthHeaders();for(let[A,le]of Object.entries($))h[A.toLowerCase()]=le}if(n?.headers!=null){let $=n.headers instanceof Headers?Object.fromEntries(n.headers.entries()):Array.isArray(n.headers)?Object.fromEntries(n.headers):n.headers;for(let[A,le]of Object.entries($))le!=null&&(h[A.toLowerCase()]=le)}if(t?.headers!=null)for(let[$,A]of Object.entries(t.headers))h[$.toLowerCase()]=A;let l=n?.method??"GET",y=n?.body,w=t?.timeoutInSeconds??i.timeoutInSeconds,U=w!=null?w*1e3:void 0,v=t?.maxRetries??i.maxRetries,O=t?.abortSignal??n?.signal??void 0,B=i.fetch??await ni();s.isDebug()&&s.debug("Making passthrough HTTP request",{method:l,url:g,hasBody:y!=null});let j=await pi(async()=>si(B,g,l,h,y??void 0,U,O,n?.credentials==="include",void 0,!1),v);return s.isDebug()&&s.debug("Passthrough HTTP request completed",{method:l,url:g,statusCode:j.status}),j}var po={};pr(po,{ConsoleLogger:()=>Wi,LogLevel:()=>Ge,Logger:()=>ti,createLogger:()=>Hi});var e={};pr(e,{JsonError:()=>ui,ParseError:()=>di,any:()=>Fs,bigint:()=>Us,boolean:()=>Ks,booleanLiteral:()=>Ms,date:()=>vs,discriminant:()=>Qs,enum_:()=>Ji,forwardCompatibleEnum_:()=>Ts,getObjectLikeUtils:()=>We,getObjectUtils:()=>Qr,getSchemaUtils:()=>Z,isProperty:()=>mr,lazy:()=>Os,lazyObject:()=>qs,list:()=>ho,never:()=>Ls,number:()=>Gs,object:()=>mo,objectWithoutOptionalProperties:()=>Vs,optional:()=>sa,partialRecord:()=>$s,property:()=>Bs,record:()=>Ns,set:()=>Js,string:()=>Ws,stringLiteral:()=>Is,transform:()=>ca,undiscriminatedUnion:()=>Ys,union:()=>ec,unknown:()=>Hs,withParsedProperties:()=>ua});var D={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function J(p,o){return`Expected ${o}. Received ${hb(p)}.`}function hb(p){if(Array.isArray(p))return"list";if(p===null)return"null";if(p instanceof BigInt)return"BigInt";switch(typeof p){case"string":return`"${p}"`;case"bigint":case"number":case"boolean":case"undefined":return`${p}`}return typeof p}function ge(p){return{...p,json:Cs(p.json),parse:Cs(p.parse)}}function Cs(p){return(o,i)=>{let t=p(o,i),{skipValidation:s=!1}=i??{};return!t.ok&&s?(console.warn(["Failed to validate.",...t.errors.map(r=>" - "+(r.path.length>0?`${r.path.join(".")}: ${r.message}`:r.message))].join(`
|
|
3
|
+
`)),{ok:!0,value:o}):t}}function uo(p){return p.path.length===0?p.message:`${p.path.join(" -> ")}: ${p.message}`}var ui=class extends Error{constructor(i){super(i.map(uo).join("; "));this.errors=i;Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};var di=class extends Error{constructor(i){super(i.map(uo).join("; "));this.errors=i;Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function Z(p){return{nullable:()=>gb(p),optional:()=>sa(p),optionalNullable:()=>yb(p),transform:o=>ca(p,o),parseOrThrow:(o,i)=>{let t=p.parse(o,i);if(t.ok)return t.value;throw new di(t.errors)},jsonOrThrow:(o,i)=>{let t=p.json(o,i);if(t.ok)return t.value;throw new ui(t.errors)}}}function gb(p){let o={parse:(i,t)=>i==null?{ok:!0,value:null}:p.parse(i,t),json:(i,t)=>i==null?{ok:!0,value:null}:p.json(i,t),getType:()=>D.NULLABLE};return{...o,...Z(o)}}function sa(p){let o={parse:(i,t)=>i==null?{ok:!0,value:void 0}:p.parse(i,t),json:(i,t)=>t?.omitUndefined&&i===void 0?{ok:!0,value:void 0}:i==null?{ok:!0,value:null}:p.json(i,t),getType:()=>D.OPTIONAL};return{...o,...Z(o)}}function yb(p){let o={parse:(i,t)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:p.parse(i,t),json:(i,t)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:p.json(i,t),getType:()=>D.OPTIONAL_NULLABLE};return{...o,...Z(o)}}function ca(p,o){let i={parse:(t,s)=>{let r=p.parse(t,s);return r.ok?{ok:!0,value:o.transform(r.value)}:r},json:(t,s)=>{let r=o.untransform(t);return p.json(r,s)},getType:()=>p.getType()};return{...i,...Z(i)}}function Us(){let p={parse:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o=="bigint"?{ok:!0,value:o}:typeof o=="number"?{ok:!0,value:BigInt(o)}:{ok:!1,errors:[{path:i,message:J(o,"bigint | number")}]},json:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o!="bigint"?{ok:!1,errors:[{path:i,message:J(o,"bigint")}]}:{ok:!0,value:o},getType:()=>D.BIGINT};return{...ge(p),...Z(p)}}var wb=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function vs(){let p={parse:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:i,message:J(o,"string")}]}:wb.test(o)?{ok:!0,value:new Date(o)}:{ok:!1,errors:[{path:i,message:J(o,"ISO 8601 date string")}]},json:(o,{breadcrumbsPrefix:i=[]}={})=>o instanceof Date?{ok:!0,value:o.toISOString()}:{ok:!1,errors:[{path:i,message:J(o,"Date object")}]},getType:()=>D.DATE};return{...ge(p),...Z(p)}}function we(p,o){return()=>{let i={parse:o,json:o,getType:()=>p};return{...ge(i),...Z(i)}}}function Ji(p){let o=new Set(p);return we(D.ENUM,(t,{allowUnrecognizedEnumValues:s,breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:J(t,"string")}]}:!o.has(t)&&!s?{ok:!1,errors:[{path:r,message:J(t,"enum")}]}:{ok:!0,value:t})()}function Ts(p){return Ji(p).transform({transform:o=>o,untransform:o=>o})}function Os(p){let o=la(p);return{...o,...Z(o)}}function la(p){return{parse:(o,i)=>mi(p).parse(o,i),json:(o,i)=>mi(p).json(o,i),getType:()=>mi(p).getType()}}function mi(p){let o=p;return o.__zurg_memoized==null&&(o.__zurg_memoized=p()),o.__zurg_memoized}function pa(p){return Object.entries(p)}function Zi(p,o){let i=new Set(o);return Object.entries(p).reduce((t,[s,r])=>(i.has(s)&&(t[s]=r),t),{})}function dr(p){if(typeof p!="object"||p===null)return!1;let o=Object.getPrototypeOf(p);return o===null?!0:Object.getPrototypeOf(o)===null}function Yi(p){return Object.keys(p)}function ks(p,o){let i=[],t=[];for(let s of p)o(s)?i.push(s):t.push(s);return[i,t]}var bb=Object.prototype.hasOwnProperty;function We(p){return{withParsedProperties:o=>ua(p,o)}}function ua(p,o){let i={parse:(t,s)=>{let r=p.parse(t,s);if(!r.ok)return r;let n={};for(let d in o)if(bb.call(o,d)){let g=o[d];n[d]=typeof g=="function"?g(r.value):g}return{ok:!0,value:{...r.value,...n}}},json:(t,s)=>{if(!dr(t))return{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:J(t,"object")}]};let r=new Set(Object.keys(o)),n=Zi(t,Object.keys(t).filter(d=>!r.has(d)));return p.json(n,s)},getType:()=>p.getType()};return{...i,...Z(i),...We(i)}}function Bs(p,o){return{rawKey:p,valueSchema:o,isProperty:!0}}function mr(p){return p.isProperty}var zb=Object.prototype.hasOwnProperty;function mo(p){let o;function i(){if(o==null){o={};for(let[w,U]of pa(p)){let v=mr(U)?U.rawKey:w,O=mr(U)?U.valueSchema:U;o[v]={rawKey:v,parsedKey:w,valueSchema:O}}}return o}let t,s,r,n;function d(){if(t==null){t=[],s=[];for(let[w,U]of pa(p)){let v=mr(U)?U.rawKey:w,O=mr(U)?U.valueSchema:U;Rb(O)&&(t.push(v),s.push(w))}r=new Set(t),n=new Set(s)}return t}function g(){return s==null&&d(),s}function h(){return r==null&&d(),r}function l(){return n==null&&d(),n}let y={_getRawProperties:()=>Object.entries(p).map(([w,U])=>mr(U)?U.rawKey:w),_getParsedProperties:()=>Yi(p),parse:(w,U)=>{let v=U?.breadcrumbsPrefix??[];return js({value:w,requiredKeys:d(),requiredKeysSet:h(),getProperty:O=>{let B=i()[O];if(B!=null)return{transformedKey:B.parsedKey,transform:j=>{let $=[...v,O];return B.valueSchema.parse(j,{...U,breadcrumbsPrefix:$})}}},unrecognizedObjectKeys:U?.unrecognizedObjectKeys,skipValidation:U?.skipValidation,breadcrumbsPrefix:v,omitUndefined:U?.omitUndefined})},json:(w,U)=>{let v=U?.breadcrumbsPrefix??[];return js({value:w,requiredKeys:g(),requiredKeysSet:l(),getProperty:O=>{let B=p[O];if(B!=null)return mr(B)?{transformedKey:B.rawKey,transform:j=>{let $=[...v,O];return B.valueSchema.json(j,{...U,breadcrumbsPrefix:$})}}:{transformedKey:O,transform:j=>{let $=[...v,O];return B.json(j,{...U,breadcrumbsPrefix:$})}}},unrecognizedObjectKeys:U?.unrecognizedObjectKeys,skipValidation:U?.skipValidation,breadcrumbsPrefix:v,omitUndefined:U?.omitUndefined})},getType:()=>D.OBJECT};return{...ge(y),...Z(y),...We(y),...Qr(y)}}function js({value:p,requiredKeys:o,requiredKeysSet:i,getProperty:t,unrecognizedObjectKeys:s="fail",skipValidation:r=!1,breadcrumbsPrefix:n=[]}){if(!dr(p))return{ok:!1,errors:[{path:n,message:J(p,"object")}]};let d=o.length,g=[],h={};for(let l in p){if(!zb.call(p,l))continue;let y=p[l],w=t(l);if(w!=null){d>0&&i.has(l)&&d--;let U=w.transform(y);U.ok?h[w.transformedKey]=U.value:(h[l]=y,g.push(...U.errors))}else switch(s){case"fail":g.push({path:[...n,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":h[l]=y;break}}if(d>0)for(let l of o)l in p||g.push({path:n,message:`Missing required key "${l}"`});return g.length===0||r?{ok:!0,value:h}:{ok:!1,errors:g}}function Qr(p){return{extend:o=>{let i={_getParsedProperties:()=>[...p._getParsedProperties(),...o._getParsedProperties()],_getRawProperties:()=>[...p._getRawProperties(),...o._getRawProperties()],parse:(t,s)=>As({extensionKeys:o._getRawProperties(),value:t,transformBase:r=>p.parse(r,s),transformExtension:r=>o.parse(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(t,s)=>As({extensionKeys:o._getParsedProperties(),value:t,transformBase:r=>p.json(r,s),transformExtension:r=>o.json(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.OBJECT};return{...i,...Z(i),...We(i),...Qr(i)}},passthrough:()=>{let o=new Set(p._getRawProperties()),i=new Set(p._getParsedProperties()),t={_getParsedProperties:()=>p._getParsedProperties(),_getRawProperties:()=>p._getRawProperties(),parse:(s,r)=>{let n=p.parse(s,{...r,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let d={};if(typeof s=="object"&&s!=null)for(let[g,h]of Object.entries(s))o.has(g)||(d[g]=h);return{ok:!0,value:{...d,...n.value}}},json:(s,r)=>{let n=p.json(s,{...r,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let d={};if(typeof s=="object"&&s!=null)for(let[g,h]of Object.entries(s))i.has(g)||(d[g]=h);return{ok:!0,value:{...d,...n.value}}},getType:()=>D.OBJECT};return{...t,...Z(t),...We(t),...Qr(t)}}}}function As({extensionKeys:p,value:o,transformBase:i,transformExtension:t,breadcrumbsPrefix:s=[]}){if(!dr(o))return{ok:!1,errors:[{path:s,message:J(o,"object")}]};let r=new Set(p),[n,d]=ks(Yi(o),l=>r.has(l)),g=i(Zi(o,d)),h=t(Zi(o,n));return g.ok&&h.ok?{ok:!0,value:{...g.value,...h.value}}:{ok:!1,errors:[...g.ok?[]:g.errors,...h.ok?[]:h.errors]}}function Rb(p){return!fb(p)}function fb(p){switch(p.getType()){case D.ANY:case D.UNKNOWN:case D.OPTIONAL:case D.OPTIONAL_NULLABLE:return!0;default:return!1}}function Vs(p){return mo(p)}function qs(p){let o={...la(p),_getRawProperties:()=>mi(p)._getRawProperties(),_getParsedProperties:()=>mi(p)._getParsedProperties()};return{...o,...Z(o),...We(o),...Qr(o)}}function ho(p){let o={parse:(i,t)=>Ds(i,(s,r)=>p.parse(s,{...t,breadcrumbsPrefix:[...t?.breadcrumbsPrefix??[],`[${r}]`]})),json:(i,t)=>Ds(i,(s,r)=>p.json(s,{...t,breadcrumbsPrefix:[...t?.breadcrumbsPrefix??[],`[${r}]`]})),getType:()=>D.LIST};return{...ge(o),...Z(o)}}function Ds(p,o){if(!Array.isArray(p))return{ok:!1,errors:[{message:J(p,"list"),path:[]}]};let i=[],t=[];for(let s=0;s<p.length;s++){let r=o(p[s],s);r.ok?i.push(r.value):t.push(...r.errors)}return t.length===0?{ok:!0,value:i}:{ok:!1,errors:t}}function Ms(p){return we(D.BOOLEAN_LITERAL,(i,{breadcrumbsPrefix:t=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:t,message:J(i,`${p.toString()}`)}]})()}function Is(p){return we(D.STRING_LITERAL,(i,{breadcrumbsPrefix:t=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:t,message:J(i,`"${p}"`)}]})()}var Fs=we(D.ANY,p=>({ok:!0,value:p}));var Ks=we(D.BOOLEAN,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="boolean"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:J(p,"boolean")}]});var Ls=we(D.NEVER,(p,{breadcrumbsPrefix:o=[]}={})=>({ok:!1,errors:[{path:o,message:"Expected never"}]}));var Gs=we(D.NUMBER,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="number"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:J(p,"number")}]});var Ws=we(D.STRING,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="string"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:J(p,"string")}]});var Hs=we(D.UNKNOWN,p=>({ok:!0,value:p}));var _b=Object.prototype.hasOwnProperty;function Ns(p,o){let i={parse:(t,s)=>go({value:t,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(t,s)=>go({value:t,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.RECORD};return{...ge(i),...Z(i)}}function $s(p,o){let i={parse:(t,s)=>go({value:t,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(t,s)=>go({value:t,isKeyNumeric:p.getType()===D.NUMBER,transformKey:r=>p.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,n)=>o.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${n}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>D.RECORD};return{...ge(i),...Z(i)}}function go({value:p,isKeyNumeric:o,transformKey:i,transformValue:t,breadcrumbsPrefix:s=[]}){if(!dr(p))return{ok:!1,errors:[{path:s,message:J(p,"object")}]};let r={},n=[];for(let d in p){if(!_b.call(p,d))continue;let g=p[d];if(g===void 0)continue;let h=d;if(o){let w=d.length>0?Number(d):NaN;Number.isNaN(w)||(h=w)}let l=i(h),y=t(g,h);l.ok&&y.ok?r[l.value]=y.value:(l.ok||n.push(...l.errors),y.ok||n.push(...y.errors))}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function Js(p){let o=ho(p),i={parse:(t,s)=>{let r=o.parse(t,s);return r.ok?{ok:!0,value:new Set(r.value)}:r},json:(t,s)=>t instanceof Set?o.json([...t],s):{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:J(t,"Set")}]},getType:()=>D.SET};return{...ge(i),...Z(i)}}function Ys(p){let o={parse:(i,t)=>Zs((s,r)=>s.parse(i,r),p,t),json:(i,t)=>Zs((s,r)=>s.json(i,r),p,t),getType:()=>D.UNDISCRIMINATED_UNION};return{...ge(o),...Z(o)}}function Zs(p,o,i){let t=[];for(let[s,r]of o.entries()){let n=p(r,{...i,skipValidation:!1});if(n.ok)return n;for(let d of n.errors)t.push({path:d.path,message:`[Variant ${s}] ${d.message}`})}return{ok:!1,errors:t}}function Qs(p,o){return{parsedDiscriminant:p,rawDiscriminant:o}}var Sb=Object.prototype.hasOwnProperty;function ec(p,o){let i=typeof p=="string"?p:p.rawDiscriminant,t=typeof p=="string"?p:p.parsedDiscriminant,s=Ji(Yi(o)),r={parse:(n,d)=>Xs({value:n,discriminant:i,transformedDiscriminant:t,transformDiscriminantValue:g=>s.parse(g,{allowUnrecognizedEnumValues:d?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...d?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:g=>o[g],allowUnrecognizedUnionMembers:d?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,h)=>h.parse(g,d),breadcrumbsPrefix:d?.breadcrumbsPrefix}),json:(n,d)=>Xs({value:n,discriminant:t,transformedDiscriminant:i,transformDiscriminantValue:g=>s.json(g,{allowUnrecognizedEnumValues:d?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...d?.breadcrumbsPrefix??[],t]}),getAdditionalPropertiesSchema:g=>o[g],allowUnrecognizedUnionMembers:d?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,h)=>h.json(g,d),breadcrumbsPrefix:d?.breadcrumbsPrefix}),getType:()=>D.UNION};return{...ge(r),...Z(r),...We(r)}}function Xs({value:p,discriminant:o,transformedDiscriminant:i,transformDiscriminantValue:t,getAdditionalPropertiesSchema:s,allowUnrecognizedUnionMembers:r=!1,transformAdditionalProperties:n,breadcrumbsPrefix:d=[]}){if(!dr(p))return{ok:!1,errors:[{path:d,message:J(p,"object")}]};let g=p[o],h={};for(let U in p)Sb.call(p,U)&&U!==o&&(h[U]=p[U]);if(g==null)return{ok:!1,errors:[{path:d,message:`Missing discriminant ("${o}")`}]};let l=t(g);if(!l.ok)return{ok:!1,errors:l.errors};let y=s(l.value);if(y==null)return r?{ok:!0,value:{[i]:l.value,...h}}:{ok:!1,errors:[{path:[...d,o],message:"Unexpected discriminant value"}]};let w=n(h,y);return w.ok?{ok:!0,value:{[i]:g,...w.value}}:w}var u={};pr(u,{encodePathParam:()=>rc,join:()=>lo,queryBuilder:()=>ic,toQueryString:()=>ur});function rc(p){if(p===null)return"null";switch(typeof p){case"undefined":return"undefined";case"string":case"number":case"boolean":break;default:p=String(p);break}return encodeURIComponent(p)}function ic(){return new da}var da=class{constructor(){this.parts=new Map}add(o,i,t){if(i==null)return this;let s=ur({[o]:i},{arrayFormat:t?.style==="comma"?"comma":"repeat"});return s.length>0&&this.parts.set(o,s),this}addMany(o){if(o!=null)for(let[i,t]of Object.entries(o))this.add(i,t);return this}mergeAdditional(o){if(o!=null)for(let[i,t]of Object.entries(o)){if(t==null)continue;let s=ur({[i]:t},{arrayFormat:"repeat"});s.length>0&&this.parts.set(i,s)}return this}build(){return[...this.parts.values()].join("&")}};var ma="apiKey",Pb="X-Schematic-Api-Key",hi=class p{constructor(o){this.options=o}static canCreate(o){return o?.[ma]!=null}async getAuthRequest({endpointMetadata:o}={}){let i=await m.get(this.options[ma]);if(i==null)throw new b({message:p.AUTH_CONFIG_ERROR_MESSAGE});return{headers:{[Pb]:i}}}};(t=>{t.AUTH_SCHEME="ApiKeyAuth",t.AUTH_CONFIG_ERROR_MESSAGE=`Please provide '${ma}' when initializing the client`;function i(s){return new t(s)}t.createInstance=i})(hi||={});function P(...p){let o={};for(let[i,t]of p.filter(s=>s!=null).flatMap(s=>Object.entries(s))){let s=i.toLowerCase();t!=null?o[s]=t:s in o&&delete o[s]}return o}function xb(p){let o=P({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.4.7","User-Agent":"@schematichq/schematic-typescript-node/1.4.7","X-Fern-Runtime":Re.type,"X-Fern-Runtime-Version":Re.version},p?.headers);return{...p,logging:po.createLogger(p?.logging),headers:o}}function I(p){let o=xb(p);if(p.auth===!1)return o.authProvider=new oi,o;if(p.auth!=null){if(typeof p.auth=="function")return o.authProvider={getAuthRequest:p.auth},o;if(Qt(p.auth))return o.authProvider=p.auth,o;Object.assign(o,p.auth)}let i=Eb(o);return o.authProvider??=new hi(i),o}function Eb(p){return{...p,authProvider:new oi}}var x={Default:"https://api.schematichq.com"};function C(p,o,i,t){switch(p.reason){case"non-json":throw new b({statusCode:p.statusCode,body:p.rawBody,rawResponse:o});case"body-is-null":throw new b({statusCode:p.statusCode,rawResponse:o});case"timeout":throw new Jr(`Timeout exceeded when calling ${i} ${t}.`,{cause:p.cause});case"unknown":throw new b({message:p.errorMessage,rawResponse:o,cause:p.cause});default:throw new b({message:"Unknown error",rawResponse:o})}}var ha=e.object({lookup:e.record(e.string(),e.string())});var oc=e.stringLiteral("company");var tc=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",oc),token:e.string(),updatedAt:e.property("updated_at",e.date())});var ac=e.object({data:tc,params:e.record(e.string(),e.unknown())});var ga=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string(),readonly:e.boolean().optional()});var _r=e.enum_(["development","production","staging"]);var ya=e.object({environmentType:e.property("environment_type",_r),name:e.string()});var wa=e.object({description:e.string().optional(),name:e.string().optional()});var ba=e.object({environmentType:e.property("environment_type",_r.optional()),name:e.string().optional()});var nc=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var V=e.object({count:e.number().optional()});var sc=e.object({data:V,params:nc});var Se=e.enum_(["api_key","app_user","stripe_app","system","temporary_access_token"]);var cc=e.object({actorType:e.property("actor_type",Se.optional()),endTime:e.property("end_time",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),startTime:e.property("start_time",e.date().optional())});var lc=e.object({data:V,params:cc});var Qe=e.enum_(["active","created","pending"]);var ke=e.enum_(["clerk","orb","stripe","unknown","workos"]);var yo=e.object({id:e.string(),state:Qe,type:ke});var wo=e.enum_(["admin","capture","read","write"]);var fe=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",_r),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var pc=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environment:fe.optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),integration:yo.optional(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),readonly:e.boolean(),scopes:e.list(wo),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var uc=e.object({data:pc,params:e.record(e.string(),e.unknown())});var _e=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environment:fe.optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),integration:yo.optional(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),readonly:e.boolean(),scopes:e.list(wo),updatedAt:e.property("updated_at",e.date())});var dc=e.object({apiKeys:e.property("api_keys",e.list(_e)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",_r),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var mc=e.object({data:dc,params:e.record(e.string(),e.unknown())});var K=e.object({deleted:e.boolean().optional()});var hc=e.object({data:K,params:e.record(e.string(),e.unknown())});var gc=e.object({data:K,params:e.record(e.string(),e.unknown())});var yc=e.enum_(["billing_credits_edit","companies_edit","company_users_edit","components_edit","data_exports_edit","features_edit","flag_rules_edit","flags_edit","overrides_edit","plan_billing_edit","plan_entitlements_edit","plan_versions_edit","plans_edit","webhooks_edit","webhooks_reveal_secret"]);var wc=e.enum_(["admin","member"]);var Sr=e.object({createdAt:e.property("created_at",e.date()),email:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string().optional(),permissions:e.record(e.string(),e.list(yc)),role:wc.optional(),updatedAt:e.property("updated_at",e.date())});var bc=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var zc=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Rc=e.object({actorType:e.property("actor_type",Se),apiKey:e.property("api_key",_e.optional()),apiKeyId:e.property("api_key_id",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),environment:fe.optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respBody:e.property("resp_body",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var fc=e.object({data:Rc,params:e.record(e.string(),e.unknown())});var _c=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Sc=e.object({accountId:e.property("account_id",e.string()),accountName:e.property("account_name",e.string()),actorType:e.property("actor_type",Se),apiKeyId:e.property("api_key_id",e.string().optional()),environmentId:e.property("environment_id",e.string().optional()),environments:e.list(fe),stripeUserId:e.property("stripe_user_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Pc=e.object({data:Sc,params:e.record(e.string(),e.unknown())});var xc=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ec=e.object({data:e.list(Sr),params:xc});var Cc=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var Uc=e.object({data:e.list(_e),params:Cc});var vc=e.object({actorType:e.property("actor_type",Se.optional()),endTime:e.property("end_time",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),startTime:e.property("start_time",e.date().optional())});var bo=e.object({actorType:e.property("actor_type",Se),apiKey:e.property("api_key",_e.optional()),apiKeyId:e.property("api_key_id",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),environment:fe.optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userName:e.property("user_name",e.string().optional())});var Tc=e.object({data:e.list(bo),params:vc});var Oc=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var kc=e.object({data:e.list(fe),params:Oc});var Bc=e.object({ok:e.boolean()});var jc=e.object({data:Bc,params:e.record(e.string(),e.unknown())});var Ac=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Vc=e.object({data:fe,params:e.record(e.string(),e.unknown())});var k=e.enum_(["orb","schematic","stripe"]);var za=e.object({companyId:e.property("company_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),email:e.string(),externalId:e.property("external_id",e.string()),meta:e.record(e.string(),e.string()),name:e.string(),providerType:e.property("provider_type",k.optional())});var Xe=e.enum_(["per_unit","tiered"]);var ne=e.enum_(["licensed","metered"]);var pe=e.enum_(["graduated","volume"]);var qc=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitDecimal:e.property("per_unit_decimal",e.string().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),priceExternalId:e.property("price_external_id",e.string()),providerType:e.property("provider_type",k.optional()),upTo:e.property("up_to",e.number().optional())});var Ra=e.object({billingScheme:e.property("billing_scheme",Xe),currency:e.string(),externalAccountId:e.property("external_account_id",e.string()),interval:e.string(),intervalCount:e.property("interval_count",e.number().optional()),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),nickname:e.string().optional(),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceTiers:e.property("price_tiers",e.list(qc)),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",k.optional()),tiersMode:e.property("tiers_mode",pe.optional()),usageType:e.property("usage_type",ne)});var fa=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string().optional(),price:e.number(),providerType:e.property("provider_type",k.optional())});var Dc=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),usageType:e.property("usage_type",ne)});var Mc=e.object({couponExternalId:e.property("coupon_external_id",e.string()),customerFacingCode:e.property("customer_facing_code",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date())});var Pr=e.enum_(["cancel","subscribe"]);var _a=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodExternalId:e.property("default_payment_method_external_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Mc),expiredAt:e.property("expired_at",e.date()),interval:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number().optional()),periodStart:e.property("period_start",e.number().optional()),productExternalIds:e.property("product_external_ids",e.list(Dc)),providerType:e.property("provider_type",k.optional()),status:e.string().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",Pr.optional())});var Sa=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),externalId:e.property("external_id",e.string()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var zo=e.enum_(["draft","open","paid","uncollectible","void"]);var Pa=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),externalId:e.property("external_id",e.string().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),status:zo.optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var xa=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalId:e.property("external_id",e.string()),providerType:e.property("provider_type",k.optional())});var Ea=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),externalId:e.property("external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var Ic=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",ne.optional()),providerType:e.property("provider_type",k.optional()),q:e.string().optional(),recurringChargesOnly:e.property("recurring_charges_only",e.boolean().optional()),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Fc=e.object({data:V,params:Ic});var Kc=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",k.optional()),q:e.string().optional()});var Lc=e.object({data:V,params:Kc});var Gc=e.object({data:K,params:e.record(e.string(),e.unknown())});var Wc=e.object({data:K,params:e.record(e.string(),e.unknown())});var Hc=e.object({data:K,params:e.record(e.string(),e.unknown())});var Nc=e.object({currency:e.string().optional(),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),productIds:e.property("product_ids",e.list(e.string()).optional()),providerType:e.property("provider_type",k.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",pe.optional()),usageType:e.property("usage_type",ne.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var gi=e.enum_(["day","month","one-time","year"]);var Ro=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var H=e.object({billingScheme:e.property("billing_scheme",Xe),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:gi,intervalCount:e.property("interval_count",e.number()),isActive:e.property("is_active",e.boolean()),meterEventName:e.property("meter_event_name",e.string().optional()),meterEventPayloadKey:e.property("meter_event_payload_key",e.string().optional()),meterId:e.property("meter_id",e.string().optional()),nickname:e.string().optional(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Ro)),productExternalId:e.property("product_external_id",e.string()),productId:e.property("product_id",e.string()),productName:e.property("product_name",e.string()),providerType:e.property("provider_type",k),tiersMode:e.property("tiers_mode",pe.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",ne)});var $c=e.object({data:e.list(H),params:Nc});var Jc=e.object({currency:e.string().optional(),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),productIds:e.property("product_ids",e.list(e.string()).optional()),providerType:e.property("provider_type",k.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",pe.optional()),usageType:e.property("usage_type",ne.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Zc=e.object({data:e.list(H),params:Jc});var Yc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",ne.optional()),providerType:e.property("provider_type",k.optional()),q:e.string().optional(),recurringChargesOnly:e.property("recurring_charges_only",e.boolean().optional()),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var L=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:gi,intervalCount:e.property("interval_count",e.number()),nickname:e.string().optional(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),providerType:e.property("provider_type",k),scheme:Xe});var er=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),prices:e.list(L),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",k),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var Qc=e.object({data:e.list(er),params:Yc});var Xc=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var fo=e.object({accountId:e.property("account_id",e.string()),amountOff:e.property("amount_off",e.number().optional()),currency:e.string().optional(),duration:e.string().optional(),durationInMonths:e.property("duration_in_months",e.number().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),isActive:e.property("is_active",e.boolean()),maxRedemptions:e.property("max_redemptions",e.number().optional()),metadata:e.record(e.string(),e.unknown()),name:e.string(),percentOff:e.property("percent_off",e.number().optional()),providerType:e.property("provider_type",k),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var el=e.object({data:e.list(fo),params:Xc});var rl=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",k.optional()),q:e.string().optional()});var il=e.object({currency:e.string(),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),meteredUsage:e.property("metered_usage",e.boolean()),perUnitPrice:e.property("per_unit_price",e.number()),totalPrice:e.property("total_price",e.number())});var ol=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",k),subscriptions:e.list(il),updatedAt:e.property("updated_at",e.date())});var tl=e.object({data:e.list(ol),params:rl});var al=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional())});var He=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string().optional()),id:e.string(),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),providerType:e.property("provider_type",k),status:zo.optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var nl=e.object({data:e.list(He),params:al});var sl=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var _o=e.object({dispalyName:e.property("dispaly_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),providerType:e.property("provider_type",k)});var cl=e.object({data:e.list(_o),params:sl});var ll=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Ne=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),customerExternalId:e.property("customer_external_id",e.string()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),paymentMethodType:e.property("payment_method_type",e.string()),providerType:e.property("provider_type",k),updatedAt:e.property("updated_at",e.date())});var pl=e.object({data:e.list(Ne),params:ll});var ul=e.object({data:fo,params:e.record(e.string(),e.unknown())});var dl=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",k),updatedAt:e.property("updated_at",e.date())});var ml=e.object({data:dl,params:e.record(e.string(),e.unknown())});var hl=e.object({data:_o,params:e.record(e.string(),e.unknown())});var gl=e.object({data:L,params:e.record(e.string(),e.unknown())});var xr=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",k),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var yl=e.object({data:xr,params:e.record(e.string(),e.unknown())});var wl=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),providerType:e.property("provider_type",k),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",Pr.optional())});var bl=e.object({data:wl,params:e.record(e.string(),e.unknown())});var zl=e.object({data:He,params:e.record(e.string(),e.unknown())});var Rl=e.object({data:Ne,params:e.record(e.string(),e.unknown())});var Ca=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var Ua=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var va=e.object({trialEnd:e.property("trial_end",e.date().optional())});var So=e.object({billingScheme:e.property("billing_scheme",Xe),billingThreshold:e.property("billing_threshold",e.number().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),interval:e.string(),intervalCount:e.property("interval_count",e.number().optional()),meterId:e.property("meter_id",e.string().optional()),name:e.string(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Ro)),providerType:e.property("provider_type",k),quantity:e.number(),subscriptionId:e.property("subscription_id",e.string()),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",ne)});var Po=e.object({amountOff:e.property("amount_off",e.number().optional()),couponId:e.property("coupon_id",e.string()),couponName:e.property("coupon_name",e.string()),currency:e.string().optional(),customerFacingCode:e.property("customer_facing_code",e.string().optional()),discountExternalId:e.property("discount_external_id",e.string()),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number().optional()),endedAt:e.property("ended_at",e.date().optional()),isActive:e.property("is_active",e.boolean()),percentOff:e.property("percent_off",e.number().optional()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date()),subscriptionExternalId:e.property("subscription_external_id",e.string())});var Qi=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Po),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",He.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",Ne.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(So),providerType:e.property("provider_type",k),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",Pr.optional())});var W=e.enum_(["all_time","current_day","current_month","current_week"]);var N=e.enum_(["billing_cycle","first_of_month"]);var fl=e.object({accountId:e.property("account_id",e.string()),capturedAtMax:e.property("captured_at_max",e.date()),capturedAtMin:e.property("captured_at_min",e.date()),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string()),monthReset:e.property("month_reset",N),period:W,validUntil:e.property("valid_until",e.date().optional()),value:e.number()});var Y=e.enum_(["duration","end_of_billing_period","end_of_next_billing_period","end_of_trial","no_expiry"]);var G=e.enum_(["billing_periods","days"]);var Er=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var Cr=e.enum_(["expire","none","rollover"]);var _l=e.object({currency:e.string(),price:H.optional()});var xo=e.object({accountId:e.property("account_id",e.string()),burnStrategy:e.property("burn_strategy",Er),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(_l)),defaultExpiryUnit:e.property("default_expiry_unit",G),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Cr),description:e.string(),environmentId:e.property("environment_id",e.string()),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:H.optional(),pricePerUnit:e.property("price_per_unit",e.number().optional()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),product:xr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ee=e.enum_(["daily","monthly","weekly","yearly"]);var Be=e.enum_(["billing_period","first_of_month"]);var rr=e.enum_(["no_reset","plan_period"]);var yi=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Sl=e.object({billingCreditAutoTopupAmount:e.property("billing_credit_auto_topup_amount",e.number().optional()),billingCreditAutoTopupAmountType:e.property("billing_credit_auto_topup_amount_type",e.string().optional()),billingCreditAutoTopupEnabled:e.property("billing_credit_auto_topup_enabled",e.boolean()),billingCreditAutoTopupExpiryType:e.property("billing_credit_auto_topup_expiry_type",Y.optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",G.optional()),billingCreditAutoTopupExpiryUnitCount:e.property("billing_credit_auto_topup_expiry_unit_count",e.number().optional()),billingCreditAutoTopupSelfService:e.property("billing_credit_auto_topup_self_service",e.boolean()),billingCreditAutoTopupThresholdCredits:e.property("billing_credit_auto_topup_threshold_credits",e.number().optional()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),companyAutoTopupAmount:e.property("company_auto_topup_amount",e.number().optional()),companyAutoTopupEnabled:e.property("company_auto_topup_enabled",e.boolean().optional()),companyAutoTopupThresholdCredits:e.property("company_auto_topup_threshold_credits",e.number().optional()),createdAt:e.property("created_at",e.date()),credit:xo.optional(),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:yi.optional(),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",Ee.optional()),resetStart:e.property("reset_start",Be.optional()),resetType:e.property("reset_type",rr),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ta=e.object({addedOn:e.property("added_on",e.date().optional()),billingProductExternalId:e.property("billing_product_external_id",e.string().optional()),billingProductId:e.property("billing_product_id",e.string().optional()),description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),includedCreditGrants:e.property("included_credit_grants",e.list(Sl)),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var wi=e.enum_(["on_payment","on_publish"]);var hr=e.enum_(["active","expired","paid","pending"]);var Ur=e.object({activationStrategy:e.property("activation_strategy",wi),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),daysUntilDue:e.property("days_until_due",e.number()),externalInvoiceId:e.property("external_invoice_id",e.string().optional()),id:e.string(),paidAt:e.property("paid_at",e.date().optional()),planId:e.property("plan_id",e.string()),publishedAt:e.property("published_at",e.date().optional()),status:hr,stripeInvoiceUrl:e.property("stripe_invoice_url",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ie=e.enum_(["company","user"]);var Eo=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",ie),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var Co=e.object({createdAt:e.property("created_at",e.date()),definition:Eo.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",ie),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var ue=e.enum_(["boolean","currency","date","number","string","url"]);var de=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",ie),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",ue),updatedAt:e.property("updated_at",e.date())});var Uo=e.object({createdAt:e.property("created_at",e.date()),definition:de.optional(),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var ee=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var vo=e.object({allocation:e.number().optional(),creditId:e.property("credit_id",e.string().optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditUsed:e.property("credit_used",e.number().optional()),eventName:e.property("event_name",e.string().optional()),featureId:e.property("feature_id",e.string()),featureKey:e.property("feature_key",e.string()),metricPeriod:e.property("metric_period",W.optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",N.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),valueType:e.property("value_type",ee)});var bi=e.enum_(["eq","gt","gte","is_empty","lt","lte","not_empty","ne"]);var zi=e.enum_(["base_plan","billing_product","company","credit","metric","plan","plan_version","trait","user"]);var Pl=e.enum_(["bool","date","int","string"]);var Oa=e.object({comparableType:e.property("comparable_type",Pl),entityType:e.property("entity_type",ie),id:e.string()});var To=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",Oa.optional()),conditionType:e.property("condition_type",zi),consumptionRate:e.property("consumption_rate",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:bi,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",Oa.optional()),traitValue:e.property("trait_value",e.string())});var xl=e.object({conditions:e.list(To)});var vr=e.enum_(["company_override","company_override_usage_exceeded","default","global_override","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var El=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(xl)),conditions:e.list(To),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",vr),value:e.boolean()});var Oo=e.object({currency:e.string(),effectiveAfter:e.property("effective_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),fromPlanName:e.property("from_plan_name",e.string()),fromSubscriptionPrice:e.property("from_subscription_price",e.number()),id:e.string(),interval:e.string(),scheduledInterval:e.property("scheduled_interval",e.string().optional()),scheduledPrice:e.property("scheduled_price",e.number().optional()),toPlanId:e.property("to_plan_id",e.string()),toPlanName:e.property("to_plan_name",e.string())});var Q=e.object({addOns:e.property("add_ons",e.list(Ta)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Qi.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Qi)),createdAt:e.property("created_at",e.date()),customPlanBillings:e.property("custom_plan_billings",e.list(Ur)),defaultPaymentMethod:e.property("default_payment_method",Ne.optional()),entitlements:e.list(vo),entityTraits:e.property("entity_traits",e.list(Uo)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Co),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(fl),name:e.string(),paymentMethods:e.property("payment_methods",e.list(Ne)),plan:Ta.optional(),plans:e.list(yi),rules:e.list(El),scheduledDowngrade:e.property("scheduled_downgrade",Oo.optional()),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var ko=e.object({company:Q.optional(),success:e.boolean()});var Cl=e.object({data:ko,params:e.record(e.string(),e.unknown())});var Ul=e.object({applicationId:e.property("application_id",e.string().optional()),cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),confirmPaymentIntentClientSecret:e.property("confirm_payment_intent_client_secret",e.string().optional()),confirmPaymentIntentId:e.property("confirm_payment_intent_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),invoiceId:e.property("invoice_id",e.string().optional()),invoiceUrl:e.property("invoice_url",e.string().optional()),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),providerType:e.property("provider_type",k),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",Pr.optional())});var vl=e.object({data:Ul,params:e.record(e.string(),e.unknown())});var Pe=e.enum_(["active","inactive"]);var Oe=e.stringLiteral("fixed");var Tl=e.object({currency:e.string(),price:L.optional()});var je=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",Oe),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),currencyPrices:e.property("currency_prices",e.list(Tl)),expiryType:e.property("expiry_type",Y),expiryUnit:e.property("expiry_unit",G),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:L.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:Pe,unitPrice:e.property("unit_price",L.optional()),updatedAt:e.property("updated_at",e.date())});var Ri=e.object({cancelAt:e.property("cancel_at",e.date().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),discounts:e.list(Po),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",He.optional()),paymentMethod:e.property("payment_method",Ne.optional()),products:e.list(So),providerType:e.property("provider_type",k),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.date().optional())});var Ol=e.object({bundle:je.optional(),quantity:e.number(),total:e.number()});var Ce=e.enum_(["adjustment","billing_credit_auto_topup","free","plan","purchased"]);var kl=e.object({createdAt:e.property("created_at",e.date()),externalUserId:e.property("external_user_id",e.string()),externalUserName:e.property("external_user_name",e.string()),id:e.string(),note:e.string(),updatedAt:e.property("updated_at",e.date())});var Ae=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var se=e.enum_(["boolean","event","trait"]);var Tr=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",se),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ve=e.object({company:Q.optional(),companyId:e.property("company_id",e.string()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expirationDate:e.property("expiration_date",e.date().optional()),feature:Tr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),notes:e.list(kl),ruleId:e.property("rule_id",e.string().optional()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),updatedAt:e.property("updated_at",e.date()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",de.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee)});var fi=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Ce),quantity:e.number()});var _i=e.object({usageThisBillingPeriod:e.property("usage_this_billing_period",e.number().optional()),usageThisCalendarMonth:e.property("usage_this_calendar_month",e.number().optional()),usageThisWeek:e.property("usage_this_week",e.number().optional()),usageToday:e.property("usage_today",e.number().optional())});var be=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var Or=e.enum_(["company_override","plan_entitlement","unknown"]);var Ue=e.object({billingProvider:e.property("billing_provider",k),externalResourceId:e.property("external_resource_id",e.string()),originator:k});var Si=e.object({companyCount:e.property("company_count",e.number()),environmentId:e.property("environment_id",e.string()),eventCount:e.property("event_count",e.number()),eventSubtype:e.property("event_subtype",e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),userCount:e.property("user_count",e.number())});var ir=e.stringLiteral("boolean");var Bo=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var jo=e.object({comparisonTrait:e.property("comparison_trait",de.optional()),comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",zi),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:bi,resourceIds:e.property("resource_ids",e.list(e.string())),resources:e.list(Bo),ruleId:e.property("rule_id",e.string()),trait:de.optional(),traitEntityType:e.property("trait_entity_type",ie.optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Bl=e.object({conditions:e.list(jo),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Pi=e.object({conditionGroups:e.property("condition_groups",e.list(Bl)),conditions:e.list(jo),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",vr),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var jl=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:Tr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),rules:e.list(Pi),updatedAt:e.property("updated_at",e.date())});var kr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var qe=e.object({billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),eventSummary:e.property("event_summary",Si.optional()),featureType:e.property("feature_type",se),flags:e.list(jl),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),plans:e.list(kr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:de.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Al=e.object({currency:e.string(),price:L.optional()});var De=e.object({burnStrategy:e.property("burn_strategy",Er),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(Al)),defaultExpiryUnit:e.property("default_expiry_unit",G),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Cr),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:L.optional(),product:xr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Vl=e.object({currency:e.string(),monthlyPrice:e.property("monthly_price",H.optional()),quarterlyPrice:e.property("quarterly_price",H.optional()),yearlyPrice:e.property("yearly_price",H.optional())});var ce=e.enum_(["amber","blue","blueGray","blueGreen","cyan","emerald","fuchsia","gray","green","indigo","lightBlue","lime","orange","pink","purple","red","redOrange","rose","sky","slate","teal","trueGray","violet","warmGray","yellow"]);var oe=e.enum_(["plan","add_on"]);var or=e.object({audienceType:e.property("audience_type",e.string().optional()),companyId:e.property("company_id",e.string().optional()),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),createdAt:e.property("created_at",e.date()),description:e.string(),icon:ce,id:e.string(),name:e.string(),planType:e.property("plan_type",oe),updatedAt:e.property("updated_at",e.date())});var re=e.object({billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(Vl)),environmentId:e.property("environment_id",e.string()),feature:Tr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",H.optional()),meteredQuarterlyPrice:e.property("metered_quarterly_price",H.optional()),meteredYearlyPrice:e.property("metered_yearly_price",H.optional()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),plan:or.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",be.optional()),ruleId:e.property("rule_id",e.string()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageBasedProduct:e.property("usage_based_product",xr.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",De.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",de.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee)});var Br=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",ee),companyOverride:e.property("company_override",Ve.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(fi).optional()),creditGrantReason:e.property("credit_grant_reason",Ce.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsageAggregation:e.property("credit_usage_aggregation",_i.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",Or),feature:qe.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",N.optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",H.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:W.optional(),plan:or.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",be.optional()),quarterlyUsageBasedPrice:e.property("quarterly_usage_based_price",H.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",H.optional())});var xi=e.object({features:e.list(Br)});var ve=e.object({autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",e.string().optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean()),autoTopupExpiryType:e.property("auto_topup_expiry_type",Y.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupSelfService:e.property("auto_topup_self_service",e.boolean()),autoTopupThresholdCredits:e.property("auto_topup_threshold_credits",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),credit:De.optional(),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),creditPluralName:e.property("credit_plural_name",e.string().optional()),creditSingularName:e.property("credit_singular_name",e.string().optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:Bo.optional(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),resetCadence:e.property("reset_cadence",Ee.optional()),resetStart:e.property("reset_start",Be.optional()),resetType:e.property("reset_type",rr.optional()),updatedAt:e.property("updated_at",e.date())});var Me=e.enum_(["schematic_managed","provider_managed","no_billing"]);var Ie=e.enum_(["free","none","one_time","recurring"]);var jr=e.object({currency:e.string(),monthlyPrice:e.property("monthly_price",L.optional()),oneTimePrice:e.property("one_time_price",L.optional()),quarterlyPrice:e.property("quarterly_price",L.optional()),yearlyPrice:e.property("yearly_price",L.optional())});var ql=e.enum_(["published","draft","archived"]);var ze=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),environmentId:e.property("environment_id",e.string()),icon:ce,id:e.string(),name:e.string(),originalPlanId:e.property("original_plan_id",e.string().optional()),planType:e.property("plan_type",oe),status:ql,updatedAt:e.property("updated_at",e.date()),version:e.number()});var ye=e.object({activeVersion:e.property("active_version",ze.optional()),audienceType:e.property("audience_type",e.string().optional()),billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),billingProduct:e.property("billing_product",er.optional()),billingStrategy:e.property("billing_strategy",Me),chargeType:e.property("charge_type",Ie),companyCount:e.property("company_count",e.number()),companyId:e.property("company_id",e.string().optional()),companyName:e.property("company_name",e.string().optional()),controlledBy:e.property("controlled_by",k),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(jr)),description:e.string(),draftVersion:e.property("draft_version",ze.optional()),entitlements:e.list(re).optional(),features:e.list(qe),icon:ce,id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(ve).optional()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",L.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",L.optional()),planType:e.property("plan_type",oe),quarterlyPrice:e.property("quarterly_price",L.optional()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ze),yearlyPrice:e.property("yearly_price",L.optional())});var Xi=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),meteredPrice:e.property("metered_price",H.optional()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",H.optional()),priceBehavior:e.property("price_behavior",be.optional()),quarterlyUsageBasedPrice:e.property("quarterly_usage_based_price",H.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",ee),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",H.optional())});var Dl=e.object({activeAddOns:e.property("active_add_ons",e.list(ye)),activePlan:e.property("active_plan",ye.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Xi)),availableCreditBundles:e.property("available_credit_bundles",e.list(je)),company:Q.optional(),featureUsage:e.property("feature_usage",xi.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Ol)),selectedPlan:e.property("selected_plan",ye.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(Xi)),subscription:Ri.optional()});var Ml=e.object({data:Dl,params:e.record(e.string(),e.unknown())});var Il=e.object({data:ko,params:e.record(e.string(),e.unknown())});var Fl=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Kl=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),newCharges:e.property("new_charges",e.number()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),taxAmount:e.property("tax_amount",e.number().optional()),taxDisplayName:e.property("tax_display_name",e.string().optional()),taxRequireBillingDetails:e.property("tax_require_billing_details",e.boolean()),totalPerBillingPeriod:e.property("total_per_billing_period",e.number()),trialEnd:e.property("trial_end",e.date().optional()),upcomingInvoiceLineItems:e.property("upcoming_invoice_line_items",e.list(Fl))});var Ao=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Kl.optional(),isScheduledDowngrade:e.property("is_scheduled_downgrade",e.boolean()),newCharges:e.property("new_charges",e.number()),paymentMethodRequired:e.property("payment_method_required",e.boolean()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),scheduledChangeTime:e.property("scheduled_change_time",e.date().optional()),trialEnd:e.property("trial_end",e.date().optional()),usageViolations:e.property("usage_violations",e.list(Br))});var Ll=e.object({data:Ao,params:e.record(e.string(),e.unknown())});var Gl=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Ao.optional())});var Wl=e.object({data:Gl,params:e.record(e.string(),e.unknown())});var Hl=e.object({data:Qi,params:e.record(e.string(),e.unknown())});var ka=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",ie),hierarchy:e.list(e.string()),traitType:e.property("trait_type",ue)});var Ba=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var ja=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",ue)});var Ei=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Aa=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(Ei)});var Te=e.enum_(["asc","desc"]);var gr=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var yr=e.enum_(["free","one_time","paid","trial"]);var Nl=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),hasScheduledDowngrade:e.property("has_scheduled_downgrade",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",Te.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(gr).optional()),subscriptionTypes:e.property("subscription_types",e.list(yr).optional()),withEntitlementFor:e.property("with_entitlement_for",e.string().optional()),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var $l=e.object({data:V,params:Nl});var Jl=e.object({entityType:e.property("entity_type",ie.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Zl=e.object({data:V,params:Jl});var Yl=e.object({entityType:e.property("entity_type",ie.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",ue.optional()),traitTypes:e.property("trait_types",e.list(ue).optional())});var Ql=e.object({data:V,params:Yl});var Xl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var ep=e.object({data:V,params:Xl});var rp=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var ip=e.object({data:V,params:rp});var op=e.object({data:Q,params:e.record(e.string(),e.unknown())});var Ci=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Ui=e.object({company:Ci.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var Fe=e.object({companyMemberships:e.property("company_memberships",e.list(Ui)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(Uo)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Co),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date())});var tp=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var ap=e.object({data:Ci,params:e.record(e.string(),e.unknown())});var np=e.object({data:K,params:e.record(e.string(),e.unknown())});var sp=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var cp=e.object({data:K,params:sp});var Vo=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var lp=e.object({data:Vo,params:e.record(e.string(),e.unknown())});var pp=e.object({data:K,params:e.record(e.string(),e.unknown())});var up=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional()});var dp=e.object({data:e.list(Ri),params:up});var mp=e.object({data:Q,params:e.record(e.string(),e.unknown())});var hp=e.object({data:de,params:e.record(e.string(),e.unknown())});var gp=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var yp=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var wp=e.object({data:e.list(yp),params:gp});var bp=e.object({data:Ui,params:e.record(e.string(),e.unknown())});var zp=e.object({data:de,params:e.record(e.string(),e.unknown())});var vi=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","plan_trait_change","plan_version_migration","quickstart","subscription_change"]);var Ti=e.enum_(["fallback","initial","trait","trial_expiry"]);var Rp=e.enum_(["adjustment","downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var eo=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Va=e.object({id:e.string(),name:e.string(),version:e.number()});var fp=e.object({featureId:e.property("feature_id",e.string()),hierarchy:e.list(e.string()),reason:e.string(),traitId:e.property("trait_id",e.string()),traitName:e.property("trait_name",e.string()),traitType:e.property("trait_type",ue),value:e.string()});var qo=e.object({action:vi,actorType:e.property("actor_type",Se),addOnsAdded:e.property("add_ons_added",e.list(eo)),addOnsRemoved:e.property("add_ons_removed",e.list(eo)),apiKey:e.property("api_key",_e.optional()),auditLog:e.property("audit_log",bo.optional()),basePlan:e.property("base_plan",eo.optional()),basePlanAction:e.property("base_plan_action",Ti.optional()),basePlanVersion:e.property("base_plan_version",Va.optional()),company:Ci.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),previousBasePlan:e.property("previous_base_plan",eo.optional()),previousBasePlanVersion:e.property("previous_base_plan_version",Va.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",Rp.optional()),traitsUpdated:e.property("traits_updated",e.list(fp)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var _p=e.object({data:qo,params:e.record(e.string(),e.unknown())});var Ar=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),planId:e.property("plan_id",e.string()),planType:e.property("plan_type",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Sp=e.object({data:Ar,params:e.record(e.string(),e.unknown())});var Pp=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var xp=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),hasScheduledDowngrade:e.property("has_scheduled_downgrade",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",Te.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(gr).optional()),subscriptionTypes:e.property("subscription_types",e.list(yr).optional()),withEntitlementFor:e.property("with_entitlement_for",e.string().optional()),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Ep=e.object({data:e.list(Q),params:xp});var Cp=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var Up=e.object({data:e.list(Ui),params:Cp});var vp=e.object({entityType:e.property("entity_type",ie.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Tp=e.object({data:e.list(Eo),params:vp});var Op=e.object({entityType:e.property("entity_type",ie.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",ue.optional()),traitTypes:e.property("trait_types",e.list(ue).optional())});var kp=e.object({data:e.list(de),params:Op});var Bp=e.object({action:vi.optional(),basePlanAction:e.property("base_plan_action",Ti.optional()),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional())});var jp=e.object({data:e.list(qo),params:Bp});var Ap=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var Vp=e.object({data:e.list(Ar),params:Ap});var qp=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var Dp=e.object({data:e.list(Fe),params:qp});var Mp=e.object({keys:e.record(e.string(),e.string()).optional()});var Ip=e.object({data:Q,params:Mp});var Fp=e.object({keys:e.record(e.string(),e.string()).optional()});var Kp=e.object({data:Fe,params:Fp});var Lp=e.object({data:de,params:e.record(e.string(),e.unknown())});var Gp=e.object({data:e.list(Ar),params:e.record(e.string(),e.unknown())});var Wp=e.object({data:Q,params:e.record(e.string(),e.unknown())});var Hp=e.object({data:Q,params:e.record(e.string(),e.unknown())});var Np=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var $p=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var Oi=e.enum_(["billing","entitlement"]);var qa=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Oi),name:e.string()});var Do=e.enum_(["draft","live"]);var Da=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Oi.optional()),name:e.string().optional(),state:Do.optional()});var Jp=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Zp=e.object({data:V,params:Jp});var tr=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:Do,type:Oi,updatedAt:e.property("updated_at",e.date())});var Yp=e.object({data:tr,params:e.record(e.string(),e.unknown())});var Qp=e.object({data:K,params:e.record(e.string(),e.unknown())});var Xp=e.object({data:tr,params:e.record(e.string(),e.unknown())});var eu=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ru=e.object({data:e.list(tr),params:eu});var iu=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var ro=e.object({billingScheme:e.property("billing_scheme",Xe),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:gi,intervalCount:e.property("interval_count",e.number()),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),nickname:e.string().optional(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",k),tiersMode:e.property("tiers_mode",pe.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",ne)});var ou=e.object({currency:e.string(),price:H.optional()});var tu=e.object({bundleType:e.property("bundle_type",Oe),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),currencyPrices:e.property("currency_prices",e.list(ou)),expiryType:e.property("expiry_type",Y),expiryUnit:e.property("expiry_unit",G),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:ro.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:Pe,unitPrice:e.property("unit_price",ro.optional()),updatedAt:e.property("updated_at",e.date())});var au=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var Vr=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var Mo=e.object({billingCreditAutoTopupAmount:e.property("billing_credit_auto_topup_amount",e.number().optional()),billingCreditAutoTopupAmountType:e.property("billing_credit_auto_topup_amount_type",e.string().optional()),billingCreditAutoTopupEnabled:e.property("billing_credit_auto_topup_enabled",e.boolean()),billingCreditAutoTopupExpiryType:e.property("billing_credit_auto_topup_expiry_type",Y.optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",G.optional()),billingCreditAutoTopupExpiryUnitCount:e.property("billing_credit_auto_topup_expiry_unit_count",e.number().optional()),billingCreditAutoTopupSelfService:e.property("billing_credit_auto_topup_self_service",e.boolean()),billingCreditAutoTopupThresholdCredits:e.property("billing_credit_auto_topup_threshold_credits",e.number().optional()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),credit:xo.optional(),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:yi.optional(),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",Ee.optional()),resetStart:e.property("reset_start",Be.optional()),resetType:e.property("reset_type",rr),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ki=e.enum_(["monthly","quarterly","yearly"]);var Ma=e.object({activeVersion:e.property("active_version",ze.optional()),audienceType:e.property("audience_type",e.string().optional()),availablePeriods:e.property("available_periods",e.list(ki)),billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),billingProduct:e.property("billing_product",er.optional()),billingStrategy:e.property("billing_strategy",Me),chargeType:e.property("charge_type",Ie),companyCanTrial:e.property("company_can_trial",e.boolean()),companyCount:e.property("company_count",e.number()),companyId:e.property("company_id",e.string().optional()),companyName:e.property("company_name",e.string().optional()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",k),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(jr)),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",Vr.optional()),description:e.string(),draftVersion:e.property("draft_version",ze.optional()),entitlements:e.list(re).optional(),features:e.list(qe),icon:ce,id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Mo)),invalidReason:e.property("invalid_reason",au.optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",L.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",L.optional()),planType:e.property("plan_type",oe),quarterlyPrice:e.property("quarterly_price",L.optional()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(Br)),valid:e.boolean(),versions:e.list(ze),yearlyPrice:e.property("yearly_price",L.optional())});var qr=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Io=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var nu=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean())});var Fo=e.object({showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var Dr=e.enum_(["expired","manual","plan_change","plan_period_reset"]);var su=e.object({amount:e.number(),createdAt:e.property("created_at",e.date()),direction:e.string(),id:e.string(),reason:e.string(),relatedGrantId:e.property("related_grant_id",e.string())});var cu=e.object({billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditName:e.property("credit_name",e.string()),currency:e.string().optional(),exhaustedAt:e.property("exhausted_at",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",Ce),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),price:ro.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",Ee.optional()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(su).optional(),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",Dr.optional())});var lu=e.object({accountId:e.property("account_id",e.string().optional()),publishableKey:e.property("publishable_key",e.string().optional()),schematicPublishableKey:e.property("schematic_publishable_key",e.string()),setupIntentClientSecret:e.property("setup_intent_client_secret",e.string().optional())});var pu=e.object({activeAddOns:e.property("active_add_ons",e.list(Ma)),activePlans:e.property("active_plans",e.list(Ma)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Xi)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qr)),capabilities:Io.optional(),checkoutSettings:e.property("checkout_settings",nu),company:Q.optional(),component:tr.optional(),creditBundles:e.property("credit_bundles",e.list(tu)),creditGrants:e.property("credit_grants",e.list(cu)),defaultPlan:e.property("default_plan",ye.optional()),displaySettings:e.property("display_settings",Fo),featureUsage:e.property("feature_usage",xi.optional()),invoices:e.list(He),postTrialPlan:e.property("post_trial_plan",ye.optional()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),scheduledDowngrade:e.property("scheduled_downgrade",Oo.optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",lu.optional()),subscription:Ri.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",He.optional())});var uu=e.object({data:pu,params:iu});var du=e.object({data:tr,params:e.record(e.string(),e.unknown())});var Ia=e.object({activeVersion:e.property("active_version",ze.optional()),audienceType:e.property("audience_type",e.string().optional()),availablePeriods:e.property("available_periods",e.list(ki)),billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),billingProduct:e.property("billing_product",er.optional()),billingStrategy:e.property("billing_strategy",Me),chargeType:e.property("charge_type",Ie),companyCount:e.property("company_count",e.number()),companyId:e.property("company_id",e.string().optional()),companyName:e.property("company_name",e.string().optional()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",k),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(jr)),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",Vr.optional()),description:e.string(),draftVersion:e.property("draft_version",ze.optional()),entitlements:e.list(re).optional(),features:e.list(qe),icon:ce,id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Mo)),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",L.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",L.optional()),planType:e.property("plan_type",oe),quarterlyPrice:e.property("quarterly_price",L.optional()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ze),yearlyPrice:e.property("yearly_price",L.optional())});var mu=e.object({activeAddOns:e.property("active_add_ons",e.list(Ia)),activePlans:e.property("active_plans",e.list(Ia)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qr)),capabilities:Io.optional(),displaySettings:e.property("display_settings",Fo),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var hu=e.object({data:mu,params:e.record(e.string(),e.unknown())});var Fa=e.object({companyId:e.property("company_id",e.string()),creditTypeId:e.property("credit_type_id",e.string()),expiresAt:e.property("expires_at",e.date().optional()),requestedAmount:e.property("requested_amount",e.number())});var Ko=e.object({currency:e.string(),pricePerUnit:e.property("price_per_unit",e.number().optional()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional())});var Ka=e.object({burnStrategy:e.property("burn_strategy",Er.optional()),currency:e.string(),currencyPrices:e.property("currency_prices",e.list(Ko).optional()),defaultExpiryUnit:e.property("default_expiry_unit",G.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Cr.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var La=e.object({billingPeriodsCount:e.property("billing_periods_count",e.number().optional()),companyId:e.property("company_id",e.string()),creditId:e.property("credit_id",e.string()),currency:e.string().optional(),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:Ce,renewalEnabled:e.property("renewal_enabled",e.boolean().optional()),renewalPeriod:e.property("renewal_period",Be.optional())});var Lo=e.object({currency:e.string(),pricePerUnit:e.property("price_per_unit",e.number().optional()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional())});var Ga=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",Oe.optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),currencyPrices:e.property("currency_prices",e.list(Lo).optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:Pe.optional()});var Wa=e.object({additionalAmount:e.property("additional_amount",e.number()),expiresAt:e.property("expires_at",e.date().optional())});var Ha=e.object({burnStrategy:e.property("burn_strategy",Er.optional()),currencyPrices:e.property("currency_prices",e.list(Ko).optional()),defaultExpiryUnit:e.property("default_expiry_unit",G.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Cr.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var Na=e.object({bundleName:e.property("bundle_name",e.string()),currencyPrices:e.property("currency_prices",e.list(Lo).optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:Pe.optional()});var $a=e.object({reason:Dr.optional()});var Bi=e.object({companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),creditTypeId:e.property("credit_type_id",e.string()),expiresAt:e.property("expires_at",e.date()),grantedAmount:e.property("granted_amount",e.number()),id:e.string(),releasedAt:e.property("released_at",e.date().optional()),updatedAt:e.property("updated_at",e.date())});var gu=e.object({data:Bi,params:e.record(e.string(),e.unknown())});var yu=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var wu=e.object({data:V,params:yu});var bu=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var zu=e.object({data:V,params:bu});var Ru=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional())});var fu=e.object({data:V,params:Ru});var Xr=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var _u=e.object({companyId:e.property("company_id",e.string().optional()),dir:Te.optional(),limit:e.number().optional(),offset:e.number().optional(),order:Xr.optional()});var Su=e.object({data:V,params:_u});var Pu=e.object({bundleType:e.property("bundle_type",Oe.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Pe.optional()});var xu=e.object({data:V,params:Pu});var wr=e.enum_(["grant","transfer","usage","zero_out"]);var Eu=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),eventType:e.property("event_type",wr.optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),startTime:e.property("start_time",e.string().optional())});var Cu=e.object({data:V,params:Eu});var ei=e.enum_(["daily","monthly","raw","weekly"]);var Uu=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:ei.optional(),startTime:e.property("start_time",e.string().optional())});var vu=e.object({data:V,params:Uu});var Tu=e.object({data:De,params:e.record(e.string(),e.unknown())});var Ou=e.object({data:ve,params:e.record(e.string(),e.unknown())});var ku=e.object({data:je,params:e.record(e.string(),e.unknown())});var Bu=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var ju=e.object({data:K,params:Bu});var Au=e.object({data:K,params:e.record(e.string(),e.unknown())});var Vu=e.object({data:Bi,params:e.record(e.string(),e.unknown())});var qu=e.object({data:je,params:e.record(e.string(),e.unknown())});var Du=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:ei.optional(),startTime:e.property("start_time",e.string().optional())});var Go=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var Wo=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var Ho=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var Mu=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:Wo.optional(),companyId:e.property("company_id",e.string()),credit:Go.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:Ho.optional(),featureId:e.property("feature_id",e.string().optional()),firstTransactionAt:e.property("first_transaction_at",e.date()),freeGrantCount:e.property("free_grant_count",e.number()),grantCount:e.property("grant_count",e.number()),lastTransactionAt:e.property("last_transaction_at",e.date()),manuallyZeroedCount:e.property("manually_zeroed_count",e.number()),netChange:e.property("net_change",e.number()),planGrantCount:e.property("plan_grant_count",e.number()),purchasedGrantCount:e.property("purchased_grant_count",e.number()),timeBucket:e.property("time_bucket",e.date()),totalConsumed:e.property("total_consumed",e.number()),totalGranted:e.property("total_granted",e.number()),transactionCount:e.property("transaction_count",e.number()),usageCount:e.property("usage_count",e.number()),zeroedOutCount:e.property("zeroed_out_count",e.number())});var Iu=e.object({data:e.list(Mu),params:Du});var Fu=e.object({data:De,params:e.record(e.string(),e.unknown())});var Ku=e.object({data:ve,params:e.record(e.string(),e.unknown())});var Lu=e.object({amount:e.number(),createdAt:e.property("created_at",e.date()),direction:e.string(),id:e.string(),reason:e.string(),relatedGrantId:e.property("related_grant_id",e.string())});var Mr=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),currency:e.string().optional(),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Ce),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:L.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",Ee.optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(Lu).optional(),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",Dr.optional())});var Gu=e.object({data:Mr,params:e.record(e.string(),e.unknown())});var Wu=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Hu=e.object({data:e.list(De),params:Wu});var Nu=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional())});var $u=e.object({data:e.list(ve),params:Nu});var Ju=e.object({companyId:e.property("company_id",e.string().optional())});var Zu=e.object({creditId:e.property("credit_id",e.string()),remaining:e.number(),source:k,total:e.number().optional()});var Yu=e.object({data:e.list(Zu),params:Ju});var Qu=e.object({companyId:e.property("company_id",e.string().optional()),dir:Te.optional(),limit:e.number().optional(),offset:e.number().optional(),order:Xr.optional()});var Xu=e.object({data:e.list(Mr),params:Qu});var ed=e.object({bundleType:e.property("bundle_type",Oe.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Pe.optional()});var rd=e.object({data:e.list(je),params:ed});var id=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),eventType:e.property("event_type",wr.optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),startTime:e.property("start_time",e.string().optional())});var od=e.object({amount:e.number(),autoTopupLogId:e.property("auto_topup_log_id",e.string().optional()),billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),company:Wo.optional(),companyId:e.property("company_id",e.string()),credit:Go.optional(),creditName:e.property("credit_name",e.string()),environmentId:e.property("environment_id",e.string()),eventAt:e.property("event_at",e.date()),eventId:e.property("event_id",e.string()),eventType:e.property("event_type",wr),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),feature:Ho.optional(),featureId:e.property("feature_id",e.string().optional()),fromGrantId:e.property("from_grant_id",e.string().optional()),grantExpiresAt:e.property("grant_expires_at",e.date().optional()),grantId:e.property("grant_id",e.string().optional()),grantQuantity:e.property("grant_quantity",e.number().optional()),grantQuantityRemaining:e.property("grant_quantity_remaining",e.number().optional()),grantReason:e.property("grant_reason",Ce.optional()),grantValidFrom:e.property("grant_valid_from",e.date().optional()),planId:e.property("plan_id",e.string().optional()),quantityConsumed:e.property("quantity_consumed",e.number().optional()),quantityRemainingAtZeroOut:e.property("quantity_remaining_at_zero_out",e.number().optional()),sourceId:e.property("source_id",e.number()),toGrantId:e.property("to_grant_id",e.string().optional()),usageEventId:e.property("usage_event_id",e.string().optional()),zeroedOutReason:e.property("zeroed_out_reason",Dr.optional())});var td=e.object({data:e.list(od),params:id});var ad=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var nd=e.object({data:e.list(Mr),params:ad});var sd=e.object({data:Bi,params:e.record(e.string(),e.unknown())});var cd=e.object({data:K,params:e.record(e.string(),e.unknown())});var ld=e.object({data:De,params:e.record(e.string(),e.unknown())});var pd=e.object({data:ve,params:e.record(e.string(),e.unknown())});var ud=e.object({data:je,params:e.record(e.string(),e.unknown())});var dd=e.object({data:Mr,params:e.record(e.string(),e.unknown())});var Ja=e.object({metadata:e.string()});var md=e.stringLiteral("csv");var hd=e.enum_(["failure","pending","success"]);var gd=e.stringLiteral("company-feature-usage");var yd=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),exportType:e.property("export_type",gd),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",md),status:hd,updatedAt:e.property("updated_at",e.date())});var wd=e.object({data:yd,params:e.record(e.string(),e.unknown())});var ae=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var Ir=e.object({currency:e.string(),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ae).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),quarterlyPriceTiers:e.property("quarterly_price_tiers",e.list(ae).optional()),quarterlyUnitPrice:e.property("quarterly_unit_price",e.number().optional()),quarterlyUnitPriceDecimal:e.property("quarterly_unit_price_decimal",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ae).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Za=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingProvider:e.property("billing_provider",k),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),currencyPrices:e.property("currency_prices",e.list(Ir).optional()),externalResourceId:e.property("external_resource_id",e.string()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ae).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),priceBehavior:e.property("price_behavior",be.optional()),priceTiers:e.property("price_tiers",e.list(ae).optional()),quarterlyMeteredPriceId:e.property("quarterly_metered_price_id",e.string().optional()),quarterlyPriceTiers:e.property("quarterly_price_tiers",e.list(ae).optional()),quarterlyUnitPrice:e.property("quarterly_unit_price",e.number().optional()),quarterlyUnitPriceDecimal:e.property("quarterly_unit_price_decimal",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",pe.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ae).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Ya=e.object({companyId:e.property("company_id",e.string()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee)});var Qa=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),currencyPrices:e.property("currency_prices",e.list(Ir).optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ae).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),priceBehavior:e.property("price_behavior",be.optional()),priceTiers:e.property("price_tiers",e.list(ae).optional()),quarterlyMeteredPriceId:e.property("quarterly_metered_price_id",e.string().optional()),quarterlyPriceTiers:e.property("quarterly_price_tiers",e.list(ae).optional()),quarterlyUnitPrice:e.property("quarterly_unit_price",e.number().optional()),quarterlyUnitPriceDecimal:e.property("quarterly_unit_price_decimal",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",pe.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ae).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Xa=e.object({sourcePlanId:e.property("source_plan_id",e.string()),targetPlanId:e.property("target_plan_id",e.string())});var en=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee)});var rn=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),currencyPrices:e.property("currency_prices",e.list(Ir).optional()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ae).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",be.optional()),priceTiers:e.property("price_tiers",e.list(ae).optional()),quarterlyMeteredPriceId:e.property("quarterly_metered_price_id",e.string().optional()),quarterlyPriceTiers:e.property("quarterly_price_tiers",e.list(ae).optional()),quarterlyUnitPrice:e.property("quarterly_unit_price",e.number().optional()),quarterlyUnitPriceDecimal:e.property("quarterly_unit_price_decimal",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",pe.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ae).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var bd=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var zd=e.object({data:V,params:bd});var Rd=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var fd=e.object({data:V,params:Rd});var _d=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),includeUsageAggregation:e.property("include_usage_aggregation",e.boolean().optional()),limit:e.number().optional(),managedBy:e.property("managed_by",k.optional()),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var Sd=e.object({data:V,params:_d});var Pd=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var xd=e.object({data:V,params:Pd});var Ed=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var Cd=e.object({data:V,params:Ed});var Ud=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var vd=e.object({data:re,params:e.record(e.string(),e.unknown())});var Td=e.object({data:K,params:e.record(e.string(),e.unknown())});var Od=e.object({data:K,params:e.record(e.string(),e.unknown())});var No=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var kd=e.object({message:e.string()});var Bd=e.object({entitlementId:e.property("entitlement_id",e.string()),errors:e.list(kd),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string())});var jd=e.object({data:e.list(re),issues:e.list(No),skipped:e.list(Bd)});var Ad=e.object({data:jd,params:e.record(e.string(),e.unknown())});var Vd=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var qd=e.object({keys:e.record(e.string(),e.string()).optional()});var Dd=e.object({data:xi,params:qd});var $e=e.enum_(["daily","hourly","monthly","weekly"]);var Md=e.object({companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),featureId:e.property("feature_id",e.string().optional()),granularity:$e.optional(),startTime:e.property("start_time",e.date().optional())});var Id=e.object({effectiveAt:e.property("effective_at",e.date()),isSoftLimit:e.property("is_soft_limit",e.boolean()),limitSource:e.property("limit_source",Or),limitValue:e.property("limit_value",e.number().optional()),planId:e.property("plan_id",e.string().optional()),priceBehavior:e.property("price_behavior",be.optional())});var Fd=e.object({periodEnd:e.property("period_end",e.date().optional()),periodStart:e.property("period_start",e.date().optional()),timestamp:e.date(),usage:e.number()});var Kd=e.object({featureId:e.property("feature_id",e.string()),featureType:e.property("feature_type",se),limits:e.list(Id),periodType:e.property("period_type",e.string().optional()),usagePoints:e.property("usage_points",e.list(Fd))});var Ld=e.object({data:Kd,params:Md});var Gd=e.object({data:re,params:e.record(e.string(),e.unknown())});var Wd=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var Hd=e.object({data:e.list(Ve),params:Wd});var Nd=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var $d=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(fi).optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional()),usageAggregation:e.property("usage_aggregation",_i.optional())});var Jd=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",ee),company:Q.optional(),companyOverride:e.property("company_override",Ve.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(fi).optional()),creditGrantReason:e.property("credit_grant_reason",Ce.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsage:e.property("credit_usage",$d.optional()),creditUsageAggregation:e.property("credit_usage_aggregation",_i.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",Or),feature:qe.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",N.optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",H.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:W.optional(),plan:or.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",be.optional()),quarterlyUsageBasedPrice:e.property("quarterly_usage_based_price",H.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",H.optional())});var Zd=e.object({data:e.list(Jd),params:Nd});var Yd=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),includeUsageAggregation:e.property("include_usage_aggregation",e.boolean().optional()),limit:e.number().optional(),managedBy:e.property("managed_by",k.optional()),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var Qd=e.object({data:e.list(Br),params:Yd});var Xd=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ar=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:Tr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainer:Sr.optional(),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),rules:e.list(Pi),updatedAt:e.property("updated_at",e.date())});var Ke=e.object({billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),eventSummary:e.property("event_summary",Si.optional()),featureType:e.property("feature_type",se),flags:e.list(ar),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainer:Sr.optional(),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),plans:e.list(kr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:de.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var em=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",ee),company:Q.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",Or),feature:Ke.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",N.optional()),period:W.optional(),plan:or.optional(),usage:e.number().optional(),user:Vo.optional()});var rm=e.object({data:e.list(em),params:Xd});var im=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),planVersionId:e.property("plan_version_id",e.string().optional()),planVersionIds:e.property("plan_version_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var om=e.object({data:e.list(re),params:im});var tm=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var am=e.object({data:re,params:e.record(e.string(),e.unknown())});var nm=e.object({data:re,params:e.record(e.string(),e.unknown())});var sm=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),flagId:e.property("flag_id",e.string().optional()),flagKey:e.property("flag_key",e.string()),reason:e.string(),reqCompany:e.property("req_company",e.record(e.string(),e.string()).optional()),reqUser:e.property("req_user",e.record(e.string(),e.string()).optional()),ruleId:e.property("rule_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var cm=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var lm=e.object({company:cm.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var pm=e.object({company:e.record(e.string(),e.string()).optional(),event:e.string(),leaseId:e.property("lease_id",e.string().optional()),quantity:e.number().optional(),traits:e.record(e.string(),e.unknown()).optional(),user:e.record(e.string(),e.string()).optional()});var $o=e.undiscriminatedUnion([pm,sm,lm]);var br=e.enum_(["flag_check","identify","track"]);var Jo=e.object({backfill:e.boolean().optional(),body:$o.optional(),eventType:e.property("event_type",br),idempotencyKey:e.property("idempotency_key",e.string().optional()),sentAt:e.property("sent_at",e.date().optional()),trustedClientClock:e.property("trusted_client_clock",e.boolean().optional())});var on=e.object({events:e.list(Jo)});var Zo=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string().optional()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var um=e.object({events:e.list(Zo)});var dm=e.object({data:um,params:e.record(e.string(),e.unknown())});var mm=e.object({data:Zo,params:e.record(e.string(),e.unknown())});var hm=e.enum_(["enriched","failed","pending","processed","unknown"]);var Yo=e.object({apiKey:e.property("api_key",e.string().optional()),apiKeyView:e.property("api_key_view",_e.optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),company:kr.optional(),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),features:e.list(kr),id:e.string(),idempotencyKey:e.property("idempotency_key",e.string().optional()),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:hm,subtype:e.string().optional(),type:br,updatedAt:e.property("updated_at",e.date().optional()),user:kr.optional(),userId:e.property("user_id",e.string().optional())});var gm=e.object({data:Yo,params:e.record(e.string(),e.unknown())});var ym=e.object({eventSubtypes:e.property("event_subtypes",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var wm=e.object({data:e.list(Si),params:ym});var bm=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var zm=e.object({data:bm,params:e.record(e.string(),e.unknown())});var Rm=e.object({companyId:e.property("company_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),eventTypes:e.property("event_types",e.list(br).optional()),flagId:e.property("flag_id",e.string().optional()),idempotencyKey:e.property("idempotency_key",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var fm=e.object({data:e.list(Yo),params:Rm});var io=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var tn=e.object({contexts:e.list(io)});var ji=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string().optional(),key:e.string(),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string()});var an=e.object({billingProvider:e.property("billing_provider",k),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),externalResourceId:e.property("external_resource_id",e.string()),featureType:e.property("feature_type",se),flag:ji.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var nn=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",se),flag:ji.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var sn=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",se.optional()),flag:ji.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ae.optional()),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string().optional(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var Qo=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",zi),creditCost:e.property("credit_cost",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string().optional(),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:bi,resourceIds:e.property("resource_ids",e.list(e.string())),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string().optional())});var _m=e.object({conditions:e.list(Qo),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Sm=e.object({conditionGroups:e.property("condition_groups",e.list(_m)),conditions:e.list(Qo),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",vr.optional()),value:e.boolean()});var cn=e.object({rules:e.list(Sm)});var Xo=e.object({companyId:e.property("company_id",e.string().optional()),entitlement:vo.optional(),error:e.string().optional(),featureAllocation:e.property("feature_allocation",e.number().optional()),featureUsage:e.property("feature_usage",e.number().optional()),featureUsageEvent:e.property("feature_usage_event",e.string().optional()),featureUsagePeriod:e.property("feature_usage_period",W.optional()),featureUsageResetAt:e.property("feature_usage_reset_at",e.date().optional()),flag:e.string(),flagId:e.property("flag_id",e.string().optional()),reason:e.string(),ruleId:e.property("rule_id",e.string().optional()),ruleType:e.property("rule_type",vr.optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var Pm=e.object({data:Xo,params:e.record(e.string(),e.unknown())});var xm=e.enum_(["active","converted","expired"]);var Em=e.object({id:e.string(),name:e.string(),trialEndDate:e.property("trial_end_date",e.date().optional()),trialStatus:e.property("trial_status",xm.optional())});var et=e.object({flags:e.list(Xo),plan:Em.optional()});var Cm=e.object({data:e.list(et)});var Um=e.object({data:Cm,params:e.record(e.string(),e.unknown())});var vm=e.object({data:et,params:e.record(e.string(),e.unknown())});var Tm=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(se).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),managedBy:e.property("managed_by",k.optional()),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var Om=e.object({data:V,params:Tm});var km=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Bm=e.object({data:V,params:km});var jm=e.object({data:Ke,params:e.record(e.string(),e.unknown())});var Am=e.object({data:ar,params:e.record(e.string(),e.unknown())});var Vm=e.object({data:K,params:e.record(e.string(),e.unknown())});var qm=e.object({data:K,params:e.record(e.string(),e.unknown())});var Dm=e.object({data:Ke,params:e.record(e.string(),e.unknown())});var Mm=e.object({data:ar,params:e.record(e.string(),e.unknown())});var Im=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(se).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),managedBy:e.property("managed_by",k.optional()),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var Fm=e.object({data:e.list(Ke),params:Im});var Km=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Lm=e.object({data:e.list(ar),params:Km});var Gm=e.object({data:Ke,params:e.record(e.string(),e.unknown())});var Wm=e.object({data:ar,params:e.record(e.string(),e.unknown())});var Hm=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string(),key:e.string(),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Nm=e.object({flag:Hm.optional(),rules:e.list(Pi)});var $m=e.object({data:Nm,params:e.record(e.string(),e.unknown())});var Jm=e.object({data:Ke,params:e.record(e.string(),e.unknown())});var Zm=e.object({limit:e.number().optional()});var Ym=e.object({actorName:e.property("actor_name",e.string()),method:e.string(),resourceName:e.property("resource_name",e.string()),resourceType:e.property("resource_type",e.string()),timestamp:e.date(),title:e.string()});var Qm=e.object({entries:e.list(Ym)});var Xm=e.object({data:Qm,params:Zm});var eh=e.object({endTime:e.property("end_time",e.date().optional()),featureId:e.property("feature_id",e.string().optional()),granularity:$e.optional(),startTime:e.property("start_time",e.date().optional())});var rt=e.object({timestamp:e.date(),usage:e.number()});var rh=e.object({eventSubtype:e.property("event_subtype",e.string()),featureId:e.property("feature_id",e.string()),points:e.list(rt)});var ih=e.object({data:rh,params:eh});var oh=e.object({endTime:e.property("end_time",e.date().optional()),featureId:e.property("feature_id",e.string().optional()),granularity:$e.optional(),startTime:e.property("start_time",e.date().optional())});var th=e.object({featureId:e.property("feature_id",e.string()),points:e.list(rt),traitDefinitionId:e.property("trait_definition_id",e.string())});var ah=e.object({data:th,params:oh});var nh=e.object({months:e.number().optional()});var sh=e.object({month:e.date(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),subscribers:e.number()});var ch=e.object({points:e.list(sh)});var lh=e.object({data:ch,params:nh});var ph=e.object({amount:e.number(),currency:e.string()});var uh=e.object({activeCredits:e.property("active_credits",e.number()),mrr:e.list(ph),paidCompanies:e.property("paid_companies",e.number()),totalCompanies:e.property("total_companies",e.number()),totalFeatures:e.property("total_features",e.number()),totalPlans:e.property("total_plans",e.number())});var dh=e.object({data:uh,params:e.record(e.string(),e.unknown())});var mh=e.object({endTime:e.property("end_time",e.date().optional()),limit:e.number().optional(),startTime:e.property("start_time",e.date().optional())});var hh=e.object({changePct:e.property("change_pct",e.number().optional()),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string()),pluralName:e.property("plural_name",e.string().optional()),priorUsage:e.property("prior_usage",e.number()),usage:e.number()});var gh=e.object({features:e.list(hh)});var yh=e.object({data:gh,params:mh});var wh=e.enum_(["billing_meta_object","manual_upsert"]);var ln=e.object({companyMatchingCriteria:e.property("company_matching_criteria",wh.optional()),companyMatchingField:e.property("company_matching_field",e.string().optional()),integrationId:e.property("integration_id",e.string())});var bh=e.object({type:ke,url:e.string()});var zh=e.object({data:bh,params:e.record(e.string(),e.unknown())});var Rh=e.object({billingOnly:e.property("billing_only",e.boolean().optional()),excludeIds:e.property("exclude_ids",e.list(e.string()).optional()),id:e.string().optional(),limit:e.number().optional(),offset:e.number().optional(),state:Qe.optional(),type:ke.optional()});var fh=e.object({authorPlans:e.property("author_plans",e.boolean()),checkout:e.boolean(),editBilling:e.property("edit_billing",e.boolean())});var _h=e.object({firstEventsReceived:e.property("first_events_received",e.boolean().optional()),webhookUrl:e.property("webhook_url",e.string().optional())});var Sh=e.object({externalCustomerIdKey:e.property("external_customer_id_key",e.string().optional())});var Ph=e.object({accountId:e.property("account_id",e.string().optional()),accountName:e.property("account_name",e.string().optional()),companyUpdateOnly:e.property("company_update_only",e.boolean().optional()),isSandbox:e.property("is_sandbox",e.boolean()),liveMode:e.property("live_mode",e.boolean()),onboardUrl:e.property("onboard_url",e.string().optional())});var xh=e.object({firstEventsReceived:e.property("first_events_received",e.boolean().optional()),webhookUrl:e.property("webhook_url",e.string().optional())});var Eh=e.union("type",{clerk:_h,orb:Sh,stripe:Ph,workos:xh}).transform({transform:p=>p,untransform:p=>p});var Ch=e.object({capabilities:fh,config:Eh.optional(),id:e.string(),isAppInstall:e.property("is_app_install",e.boolean()),isConnectInstall:e.property("is_connect_install",e.boolean()),state:Qe,type:ke});var Uh=e.object({data:e.list(Ch),params:Rh});var vh=e.object({keys:e.list(e.string())});var Th=e.object({data:vh,params:e.record(e.string(),e.unknown())});var it=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),state:Qe,type:ke,updatedAt:e.property("updated_at",e.date())});var Oh=e.object({data:it,params:e.record(e.string(),e.unknown())});var kh=e.object({data:it,params:e.record(e.string(),e.unknown())});var Bh=e.object({data:K,params:e.record(e.string(),e.unknown())});var jh=e.object({companyId:e.property("company_id",e.string()),description:e.string(),icon:ce.optional(),name:e.string()});var Ah=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),currencyPrices:e.property("currency_prices",e.list(Ir).optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",W.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",N.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ae).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),priceBehavior:e.property("price_behavior",be.optional()),priceTiers:e.property("price_tiers",e.list(ae).optional()),quarterlyMeteredPriceId:e.property("quarterly_metered_price_id",e.string().optional()),quarterlyPriceTiers:e.property("quarterly_price_tiers",e.list(ae).optional()),quarterlyUnitPrice:e.property("quarterly_unit_price",e.number().optional()),quarterlyUnitPriceDecimal:e.property("quarterly_unit_price_decimal",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",pe.optional()),usageQuantity:e.property("usage_quantity",e.number().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",ee),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ae).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var ot=e.enum_(["create","update","delete"]);var Ai=e.object({action:ot,entitlementId:e.property("entitlement_id",e.string().optional()),req:Ah.optional()});var Vh=e.object({currency:e.string(),monthlyPrice:e.property("monthly_price",e.number().optional()),oneTimePrice:e.property("one_time_price",e.number().optional()),quarterlyPrice:e.property("quarterly_price",e.number().optional()),yearlyPrice:e.property("yearly_price",e.number().optional())});var Fr=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingStrategy:e.property("billing_strategy",Me.optional()),chargeType:e.property("charge_type",Ie),currency:e.string().optional(),currencyPrices:e.property("currency_prices",e.list(Vh).optional()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",e.number().optional()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePrice:e.property("one_time_price",e.number().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),quarterlyPrice:e.property("quarterly_price",e.number().optional()),quarterlyPriceId:e.property("quarterly_price_id",e.string().optional()),trialDays:e.property("trial_days",e.number().optional()),yearlyPrice:e.property("yearly_price",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var pn=e.object({billingProduct:e.property("billing_product",Fr.optional()),entitlements:e.list(Ai),plan:jh.optional()});var tt=e.object({description:e.string(),icon:ce.optional(),name:e.string(),planType:e.property("plan_type",oe)});var at=e.stringLiteral("credit");var nt=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",at.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",Y.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupSelfService:e.property("auto_topup_self_service",e.boolean().optional()),autoTopupThresholdCredits:e.property("auto_topup_threshold_credits",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),planVersionId:e.property("plan_version_id",e.string().optional()),resetCadence:e.property("reset_cadence",Ee),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",rr.optional())});var qh=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var st=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",at.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",Y.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupSelfService:e.property("auto_topup_self_service",e.boolean().optional()),autoTopupThresholdCredits:e.property("auto_topup_threshold_credits",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number().optional()),expiryType:e.property("expiry_type",Y.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Ee),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",rr.optional())});var ct=e.object({action:ot,createReq:e.property("create_req",nt.optional()),creditGrantId:e.property("credit_grant_id",e.string().optional()),deleteReq:e.property("delete_req",qh.optional()),updateReq:e.property("update_req",st.optional())});var un=e.object({billingProduct:e.property("billing_product",Fr.optional()),creditGrants:e.property("credit_grants",e.list(ct).optional()),entitlements:e.list(Ai),plan:tt.optional(),traits:e.list(Ei).optional()});var lt=e.object({description:e.string().optional(),icon:ce.optional(),name:e.string()});var dn=e.object({billingProduct:e.property("billing_product",Fr.optional()),creditGrants:e.property("credit_grants",e.list(ct).optional()),entitlements:e.list(Ai),plan:lt.optional(),planVersionId:e.property("plan_version_id",e.string().optional()),traits:e.list(Ei).optional()});var pt=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),billingStrategy:e.property("billing_strategy",Me),chargeType:e.property("charge_type",Ie),controlledBy:e.property("controlled_by",k),environmentId:e.property("environment_id",e.string()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),planId:e.property("plan_id",e.string()),trialDays:e.property("trial_days",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var Vi=e.object({billingProduct:e.property("billing_product",pt.optional()),creditGrants:e.property("credit_grants",e.list(ve).optional()),entitlements:e.list(re).optional(),plan:or.optional(),traits:e.list(Ar).optional()});var Dh=e.object({data:Vi,params:e.record(e.string(),e.unknown())});var Mh=e.object({data:Vi,params:e.record(e.string(),e.unknown())});var Ih=e.object({data:Vi,params:e.record(e.string(),e.unknown())});var Fh=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var zr=e.object({entitlements:e.list(Fh).optional(),planId:e.property("plan_id",e.string())});var qi=e.object({bundleId:e.string()});var ut=e.enum_(["create_prorations","invoice_immediately"]);var dt=e.enum_(["end_of_billing_period","none"]);var mn=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qr).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",Vr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(zr)),orderedBundleList:e.property("ordered_bundle_list",e.list(qi)),orderedPlans:e.property("ordered_plans",e.list(zr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",ut),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",dt.optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var hn=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qr).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",Vr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(zr)),orderedBundleList:e.property("ordered_bundle_list",e.list(qi)),orderedPlans:e.property("ordered_plans",e.list(zr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",ut),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",dt.optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var mt=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var Kh=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var ht=e.object({showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showFeatureDescription:e.property("show_feature_description",e.boolean()),showHardLimit:e.property("show_hard_limit",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean())});var gt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Kh)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",mt),componentSettings:e.property("component_settings",ht),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnIds:e.property("ordered_add_on_ids",e.list(zr)),planIds:e.property("plan_ids",e.list(zr)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",e.string()),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",e.string().optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Lh=e.object({data:gt,params:e.record(e.string(),e.unknown())});var Gh=e.object({includeCompanyCounts:e.property("include_company_counts",e.boolean().optional())});var yt=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var ri=e.object({activeVersion:e.property("active_version",ze.optional()),audienceType:e.property("audience_type",e.string().optional()),availablePeriods:e.property("available_periods",e.list(ki)),billingLinkedResource:e.property("billing_linked_resource",Ue.optional()),billingProduct:e.property("billing_product",er.optional()),billingStrategy:e.property("billing_strategy",Me),chargeType:e.property("charge_type",Ie),companyCount:e.property("company_count",e.number()),companyId:e.property("company_id",e.string().optional()),companyName:e.property("company_name",e.string().optional()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",k),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currencyPrices:e.property("currency_prices",e.list(jr)),customPlanConfig:e.property("custom_plan_config",yt.optional()),description:e.string(),draftVersion:e.property("draft_version",ze.optional()),entitlements:e.list(re).optional(),features:e.list(qe),icon:ce,id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(ve).optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",L.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",L.optional()),planType:e.property("plan_type",oe),quarterlyPrice:e.property("quarterly_price",L.optional()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ze),yearlyPrice:e.property("yearly_price",L.optional())});var Wh=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var gn=e.object({entitlements:e.list(Wh).optional(),planId:e.property("plan_id",e.string())});var Hh=e.object({addOns:e.property("add_ons",e.list(ri)),checkoutSettings:e.property("checkout_settings",mt),componentSettings:e.property("component_settings",ht),customPlanConfig:e.property("custom_plan_config",yt.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",ri.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",ri.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",ri.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",H.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(gn)),orderedBundleList:e.property("ordered_bundle_list",e.list(qi)),orderedPlanList:e.property("ordered_plan_list",e.list(gn)),plans:e.list(ri),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",e.string()),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",e.string().optional()),scheduledDowngradePreventWhenOverLimit:e.property("scheduled_downgrade_prevent_when_over_limit",e.boolean().optional()),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetails:e.property("sync_customer_billing_details",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlan:e.property("trial_expiry_plan",ri.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",H.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Nh=e.object({data:Hh,params:Gh});var $h=e.object({data:gt,params:e.record(e.string(),e.unknown())});var Di=e.enum_(["immediate","leave"]);var yn=e.object({companyIds:e.property("company_ids",e.list(e.string())),excludedCompanyIds:e.property("excluded_company_ids",e.list(e.string())),planId:e.property("plan_id",e.string()),planVersionIdTo:e.property("plan_version_id_to",e.string()),planVersionIdsFrom:e.property("plan_version_ids_from",e.list(e.string())),strategy:Di,targetPlanType:e.property("target_plan_type",oe)});var wt=e.enum_(["ambiguous_subscription_item","multiple_subscriptions","no_price_for_interval","not_on_origin_version","permanent_config","permanent_decline","transient_decline","transient_infra","transient_stripe","unknown","would_leave_empty_subscription"]);var wn=e.object({errorCodes:e.property("error_codes",e.list(wt))});var Rr=e.enum_(["completed","failed","in_progress","pending","skipped"]);var Jh=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:Rr.optional()});var Zh=e.object({data:V,params:Jh});var fr=e.enum_(["completed","failed","in_progress","pending"]);var Yh=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:fr.optional()});var Qh=e.object({data:V,params:Yh});var Kr=e.object({completedAt:e.property("completed_at",e.date().optional()),completedCompanies:e.property("completed_companies",e.number()),createdAt:e.property("created_at",e.date()),error:e.string().optional(),failedCompanies:e.property("failed_companies",e.number()),id:e.string(),planId:e.property("plan_id",e.string()),planVersionIdFrom:e.property("plan_version_id_from",e.string().optional()),planVersionIdTo:e.property("plan_version_id_to",e.string()),planVersionIdsFrom:e.property("plan_version_ids_from",e.list(e.string())),skippedCompanies:e.property("skipped_companies",e.number()),startedAt:e.property("started_at",e.date().optional()),status:fr,strategy:Di,totalCompanies:e.property("total_companies",e.number()),updatedAt:e.property("updated_at",e.date())});var Xh=e.object({data:Kr,params:e.record(e.string(),e.unknown())});var eg=e.object({data:Kr,params:e.record(e.string(),e.unknown())});var rg=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:Rr.optional()});var bt=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),completedAt:e.property("completed_at",e.date().optional()),createdAt:e.property("created_at",e.date()),error:e.string().optional(),errorCode:e.property("error_code",wt.optional()),id:e.string(),migrationId:e.property("migration_id",e.string()),planVersionIdFrom:e.property("plan_version_id_from",e.string().optional()),startedAt:e.property("started_at",e.date().optional()),status:Rr,updatedAt:e.property("updated_at",e.date())});var ig=e.object({data:e.list(bt),params:rg});var og=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:fr.optional()});var tg=e.object({data:e.list(Kr),params:og});var ag=e.object({data:bt,params:e.record(e.string(),e.unknown())});var ng=e.object({data:Kr,params:e.record(e.string(),e.unknown())});var bn=e.object({billingProvider:e.property("billing_provider",k),description:e.string(),externalResourceId:e.property("external_resource_id",e.string()),externalResourceVersion:e.property("external_resource_version",e.string().optional()),icon:ce.optional(),name:e.string(),planType:e.property("plan_type",oe)});var zn=e.object({companyId:e.property("company_id",e.string()),copiedFromPlanId:e.property("copied_from_plan_id",e.string().optional()),description:e.string(),icon:ce.optional(),name:e.string()});var Lr=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var Rn=e.object({activationStrategy:e.property("activation_strategy",wi.optional()),customerEmail:e.property("customer_email",e.string().optional()),daysUntilDue:e.property("days_until_due",e.number().optional()),excludedCompanyIds:e.property("excluded_company_ids",e.list(e.string())),migrationStrategy:e.property("migration_strategy",Di),payInAdvance:e.property("pay_in_advance",e.list(Lr))});var fn=e.object({activationStrategy:e.property("activation_strategy",wi.optional()),customerEmail:e.property("customer_email",e.string()),daysUntilDue:e.property("days_until_due",e.number().optional()),payInAdvance:e.property("pay_in_advance",e.list(Lr))});var _n=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var sg=e.object({limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var cg=e.object({data:V,params:sg});var lg=e.object({companyId:e.property("company_id",e.string().optional()),companyScopedOnly:e.property("company_scoped_only",e.boolean().optional()),excludeCompanyScoped:e.property("exclude_company_scoped",e.boolean().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),includeDraftVersions:e.property("include_draft_versions",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",oe.optional()),q:e.string().optional(),scopedToCompanyId:e.property("scoped_to_company_id",e.string().optional()),withEntitlements:e.property("with_entitlements",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional())});var pg=e.object({data:V,params:lg});var ug=e.object({data:ye,params:e.record(e.string(),e.unknown())});var dg=e.object({data:ye,params:e.record(e.string(),e.unknown())});var mg=e.object({data:K,params:e.record(e.string(),e.unknown())});var hg=e.object({promoteArchivedVersion:e.property("promote_archived_version",e.boolean().optional())});var gg=e.object({data:K,params:hg});var yg=e.object({planVersionId:e.property("plan_version_id",e.string().optional())});var wg=e.object({data:ye,params:yg});var bg=e.object({limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var zg=e.object({data:e.list(Q),params:bg});var Rg=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),status:hr.optional(),statuses:e.list(hr).optional()});var fg=e.object({data:e.list(Ur),params:Rg});var _g=e.object({planId:e.property("plan_id",e.string().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var Sg=e.object({data:e.list(No),params:_g});var Pg=e.object({companyId:e.property("company_id",e.string().optional()),companyScopedOnly:e.property("company_scoped_only",e.boolean().optional()),excludeCompanyScoped:e.property("exclude_company_scoped",e.boolean().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),includeDraftVersions:e.property("include_draft_versions",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",oe.optional()),q:e.string().optional(),scopedToCompanyId:e.property("scoped_to_company_id",e.string().optional()),withEntitlements:e.property("with_entitlements",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional())});var xg=e.object({data:e.list(ye),params:Pg});var Eg=e.object({data:Ur,params:e.record(e.string(),e.unknown())});var Cg=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Ug=e.object({data:Ur,params:e.record(e.string(),e.unknown())});var vg=e.object({data:Q,params:e.record(e.string(),e.unknown())});var Tg=e.object({data:ye,params:e.record(e.string(),e.unknown())});var Og=e.object({data:pt,params:e.record(e.string(),e.unknown())});var kg=e.object({data:ye,params:e.record(e.string(),e.unknown())});var Sn=e.object({companyId:e.property("company_id",e.string()),executeAfter:e.property("execute_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),toPlanId:e.property("to_plan_id",e.string())});var Gr=e.enum_(["cancelled","error","executing","pending","success"]);var Pn=e.object({executeAfter:e.property("execute_after",e.date().optional()),status:Gr.optional()});var Wr=e.object({actorType:e.property("actor_type",e.string()),companyId:e.property("company_id",e.string()),completedAt:e.property("completed_at",e.date().optional()),createdAt:e.property("created_at",e.date()),errorMessage:e.property("error_message",e.string().optional()),executeAfter:e.property("execute_after",e.date()),fromPlanId:e.property("from_plan_id",e.string()),id:e.string(),scheduledInterval:e.property("scheduled_interval",e.string().optional()),scheduledPrice:e.property("scheduled_price",e.number().optional()),startedAt:e.property("started_at",e.date().optional()),status:Gr,toPlanId:e.property("to_plan_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Bg=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var jg=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var Ag=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),status:Gr.optional()});var Vg=e.object({data:e.list(Wr),params:Ag});var qg=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var Mi=e.object({creditId:e.property("credit_id",e.string())});var Ii=e.object({featureId:e.property("feature_id",e.string())});var Hr=e.enum_(["subscription.trial.ended","company.created","company.deleted","company.override.created","company.override.deleted","company.override.expired","company.override.updated","company.plan_changed","company.scheduled_downgrade","company.updated","credit.limit.reached","credit.limit.warning","entitlement.limit.reached","entitlement.limit.warning","entitlement.soft_limit.reached","entitlement.soft_limit.warning","entitlement.tier_limit.reached","entitlement.tier_limit.warning","feature.created","feature.deleted","feature.updated","flag.created","flag.deleted","flag_rules.updated","flag.updated","plan.created","plan.deleted","plan.entitlement.created","plan.entitlement.deleted","plan.entitlement.updated","plan.updated","plan_version.deleted","rule.deleted","test.send","user.created","user.deleted","user.updated","auto.topup.hard.failure","auto.topup.retry.exceeded"]);var xn=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Mi).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Ii).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(Hr)),url:e.string()});var zt=e.enum_(["active","inactive"]);var En=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Mi).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Ii).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(Hr).optional()),status:zt.optional(),url:e.string().optional()});var Dg=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var Mg=e.object({data:V,params:Dg});var Ig=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Fg=e.object({data:V,params:Ig});var nr=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Mi).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Ii).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(Hr)),secret:e.string(),status:zt,updatedAt:e.property("updated_at",e.date()),url:e.string()});var Kg=e.object({data:nr,params:e.record(e.string(),e.unknown())});var Lg=e.object({data:K,params:e.record(e.string(),e.unknown())});var Gg=e.enum_(["failure","pending","success"]);var Rt=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",Hr),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:Gg,updatedAt:e.property("updated_at",e.date()),webhook:nr.optional(),webhookId:e.property("webhook_id",e.string())});var Wg=e.object({data:Rt,params:e.record(e.string(),e.unknown())});var Hg=e.object({data:nr,params:e.record(e.string(),e.unknown())});var Ng=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var $g=e.object({data:e.list(Rt),params:Ng});var Jg=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Zg=e.object({data:e.list(nr),params:Jg});var Yg=e.object({data:nr,params:e.record(e.string(),e.unknown())});var a=e.object({error:e.string()});var Qg=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var Xg=e.object({autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupThresholdCredits:e.property("auto_topup_threshold_credits",e.number().optional()),planCreditGrantId:e.property("plan_credit_grant_id",e.string())});var ft=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var Cn=e.object({addOnIds:e.property("add_on_ids",e.list(Qg)),autoTopupOverrides:e.property("auto_topup_overrides",e.list(Xg)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(ft)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(Lr)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var Un=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),key:e.string(),maintainerAccountMemberId:e.property("maintainer_account_member_id",e.string().optional()),name:e.string()});var vn=e.object({keys:e.record(e.string(),e.string())});var ey=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional()),versionId:e.property("version_id",e.string().optional())});var Tn=e.object({addOnSelections:e.property("add_on_selections",e.list(ey)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_id",e.string().optional()),basePlanVersionId:e.property("base_plan_version_id",e.string().optional()),cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(ft)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(Lr)),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),prorate:e.boolean().optional(),trialEnd:e.property("trial_end",e.date().optional())});var ry=e.record(e.string(),e.unknown());var iy=e.record(e.string(),e.unknown());var On=e.object({id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),preventKeyRemap:e.property("prevent_key_remap",e.boolean().optional()),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var kn=e.object({incr:e.number().optional(),keys:e.record(e.string(),e.string()),set:e.string().optional(),trait:e.string(),updateOnly:e.property("update_only",e.boolean().optional())});var Bn=e.object({companies:e.list(e.record(e.string(),e.string())).optional(),company:e.record(e.string(),e.string()).optional(),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var _t=class{constructor(o){this._options=I(o)}issueTemporaryAccessToken(o,i){return S.fromPromise(this.__issueTemporaryAccessToken(o,i))}async __issueTemporaryAccessToken(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"temporary-access-tokens"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:{...ha.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),resource_type:"company"},timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ac.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/temporary-access-tokens")}};var St=class{constructor(o){this._options=I(o)}listAccountMembers(o={},i){return S.fromPromise(this.__listAccountMembers(o,i))}async __listAccountMembers(o={},i){let{ids:t,q:s,limit:r,offset:n}=o,d={ids:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"account-members"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Ec.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/account-members")}getAccountMember(o,i){return S.fromPromise(this.__getAccountMember(o,i))}async __getAccountMember(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`account-members/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:bc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/account-members/{account_member_id}")}listApiKeys(o,i){return S.fromPromise(this.__listApiKeys(o,i))}async __listApiKeys(o,i){let{environmentId:t,requireEnvironment:s,limit:r,offset:n}=o,d={environment_id:t,require_environment:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"api-keys"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Uc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/api-keys")}createApiKey(o,i){return S.fromPromise(this.__createApiKey(o,i))}async __createApiKey(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"api-keys"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:ga.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:uc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/api-keys")}getApiKey(o,i){return S.fromPromise(this.__getApiKey(o,i))}async __getApiKey(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`api-keys/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/api-keys/{api_key_id}")}updateApiKey(o,i={},t){return S.fromPromise(this.__updateApiKey(o,i,t))}async __updateApiKey(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`api-keys/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:wa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Ac.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/api-keys/{api_key_id}")}deleteApiKey(o,i){return S.fromPromise(this.__deleteApiKey(o,i))}async __deleteApiKey(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`api-keys/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:hc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/api-keys/{api_key_id}")}countApiKeys(o,i){return S.fromPromise(this.__countApiKeys(o,i))}async __countApiKeys(o,i){let{environmentId:t,requireEnvironment:s,limit:r,offset:n}=o,d={environment_id:t,require_environment:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"api-keys/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:sc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/api-keys/count")}listAuditLogs(o={},i){return S.fromPromise(this.__listAuditLogs(o,i))}async __listAuditLogs(o={},i){let{actorType:t,endTime:s,environmentId:r,q:n,startTime:d,limit:g,offset:h}=o,l={actor_type:t!=null?Se.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,end_time:s?.toISOString(),environment_id:r,q:n,start_time:d?.toISOString(),limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"audit-log"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:Tc.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/audit-log")}getAuditLog(o,i){return S.fromPromise(this.__getAuditLog(o,i))}async __getAuditLog(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`audit-log/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:fc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/audit-log/{audit_log_id}")}countAuditLogs(o={},i){return S.fromPromise(this.__countAuditLogs(o,i))}async __countAuditLogs(o={},i){let{actorType:t,endTime:s,environmentId:r,q:n,startTime:d,limit:g,offset:h}=o,l={actor_type:t!=null?Se.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,end_time:s?.toISOString(),environment_id:r,q:n,start_time:d?.toISOString(),limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"audit-log/count"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:lc.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/audit-log/count")}listEnvironments(o={},i){return S.fromPromise(this.__listEnvironments(o,i))}async __listEnvironments(o={},i){let{ids:t,limit:s,offset:r}=o,n={ids:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"environments"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:kc.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/environments")}createEnvironment(o,i){return S.fromPromise(this.__createEnvironment(o,i))}async __createEnvironment(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"environments"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:ya.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:mc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/environments")}getEnvironment(o,i){return S.fromPromise(this.__getEnvironment(o,i))}async __getEnvironment(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`environments/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:_c.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/environments/{environment_id}")}updateEnvironment(o,i={},t){return S.fromPromise(this.__updateEnvironment(o,i,t))}async __updateEnvironment(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`environments/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:ba.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Vc.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/environments/{environment_id}")}deleteEnvironment(o,i){return S.fromPromise(this.__deleteEnvironment(o,i))}async __deleteEnvironment(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`environments/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:gc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/environments/{environment_id}")}quickstart(o){return S.fromPromise(this.__quickstart(o))}async __quickstart(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"quickstart"),method:"POST",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:jc.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new T(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"POST","/quickstart")}getWhoAmI(o){return S.fromPromise(this.__getWhoAmI(o))}async __getWhoAmI(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"whoami"),method:"GET",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Pc.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"GET","/whoami")}};var Pt=class{constructor(o){this._options=I(o)}listCoupons(o={},i){return S.fromPromise(this.__listCoupons(o,i))}async __listCoupons(o={},i){let{isActive:t,q:s,limit:r,offset:n}=o,d={is_active:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/coupons"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:el.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/coupons")}upsertBillingCoupon(o,i){return S.fromPromise(this.__upsertBillingCoupon(o,i))}async __upsertBillingCoupon(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/coupons"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Sa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ul.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/coupons")}upsertBillingCustomer(o,i){return S.fromPromise(this.__upsertBillingCustomer(o,i))}async __upsertBillingCustomer(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/customer/upsert"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:za.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ml.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/customer/upsert")}listCustomersWithSubscriptions(o={},i){return S.fromPromise(this.__listCustomersWithSubscriptions(o,i))}async __listCustomersWithSubscriptions(o={},i){let{companyIds:t,name:s,providerType:r,q:n,limit:d,offset:g}=o,h={company_ids:t,name:s,provider_type:r!=null?k.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,q:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/customers"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:tl.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/billing/customers")}countCustomers(o={},i){return S.fromPromise(this.__countCustomers(o,i))}async __countCustomers(o={},i){let{companyIds:t,name:s,providerType:r,q:n,limit:d,offset:g}=o,h={company_ids:t,name:s,provider_type:r!=null?k.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,q:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/customers/count"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Lc.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/billing/customers/count")}listInvoices(o,i){return S.fromPromise(this.__listInvoices(o,i))}async __listInvoices(o,i){let{companyId:t,customerExternalId:s,subscriptionExternalId:r,limit:n,offset:d}=o,g={company_id:t,customer_external_id:s,subscription_external_id:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/invoices"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:nl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/billing/invoices")}upsertInvoice(o,i){return S.fromPromise(this.__upsertInvoice(o,i))}async __upsertInvoice(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/invoices"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Pa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/invoices")}listMeters(o={},i){return S.fromPromise(this.__listMeters(o,i))}async __listMeters(o={},i){let{displayName:t,limit:s,offset:r}=o,n={display_name:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/meter"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:cl.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/billing/meter")}upsertBillingMeter(o,i){return S.fromPromise(this.__upsertBillingMeter(o,i))}async __upsertBillingMeter(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/meter/upsert"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:xa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:hl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/meter/upsert")}listPaymentMethods(o,i){return S.fromPromise(this.__listPaymentMethods(o,i))}async __listPaymentMethods(o,i){let{companyId:t,customerExternalId:s,limit:r,offset:n}=o,d={company_id:t,customer_external_id:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/payment-methods"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:pl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/payment-methods")}upsertPaymentMethod(o,i){return S.fromPromise(this.__upsertPaymentMethod(o,i))}async __upsertPaymentMethod(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/payment-methods"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ea.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Rl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/payment-methods")}deletePaymentMethodByExternalId(o,i){return S.fromPromise(this.__deletePaymentMethodByExternalId(o,i))}async __deletePaymentMethodByExternalId(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/payment-methods/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/billing/payment-methods/{billing_id}")}listBillingPrices(o={},i){return S.fromPromise(this.__listBillingPrices(o,i))}async __listBillingPrices(o={},i){let{currency:t,forInitialPlan:s,forTrialExpiryPlan:r,ids:n,interval:d,isActive:g,price:h,productId:l,productIds:y,providerType:w,q:U,tiersMode:v,usageType:O,withMeter:B,limit:j,offset:$}=o,A={currency:t,for_initial_plan:s,for_trial_expiry_plan:r,ids:n,interval:d,is_active:g,price:h,product_id:l,product_ids:y,provider_type:w!=null?k.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,q:U,tiers_mode:v!=null?pe.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,usage_type:O!=null?ne.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"}):void 0,with_meter:B,limit:j,offset:$},le=await this._options.authProvider.getAuthRequest(),Le=P(le.headers,this._options?.headers,i?.headers),q=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/price"),method:"GET",headers:Le,queryString:u.queryBuilder().addMany(A).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(q.ok)return{data:$c.parseOrThrow(q.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:q.rawResponse};if(q.error.reason==="status-code")switch(q.error.statusCode){case 400:throw new T(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 401:throw new _(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 403:throw new z(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 404:throw new f(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 500:throw new R(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);default:throw new b({statusCode:q.error.statusCode,body:q.error.body,rawResponse:q.rawResponse})}return C(q.error,q.rawResponse,"GET","/billing/price")}upsertBillingPrice(o,i){return S.fromPromise(this.__upsertBillingPrice(o,i))}async __upsertBillingPrice(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/price/upsert"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ra.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:gl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/price/upsert")}deleteBillingProduct(o,i){return S.fromPromise(this.__deleteBillingProduct(o,i))}async __deleteBillingProduct(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/product/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/billing/product/{billing_id}")}listBillingProductPrices(o={},i){return S.fromPromise(this.__listBillingProductPrices(o,i))}async __listBillingProductPrices(o={},i){let{currency:t,forInitialPlan:s,forTrialExpiryPlan:r,ids:n,interval:d,isActive:g,price:h,productId:l,productIds:y,providerType:w,q:U,tiersMode:v,usageType:O,withMeter:B,limit:j,offset:$}=o,A={currency:t,for_initial_plan:s,for_trial_expiry_plan:r,ids:n,interval:d,is_active:g,price:h,product_id:l,product_ids:y,provider_type:w!=null?k.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,q:U,tiers_mode:v!=null?pe.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,usage_type:O!=null?ne.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"}):void 0,with_meter:B,limit:j,offset:$},le=await this._options.authProvider.getAuthRequest(),Le=P(le.headers,this._options?.headers,i?.headers),q=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/product/prices"),method:"GET",headers:Le,queryString:u.queryBuilder().addMany(A).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(q.ok)return{data:Zc.parseOrThrow(q.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:q.rawResponse};if(q.error.reason==="status-code")switch(q.error.statusCode){case 400:throw new T(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 401:throw new _(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 403:throw new z(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 404:throw new f(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);case 500:throw new R(a.parseOrThrow(q.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),q.rawResponse);default:throw new b({statusCode:q.error.statusCode,body:q.error.body,rawResponse:q.rawResponse})}return C(q.error,q.rawResponse,"GET","/billing/product/prices")}deleteProductPrice(o,i){return S.fromPromise(this.__deleteProductPrice(o,i))}async __deleteProductPrice(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/product/prices/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Hc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/billing/product/prices/{billing_id}")}upsertBillingProduct(o,i){return S.fromPromise(this.__upsertBillingProduct(o,i))}async __upsertBillingProduct(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/product/upsert"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:fa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:yl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/product/upsert")}listBillingProducts(o={},i){return S.fromPromise(this.__listBillingProducts(o,i))}async __listBillingProducts(o={},i){let{ids:t,isActive:s,name:r,priceUsageType:n,providerType:d,q:g,recurringChargesOnly:h,withOneTimeCharges:l,withPricesOnly:y,withZeroPrice:w,withoutLinkedToPlan:U,limit:v,offset:O}=o,B={ids:t,is_active:s,name:r,price_usage_type:n!=null?ne.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,provider_type:d!=null?k.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,q:g,recurring_charges_only:h,with_one_time_charges:l,with_prices_only:y,with_zero_price:w,without_linked_to_plan:U,limit:v,offset:O},j=await this._options.authProvider.getAuthRequest(),$=P(j.headers,this._options?.headers,i?.headers),A=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/products"),method:"GET",headers:$,queryString:u.queryBuilder().addMany(B).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(A.ok)return{data:Qc.parseOrThrow(A.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 400:throw new T(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 401:throw new _(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 403:throw new z(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 404:throw new f(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 500:throw new R(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);default:throw new b({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}return C(A.error,A.rawResponse,"GET","/billing/products")}countBillingProducts(o={},i){return S.fromPromise(this.__countBillingProducts(o,i))}async __countBillingProducts(o={},i){let{ids:t,isActive:s,name:r,priceUsageType:n,providerType:d,q:g,recurringChargesOnly:h,withOneTimeCharges:l,withPricesOnly:y,withZeroPrice:w,withoutLinkedToPlan:U,limit:v,offset:O}=o,B={ids:t,is_active:s,name:r,price_usage_type:n!=null?ne.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,provider_type:d!=null?k.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,q:g,recurring_charges_only:h,with_one_time_charges:l,with_prices_only:y,with_zero_price:w,without_linked_to_plan:U,limit:v,offset:O},j=await this._options.authProvider.getAuthRequest(),$=P(j.headers,this._options?.headers,i?.headers),A=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/products/count"),method:"GET",headers:$,queryString:u.queryBuilder().addMany(B).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(A.ok)return{data:Fc.parseOrThrow(A.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 400:throw new T(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 401:throw new _(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 403:throw new z(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 404:throw new f(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);case 500:throw new R(a.parseOrThrow(A.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),A.rawResponse);default:throw new b({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}return C(A.error,A.rawResponse,"GET","/billing/products/count")}upsertBillingSubscription(o,i){return S.fromPromise(this.__upsertBillingSubscription(o,i))}async __upsertBillingSubscription(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/subscription/upsert"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:_a.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:bl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/subscription/upsert")}};var xt=class{constructor(o){this._options=I(o)}internal(o,i){return S.fromPromise(this.__internal(o,i))}async __internal(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"checkout-internal"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Cn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:vl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/checkout-internal")}getCheckoutData(o,i){return S.fromPromise(this.__getCheckoutData(o,i))}async __getCheckoutData(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"checkout-internal/data"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ua.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ml.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/checkout-internal/data")}previewCheckoutInternal(o,i){return S.fromPromise(this.__previewCheckoutInternal(o,i))}async __previewCheckoutInternal(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"checkout-internal/preview"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Cn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ll.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/checkout-internal/preview")}managePlan(o,i){return S.fromPromise(this.__managePlan(o,i))}async __managePlan(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"manage-plan"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Tn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Il.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/manage-plan")}previewManagePlan(o,i){return S.fromPromise(this.__previewManagePlan(o,i))}async __previewManagePlan(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"manage-plan/preview"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Tn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/manage-plan/preview")}cancelSubscription(o,i){return S.fromPromise(this.__cancelSubscription(o,i))}async __cancelSubscription(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"manage-plan/subscription/cancel"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ca.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Cl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/manage-plan/subscription/cancel")}updateCustomerSubscriptionTrialEnd(o,i={},t){return S.fromPromise(this.__updateCustomerSubscriptionTrialEnd(o,i,t))}async __updateCustomerSubscriptionTrialEnd(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`subscription/${u.encodePathParam(o)}/edit-trial-end`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:va.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Hl.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/subscription/{subscription_id}/edit-trial-end")}};var Et=class{constructor(o){this._options=I(o)}listCompanies(o={},i){return S.fromPromise(this.__listCompanies(o,i))}async __listCompanies(o={},i){let{creditTypeIds:t,hasScheduledDowngrade:s,ids:r,monetizedSubscriptions:n,planId:d,planIds:g,planVersionId:h,planVersionIds:l,q:y,sortOrderColumn:w,sortOrderDirection:U,subscriptionStatuses:v,subscriptionTypes:O,withEntitlementFor:B,withoutFeatureOverrideFor:j,withoutPlan:$,withoutSubscription:A,withSubscription:le,limit:Le,offset:q}=o,M={credit_type_ids:t,has_scheduled_downgrade:s,ids:r,monetized_subscriptions:n,plan_id:d,plan_ids:g,plan_version_id:h,plan_version_ids:l,q:y,sort_order_column:w,sort_order_direction:U!=null?Te.jsonOrThrow(U,{unrecognizedObjectKeys:"strip"}):void 0,subscription_statuses:Array.isArray(v)?v.map($r=>gr.jsonOrThrow($r,{unrecognizedObjectKeys:"strip"})):v!=null?gr.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,subscription_types:Array.isArray(O)?O.map($r=>yr.jsonOrThrow($r,{unrecognizedObjectKeys:"strip"})):O!=null?yr.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"}):void 0,with_entitlement_for:B,without_feature_override_for:j,without_plan:$,without_subscription:A,with_subscription:le,limit:Le,offset:q},Jt=await this._options.authProvider.getAuthRequest(),Zt=P(Jt.headers,this._options?.headers,i?.headers),F=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies"),method:"GET",headers:Zt,queryString:u.queryBuilder().addMany(M).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(F.ok)return{data:Ep.parseOrThrow(F.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:F.rawResponse};if(F.error.reason==="status-code")switch(F.error.statusCode){case 400:throw new T(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 401:throw new _(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 403:throw new z(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 404:throw new f(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 500:throw new R(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);default:throw new b({statusCode:F.error.statusCode,body:F.error.body,rawResponse:F.rawResponse})}return C(F.error,F.rawResponse,"GET","/companies")}upsertCompany(o,i){return S.fromPromise(this.__upsertCompany(o,i))}async __upsertCompany(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:On.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/companies")}getCompany(o,i){return S.fromPromise(this.__getCompany(o,i))}async __getCompany(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`companies/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:mp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/companies/{company_id}")}deleteCompany(o,i={},t){return S.fromPromise(this.__deleteCompany(o,i,t))}async __deleteCompany(o,i={},t){let{cancelSubscription:s,prorate:r}=i,n={cancel_subscription:s,prorate:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,t?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`companies/${u.encodePathParam(o)}`),method:"DELETE",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(t?.queryParams).build(),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:cp.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"DELETE","/companies/{company_id}")}countCompanies(o={},i){return S.fromPromise(this.__countCompanies(o,i))}async __countCompanies(o={},i){let{creditTypeIds:t,hasScheduledDowngrade:s,ids:r,monetizedSubscriptions:n,planId:d,planIds:g,planVersionId:h,planVersionIds:l,q:y,sortOrderColumn:w,sortOrderDirection:U,subscriptionStatuses:v,subscriptionTypes:O,withEntitlementFor:B,withoutFeatureOverrideFor:j,withoutPlan:$,withoutSubscription:A,withSubscription:le,limit:Le,offset:q}=o,M={credit_type_ids:t,has_scheduled_downgrade:s,ids:r,monetized_subscriptions:n,plan_id:d,plan_ids:g,plan_version_id:h,plan_version_ids:l,q:y,sort_order_column:w,sort_order_direction:U!=null?Te.jsonOrThrow(U,{unrecognizedObjectKeys:"strip"}):void 0,subscription_statuses:Array.isArray(v)?v.map($r=>gr.jsonOrThrow($r,{unrecognizedObjectKeys:"strip"})):v!=null?gr.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"}):void 0,subscription_types:Array.isArray(O)?O.map($r=>yr.jsonOrThrow($r,{unrecognizedObjectKeys:"strip"})):O!=null?yr.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"}):void 0,with_entitlement_for:B,without_feature_override_for:j,without_plan:$,without_subscription:A,with_subscription:le,limit:Le,offset:q},Jt=await this._options.authProvider.getAuthRequest(),Zt=P(Jt.headers,this._options?.headers,i?.headers),F=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies/count"),method:"GET",headers:Zt,queryString:u.queryBuilder().addMany(M).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(F.ok)return{data:$l.parseOrThrow(F.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:F.rawResponse};if(F.error.reason==="status-code")switch(F.error.statusCode){case 400:throw new T(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 401:throw new _(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 403:throw new z(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 404:throw new f(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);case 500:throw new R(a.parseOrThrow(F.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),F.rawResponse);default:throw new b({statusCode:F.error.statusCode,body:F.error.body,rawResponse:F.rawResponse})}return C(F.error,F.rawResponse,"GET","/companies/count")}createCompany(o,i){return S.fromPromise(this.__createCompany(o,i))}async __createCompany(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies/create"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:On.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:op.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/companies/create")}deleteCompanyByKeys(o,i){return S.fromPromise(this.__deleteCompanyByKeys(o,i))}async __deleteCompanyByKeys(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies/delete"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:vn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ap.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/companies/delete")}lookupCompany(o,i){return S.fromPromise(this.__lookupCompany(o,i))}async __lookupCompany(o,i){let{keys:t}=o,s={keys:xe(t)},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"companies/lookup"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Ip.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/companies/lookup")}listCompanyMemberships(o={},i){return S.fromPromise(this.__listCompanyMemberships(o,i))}async __listCompanyMemberships(o={},i){let{companyId:t,userId:s,limit:r,offset:n}=o,d={company_id:t,user_id:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-memberships"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Up.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/company-memberships")}getOrCreateCompanyMembership(o,i){return S.fromPromise(this.__getOrCreateCompanyMembership(o,i))}async __getOrCreateCompanyMembership(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-memberships"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ba.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:bp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/company-memberships")}deleteCompanyMembership(o,i){return S.fromPromise(this.__deleteCompanyMembership(o,i))}async __deleteCompanyMembership(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`company-memberships/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:np.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/company-memberships/{company_membership_id}")}getActiveCompanySubscription(o={},i){return S.fromPromise(this.__getActiveCompanySubscription(o,i))}async __getActiveCompanySubscription(o={},i){let{companyId:t,companyIds:s,limit:r,offset:n}=o,d={company_id:t,company_ids:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-subscriptions"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:dp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/company-subscriptions")}upsertCompanyTrait(o,i){return S.fromPromise(this.__upsertCompanyTrait(o,i))}async __upsertCompanyTrait(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-traits"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:kn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Hp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/company-traits")}listEntityKeyDefinitions(o={},i){return S.fromPromise(this.__listEntityKeyDefinitions(o,i))}async __listEntityKeyDefinitions(o={},i){let{entityType:t,ids:s,q:r,limit:n,offset:d}=o,g={entity_type:t!=null?ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-key-definitions"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Tp.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/entity-key-definitions")}countEntityKeyDefinitions(o={},i){return S.fromPromise(this.__countEntityKeyDefinitions(o,i))}async __countEntityKeyDefinitions(o={},i){let{entityType:t,ids:s,q:r,limit:n,offset:d}=o,g={entity_type:t!=null?ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-key-definitions/count"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Zl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/entity-key-definitions/count")}listEntityTraitDefinitions(o={},i){return S.fromPromise(this.__listEntityTraitDefinitions(o,i))}async __listEntityTraitDefinitions(o={},i){let{entityType:t,ids:s,q:r,traitType:n,traitTypes:d,limit:g,offset:h}=o,l={entity_type:t!=null?ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,trait_type:n!=null?ue.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,trait_types:Array.isArray(d)?d.map(v=>ue.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):d!=null?ue.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-trait-definitions"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:kp.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/entity-trait-definitions")}getOrCreateEntityTraitDefinition(o,i){return S.fromPromise(this.__getOrCreateEntityTraitDefinition(o,i))}async __getOrCreateEntityTraitDefinition(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-trait-definitions"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:ka.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/entity-trait-definitions")}getEntityTraitDefinition(o,i){return S.fromPromise(this.__getEntityTraitDefinition(o,i))}async __getEntityTraitDefinition(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`entity-trait-definitions/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:hp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/entity-trait-definitions/{entity_trait_definition_id}")}updateEntityTraitDefinition(o,i,t){return S.fromPromise(this.__updateEntityTraitDefinition(o,i,t))}async __updateEntityTraitDefinition(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`entity-trait-definitions/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:ja.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Lp.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/entity-trait-definitions/{entity_trait_definition_id}")}countEntityTraitDefinitions(o={},i){return S.fromPromise(this.__countEntityTraitDefinitions(o,i))}async __countEntityTraitDefinitions(o={},i){let{entityType:t,ids:s,q:r,traitType:n,traitTypes:d,limit:g,offset:h}=o,l={entity_type:t!=null?ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,ids:s,q:r,trait_type:n!=null?ue.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,trait_types:Array.isArray(d)?d.map(v=>ue.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):d!=null?ue.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-trait-definitions/count"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:Ql.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/entity-trait-definitions/count")}getEntityTraitValues(o,i){return S.fromPromise(this.__getEntityTraitValues(o,i))}async __getEntityTraitValues(o,i){let{definitionId:t,q:s,limit:r,offset:n}=o,d={definition_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"entity-trait-values"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:wp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/entity-trait-values")}listPlanChanges(o={},i){return S.fromPromise(this.__listPlanChanges(o,i))}async __listPlanChanges(o={},i){let{action:t,basePlanAction:s,companyId:r,companyIds:n,planIds:d,limit:g,offset:h}=o,l={action:t!=null?vi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}):void 0,base_plan_action:s!=null?Ti.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,company_id:r,company_ids:n,plan_ids:d,limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-changes"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:jp.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/plan-changes")}getPlanChange(o,i){return S.fromPromise(this.__getPlanChange(o,i))}async __getPlanChange(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-changes/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:_p.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/plan-changes/{plan_change_id}")}listPlanTraits(o={},i){return S.fromPromise(this.__listPlanTraits(o,i))}async __listPlanTraits(o={},i){let{ids:t,planId:s,traitId:r,traitIds:n,limit:d,offset:g}=o,h={ids:t,plan_id:s,trait_id:r,trait_ids:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-traits"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Vp.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/plan-traits")}getPlanTrait(o,i){return S.fromPromise(this.__getPlanTrait(o,i))}async __getPlanTrait(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-traits/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Sp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/plan-traits/{plan_trait_id}")}updatePlanTraitsBulk(o,i){return S.fromPromise(this.__updatePlanTraitsBulk(o,i))}async __updatePlanTraitsBulk(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-traits/bulk"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Aa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-traits/bulk")}countPlanTraits(o={},i){return S.fromPromise(this.__countPlanTraits(o,i))}async __countPlanTraits(o={},i){let{ids:t,planId:s,traitId:r,traitIds:n,limit:d,offset:g}=o,h={ids:t,plan_id:s,trait_id:r,trait_ids:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-traits/count"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:ep.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/plan-traits/count")}upsertUserTrait(o,i){return S.fromPromise(this.__upsertUserTrait(o,i))}async __upsertUserTrait(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"user-traits"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:kn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:$p.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/user-traits")}listUsers(o={},i){return S.fromPromise(this.__listUsers(o,i))}async __listUsers(o={},i){let{companyId:t,ids:s,planId:r,q:n,limit:d,offset:g}=o,h={company_id:t,ids:s,plan_id:r,q:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:Dp.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/users")}upsertUser(o,i){return S.fromPromise(this.__upsertUser(o,i))}async __upsertUser(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Bn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Np.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/users")}getUser(o,i){return S.fromPromise(this.__getUser(o,i))}async __getUser(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`users/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Pp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/users/{user_id}")}deleteUser(o,i){return S.fromPromise(this.__deleteUser(o,i))}async __deleteUser(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`users/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:pp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/users/{user_id}")}countUsers(o={},i){return S.fromPromise(this.__countUsers(o,i))}async __countUsers(o={},i){let{companyId:t,ids:s,planId:r,q:n,limit:d,offset:g}=o,h={company_id:t,ids:s,plan_id:r,q:n,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users/count"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:ip.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/users/count")}createUser(o,i){return S.fromPromise(this.__createUser(o,i))}async __createUser(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users/create"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Bn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:tp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/users/create")}deleteUserByKeys(o,i){return S.fromPromise(this.__deleteUserByKeys(o,i))}async __deleteUserByKeys(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users/delete"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:vn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:lp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/users/delete")}lookupUser(o,i){return S.fromPromise(this.__lookupUser(o,i))}async __lookupUser(o,i){let{keys:t}=o,s={keys:xe(t)},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"users/lookup"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Kp.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/users/lookup")}};var Ct=class{constructor(o){this._options=I(o)}listComponents(o={},i){return S.fromPromise(this.__listComponents(o,i))}async __listComponents(o={},i){let{q:t,limit:s,offset:r}=o,n={q:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"components"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:ru.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/components")}createComponent(o,i){return S.fromPromise(this.__createComponent(o,i))}async __createComponent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"components"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Yp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/components")}getComponent(o,i){return S.fromPromise(this.__getComponent(o,i))}async __getComponent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`components/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Xp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/components/{component_id}")}updateComponent(o,i={},t){return S.fromPromise(this.__updateComponent(o,i,t))}async __updateComponent(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`components/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Da.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:du.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/components/{component_id}")}deleteComponent(o,i){return S.fromPromise(this.__deleteComponent(o,i))}async __deleteComponent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`components/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Qp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/components/{component_id}")}countComponents(o={},i){return S.fromPromise(this.__countComponents(o,i))}async __countComponents(o={},i){let{q:t,limit:s,offset:r}=o,n={q:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"components/count"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:Zp.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/components/count")}previewComponentData(o={},i){return S.fromPromise(this.__previewComponentData(o,i))}async __previewComponentData(o={},i){let{companyId:t,componentId:s}=o,r={company_id:t,component_id:s},n=await this._options.authProvider.getAuthRequest(),d=P(n.headers,this._options?.headers,i?.headers),g=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"components/preview-data"),method:"GET",headers:d,queryString:u.queryBuilder().addMany(r).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:uu.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new _(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new z(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new f(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new R(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new b({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return C(g.error,g.rawResponse,"GET","/components/preview-data")}};var Ut=class{constructor(o){this._options=I(o)}getPublicPlans(o){return S.fromPromise(this.__getPublicPlans(o))}async __getPublicPlans(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"public/plans"),method:"GET",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:hu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"GET","/public/plans")}};var vt=class{constructor(o){this._options=I(o)}listBillingCredits(o={},i){return S.fromPromise(this.__listBillingCredits(o,i))}async __listBillingCredits(o={},i){let{ids:t,name:s,limit:r,offset:n}=o,d={ids:t,name:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Hu.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/credits")}createBillingCredit(o,i){return S.fromPromise(this.__createBillingCredit(o,i))}async __createBillingCredit(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ka.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Tu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/credits")}getSingleBillingCredit(o,i){return S.fromPromise(this.__getSingleBillingCredit(o,i))}async __getSingleBillingCredit(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Fu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/billing/credits/{credit_id}")}updateBillingCredit(o,i,t){return S.fromPromise(this.__updateBillingCredit(o,i,t))}async __updateBillingCredit(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Ha.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:ld.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/{credit_id}")}softDeleteBillingCredit(o,i){return S.fromPromise(this.__softDeleteBillingCredit(o,i))}async __softDeleteBillingCredit(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:cd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/billing/credits/{credit_id}")}listCompanyCreditBalances(o,i){return S.fromPromise(this.__listCompanyCreditBalances(o,i))}async __listCompanyCreditBalances(o,i){let{companyId:t}=o,s={company_id:t},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/balance"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Yu.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new T(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/billing/credits/balance")}listCreditBundles(o={},i){return S.fromPromise(this.__listCreditBundles(o,i))}async __listCreditBundles(o={},i){let{ids:t,creditId:s,status:r,bundleType:n,limit:d,offset:g}=o,h={ids:t,credit_id:s,status:r!=null?Pe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,bundle_type:n!=null?Oe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/bundles"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:rd.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/billing/credits/bundles")}createCreditBundle(o,i){return S.fromPromise(this.__createCreditBundle(o,i))}async __createCreditBundle(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/bundles"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ga.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ku.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/credits/bundles")}getCreditBundle(o,i){return S.fromPromise(this.__getCreditBundle(o,i))}async __getCreditBundle(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/bundles/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:qu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/billing/credits/bundles/{bundle_id}")}updateCreditBundleDetails(o,i,t){return S.fromPromise(this.__updateCreditBundleDetails(o,i,t))}async __updateCreditBundleDetails(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/bundles/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Na.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:ud.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/bundles/{bundle_id}")}deleteCreditBundle(o,i){return S.fromPromise(this.__deleteCreditBundle(o,i))}async __deleteCreditBundle(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/bundles/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Au.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/billing/credits/bundles/{bundle_id}")}countCreditBundles(o={},i){return S.fromPromise(this.__countCreditBundles(o,i))}async __countCreditBundles(o={},i){let{ids:t,creditId:s,status:r,bundleType:n,limit:d,offset:g}=o,h={ids:t,credit_id:s,status:r!=null?Pe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,bundle_type:n!=null?Oe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/bundles/count"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:xu.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/billing/credits/bundles/count")}countBillingCredits(o={},i){return S.fromPromise(this.__countBillingCredits(o,i))}async __countBillingCredits(o={},i){let{ids:t,name:s,limit:r,offset:n}=o,d={ids:t,name:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:zu.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/credits/count")}zeroOutGrant(o,i={},t){return S.fromPromise(this.__zeroOutGrant(o,i,t))}async __zeroOutGrant(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/grants/${u.encodePathParam(o)}/zero-out`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:$a.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:dd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/grants/{grant_id}/zero-out")}grantBillingCreditsToCompany(o,i){return S.fromPromise(this.__grantBillingCreditsToCompany(o,i))}async __grantBillingCreditsToCompany(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/grants/company"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:La.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/credits/grants/company")}countCompanyGrants(o={},i){return S.fromPromise(this.__countCompanyGrants(o,i))}async __countCompanyGrants(o={},i){let{companyId:t,order:s,dir:r,limit:n,offset:d}=o,g={company_id:t,order:s!=null?Xr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,dir:r!=null?Te.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/grants/company/count"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Su.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/billing/credits/grants/company/count")}listCompanyGrants(o={},i){return S.fromPromise(this.__listCompanyGrants(o,i))}async __listCompanyGrants(o={},i){let{companyId:t,order:s,dir:r,limit:n,offset:d}=o,g={company_id:t,order:s!=null?Xr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,dir:r!=null?Te.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/grants/company/list"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Xu.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/billing/credits/grants/company/list")}countBillingCreditsGrants(o={},i){return S.fromPromise(this.__countBillingCreditsGrants(o,i))}async __countBillingCreditsGrants(o={},i){let{creditId:t,ids:s,limit:r,offset:n}=o,d={credit_id:t,ids:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/grants/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:wu.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/credits/grants/count")}listGrantsForCredit(o={},i){return S.fromPromise(this.__listGrantsForCredit(o,i))}async __listGrantsForCredit(o={},i){let{creditId:t,ids:s,limit:r,offset:n}=o,d={credit_id:t,ids:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/grants/list"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:nd.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/billing/credits/grants/list")}acquireCreditLease(o,i){return S.fromPromise(this.__acquireCreditLease(o,i))}async __acquireCreditLease(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/lease"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Fa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:gu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/credits/lease")}extendCreditLease(o,i,t){return S.fromPromise(this.__extendCreditLease(o,i,t))}async __extendCreditLease(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/lease/${u.encodePathParam(o)}/extend`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Wa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Vu.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/lease/{lease_id}/extend")}releaseCreditLease(o,i,t){return S.fromPromise(this.__releaseCreditLease(o,i,t))}async __releaseCreditLease(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/lease/${u.encodePathParam(o)}/release`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:iy.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:sd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/lease/{lease_id}/release")}getEnrichedCreditLedger(o,i){return S.fromPromise(this.__getEnrichedCreditLedger(o,i))}async __getEnrichedCreditLedger(o,i){let{companyId:t,billingCreditId:s,featureId:r,period:n,startTime:d,endTime:g,limit:h,offset:l}=o,y={company_id:t,billing_credit_id:s,feature_id:r,period:ei.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),start_time:d,end_time:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/ledger"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:Iu.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/billing/credits/ledger")}countCreditLedger(o,i){return S.fromPromise(this.__countCreditLedger(o,i))}async __countCreditLedger(o,i){let{companyId:t,billingCreditId:s,featureId:r,period:n,startTime:d,endTime:g,limit:h,offset:l}=o,y={company_id:t,billing_credit_id:s,feature_id:r,period:ei.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),start_time:d,end_time:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/ledger/count"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:vu.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/billing/credits/ledger/count")}listBillingPlanCreditGrants(o={},i){return S.fromPromise(this.__listBillingPlanCreditGrants(o,i))}async __listBillingPlanCreditGrants(o={},i){let{creditId:t,ids:s,planId:r,planIds:n,planVersionId:d,planVersionIds:g,limit:h,offset:l}=o,y={credit_id:t,ids:s,plan_id:r,plan_ids:n,plan_version_id:d,plan_version_ids:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/plan-grants"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:$u.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/billing/credits/plan-grants")}createBillingPlanCreditGrant(o,i){return S.fromPromise(this.__createBillingPlanCreditGrant(o,i))}async __createBillingPlanCreditGrant(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/plan-grants"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:nt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ou.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/billing/credits/plan-grants")}getSingleBillingPlanCreditGrant(o,i){return S.fromPromise(this.__getSingleBillingPlanCreditGrant(o,i))}async __getSingleBillingPlanCreditGrant(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/plan-grants/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ku.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/billing/credits/plan-grants/{plan_grant_id}")}updateBillingPlanCreditGrant(o,i,t){return S.fromPromise(this.__updateBillingPlanCreditGrant(o,i,t))}async __updateBillingPlanCreditGrant(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/plan-grants/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:st.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:pd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/billing/credits/plan-grants/{plan_grant_id}")}deleteBillingPlanCreditGrant(o,i={},t){return S.fromPromise(this.__deleteBillingPlanCreditGrant(o,i,t))}async __deleteBillingPlanCreditGrant(o,i={},t){let{applyToExisting:s}=i,r={apply_to_existing:s},n=await this._options.authProvider.getAuthRequest(),d=P(n.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`billing/credits/plan-grants/${u.encodePathParam(o)}`),method:"DELETE",headers:d,queryString:u.queryBuilder().addMany(r).mergeAdditional(t?.queryParams).build(),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:ju.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new _(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new z(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new f(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new R(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new b({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return C(g.error,g.rawResponse,"DELETE","/billing/credits/plan-grants/{plan_grant_id}")}countBillingPlanCreditGrants(o={},i){return S.fromPromise(this.__countBillingPlanCreditGrants(o,i))}async __countBillingPlanCreditGrants(o={},i){let{creditId:t,ids:s,planId:r,planIds:n,planVersionId:d,planVersionIds:g,limit:h,offset:l}=o,y={credit_id:t,ids:s,plan_id:r,plan_ids:n,plan_version_id:d,plan_version_ids:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"billing/credits/plan-grants/count"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:fu.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/billing/credits/plan-grants/count")}listCreditEventLedger(o,i){return S.fromPromise(this.__listCreditEventLedger(o,i))}async __listCreditEventLedger(o,i){let{billingCreditId:t,companyId:s,endTime:r,eventType:n,featureId:d,startTime:g,limit:h,offset:l}=o,y={billing_credit_id:t,company_id:s,end_time:r,event_type:n!=null?wr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,feature_id:d,start_time:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"v2/billing/credits/ledger"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:td.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/v2/billing/credits/ledger")}countCreditEventLedger(o,i){return S.fromPromise(this.__countCreditEventLedger(o,i))}async __countCreditEventLedger(o,i){let{billingCreditId:t,companyId:s,endTime:r,eventType:n,featureId:d,startTime:g,limit:h,offset:l}=o,y={billing_credit_id:t,company_id:s,end_time:r,event_type:n!=null?wr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,feature_id:d,start_time:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"v2/billing/credits/ledger/count"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:Cu.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/v2/billing/credits/ledger/count")}};var Tt=class{constructor(o){this._options=I(o)}createDataExport(o,i){return S.fromPromise(this.__createDataExport(o,i))}async __createDataExport(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"data-exports"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:{...Ja.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),export_type:"company-feature-usage",output_file_type:"csv"},timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:wd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/data-exports")}getDataExportArtifact(o,i){return S.fromPromise(this.__getDataExportArtifact(o,i))}async __getDataExportArtifact(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`data-exports/${u.encodePathParam(o)}/artifact`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),responseType:"streaming",timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/data-exports/{data_export_id}/artifact")}};var Ot=class{constructor(o){this._options=I(o)}listCompanyOverrides(o={},i){return S.fromPromise(this.__listCompanyOverrides(o,i))}async __listCompanyOverrides(o={},i){let{companyId:t,companyIds:s,featureId:r,featureIds:n,ids:d,withoutExpired:g,q:h,limit:l,offset:y}=o,w={company_id:t,company_ids:s,feature_id:r,feature_ids:n,ids:d,without_expired:g,q:h,limit:l,offset:y},U=await this._options.authProvider.getAuthRequest(),v=P(U.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-overrides"),method:"GET",headers:v,queryString:u.queryBuilder().addMany(w).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:Hd.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new _(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new z(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new f(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new R(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new b({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return C(O.error,O.rawResponse,"GET","/company-overrides")}createCompanyOverride(o,i){return S.fromPromise(this.__createCompanyOverride(o,i))}async __createCompanyOverride(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-overrides"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Ya.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ud.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/company-overrides")}getCompanyOverride(o,i){return S.fromPromise(this.__getCompanyOverride(o,i))}async __getCompanyOverride(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`company-overrides/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Vd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/company-overrides/{company_override_id}")}updateCompanyOverride(o,i,t){return S.fromPromise(this.__updateCompanyOverride(o,i,t))}async __updateCompanyOverride(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`company-overrides/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:en.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:tm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/company-overrides/{company_override_id}")}deleteCompanyOverride(o,i){return S.fromPromise(this.__deleteCompanyOverride(o,i))}async __deleteCompanyOverride(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`company-overrides/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Td.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/company-overrides/{company_override_id}")}countCompanyOverrides(o={},i){return S.fromPromise(this.__countCompanyOverrides(o,i))}async __countCompanyOverrides(o={},i){let{companyId:t,companyIds:s,featureId:r,featureIds:n,ids:d,withoutExpired:g,q:h,limit:l,offset:y}=o,w={company_id:t,company_ids:s,feature_id:r,feature_ids:n,ids:d,without_expired:g,q:h,limit:l,offset:y},U=await this._options.authProvider.getAuthRequest(),v=P(U.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"company-overrides/count"),method:"GET",headers:v,queryString:u.queryBuilder().addMany(w).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:zd.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new _(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new z(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new f(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new R(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new b({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return C(O.error,O.rawResponse,"GET","/company-overrides/count")}listFeatureCompanies(o,i){return S.fromPromise(this.__listFeatureCompanies(o,i))}async __listFeatureCompanies(o,i){let{featureId:t,q:s,limit:r,offset:n}=o,d={feature_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-companies"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Zd.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/feature-companies")}countFeatureCompanies(o,i){return S.fromPromise(this.__countFeatureCompanies(o,i))}async __countFeatureCompanies(o,i){let{featureId:t,q:s,limit:r,offset:n}=o,d={feature_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-companies/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:fd.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/feature-companies/count")}listFeatureUsage(o={},i){return S.fromPromise(this.__listFeatureUsage(o,i))}async __listFeatureUsage(o={},i){let{companyId:t,companyKeys:s,featureIds:r,includeUsageAggregation:n,managedBy:d,q:g,withoutNegativeEntitlements:h,limit:l,offset:y}=o,w={company_id:t,company_keys:s!=null?xe(s):void 0,feature_ids:r,include_usage_aggregation:n,managed_by:d!=null?k.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,q:g,without_negative_entitlements:h,limit:l,offset:y},U=await this._options.authProvider.getAuthRequest(),v=P(U.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-usage"),method:"GET",headers:v,queryString:u.queryBuilder().addMany(w).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:Qd.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new _(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new z(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new f(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new R(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new b({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return C(O.error,O.rawResponse,"GET","/feature-usage")}getFeatureUsageTimeSeries(o,i){return S.fromPromise(this.__getFeatureUsageTimeSeries(o,i))}async __getFeatureUsageTimeSeries(o,i){let{companyId:t,endTime:s,featureId:r,granularity:n,startTime:d}=o,g={company_id:t,end_time:s.toISOString(),feature_id:r,granularity:n!=null?$e.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,start_time:d.toISOString()},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-usage-timeseries"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Ld.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/feature-usage-timeseries")}countFeatureUsage(o={},i){return S.fromPromise(this.__countFeatureUsage(o,i))}async __countFeatureUsage(o={},i){let{companyId:t,companyKeys:s,featureIds:r,includeUsageAggregation:n,managedBy:d,q:g,withoutNegativeEntitlements:h,limit:l,offset:y}=o,w={company_id:t,company_keys:s!=null?xe(s):void 0,feature_ids:r,include_usage_aggregation:n,managed_by:d!=null?k.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,q:g,without_negative_entitlements:h,limit:l,offset:y},U=await this._options.authProvider.getAuthRequest(),v=P(U.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-usage/count"),method:"GET",headers:v,queryString:u.queryBuilder().addMany(w).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(O.ok)return{data:Sd.parseOrThrow(O.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:O.rawResponse};if(O.error.reason==="status-code")switch(O.error.statusCode){case 400:throw new T(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new _(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new z(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new f(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new R(a.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);default:throw new b({statusCode:O.error.statusCode,body:O.error.body,rawResponse:O.rawResponse})}return C(O.error,O.rawResponse,"GET","/feature-usage/count")}listFeatureUsers(o,i){return S.fromPromise(this.__listFeatureUsers(o,i))}async __listFeatureUsers(o,i){let{featureId:t,q:s,limit:r,offset:n}=o,d={feature_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-users"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:rm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/feature-users")}countFeatureUsers(o,i){return S.fromPromise(this.__countFeatureUsers(o,i))}async __countFeatureUsers(o,i){let{featureId:t,q:s,limit:r,offset:n}=o,d={feature_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"feature-users/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:xd.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/feature-users/count")}listPlanEntitlements(o={},i){return S.fromPromise(this.__listPlanEntitlements(o,i))}async __listPlanEntitlements(o={},i){let{featureId:t,featureIds:s,ids:r,planId:n,planIds:d,planVersionId:g,planVersionIds:h,q:l,withMeteredProducts:y,limit:w,offset:U}=o,v={feature_id:t,feature_ids:s,ids:r,plan_id:n,plan_ids:d,plan_version_id:g,plan_version_ids:h,q:l,with_metered_products:y,limit:w,offset:U},O=await this._options.authProvider.getAuthRequest(),B=P(O.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-entitlements"),method:"GET",headers:B,queryString:u.queryBuilder().addMany(v).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(j.ok)return{data:om.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new T(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new _(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new z(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new f(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new R(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new b({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return C(j.error,j.rawResponse,"GET","/plan-entitlements")}createPlanEntitlement(o,i){return S.fromPromise(this.__createPlanEntitlement(o,i))}async __createPlanEntitlement(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-entitlements"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:vd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-entitlements")}getPlanEntitlement(o,i){return S.fromPromise(this.__getPlanEntitlement(o,i))}async __getPlanEntitlement(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-entitlements/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Gd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/plan-entitlements/{plan_entitlement_id}")}updatePlanEntitlement(o,i,t){return S.fromPromise(this.__updatePlanEntitlement(o,i,t))}async __updatePlanEntitlement(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-entitlements/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:rn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:am.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plan-entitlements/{plan_entitlement_id}")}deletePlanEntitlement(o,i){return S.fromPromise(this.__deletePlanEntitlement(o,i))}async __deletePlanEntitlement(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-entitlements/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Od.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/plan-entitlements/{plan_entitlement_id}")}upsertPlanEntitlementForBillingProduct(o,i){return S.fromPromise(this.__upsertPlanEntitlementForBillingProduct(o,i))}async __upsertPlanEntitlementForBillingProduct(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-entitlements/billing-linked"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Za.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:nm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-entitlements/billing-linked")}countPlanEntitlements(o={},i){return S.fromPromise(this.__countPlanEntitlements(o,i))}async __countPlanEntitlements(o={},i){let{featureId:t,featureIds:s,ids:r,planId:n,planIds:d,planVersionId:g,planVersionIds:h,q:l,withMeteredProducts:y,limit:w,offset:U}=o,v={feature_id:t,feature_ids:s,ids:r,plan_id:n,plan_ids:d,plan_version_id:g,plan_version_ids:h,q:l,with_metered_products:y,limit:w,offset:U},O=await this._options.authProvider.getAuthRequest(),B=P(O.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-entitlements/count"),method:"GET",headers:B,queryString:u.queryBuilder().addMany(v).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(j.ok)return{data:Cd.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new T(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new _(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new z(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new f(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new R(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new b({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return C(j.error,j.rawResponse,"GET","/plan-entitlements/count")}duplicatePlanEntitlements(o,i){return S.fromPromise(this.__duplicatePlanEntitlements(o,i))}async __duplicatePlanEntitlements(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-entitlements/duplicate"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Xa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Ad.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-entitlements/duplicate")}getFeatureUsageByCompany(o,i){return S.fromPromise(this.__getFeatureUsageByCompany(o,i))}async __getFeatureUsageByCompany(o,i){let{keys:t}=o,s={keys:xe(t)},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"usage-by-company"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Dd.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/usage-by-company")}};var kt=class{constructor(o){this._options=I(o)}createEventBatch(o,i){return S.fromPromise(this.__createEventBatch(o,i))}async __createEventBatch(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"event-batch"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:on.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:dm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/event-batch")}getEventSummaries(o={},i){return S.fromPromise(this.__getEventSummaries(o,i))}async __getEventSummaries(o={},i){let{q:t,eventSubtypes:s,limit:r,offset:n}=o,d={q:t,event_subtypes:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"event-types"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:wm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/event-types")}listEvents(o={},i){return S.fromPromise(this.__listEvents(o,i))}async __listEvents(o={},i){let{companyId:t,eventSubtype:s,eventTypes:r,flagId:n,idempotencyKey:d,userId:g,limit:h,offset:l}=o,y={company_id:t,event_subtype:s,event_types:Array.isArray(r)?r.map(O=>br.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})):r!=null?br.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,flag_id:n,idempotency_key:d,user_id:g,limit:h,offset:l},w=await this._options.authProvider.getAuthRequest(),U=P(w.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"events"),method:"GET",headers:U,queryString:u.queryBuilder().addMany(y).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(v.ok)return{data:fm.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new T(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new _(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new z(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new f(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new R(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new b({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}return C(v.error,v.rawResponse,"GET","/events")}createEvent(o,i){return S.fromPromise(this.__createEvent(o,i))}async __createEvent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"events"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Jo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:mm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/events")}getEvent(o,i){return S.fromPromise(this.__getEvent(o,i))}async __getEvent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`events/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:gm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/events/{event_id}")}getSegmentIntegrationStatus(o){return S.fromPromise(this.__getSegmentIntegrationStatus(o))}async __getSegmentIntegrationStatus(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"segment-integration"),method:"GET",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:zm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"GET","/segment-integration")}};var Bt=class{constructor(o){this._options=I(o)}listFeatures(o={},i){return S.fromPromise(this.__listFeatures(o,i))}async __listFeatures(o={},i){let{booleanRequireEvent:t,featureType:s,ids:r,managedBy:n,planVersionId:d,q:g,withoutCompanyOverrideFor:h,withoutPlanEntitlementFor:l,limit:y,offset:w}=o,U={boolean_require_event:t,feature_type:Array.isArray(s)?s.map(j=>se.jsonOrThrow(j,{unrecognizedObjectKeys:"strip"})):s!=null?se.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,ids:r,managed_by:n!=null?k.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,plan_version_id:d,q:g,without_company_override_for:h,without_plan_entitlement_for:l,limit:y,offset:w},v=await this._options.authProvider.getAuthRequest(),O=P(v.headers,this._options?.headers,i?.headers),B=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"features"),method:"GET",headers:O,queryString:u.queryBuilder().addMany(U).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(B.ok)return{data:Fm.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new T(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new _(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new z(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new f(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new R(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new b({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}return C(B.error,B.rawResponse,"GET","/features")}createFeature(o,i){return S.fromPromise(this.__createFeature(o,i))}async __createFeature(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"features"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:nn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/features")}getFeature(o,i){return S.fromPromise(this.__getFeature(o,i))}async __getFeature(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`features/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Dm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/features/{feature_id}")}updateFeature(o,i={},t){return S.fromPromise(this.__updateFeature(o,i,t))}async __updateFeature(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`features/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:sn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Gm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/features/{feature_id}")}deleteFeature(o,i){return S.fromPromise(this.__deleteFeature(o,i))}async __deleteFeature(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`features/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Vm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/features/{feature_id}")}upsertFeatureForBillingProduct(o,i){return S.fromPromise(this.__upsertFeatureForBillingProduct(o,i))}async __upsertFeatureForBillingProduct(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"features/billing-linked"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:an.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/features/billing-linked")}countFeatures(o={},i){return S.fromPromise(this.__countFeatures(o,i))}async __countFeatures(o={},i){let{booleanRequireEvent:t,featureType:s,ids:r,managedBy:n,planVersionId:d,q:g,withoutCompanyOverrideFor:h,withoutPlanEntitlementFor:l,limit:y,offset:w}=o,U={boolean_require_event:t,feature_type:Array.isArray(s)?s.map(j=>se.jsonOrThrow(j,{unrecognizedObjectKeys:"strip"})):s!=null?se.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,ids:r,managed_by:n!=null?k.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,plan_version_id:d,q:g,without_company_override_for:h,without_plan_entitlement_for:l,limit:y,offset:w},v=await this._options.authProvider.getAuthRequest(),O=P(v.headers,this._options?.headers,i?.headers),B=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"features/count"),method:"GET",headers:O,queryString:u.queryBuilder().addMany(U).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(B.ok)return{data:Om.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new T(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new _(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new z(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new f(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new R(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new b({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}return C(B.error,B.rawResponse,"GET","/features/count")}listFlags(o={},i){return S.fromPromise(this.__listFlags(o,i))}async __listFlags(o={},i){let{featureId:t,ids:s,q:r,limit:n,offset:d}=o,g={feature_id:t,ids:s,q:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"flags"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Lm.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/flags")}createFlag(o,i){return S.fromPromise(this.__createFlag(o,i))}async __createFlag(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"flags"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Un.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Am.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/flags")}getFlag(o,i){return S.fromPromise(this.__getFlag(o,i))}async __getFlag(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`flags/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Mm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/flags/{flag_id}")}updateFlag(o,i,t){return S.fromPromise(this.__updateFlag(o,i,t))}async __updateFlag(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`flags/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Un.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Wm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/flags/{flag_id}")}deleteFlag(o,i){return S.fromPromise(this.__deleteFlag(o,i))}async __deleteFlag(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`flags/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:qm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/flags/{flag_id}")}updateFlagRules(o,i,t){return S.fromPromise(this.__updateFlagRules(o,i,t))}async __updateFlagRules(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`flags/${u.encodePathParam(o)}/rules`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:cn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:$m.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/flags/{flag_id}/rules")}checkFlag(o,i,t){return S.fromPromise(this.__checkFlag(o,i,t))}async __checkFlag(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`flags/${u.encodePathParam(o)}/check`),method:"POST",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:io.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Pm.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"POST","/flags/{key}/check")}checkFlags(o,i){return S.fromPromise(this.__checkFlags(o,i))}async __checkFlags(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"flags/check"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:io.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:vm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/flags/check")}checkFlagsBulk(o,i){return S.fromPromise(this.__checkFlagsBulk(o,i))}async __checkFlagsBulk(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"flags/check-bulk"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:tn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Um.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/flags/check-bulk")}countFlags(o={},i){return S.fromPromise(this.__countFlags(o,i))}async __countFlags(o={},i){let{featureId:t,ids:s,q:r,limit:n,offset:d}=o,g={feature_id:t,ids:s,q:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"flags/count"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Bm.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/flags/count")}};var jt=class{constructor(o){this._options=I(o)}getActivity(o={},i){return S.fromPromise(this.__getActivity(o,i))}async __getActivity(o={},i){let{limit:t}=o,s={limit:t},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/activity"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Xm.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/insights/activity")}getEnvironmentFeatureUsageTimeSeries(o,i){return S.fromPromise(this.__getEnvironmentFeatureUsageTimeSeries(o,i))}async __getEnvironmentFeatureUsageTimeSeries(o,i){let{endTime:t,featureId:s,granularity:r,startTime:n}=o,d={end_time:t.toISOString(),feature_id:s,granularity:r!=null?$e.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,start_time:n.toISOString()},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/feature-usage-timeseries"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:ih.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/insights/feature-usage-timeseries")}getPlanGrowth(o={},i){return S.fromPromise(this.__getPlanGrowth(o,i))}async __getPlanGrowth(o={},i){let{months:t}=o,s={months:t},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/plan-growth"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:lh.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/insights/plan-growth")}getSummary(o){return S.fromPromise(this.__getSummary(o))}async __getSummary(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/summary"),method:"GET",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:dh.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"GET","/insights/summary")}getTopFeaturesByUsage(o,i){return S.fromPromise(this.__getTopFeaturesByUsage(o,i))}async __getTopFeaturesByUsage(o,i){let{endTime:t,limit:s,startTime:r}=o,n={end_time:t.toISOString(),limit:s,start_time:r.toISOString()},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/top-features"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:yh.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/insights/top-features")}getEnvironmentTraitUsageTimeSeries(o,i){return S.fromPromise(this.__getEnvironmentTraitUsageTimeSeries(o,i))}async __getEnvironmentTraitUsageTimeSeries(o,i){let{endTime:t,featureId:s,granularity:r,startTime:n}=o,d={end_time:t.toISOString(),feature_id:s,granularity:r!=null?$e.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,start_time:n.toISOString()},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"insights/trait-usage-timeseries"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:ah.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/insights/trait-usage-timeseries")}};var At=class{constructor(o){this._options=I(o)}runIntegration(o,i){return S.fromPromise(this.__runIntegration(o,i))}async __runIntegration(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`integration/start/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Oh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/integration/start/{integration_id}")}listIntegrations(o={},i){return S.fromPromise(this.__listIntegrations(o,i))}async __listIntegrations(o={},i){let{billingOnly:t,excludeIds:s,id:r,state:n,type:d,limit:g,offset:h}=o,l={billing_only:t,exclude_ids:s,id:r,state:n!=null?Qe.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,type:d!=null?ke.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"}):void 0,limit:g,offset:h},y=await this._options.authProvider.getAuthRequest(),w=P(y.headers,this._options?.headers,i?.headers),U=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"integrations"),method:"GET",headers:w,queryString:u.queryBuilder().addMany(l).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(U.ok)return{data:Uh.parseOrThrow(U.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new T(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 401:throw new _(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 403:throw new z(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 404:throw new f(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);case 500:throw new R(a.parseOrThrow(U.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),U.rawResponse);default:throw new b({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}return C(U.error,U.rawResponse,"GET","/integrations")}getIntegrationWebhookUrl(o,i){return S.fromPromise(this.__getIntegrationWebhookUrl(o,i))}async __getIntegrationWebhookUrl(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`integrations/${u.encodePathParam(o)}/webhook-url`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:zh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/integrations/{type}/webhook-url")}startDataImport(o,i){return S.fromPromise(this.__startDataImport(o,i))}async __startDataImport(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"integrations/start-data-import"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:ln.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:kh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/integrations/start-data-import")}loadSampleDataSetV2(o){return S.fromPromise(this.__loadSampleDataSetV2(o))}async __loadSampleDataSetV2(o){let i=await this._options.authProvider.getAuthRequest(),t=P(i.headers,this._options?.headers,o?.headers),s=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"integrations/stripe/dataset-sample-v2"),method:"GET",headers:t,queryString:u.queryBuilder().mergeAdditional(o?.queryParams).build(),timeoutMs:(o?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:o?.maxRetries??this._options?.maxRetries,abortSignal:o?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Th.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 401:throw new _(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new z(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new f(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new R(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new b({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return C(s.error,s.rawResponse,"GET","/integrations/stripe/dataset-sample-v2")}uninstallIntegration(o,i){return S.fromPromise(this.__uninstallIntegration(o,i))}async __uninstallIntegration(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`integrations/uninstall/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Bh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/integrations/uninstall/{integration_id}")}};var Vt=class{constructor(o){this._options=I(o)}createCustomPlanBundle(o,i){return S.fromPromise(this.__createCustomPlanBundle(o,i))}async __createCustomPlanBundle(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"custom-plan-bundles"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:pn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Dh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/custom-plan-bundles")}createPlanBundle(o,i){return S.fromPromise(this.__createPlanBundle(o,i))}async __createPlanBundle(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-bundles"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:un.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Mh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-bundles")}updatePlanBundle(o,i,t){return S.fromPromise(this.__updatePlanBundle(o,i,t))}async __updatePlanBundle(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-bundles/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:dn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Ih.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plan-bundles/{plan_bundle_id}")}};var qt=class{constructor(o){this._options=I(o)}getPlanGroup(o={},i){return S.fromPromise(this.__getPlanGroup(o,i))}async __getPlanGroup(o={},i){let{includeCompanyCounts:t}=o,s={include_company_counts:t},r=await this._options.authProvider.getAuthRequest(),n=P(r.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-groups"),method:"GET",headers:n,queryString:u.queryBuilder().addMany(s).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:Nh.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new _(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new z(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new f(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new R(a.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new b({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return C(d.error,d.rawResponse,"GET","/plan-groups")}createPlanGroup(o,i){return S.fromPromise(this.__createPlanGroup(o,i))}async __createPlanGroup(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-groups"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:mn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Lh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-groups")}updatePlanGroup(o,i,t){return S.fromPromise(this.__updatePlanGroup(o,i,t))}async __updatePlanGroup(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-groups/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:hn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:$h.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plan-groups/{plan_group_id}")}};var Dt=class{constructor(o){this._options=I(o)}listCompanyMigrations(o={},i){return S.fromPromise(this.__listCompanyMigrations(o,i))}async __listCompanyMigrations(o={},i){let{migrationId:t,q:s,status:r,limit:n,offset:d}=o,g={migration_id:t,q:s,status:r!=null?Rr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-version-company-migrations"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:ig.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/plan-version-company-migrations")}retryCompanyMigration(o,i){return S.fromPromise(this.__retryCompanyMigration(o,i))}async __retryCompanyMigration(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-version-company-migrations/${u.encodePathParam(o)}/retry`),method:"POST",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ag.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-version-company-migrations/{plan_version_company_migration_id}/retry")}countCompanyMigrations(o={},i){return S.fromPromise(this.__countCompanyMigrations(o,i))}async __countCompanyMigrations(o={},i){let{migrationId:t,q:s,status:r,limit:n,offset:d}=o,g={migration_id:t,q:s,status:r!=null?Rr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-version-company-migrations/count"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Zh.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/plan-version-company-migrations/count")}listMigrations(o={},i){return S.fromPromise(this.__listMigrations(o,i))}async __listMigrations(o={},i){let{planVersionId:t,status:s,limit:r,offset:n}=o,d={plan_version_id:t,status:s!=null?fr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-version-migrations"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:tg.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/plan-version-migrations")}createMigration(o,i){return S.fromPromise(this.__createMigration(o,i))}async __createMigration(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-version-migrations"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:yn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Xh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plan-version-migrations")}getMigration(o,i){return S.fromPromise(this.__getMigration(o,i))}async __getMigration(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-version-migrations/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:eg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/plan-version-migrations/{plan_version_migration_id}")}retryMigration(o,i,t){return S.fromPromise(this.__retryMigration(o,i,t))}async __retryMigration(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plan-version-migrations/${u.encodePathParam(o)}/retry`),method:"POST",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:wn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:ng.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"POST","/plan-version-migrations/{plan_version_migration_id}/retry")}countMigrations(o={},i){return S.fromPromise(this.__countMigrations(o,i))}async __countMigrations(o={},i){let{planVersionId:t,status:s,limit:r,offset:n}=o,d={plan_version_id:t,status:s!=null?fr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plan-version-migrations/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Qh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/plan-version-migrations/count")}};var Mt=class{constructor(o){this._options=I(o)}updateCompanyPlans(o,i,t){return S.fromPromise(this.__updateCompanyPlans(o,i,t))}async __updateCompanyPlans(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`company-plans/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:_n.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:vg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/company-plans/{company_plan_id}")}listCustomPlanBillings(o={},i){return S.fromPromise(this.__listCustomPlanBillings(o,i))}async __listCustomPlanBillings(o={},i){let{companyId:t,planId:s,status:r,statuses:n,limit:d,offset:g}=o,h={company_id:t,plan_id:s,status:r!=null?hr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}):void 0,statuses:Array.isArray(n)?n.map(U=>hr.jsonOrThrow(U,{unrecognizedObjectKeys:"strip"})):n!=null?hr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}):void 0,limit:d,offset:g},l=await this._options.authProvider.getAuthRequest(),y=P(l.headers,this._options?.headers,i?.headers),w=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"custom-plan-billings"),method:"GET",headers:y,queryString:u.queryBuilder().addMany(h).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(w.ok)return{data:fg.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new T(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 401:throw new _(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new z(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new f(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new R(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new b({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}return C(w.error,w.rawResponse,"GET","/custom-plan-billings")}markCustomPlanBillingPaid(o,i,t){return S.fromPromise(this.__markCustomPlanBillingPaid(o,i,t))}async __markCustomPlanBillingPaid(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`custom-plan-billings/${u.encodePathParam(o)}/mark-paid`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:ry.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Eg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/custom-plan-billings/{custom_plan_billing_id}/mark-paid")}retryCustomPlanBilling(o,i,t){return S.fromPromise(this.__retryCustomPlanBilling(o,i,t))}async __retryCustomPlanBilling(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`custom-plan-billings/${u.encodePathParam(o)}/retry`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:fn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Ug.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/custom-plan-billings/{custom_plan_billing_id}/retry")}createCustomPlan(o,i){return S.fromPromise(this.__createCustomPlan(o,i))}async __createCustomPlan(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"custom-plans"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:zn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ug.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/custom-plans")}listPlans(o={},i){return S.fromPromise(this.__listPlans(o,i))}async __listPlans(o={},i){let{companyId:t,companyScopedOnly:s,excludeCompanyScoped:r,forFallbackPlan:n,forInitialPlan:d,forTrialExpiryPlan:g,hasProductId:h,ids:l,includeDraftVersions:y,planType:w,q:U,scopedToCompanyId:v,withEntitlements:O,withoutEntitlementFor:B,withoutPaidProductId:j,limit:$,offset:A}=o,le={company_id:t,company_scoped_only:s,exclude_company_scoped:r,for_fallback_plan:n,for_initial_plan:d,for_trial_expiry_plan:g,has_product_id:h,ids:l,include_draft_versions:y,plan_type:w!=null?oe.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,q:U,scoped_to_company_id:v,with_entitlements:O,without_entitlement_for:B,without_paid_product_id:j,limit:$,offset:A},Le=await this._options.authProvider.getAuthRequest(),q=P(Le.headers,this._options?.headers,i?.headers),M=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans"),method:"GET",headers:q,queryString:u.queryBuilder().addMany(le).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(M.ok)return{data:xg.parseOrThrow(M.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 400:throw new T(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new _(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new z(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new f(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new R(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);default:throw new b({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}return C(M.error,M.rawResponse,"GET","/plans")}createPlan(o,i){return S.fromPromise(this.__createPlan(o,i))}async __createPlan(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:tt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:dg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plans")}getPlan(o,i={},t){return S.fromPromise(this.__getPlan(o,i,t))}async __getPlan(o,i={},t){let{planVersionId:s}=i,r={plan_version_id:s},n=await this._options.authProvider.getAuthRequest(),d=P(n.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/${u.encodePathParam(o)}`),method:"GET",headers:d,queryString:u.queryBuilder().addMany(r).mergeAdditional(t?.queryParams).build(),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:wg.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new _(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new z(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new f(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new R(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new b({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return C(g.error,g.rawResponse,"GET","/plans/{plan_id}")}updatePlan(o,i,t){return S.fromPromise(this.__updatePlan(o,i,t))}async __updatePlan(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:lt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Tg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plans/{plan_id}")}deletePlan(o,i){return S.fromPromise(this.__deletePlan(o,i))}async __deletePlan(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:mg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/plans/{plan_id}")}upsertBillingProductPlan(o,i,t){return S.fromPromise(this.__upsertBillingProductPlan(o,i,t))}async __upsertBillingProductPlan(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/${u.encodePathParam(o)}/billing_products`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Fr.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Og.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plans/{plan_id}/billing_products")}upsertPlanForBillingProduct(o,i){return S.fromPromise(this.__upsertPlanForBillingProduct(o,i))}async __upsertPlanForBillingProduct(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans/billing-linked"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:bn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:kg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/plans/billing-linked")}listBillingProductMatchCompanies(o,i){return S.fromPromise(this.__listBillingProductMatchCompanies(o,i))}async __listBillingProductMatchCompanies(o,i){let{planId:t,q:s,limit:r,offset:n}=o,d={plan_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans/billing-product-match-companies"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:zg.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/plans/billing-product-match-companies")}countBillingProductMatchCompanies(o,i){return S.fromPromise(this.__countBillingProductMatchCompanies(o,i))}async __countBillingProductMatchCompanies(o,i){let{planId:t,q:s,limit:r,offset:n}=o,d={plan_id:t,q:s,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans/billing-product-match-companies/count"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:cg.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/plans/billing-product-match-companies/count")}countPlans(o={},i){return S.fromPromise(this.__countPlans(o,i))}async __countPlans(o={},i){let{companyId:t,companyScopedOnly:s,excludeCompanyScoped:r,forFallbackPlan:n,forInitialPlan:d,forTrialExpiryPlan:g,hasProductId:h,ids:l,includeDraftVersions:y,planType:w,q:U,scopedToCompanyId:v,withEntitlements:O,withoutEntitlementFor:B,withoutPaidProductId:j,limit:$,offset:A}=o,le={company_id:t,company_scoped_only:s,exclude_company_scoped:r,for_fallback_plan:n,for_initial_plan:d,for_trial_expiry_plan:g,has_product_id:h,ids:l,include_draft_versions:y,plan_type:w!=null?oe.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"}):void 0,q:U,scoped_to_company_id:v,with_entitlements:O,without_entitlement_for:B,without_paid_product_id:j,limit:$,offset:A},Le=await this._options.authProvider.getAuthRequest(),q=P(Le.headers,this._options?.headers,i?.headers),M=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans/count"),method:"GET",headers:q,queryString:u.queryBuilder().addMany(le).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(M.ok)return{data:pg.parseOrThrow(M.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 400:throw new T(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new _(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new z(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new f(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new R(a.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);default:throw new b({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}return C(M.error,M.rawResponse,"GET","/plans/count")}listPlanIssues(o,i){return S.fromPromise(this.__listPlanIssues(o,i))}async __listPlanIssues(o,i){let{planId:t,planVersionId:s}=o,r={plan_id:t,plan_version_id:s},n=await this._options.authProvider.getAuthRequest(),d=P(n.headers,this._options?.headers,i?.headers),g=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"plans/issues"),method:"GET",headers:d,queryString:u.queryBuilder().addMany(r).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Sg.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new _(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new z(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new f(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new R(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new b({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return C(g.error,g.rawResponse,"GET","/plans/issues")}deletePlanVersion(o,i={},t){return S.fromPromise(this.__deletePlanVersion(o,i,t))}async __deletePlanVersion(o,i={},t){let{promoteArchivedVersion:s}=i,r={promote_archived_version:s},n=await this._options.authProvider.getAuthRequest(),d=P(n.headers,this._options?.headers,t?.headers),g=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/version/${u.encodePathParam(o)}`),method:"DELETE",headers:d,queryString:u.queryBuilder().addMany(r).mergeAdditional(t?.queryParams).build(),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:gg.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new T(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new _(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new z(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new f(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new R(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new b({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}return C(g.error,g.rawResponse,"DELETE","/plans/version/{plan_id}")}publishPlanVersion(o,i,t){return S.fromPromise(this.__publishPlanVersion(o,i,t))}async __publishPlanVersion(o,i,t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`plans/version/${u.encodePathParam(o)}/publish`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Rn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Cg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/plans/version/{plan_id}/publish")}};var It=class{constructor(o){this._options=I(o)}listScheduledCheckouts(o={},i){return S.fromPromise(this.__listScheduledCheckouts(o,i))}async __listScheduledCheckouts(o={},i){let{companyId:t,status:s,limit:r,offset:n}=o,d={company_id:t,status:s!=null?Gr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):void 0,limit:r,offset:n},g=await this._options.authProvider.getAuthRequest(),h=P(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"scheduled-checkout"),method:"GET",headers:h,queryString:u.queryBuilder().addMany(d).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(l.ok)return{data:Vg.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new T(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new _(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new z(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new f(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new R(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new b({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return C(l.error,l.rawResponse,"GET","/scheduled-checkout")}createScheduledCheckout(o,i){return S.fromPromise(this.__createScheduledCheckout(o,i))}async __createScheduledCheckout(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"scheduled-checkout"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:Sn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Bg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/scheduled-checkout")}getScheduledCheckout(o,i){return S.fromPromise(this.__getScheduledCheckout(o,i))}async __getScheduledCheckout(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`scheduled-checkout/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:jg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/scheduled-checkout/{scheduled_checkout_id}")}updateScheduledCheckout(o,i={},t){return S.fromPromise(this.__updateScheduledCheckout(o,i,t))}async __updateScheduledCheckout(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`scheduled-checkout/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:Pn.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:qg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/scheduled-checkout/{scheduled_checkout_id}")}};var Ft=class{constructor(o){this._options=I(o)}listWebhookEvents(o={},i){return S.fromPromise(this.__listWebhookEvents(o,i))}async __listWebhookEvents(o={},i){let{ids:t,q:s,webhookId:r,limit:n,offset:d}=o,g={ids:t,q:s,webhook_id:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"webhook-events"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:$g.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/webhook-events")}getWebhookEvent(o,i){return S.fromPromise(this.__getWebhookEvent(o,i))}async __getWebhookEvent(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`webhook-events/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/webhook-events/{webhook_event_id}")}countWebhookEvents(o={},i){return S.fromPromise(this.__countWebhookEvents(o,i))}async __countWebhookEvents(o={},i){let{ids:t,q:s,webhookId:r,limit:n,offset:d}=o,g={ids:t,q:s,webhook_id:r,limit:n,offset:d},h=await this._options.authProvider.getAuthRequest(),l=P(h.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"webhook-events/count"),method:"GET",headers:l,queryString:u.queryBuilder().addMany(g).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(y.ok)return{data:Mg.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new T(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new _(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new z(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new f(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new R(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new b({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return C(y.error,y.rawResponse,"GET","/webhook-events/count")}listWebhooks(o={},i){return S.fromPromise(this.__listWebhooks(o,i))}async __listWebhooks(o={},i){let{q:t,limit:s,offset:r}=o,n={q:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"webhooks"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:Zg.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/webhooks")}createWebhook(o,i){return S.fromPromise(this.__createWebhook(o,i))}async __createWebhook(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"webhooks"),method:"POST",headers:s,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),requestType:"json",body:xn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Kg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"POST","/webhooks")}getWebhook(o,i){return S.fromPromise(this.__getWebhook(o,i))}async __getWebhook(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`webhooks/${u.encodePathParam(o)}`),method:"GET",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Hg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"GET","/webhooks/{webhook_id}")}updateWebhook(o,i={},t){return S.fromPromise(this.__updateWebhook(o,i,t))}async __updateWebhook(o,i={},t){let s=await this._options.authProvider.getAuthRequest(),r=P(s.headers,this._options?.headers,t?.headers),n=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`webhooks/${u.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryString:u.queryBuilder().mergeAdditional(t?.queryParams).build(),requestType:"json",body:En.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:t?.maxRetries??this._options?.maxRetries,abortSignal:t?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(n.ok)return{data:Yg.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new T(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new _(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new z(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new f(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new R(a.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);default:throw new b({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return C(n.error,n.rawResponse,"PUT","/webhooks/{webhook_id}")}deleteWebhook(o,i){return S.fromPromise(this.__deleteWebhook(o,i))}async __deleteWebhook(o,i){let t=await this._options.authProvider.getAuthRequest(),s=P(t.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,`webhooks/${u.encodePathParam(o)}`),method:"DELETE",headers:s,queryString:u.queryBuilder().mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Lg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new T(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new _(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new z(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new f(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new R(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new b({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}return C(r.error,r.rawResponse,"DELETE","/webhooks/{webhook_id}")}countWebhooks(o={},i){return S.fromPromise(this.__countWebhooks(o,i))}async __countWebhooks(o={},i){let{q:t,limit:s,offset:r}=o,n={q:t,limit:s,offset:r},d=await this._options.authProvider.getAuthRequest(),g=P(d.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??E)({url:u.join(await m.get(this._options.baseUrl)??await m.get(this._options.environment)??x.Default,"webhooks/count"),method:"GET",headers:g,queryString:u.queryBuilder().addMany(n).mergeAdditional(i?.queryParams).build(),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(h.ok)return{data:Fg.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new T(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new _(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new z(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new f(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new R(a.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);default:throw new b({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}return C(h.error,h.rawResponse,"GET","/webhooks/count")}};var Kt=class{constructor(o){this._options=I(o)}get accounts(){return this._accounts??=new St(this._options)}get billing(){return this._billing??=new Pt(this._options)}get credits(){return this._credits??=new vt(this._options)}get checkout(){return this._checkout??=new xt(this._options)}get companies(){return this._companies??=new Et(this._options)}get entitlements(){return this._entitlements??=new Ot(this._options)}get plans(){return this._plans??=new Mt(this._options)}get components(){return this._components??=new Ct(this._options)}get planbundle(){return this._planbundle??=new Vt(this._options)}get dataexports(){return this._dataexports??=new Tt(this._options)}get events(){return this._events??=new kt(this._options)}get features(){return this._features??=new Bt(this._options)}get insights(){return this._insights??=new jt(this._options)}get integrationsapi(){return this._integrationsapi??=new At(this._options)}get plangroups(){return this._plangroups??=new qt(this._options)}get planmigrations(){return this._planmigrations??=new Dt(this._options)}get componentspublic(){return this._componentspublic??=new Ut(this._options)}get scheduledcheckout(){return this._scheduledcheckout??=new It(this._options)}get accesstokens(){return this._accesstokens??=new _t(this._options)}get webhooks(){return this._webhooks??=new Ft(this._options)}async fetch(o,i,t){return na(o,i,{baseUrl:this._options.baseUrl??this._options.environment,headers:this._options.headers,timeoutInSeconds:this._options.timeoutInSeconds,maxRetries:this._options.maxRetries,fetch:this._options.fetch,logging:this._options.logging,getAuthHeaders:async()=>(await this._options.authProvider.getAuthRequest()).headers},t)}};var Je={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},jn={[Je.Debug]:1,[Je.Info]:2,[Je.Warn]:3,[Je.Error]:4},oy=Je.Warn,Nr=class{constructor(o=oy){this.level=jn[o]??jn[oy]}shouldLog(o){return jn[o]>=this.level}error(o,...i){this.shouldLog(Je.Error)&&console.error(o,...i)}warn(o,...i){this.shouldLog(Je.Warn)&&console.warn(o,...i)}info(o,...i){this.shouldLog(Je.Info)&&console.info(o,...i)}debug(o,...i){this.shouldLog(Je.Debug)&&console.debug(o,...i)}};var Cb=1e3,Ub=1e3,vb=3,Tb=1e3,Lt=class{constructor(o,i){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:t=new Nr,maxSize:s=Ub,interval:r=Cb,offline:n=!1,maxRetries:d=vb,initialRetryDelay:g=Tb}=i||{};this.captureClient=o,this.interval=r,this.logger=t,this.maxSize=s,this.offline=n,this.maxRetries=d,this.initialRetryDelay=g,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let o=[...this.events];this.events=[];let i=0,t=!1,s=null;for(;i<=this.maxRetries&&!t;)try{i>0&&this.logger.info(`Retrying event batch submission (attempt ${i} of ${this.maxRetries})`),await this.captureClient.sendBatch(o),t=!0}catch(r){if(s=r,i++,i<=this.maxRetries){let n=this.initialRetryDelay*Math.pow(2,i-1),d=Math.random()*.1*n,g=n+d;this.logger.warn(`Event batch submission failed: ${r}. Retrying in ${(g/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(h=>setTimeout(h,g))}}t?i>0&&this.logger.info(`Event batch submission succeeded after ${i} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,s)}finally{this.flushing=!1}}}async push(o){if(!this.offline){if(this.stopped){this.logger.error("Event buffer is stopped, not accepting new events");return}this.events.length>=this.maxSize&&!this.flushing&&await this.flush(),this.events.push(o)}}async stop(){this.shutdown=!0,this.stopped=!0,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),await this.flush()}startPeriodicFlush(){this.offline||this.intervalId||(this.intervalId=setInterval(async()=>{this.shutdown||await this.flush()},this.interval),this.intervalId.unref&&this.intervalId.unref())}};var Ob="https://c.schematichq.com",kb=1e4,Bb=p=>p.replace(/\/+$/,"")+"/batch",jb=(p,o)=>{let i={api_key:o,type:p.eventType};return p.body!==void 0&&(i.body=$o.jsonOrThrow(p.body,{unrecognizedObjectKeys:"strip"})),p.idempotencyKey!==void 0&&(i.idempotency_key=p.idempotencyKey),p.sentAt!==void 0&&(i.sent_at=p.sentAt instanceof Date?p.sentAt.toISOString():p.sentAt),p.trustedClientClock!==void 0&&(i.trusted_client_clock=p.trustedClientClock),p.backfill!==void 0&&(i.backfill=p.backfill),i},Ab=(p,o)=>({events:p.map(i=>jb(i,o))}),Vb=p=>{if(typeof p!="object"||p===null||!("reason"in p))return"unknown error";let o=p;switch(o.reason){case"status-code":{let i=typeof o.body=="string"?o.body:JSON.stringify(o.body??"");return`HTTP ${o.statusCode}: ${i}`}case"timeout":return"request timed out";case"non-json":return`non-JSON response (HTTP ${o.statusCode})`;case"body-is-null":return`empty response body (HTTP ${o.statusCode})`;default:return o.errorMessage??"unknown error"}},Gt=class{constructor(o){this.apiKey=o.apiKey,this.baseUrl=o.baseUrl??Ob,this.timeoutMs=o.timeoutMs??kb,this.fetcher=o.fetcher,this.headers=o.headers??{}}async sendBatch(o){if(o.length===0)return;let i=await this.fetcher({url:Bb(this.baseUrl),method:"POST",contentType:"application/json",requestType:"json",headers:{...this.headers,"X-Schematic-Api-Key":this.apiKey},body:Ab(o,this.apiKey),timeoutMs:this.timeoutMs,maxRetries:0});if(!i.ok)throw new Error(`capture service returned ${Vb(i.error)}`)}};function ty(p){return async function(i){let t={};if(p&&Object.assign(t,p),i.body!==void 0&&i.contentType!=null&&(t["Content-Type"]=i.contentType),i.headers!=null)for(let[d,g]of Object.entries(i.headers))g!=null&&typeof g=="string"&&(t[d]=g);let s=so(i.url,i.queryParameters),r=await co({body:i.body,type:i.requestType==="json"?"json":"other"}),n=await ni();try{let d=await pi(async()=>si(n,s,i.method,t,r,i.timeoutMs,i.abortSignal,i.withCredentials,i.duplex),i.maxRetries),g=await ai(d,i.responseType),h=$i(d);return d.status>=200&&d.status<400?{ok:!0,body:g,headers:d.headers,rawResponse:h}:{ok:!1,error:{reason:"status-code",statusCode:d.status,body:g},rawResponse:h}}catch(d){return i.abortSignal!=null&&i.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ci}:d instanceof Error&&d.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:ci}:d instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:d.message},rawResponse:li}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(d)},rawResponse:li}}}}async function qb(p){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ye,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var ay=qb;var Fi=class{constructor(){this.wasmInstance=null;this.initialized=!1}async initialize(){if(!this.initialized)try{let i=require("./wasm/rulesengine.js");this.wasmInstance=new i.RulesEngineJS,this.initialized=!0}catch(o){throw new Error(`Failed to initialize WASM rules engine: ${o}`)}}async checkFlag(o,i,t){this.ensureInitialized();let s=(r,n)=>n===null?void 0:n;try{let r=JSON.stringify(o,s),n=i?JSON.stringify(i,s):void 0,d=t?JSON.stringify(t,s):void 0,g=this.wasmInstance.checkFlag(r,n,d);return JSON.parse(g)}catch(r){throw new Error(`WASM flag check failed: ${r}`)}}getVersionKey(){return this.ensureInitialized(),this.wasmInstance.getVersionKey()}isInitialized(){return this.initialized}ensureInitialized(){if(!this.initialized||!this.wasmInstance)throw new Error("WASM rules engine not initialized. Call initialize() first.")}};An();function Li(p,o,i){return p[o]??p[i]}function qn(p){return JSON.parse(JSON.stringify(p))}function Db(p){return JSON.parse(JSON.stringify(p))}function ny(p,o){let i=qn(p),t,s=!1;for(let r of Object.keys(o))switch(r){case"id":case"account_id":case"environment_id":i[r]=o[r];break;case"base_plan_id":i[r]=o[r]??null;break;case"billing_product_ids":case"plan_ids":case"plan_version_ids":case"entitlements":case"rules":case"traits":case"subscription":i[r]=o[r];break;case"keys":{let n=Li(i,"keys","keys")??{},d=o[r];i[r]={...n,...d};break}case"credit_balances":{let n=Li(i,"creditBalances","credit_balances")??{},d=o[r]??{};i[r]={...n,...d},t=d;break}case"metrics":{let n=Li(i,"metrics","metrics")??[],d=o[r]??[];i[r]=Ib(n,d),s=!0;break}}return(t||s)&&!("entitlements"in o)&&Mb(i,t,s),i}function Mb(p,o,i){let t=Li(p,"entitlements","entitlements")??[];if(t.length===0)return;let s=new Map;if(i){let r=Li(p,"metrics","metrics")??[];for(let n of r)n&&s.set(Wt(Vn(n)),n.value??0)}for(let r of t){let n=r.creditId??r.credit_id;o&&n&&n in o&&(r.credit_remaining=o[n]);let d=r.eventName??r.event_name;if(s.size>0&&d){let g=(r.metricPeriod??r.metric_period)||"all_time",h=(r.monthReset??r.month_reset)||"first_of_month",l=s.get(Wt({eventSubtype:d,period:g,monthReset:h}));l!==void 0&&(r.usage=l)}}}function sy(p,o){let i=Db(p);for(let t of Object.keys(o))switch(t){case"id":case"account_id":case"environment_id":i[t]=o[t];break;case"keys":{let s=Li(i,"keys","keys")??{},r=o[t];i[t]={...s,...r};break}case"traits":case"rules":i[t]=o[t];break}return i}function Wt(p){return`${p.eventSubtype}|${p.period}|${p.monthReset}`}function Vn(p){return{eventSubtype:(p.eventSubtype??p.event_subtype)||"",period:p.period||"",monthReset:(p.monthReset??p.month_reset)||""}}function Ib(p,o){let i=[...p],t=new Map;for(let s=0;s<i.length;s++){let r=i[s];if(r){let n=Wt(Vn(r));t.set(n,s)}}for(let s of o){if(!s)continue;let r=Wt(Vn(s)),n=t.get(r);n!==void 0?i[n]=s:i.push(s)}return i}var sr="company",cr="user",$b="flags",Mn=30*1e3,Jb=1440*60*1e3,Zb=720*60*60*1e3,oo=class extends Ki{constructor(i){super();this.replicatorReady=!1;this.pendingCompanyRequests=new Map;this.pendingUserRequests=new Map;if(this.apiKey=i.apiKey,this.baseURL=i.baseURL,this.logger=i.logger,this.cacheTTL=i.cacheTTL??Jb,this.companyCacheProvider=this.createCacheProvider(i,"company"),this.userCacheProvider=this.createCacheProvider(i,"user"),this.flagsCacheProvider=this.createCacheProvider(i,"flag"),this.companyKeyCacheProvider=this.createKeyCacheProvider(i),this.userKeyCacheProvider=this.createKeyCacheProvider(i),this.replicatorMode=i.replicatorMode??!1,this.replicatorHealthURL=i.replicatorHealthURL,this.replicatorHealthCheck=i.replicatorHealthCheck??30*1e3,this.replicatorMode&&!i.redisClient&&!i.companyCache&&!i.userCache&&!i.flagCache)throw new Error("Replicator mode requires a Redis client or custom cache providers for shared cache access");this.rulesEngine=new Fi}createCacheProvider(i,t){let s;switch(t){case"company":s=i.companyCache;break;case"user":s=i.userCache;break;case"flag":s=i.flagCache;break}if(s)return this.logger.debug(`Using custom cache provider for ${t} cache`),s;let r=this.calculateCacheTTL(t);return i.redisClient?(this.logger.debug(`Using Redis cache provider for ${t} cache (TTL: ${r}ms)`),new Zr({client:i.redisClient,keyPrefix:i.redisKeyPrefix||"schematic:",ttl:r})):(this.logger.debug(`Using memory cache provider for ${t} cache (TTL: ${r}ms)`),new Ze({ttl:r}))}createKeyCacheProvider(i){let t=this.cacheTTL;return i.redisClient?new Zr({client:i.redisClient,keyPrefix:i.redisKeyPrefix||"schematic:",ttl:t}):new Ze({ttl:t})}calculateCacheTTL(i){return i==="flag"?Math.max(Zb,this.cacheTTL):this.cacheTTL}async start(){try{await this.rulesEngine.initialize(),this.logger.debug("Rules engine initialized successfully")}catch(t){this.logger.warn(`Failed to initialize rules engine: ${t}`)}if(this.replicatorMode){this.logger.info("Replicator mode enabled - skipping WebSocket connection"),this.replicatorHealthURL&&this.startReplicatorHealthCheck();return}if(!this.baseURL)throw new Error("BaseURL is required when not in replicator mode");this.logger.info("Starting DataStream client");let{DatastreamWSClient:i}=(yy(),Gn(gy));this.wsClient=new i({url:this.baseURL,apiKey:this.apiKey,logger:this.logger,messageHandler:this.handleMessage.bind(this),connectionReadyHandler:this.handleConnectionReady.bind(this)}),this.wsClient.on("connected",()=>{this.emit("connected")}),this.wsClient.on("disconnected",()=>{this.emit("disconnected"),this.clearPendingRequests()}),this.wsClient.on("ready",()=>{this.emit("ready")}),this.wsClient.on("not-ready",()=>{this.emit("not-ready")}),this.wsClient.on("error",t=>{this.emit("error",t)}),this.wsClient.start()}isConnected(){return this.replicatorMode?this.isReplicatorReady():this.wsClient?.isConnected()??!1}async getCompany(i){let t=await this.getCompanyFromCache(i);if(t)return this.logger.debug(`Company found in cache for keys: ${JSON.stringify(i)}`),t;if(this.replicatorMode)throw new Error("Company not found in cache and replicator mode is enabled");if(!this.isConnected())throw new Error("DataStream client is not connected");let s=this.generateCacheKeysForCompany(i),r=!1;for(let n of s)if(this.pendingCompanyRequests.has(n)){r=!0;break}return new Promise((n,d)=>{let g=setTimeout(()=>{this.cleanupPendingCompanyRequests(s,h),d(new Error("Timeout while waiting for company data"))},Mn),h=l=>{clearTimeout(g),l?n(l):d(new Error("Company not found"))};for(let l of s)this.pendingCompanyRequests.has(l)||this.pendingCompanyRequests.set(l,[]),this.pendingCompanyRequests.get(l).push(h);r||this.sendDataStreamRequest({entity_type:"rulesengine.Company",keys:i}).catch(l=>{this.cleanupPendingCompanyRequests(s,h),d(l)})})}async getUser(i){let t=await this.getUserFromCache(i);if(t)return this.logger.debug(`User found in cache for keys: ${JSON.stringify(i)}`),t;if(this.replicatorMode)throw new Error("User not found in cache and replicator mode is enabled");if(!this.isConnected())throw new Error("DataStream client is not connected");let s=this.generateCacheKeysForUser(i),r=!1;for(let n of s)if(this.pendingUserRequests.has(n)){r=!0;break}return new Promise((n,d)=>{let g=setTimeout(()=>{this.cleanupPendingUserRequests(s,h),d(new Error("Timeout while waiting for user data"))},Mn),h=l=>{clearTimeout(g),l?n(l):d(new Error("User not found"))};for(let l of s)this.pendingUserRequests.has(l)||this.pendingUserRequests.set(l,[]),this.pendingUserRequests.get(l).push(h);r||this.sendDataStreamRequest({entity_type:"rulesengine.User",keys:i}).catch(l=>{this.cleanupPendingUserRequests(s,h),d(l)})})}async getFlag(i){let t=this.flagCacheKey(i);this.logger.debug(`Retrieving flag from cache: ${i} (cache key: ${t})`);try{return await this.flagsCacheProvider.get(t)||null}catch(s){return this.logger.warn(`Failed to retrieve flag from cache: ${s}`),null}}async getAllFlags(){return this.pendingFlagRequest?new Promise((i,t)=>{let s=this.pendingFlagRequest;this.pendingFlagRequest=r=>{s(r),r?i():t(new Error("Failed to refresh flags"))}}):new Promise((i,t)=>{let s=setTimeout(()=>{this.pendingFlagRequest=void 0,t(new Error("Timeout while waiting for flags data"))},Mn);this.pendingFlagRequest=r=>{clearTimeout(s),this.pendingFlagRequest=void 0,r?i():t(new Error("Failed to refresh flags"))},this.sendDataStreamRequest({entity_type:"rulesengine.Flags"}).catch(r=>{clearTimeout(s),this.pendingFlagRequest=void 0,t(r)})})}async checkFlag(i,t){let s=await this.getFlag(t);if(!s)throw new Error(`Flag not found: ${t}`);let r=i.company&&Object.keys(i.company).length>0,n=i.user&&Object.keys(i.user).length>0,d=null,g=null;if(r&&(d=await this.getCompanyFromCache(i.company),this.logger.debug(`Company ${d?"found in cache":"not found in cache"} for keys: ${JSON.stringify(i.company)}`)),n&&(g=await this.getUserFromCache(i.user),this.logger.debug(`User ${g?"found in cache":"not found in cache"} for keys: ${JSON.stringify(i.user)}`)),this.replicatorMode)return this.evaluateFlag(s,d,g);if((!r||d)&&(!n||g))return this.logger.debug(`All required resources found in cache for flag ${t} evaluation`),this.evaluateFlag(s,d,g);if(!this.isConnected())throw new Error("Datastream not connected and required entities not in cache");let h=r&&!d?this.getCompany(i.company):Promise.resolve(d),l=n&&!g?this.getUser(i.user):Promise.resolve(g),[y,w]=await Promise.all([h,l]);return this.evaluateFlag(s,y,w)}async updateCompanyMetrics(i,t,s){let r=await this.getCompanyFromCache(i);if(!r)return;let n=this.deepCopyCompany(r);if(n.metrics)for(let d of n.metrics)(d.eventSubtype??d.event_subtype)===t&&(d.value=(d.value||0)+s);await this.cacheCompanyForKeys(n)}close(){this.logger.info("Closing DataStream client"),this.replicatorHealthInterval&&(clearInterval(this.replicatorHealthInterval),this.replicatorHealthInterval=void 0),this.clearPendingRequests(),this.wsClient&&(this.wsClient.close(),this.wsClient=void 0),this.logger.info("DataStream client closed")}isReplicatorReady(){return this.replicatorReady}isReplicatorMode(){return this.replicatorMode}getReplicatorCacheVersion(){return this.replicatorCacheVersion}async getReplicatorCacheVersionAsync(i=2e3){if(this.replicatorCacheVersion)return this.replicatorCacheVersion;if(this.replicatorMode&&this.replicatorHealthURL)try{let t=new AbortController,s=setTimeout(()=>t.abort(),i),r=await fetch(this.replicatorHealthURL,{method:"GET",signal:t.signal});if(clearTimeout(s),r.ok){let n=await r.json(),d=n.cache_version||n.cacheVersion;if(d)return this.replicatorCacheVersion=d,d}}catch(t){this.logger.debug(`Failed to fetch replicator cache version: ${t}`)}}async handleMessage(i){this.logger.debug(`Processing datastream message: EntityType=${i.entity_type}, MessageType=${i.message_type}`);try{if(i.message_type==="error"){await this.handleErrorMessage(i);return}switch(i.entity_type){case"rulesengine.Company":case"rulesengine.Companies":await this.handleCompanyMessage(i);break;case"rulesengine.User":case"rulesengine.Users":await this.handleUserMessage(i);break;case"rulesengine.Flags":await this.handleFlagsMessage(i);break;case"rulesengine.Flag":await this.handleFlagMessage(i);break;default:this.logger.warn(`Unknown entity type in datastream message: ${i.entity_type}`)}}catch(t){this.logger.error(`Error processing datastream message: ${t}`),this.emit("error",t)}}async handleCompanyMessage(i){let t;if(i.message_type==="partial"){let s=i.entity_id;if(!s){this.logger.error("Partial company message missing entity_id");return}let r=this.resourceIdCacheKey(sr,s),n=await this.companyCacheProvider.get(r);if(!n){this.logger.warn(`Cache miss for partial company '${s}', skipping`);return}try{t=ny(n,i.data)}catch(d){this.logger.error(`Failed to merge partial company: ${d}`);return}}else t=i.data;if(t){if(i.message_type==="delete"){if(t.keys)for(let[r,n]of Object.entries(t.keys)){let d=this.resourceKeyToCacheKey(sr,r,n);try{await this.companyKeyCacheProvider.delete(d)}catch(g){this.logger.warn(`Failed to delete company key mapping from cache: ${g}`)}}let s=this.resourceIdCacheKey(sr,t.id);try{await this.companyCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete company resource from cache: ${r}`)}return}await this.cacheCompanyForKeys(t),this.notifyPendingCompanyRequests(t.keys||{},t)}}async handleUserMessage(i){let t;if(i.message_type==="partial"){let s=i.entity_id;if(!s){this.logger.error("Partial user message missing entity_id");return}let r=this.resourceIdCacheKey(cr,s),n=await this.userCacheProvider.get(r);if(!n){this.logger.warn(`Cache miss for partial user '${s}', skipping`);return}try{t=sy(n,i.data)}catch(d){this.logger.error(`Failed to merge partial user: ${d}`);return}}else t=i.data;if(t){if(i.message_type==="delete"){if(t.keys)for(let[r,n]of Object.entries(t.keys)){let d=this.resourceKeyToCacheKey(cr,r,n);try{await this.userKeyCacheProvider.delete(d)}catch(g){this.logger.warn(`Failed to delete user key mapping from cache: ${g}`)}}let s=this.resourceIdCacheKey(cr,t.id);try{await this.userCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete user resource from cache: ${r}`)}return}await this.cacheUserForKeys(t),this.notifyPendingUserRequests(t.keys||{},t)}}async handleFlagsMessage(i){let t=i.data;if(!Array.isArray(t)){this.logger.warn("Expected flags array in bulk flags message");return}let s=await Promise.allSettled(t.filter(d=>d?.key).map(async d=>{let g=this.flagCacheKey(d.key);return await this.flagsCacheProvider.set(g,d),g})),r=s.filter(d=>d.status==="fulfilled").map(d=>d.value),n=s.filter(d=>d.status==="rejected");if(n.length>0&&this.logger.warn(`Failed to cache ${n.length} flag(s)`),this.flagsCacheProvider.deleteMissing)try{await this.flagsCacheProvider.deleteMissing(r,{scanPattern:"flags:*"})}catch(d){this.logger.warn(`Failed to delete missing flags: ${d}`)}this.pendingFlagRequest&&this.pendingFlagRequest(!0)}async handleFlagMessage(i){let t=i.data;if(!t?.key)return;let s=this.flagCacheKey(t.key);try{switch(i.message_type){case"delete":await this.flagsCacheProvider.delete(s);break;case"full":await this.flagsCacheProvider.set(s,t);break;default:this.logger.warn(`Unhandled message type for flag: ${i.message_type}`);break}}catch(r){this.logger.warn(`Failed to update flag cache: ${r}`)}this.pendingFlagRequest&&this.pendingFlagRequest(!0)}async handleErrorMessage(i){let t=i.data;if(t?.keys&&t?.entity_type)switch(t.entity_type){case"rulesengine.Company":this.notifyPendingCompanyRequests(t.keys,null);break;case"rulesengine.User":this.notifyPendingUserRequests(t.keys,null);break;default:this.logger.warn(`Received error for unsupported entity type: ${t.entity_type}`)}let s=t?.error||"Unknown datastream error";this.logger.warn(`DataStream error received: ${s}`)}async handleConnectionReady(){this.logger.info("DataStream connection is ready");try{await this.getAllFlags(),this.logger.debug("Requested initial flag data")}catch(i){throw this.logger.error(`Failed to request initial flag data: ${i}`),i}}async sendDataStreamRequest(i){if(!this.wsClient||!this.wsClient.isConnected())throw new Error("DataStream client is not connected");this.logger.debug(`Sending datastream request: EntityType=${i.entity_type}, Keys=${JSON.stringify(i.keys)}`);let t={data:i};await this.wsClient.sendMessage(t)}async getCompanyFromCache(i){for(let[t,s]of Object.entries(i)){let r=this.resourceKeyToCacheKey(sr,t,s);try{let n=await this.companyKeyCacheProvider.get(r);if(n){let d=this.resourceIdCacheKey(sr,n),g=await this.companyCacheProvider.get(d);if(g)return g}}catch(n){this.logger.warn(`Failed to retrieve company from cache: ${n}`)}}return null}async getUserFromCache(i){for(let[t,s]of Object.entries(i)){let r=this.resourceKeyToCacheKey(cr,t,s);try{let n=await this.userKeyCacheProvider.get(r);if(n){let d=this.resourceIdCacheKey(cr,n),g=await this.userCacheProvider.get(d);if(g)return g}}catch(n){this.logger.warn(`Failed to retrieve user from cache: ${n}`)}}return null}async cacheCompanyForKeys(i){if(!i.keys||Object.keys(i.keys).length===0)throw new Error("No keys provided for company lookup");let t=this.resourceIdCacheKey(sr,i.id),s=await this.companyCacheProvider.get(t);if(s?.keys){for(let[r,n]of Object.entries(s.keys))if(i.keys[r]===void 0||i.keys[r]!==n){let d=this.resourceKeyToCacheKey(sr,r,n);try{await this.companyKeyCacheProvider.delete(d)}catch(g){this.logger.warn(`Failed to delete stale company key mapping '${d}': ${g}`)}}}await this.companyCacheProvider.set(t,i,this.cacheTTL);for(let[r,n]of Object.entries(i.keys)){let d=this.resourceKeyToCacheKey(sr,r,n);try{await this.companyKeyCacheProvider.set(d,i.id,this.cacheTTL)}catch(g){this.logger.warn(`Failed to cache company key mapping '${d}': ${g}`)}}}async cacheUserForKeys(i){if(!i.keys||Object.keys(i.keys).length===0)throw new Error("No keys provided for user lookup");let t=this.resourceIdCacheKey(cr,i.id),s=await this.userCacheProvider.get(t);if(s?.keys){for(let[r,n]of Object.entries(s.keys))if(i.keys[r]===void 0||i.keys[r]!==n){let d=this.resourceKeyToCacheKey(cr,r,n);try{await this.userKeyCacheProvider.delete(d)}catch(g){this.logger.warn(`Failed to delete stale user key mapping '${d}': ${g}`)}}}await this.userCacheProvider.set(t,i,this.cacheTTL);for(let[r,n]of Object.entries(i.keys)){let d=this.resourceKeyToCacheKey(cr,r,n);try{await this.userKeyCacheProvider.set(d,i.id,this.cacheTTL)}catch(g){this.logger.warn(`Failed to cache user key mapping '${d}': ${g}`)}}}generateCacheKeysForCompany(i){return Object.entries(i).map(([t,s])=>this.resourceKeyToCacheKey(sr,t,s))}generateCacheKeysForUser(i){return Object.entries(i).map(([t,s])=>this.resourceKeyToCacheKey(cr,t,s))}notifyPendingCompanyRequests(i,t){for(let[s,r]of Object.entries(i)){let n=this.resourceKeyToCacheKey(sr,s,r),d=this.pendingCompanyRequests.get(n);d&&(this.pendingCompanyRequests.delete(n),d.forEach(g=>{try{g(t)}catch(h){this.logger.error(`Error in company request handler: ${h}`)}}))}}notifyPendingUserRequests(i,t){for(let[s,r]of Object.entries(i)){let n=this.resourceKeyToCacheKey(cr,s,r),d=this.pendingUserRequests.get(n);d&&(this.pendingUserRequests.delete(n),d.forEach(g=>{try{g(t)}catch(h){this.logger.error(`Error in user request handler: ${h}`)}}))}}cleanupPendingCompanyRequests(i,t){for(let s of i){let r=this.pendingCompanyRequests.get(s);if(r){let n=r.indexOf(t);n!==-1&&r.splice(n,1),r.length===0&&this.pendingCompanyRequests.delete(s)}}}cleanupPendingUserRequests(i,t){for(let s of i){let r=this.pendingUserRequests.get(s);if(r){let n=r.indexOf(t);n!==-1&&r.splice(n,1),r.length===0&&this.pendingUserRequests.delete(s)}}}clearPendingRequests(){for(let[,i]of this.pendingCompanyRequests)i.forEach(t=>{try{t(null)}catch(s){this.logger.error(`Error clearing company request: ${s}`)}});this.pendingCompanyRequests.clear();for(let[,i]of this.pendingUserRequests)i.forEach(t=>{try{t(null)}catch(s){this.logger.error(`Error clearing user request: ${s}`)}});if(this.pendingUserRequests.clear(),this.pendingFlagRequest){try{this.pendingFlagRequest(!1)}catch(i){this.logger.error(`Error clearing flag request: ${i}`)}this.pendingFlagRequest=void 0}}startReplicatorHealthCheck(){this.replicatorHealthURL&&(this.logger.info(`Starting replicator health check with URL: ${this.replicatorHealthURL}, interval: ${this.replicatorHealthCheck}ms`),this.checkReplicatorHealth(),this.replicatorHealthInterval=setInterval(()=>{this.checkReplicatorHealth()},this.replicatorHealthCheck),this.replicatorHealthInterval.unref())}async checkReplicatorHealth(){if(this.replicatorHealthURL)try{let i=new AbortController,t=setTimeout(()=>i.abort(),5e3),s=await fetch(this.replicatorHealthURL,{method:"GET",signal:i.signal});if(clearTimeout(t),!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);let r=await s.json(),n=this.replicatorReady;this.replicatorReady=r.ready??!1;let d=r.cache_version||r.cacheVersion;if(d&&d!==this.replicatorCacheVersion){let g=this.replicatorCacheVersion;this.replicatorCacheVersion=d,this.logger.info(`Cache version changed from ${g||"(null)"} to ${d}`)}this.replicatorReady&&!n?(this.logger.info("External replicator is now ready"),this.emit("replicator-health-changed",!0)):!this.replicatorReady&&n&&(this.logger.info("External replicator is no longer ready"),this.emit("replicator-health-changed",!1))}catch(i){this.replicatorReady&&(this.replicatorReady=!1,this.logger.info("External replicator is no longer ready"),this.emit("replicator-health-changed",!1)),this.logger.debug(`Replicator health check failed: ${i}`)}}flagCacheKey(i){let t=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey(),s=`${$b}:${t}:${i.toLowerCase()}`;return this.logger.debug(`Generated flag cache key - flag: ${i}, mode: ${this.replicatorMode?"replicator":"datastream"}, version: ${t}, cacheKey: ${s}`),s}resourceIdCacheKey(i,t){let s=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${i}:${s}:${t}`}resourceKeyToCacheKey(i,t,s){let r=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${i}:${r}:${t.toLowerCase()}:${s.toLowerCase()}`}deepCopyCompany(i){return qn(i)}async evaluateFlag(i,t,s){let r=i.defaultValue??!1;try{if(this.rulesEngine.isInitialized()){this.logger.debug(`Evaluating flag with rules engine: ${JSON.stringify({flagId:i.id,flagRules:i.rules?.length||0,companyId:t?.id,userId:s?.id})}`);let n=await this.rulesEngine.checkFlag(i,t,s);return this.logger.debug(`Rules engine evaluation result: ${JSON.stringify(n)}`),{flagKey:i.key,value:n.value??r,reason:n.reason||"RULES_ENGINE_EVALUATION",companyId:t?.id,userId:s?.id,flagId:i.id,ruleId:n.ruleId,ruleType:n.ruleType,entitlement:n.entitlement?{...n.entitlement,metricResetAt:n.entitlement.metricResetAt?new Date(n.entitlement.metricResetAt):void 0}:void 0}}else return this.logger.warn("Rules engine not initialized, using default flag value"),{flagKey:i.key,value:r,reason:"RULES_ENGINE_UNAVAILABLE",companyId:t?.id,userId:s?.id,flagId:i.id}}catch(n){return this.logger.error(`Rules engine evaluation failed: ${n}`),{flagKey:i.key,value:r,reason:"RULES_ENGINE_ERROR",companyId:t?.id,userId:s?.id,flagId:i.id}}}getRulesEngineVersionKey(){try{if(this.rulesEngine.isInitialized())return this.rulesEngine.getVersionKey()}catch(i){this.logger.warn(`Failed to get rules engine version key: ${i}`)}return"1"}};var Ht=class extends Kt{constructor(o){let{apiKey:i="",basePath:t,eventBufferInterval:s,eventCaptureBaseURL:r,flagDefaults:n={},logLevel:d,timeoutMs:g}=o??{},{offline:h=!1}=o??{},l=o?.logger??new Nr(d),y={};o?.environmentId&&(y["X-Schematic-Environment-Id"]=o.environmentId),o?.headers&&Object.assign(y,o.headers),h?i!==""&&l.debug("Offline mode enabled, ignoring API key"):i===""&&!h&&(l.warn("No API key was provided, running in offline mode"),h=!0);let w=h?ay:ty(y);super({apiKey:i,environment:t,fetcher:w,timeoutInSeconds:g!==void 0?g/1e3:void 0}),this.logger=l;let U={},v=this._options?.headers;if(v)for(let[B,j]of Object.entries(v))typeof j=="string"&&(U[B]=j);let O=new Gt({apiKey:i,fetcher:w,headers:U,baseUrl:r,timeoutMs:g});if(this.eventBuffer=new Lt(O,{interval:s,logger:l,offline:h}),this.flagCheckCacheProviders=o?.cacheProviders?.flagChecks??[new Ze],this.flagDefaults=n,this.offline=h,o?.useDataStream&&!h){let j=["workerd","edge-runtime","browser","web-worker"].includes(Re.type),$=o.dataStream?.replicatorMode===!0;if(j&&!$)l.warn(`DataStream is not supported in ${Re.type} runtime and will be disabled. DataStream requires Node.js APIs (WebSocket) that are not available in edge/browser environments. Use replicatorMode for edge runtime compatibility.`);else{let A={apiKey:i,baseURL:t,logger:l,cacheTTL:o.dataStream?.cacheTTL,redisClient:o.dataStream?.redisClient,redisKeyPrefix:o.dataStream?.redisKeyPrefix,replicatorMode:o.dataStream?.replicatorMode,replicatorHealthURL:o.dataStream?.replicatorHealthURL,replicatorHealthCheck:o.dataStream?.replicatorHealthCheck};this.datastreamClient=new oo(A),this.datastreamClient.start().catch(le=>{l.error(`Failed to start DataStream client: ${le}`),this.datastreamClient=void 0})}}}useDataStream(){return this.datastreamClient!==void 0}async checkFlag(o,i,t){return(await this.checkFlagWithEntitlement(o,i,t)).value}async checkFlagWithEntitlement(o,i,t){let s=()=>t?.defaultValue===void 0?this.getFlagDefault(i):typeof t.defaultValue=="function"?t.defaultValue():t.defaultValue;if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${i}`),{flagKey:i,reason:"flag default",value:s()};if(this.useDataStream())try{let r=await this.datastreamClient.checkFlag(o,i);return this.enqueueEvent(Yt.FlagCheck,{flagKey:i,value:r?.value??!1,reason:r?.reason??"unknown",ruleId:r?.ruleId,companyId:r?.companyId,userId:r?.userId,flagId:r?.flagId,reqCompany:o.company,reqUser:o.user}),{companyId:r.companyId,entitlement:r.entitlement,err:r.err,flagKey:r.flagKey??i,flagId:r.flagId,reason:r.reason,ruleId:r.ruleId,ruleType:r.ruleType,userId:r.userId,value:r.value??this.getFlagDefault(i)}}catch(r){return this.logger.debug(`Datastream flag check failed (${r}), falling back to API`),this.checkFlagViaAPI(o,i,t,s)}return this.checkFlagViaAPI(o,i,t,s)}async checkFlagViaAPI(o,i,t,s){let r=s??(()=>this.getFlagDefault(i));try{let n=JSON.stringify({evalCtx:o,key:i});for(let h of this.flagCheckCacheProviders){let l=await h.get(n);if(l!=null)return this.logger.debug(`${h.constructor.name} cache hit for flag ${i}`),l}let d=await this.features.checkFlag(i,o,{timeoutInSeconds:t?.timeoutMs!==void 0?t.timeoutMs/1e3:void 0});if(d.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${i}, falling back to default`),{flagKey:i,reason:"flag default",value:r()};this.logger.debug(`Feature flag API response for ${i}: ${JSON.stringify(d.data)}`);let g={companyId:d.data.companyId,entitlement:d.data.entitlement,err:d.data.error,flagKey:d.data.flag,flagId:d.data.flagId,reason:d.data.reason,ruleId:d.data.ruleId,ruleType:d.data.ruleType,userId:d.data.userId,value:d.data.value};try{for(let h of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${i} in ${h.constructor.name}`),await h.set(n,g)}catch(h){this.logger.warn(`Cache write failed for flag ${i}: ${h}`)}return g}catch(n){return this.logger.error(`Error checking flag ${i}: ${n}`),{flagKey:i,reason:"flag default",value:r()}}}async checkFlags(o,i){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag values for flags ${i?i.join(", "):"all"}`),i&&i.length>0?i.map(t=>({flag:t,value:this.getFlagDefault(t),reason:"Offline mode - using default value"})):[];try{if(this.useDataStream()&&this.datastreamClient.isConnected()&&i&&i.length>0){let g=await this.checkFlagsViaDataStream(o,i);if(g)return g}if(!i||i.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(o)).data.flags;let t=new Map,s=[];for(let g of i){let h=JSON.stringify({evalCtx:o,key:g}),l=!1;for(let y of this.flagCheckCacheProviders){let w=await y.get(h);if(w!=null){this.logger.debug(`${y.constructor.name} cache hit for flag ${g}`),t.set(g,{flag:g,value:w.value,reason:w.reason}),l=!0;break}}l||s.push(g)}if(s.length===0)return this.logger.debug(`All ${i.length} flags found in cache`),i.map(g=>t.get(g));this.logger.debug(`Cache miss for ${s.length} flags: ${s.join(", ")}, calling API`);let n=(await this.features.checkFlags(o)).data.flags,d=[];for(let g of i){let h=n.find(l=>l.flag===g);if(h){let l=JSON.stringify({evalCtx:o,key:g}),y={companyId:h.companyId,entitlement:h.entitlement,err:h.error,flagKey:h.flag,flagId:h.flagId,reason:h.reason,ruleId:h.ruleId,ruleType:h.ruleType,userId:h.userId,value:h.value};try{for(let w of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${l} in ${w.constructor.name}`),await w.set(l,y)}catch(w){this.logger.warn(`Cache write failed for flag ${g}: ${w}`)}d.push(h)}else{let l=t.get(g);if(l)d.push(l);else{this.logger.debug(`Flag ${g} not found in API response or cache, using default value`);let y={flag:g,value:this.getFlagDefault(g),reason:"Flag not found - using default value"};d.push(y)}}}return this.logger.debug(`Checked ${i.length} flags: used fresh API values for consistency (${s.length} were cache misses)`),d}catch(t){return this.logger.error(`Error checking flags ${i?i.join(", "):"all"}: ${t}`),i&&i.length>0?i.map(s=>({flag:s,value:this.getFlagDefault(s),reason:`Error occurred - using default value: ${t}`})):[]}}async checkFlagsViaDataStream(o,i){let t=[];for(let s of i)try{let r=await this.datastreamClient.checkFlag(o,s);t.push({flag:r.flagKey??s,value:r.value??this.getFlagDefault(s),reason:r.reason,flagId:r.flagId,ruleId:r.ruleId,ruleType:r.ruleType,companyId:r.companyId,userId:r.userId,entitlement:r.entitlement,error:r.err})}catch(r){return this.logger.debug(`Datastream checkFlags falling back to API (${r})`),null}return this.logger.debug(`All ${i.length} flags evaluated via DataStream`),t}async close(){return this.datastreamClient&&this.datastreamClient.close(),this.eventBuffer.stop()}async identify(o,i){if(!this.offline)try{await this.enqueueEvent("identify",o,i)}catch(t){this.logger.error(`Error sending identify event: ${t}`)}}async track(o,i){if(!this.offline)try{if(await this.enqueueEvent("track",o,i),o.company&&this.useDataStream()&&this.datastreamClient.isConnected())try{await this.datastreamClient.updateCompanyMetrics(o.company,o.event,o.quantity||1)}catch(t){this.logger.error(`Failed to update company metrics: ${t}`)}}catch(t){this.logger.error(`Error sending track event: ${t}`)}}setFlagDefault(o,i){this.flagDefaults[o]=i}setFlagDefaults(o){Object.assign(this.flagDefaults,o)}getFlagDefault(o){return this.flagDefaults[o]??!1}async enqueueEvent(o,i,t){try{let s={eventType:o,body:i,sentAt:new Date};t&&(t.idempotencyKey!==void 0&&(s.idempotencyKey=t.idempotencyKey),"sentAt"in t&&t.sentAt!==void 0&&(s.sentAt=t.sentAt),"trustedClientClock"in t&&t.trustedClientClock!==void 0&&(s.trustedClientClock=t.trustedClientClock),"backfill"in t&&t.backfill!==void 0&&(s.backfill=t.backfill)),this.eventBuffer.push(s)}catch(s){this.logger.error(`Error enqueueing ${o} event: ${s}`)}}};var Nt=ao(require("crypto")),In="X-Schematic-Webhook-Signature",Fn="X-Schematic-Webhook-Timestamp",lr=class p extends Error{constructor(o){super(o),Object.setPrototypeOf(this,p.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new p("Missing webhook signature header")}static missingTimestamp(){return new p("Missing webhook timestamp header")}static invalidSignature(){return new p("Invalid webhook signature")}};function $t(p,o,i){let t=Buffer.isBuffer(p)?p:Buffer.from(p),s=Buffer.concat([t,Buffer.from(`+${o}`)]),r=Nt.createHmac("sha256",i);return r.update(s),r.digest()}function by(p,o,i){return $t(p,o,i).toString("hex")}function Kn(p,o,i,t){if(!o)throw lr.missingSignature();if(!i)throw lr.missingTimestamp();let s;try{s=Buffer.from(o,"hex")}catch(n){throw new lr(`Invalid signature format: ${n?.message||"Unknown error"}`)}let r=$t(p,i,t);if(s.length!==r.length||!Nt.timingSafeEqual(s,r))throw lr.invalidSignature()}function zy(p,o,i,t={}){let s=p.headers,r=t.signatureHeader||In,n=t.timestampHeader||Fn,d=wy(s,r),g=wy(s,n),h;if(i!==void 0)h=i;else if("rawBody"in p&&p.rawBody)h=p.rawBody;else throw new lr("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");Kn(h,d,g,o)}function wy(p,o){let i=p[o]||p[o.toLowerCase()];return Array.isArray(i)?i[0]||"":i||""}0&&(module.exports={ConsoleLogger,LocalCache,LogLevel,RedisCacheProvider,RulesEngineClient,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});
|