@schematichq/schematic-typescript-node 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/README.md +36 -2
  2. package/dist/Client.d.ts +12 -0
  3. package/dist/api/resources/accounts/client/Client.d.ts +33 -16
  4. package/dist/api/resources/accounts/client/requests/CountAuditLogsRequest.d.ts +24 -0
  5. package/dist/api/resources/accounts/client/requests/CreateApiKeyRequestBody.d.ts +1 -0
  6. package/dist/api/resources/accounts/client/requests/ListAuditLogsRequest.d.ts +24 -0
  7. package/dist/api/resources/accounts/client/requests/index.d.ts +2 -2
  8. package/dist/api/resources/accounts/types/{ListApiRequestsParams.d.ts → CountAuditLogsParams.d.ts} +5 -2
  9. package/dist/api/resources/accounts/types/{CountApiRequestsResponse.d.ts → CountAuditLogsResponse.d.ts} +2 -2
  10. package/dist/api/resources/accounts/types/{GetApiRequestResponse.d.ts → GetAuditLogResponse.d.ts} +2 -2
  11. package/dist/api/resources/accounts/types/GetWhoAmIResponse.d.ts +6 -0
  12. package/dist/api/resources/accounts/types/{CountApiRequestsParams.d.ts → ListAuditLogsParams.d.ts} +5 -2
  13. package/dist/api/resources/accounts/types/ListAuditLogsResponse.d.ts +6 -0
  14. package/dist/api/resources/accounts/types/index.d.ts +6 -5
  15. package/dist/api/resources/billing/client/Client.d.ts +0 -3
  16. package/dist/api/resources/billing/client/requests/CountBillingProductsRequest.d.ts +1 -1
  17. package/dist/api/resources/billing/client/requests/CountCustomersRequest.d.ts +0 -2
  18. package/dist/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +0 -2
  19. package/dist/api/resources/billing/client/requests/CreateInvoiceRequestBody.d.ts +2 -0
  20. package/dist/api/resources/billing/client/requests/ListBillingProductsRequest.d.ts +1 -1
  21. package/dist/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.d.ts +0 -2
  22. package/dist/api/resources/billing/types/CountBillingProductsParams.d.ts +1 -1
  23. package/dist/api/resources/billing/types/CountCustomersParams.d.ts +0 -1
  24. package/dist/api/resources/billing/types/ListBillingProductsParams.d.ts +1 -1
  25. package/dist/api/resources/billing/types/ListCustomersWithSubscriptionsParams.d.ts +0 -1
  26. package/dist/api/resources/companies/client/Client.d.ts +12 -48
  27. package/dist/api/resources/companies/client/requests/CountCompaniesRequest.d.ts +27 -0
  28. package/dist/api/resources/companies/client/requests/ListCompaniesRequest.d.ts +27 -0
  29. package/dist/api/resources/companies/client/requests/index.d.ts +0 -2
  30. package/dist/api/resources/companies/types/CountCompaniesParams.d.ts +21 -0
  31. package/dist/api/resources/companies/types/ListCompaniesParams.d.ts +21 -0
  32. package/dist/api/resources/companies/types/index.d.ts +0 -4
  33. package/dist/api/resources/componentspublic/client/Client.d.ts +26 -0
  34. package/dist/api/resources/componentspublic/client/index.d.ts +1 -0
  35. package/dist/api/resources/componentspublic/index.d.ts +2 -0
  36. package/dist/api/resources/componentspublic/types/GetPublicPlansResponse.d.ts +6 -0
  37. package/dist/api/resources/componentspublic/types/index.d.ts +1 -0
  38. package/dist/api/resources/credits/client/Client.d.ts +71 -0
  39. package/dist/api/resources/credits/client/requests/CountBillingPlanCreditGrantsRequest.d.ts +3 -1
  40. package/dist/api/resources/credits/client/requests/CountCompanyGrantsRequest.d.ts +20 -0
  41. package/dist/api/resources/credits/client/requests/CountCreditEventLedgerRequest.d.ts +26 -0
  42. package/dist/api/resources/credits/client/requests/ListBillingPlanCreditGrantsRequest.d.ts +3 -1
  43. package/dist/api/resources/credits/client/requests/ListCreditEventLedgerRequest.d.ts +26 -0
  44. package/dist/api/resources/credits/client/requests/index.d.ts +3 -2
  45. package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +1 -0
  46. package/dist/api/resources/credits/types/CountCompanyGrantsParams.d.ts +13 -0
  47. package/dist/api/resources/credits/types/CountCompanyGrantsResponse.d.ts +6 -0
  48. package/dist/api/resources/credits/types/CountCreditEventLedgerParams.d.ts +16 -0
  49. package/dist/api/resources/credits/types/CountCreditEventLedgerResponse.d.ts +6 -0
  50. package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +1 -0
  51. package/dist/api/resources/credits/types/ListCreditEventLedgerParams.d.ts +16 -0
  52. package/dist/api/resources/credits/types/ListCreditEventLedgerResponse.d.ts +6 -0
  53. package/dist/api/resources/credits/types/index.d.ts +6 -0
  54. package/dist/api/resources/entitlements/client/Client.d.ts +22 -0
  55. package/dist/api/resources/entitlements/client/requests/CountPlanEntitlementsRequest.d.ts +5 -0
  56. package/dist/api/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +1 -0
  57. package/dist/api/resources/entitlements/client/requests/GetFeatureUsageTimeSeriesRequest.d.ts +18 -0
  58. package/dist/api/resources/entitlements/client/requests/ListPlanEntitlementsRequest.d.ts +5 -0
  59. package/dist/api/resources/entitlements/client/requests/index.d.ts +1 -0
  60. package/dist/api/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +4 -0
  61. package/dist/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.d.ts +11 -0
  62. package/dist/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.d.ts +6 -0
  63. package/dist/api/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +4 -0
  64. package/dist/api/resources/entitlements/types/index.d.ts +2 -0
  65. package/dist/api/resources/features/client/Client.d.ts +2 -0
  66. package/dist/api/resources/features/client/requests/CountFeaturesRequest.d.ts +3 -0
  67. package/dist/api/resources/features/client/requests/ListFeaturesRequest.d.ts +3 -0
  68. package/dist/api/resources/features/types/CountFeaturesParams.d.ts +2 -0
  69. package/dist/api/resources/features/types/ListFeaturesParams.d.ts +2 -0
  70. package/dist/api/resources/index.d.ts +11 -0
  71. package/dist/api/resources/planbundle/client/Client.d.ts +52 -0
  72. package/dist/api/resources/planbundle/client/index.d.ts +1 -0
  73. package/dist/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.d.ts +16 -0
  74. package/dist/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.d.ts +17 -0
  75. package/dist/api/resources/planbundle/client/requests/index.d.ts +2 -0
  76. package/dist/api/resources/planbundle/index.d.ts +2 -0
  77. package/dist/api/resources/planbundle/types/CreatePlanBundleResponse.d.ts +6 -0
  78. package/dist/api/resources/planbundle/types/UpdatePlanBundleResponse.d.ts +6 -0
  79. package/dist/api/resources/planbundle/types/index.d.ts +2 -0
  80. package/dist/api/resources/plangroups/client/Client.d.ts +4 -0
  81. package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +6 -0
  82. package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +6 -0
  83. package/dist/api/resources/planmigrations/client/Client.d.ts +109 -0
  84. package/dist/api/resources/planmigrations/client/index.d.ts +1 -0
  85. package/dist/api/resources/planmigrations/client/requests/CountCompanyMigrationsRequest.d.ts +20 -0
  86. package/dist/api/resources/planmigrations/client/requests/CountMigrationsRequest.d.ts +18 -0
  87. package/dist/api/resources/planmigrations/client/requests/ListCompanyMigrationsRequest.d.ts +20 -0
  88. package/dist/api/resources/planmigrations/client/requests/ListMigrationsRequest.d.ts +18 -0
  89. package/dist/api/resources/planmigrations/client/requests/index.d.ts +4 -0
  90. package/dist/api/resources/planmigrations/index.d.ts +2 -0
  91. package/dist/api/resources/planmigrations/types/CountCompanyMigrationsParams.d.ts +13 -0
  92. package/dist/api/resources/planmigrations/types/CountCompanyMigrationsResponse.d.ts +6 -0
  93. package/dist/api/resources/planmigrations/types/CountMigrationsParams.d.ts +12 -0
  94. package/dist/api/resources/planmigrations/types/CountMigrationsResponse.d.ts +6 -0
  95. package/dist/api/resources/planmigrations/types/GetMigrationResponse.d.ts +6 -0
  96. package/dist/api/resources/planmigrations/types/ListCompanyMigrationsParams.d.ts +13 -0
  97. package/dist/api/resources/planmigrations/types/ListCompanyMigrationsResponse.d.ts +6 -0
  98. package/dist/api/resources/planmigrations/types/ListMigrationsParams.d.ts +12 -0
  99. package/dist/api/resources/planmigrations/types/ListMigrationsResponse.d.ts +6 -0
  100. package/dist/api/resources/planmigrations/types/index.d.ts +9 -0
  101. package/dist/api/resources/plans/client/Client.d.ts +41 -3
  102. package/dist/api/resources/plans/client/requests/GetPlanRequest.d.ts +10 -0
  103. package/dist/api/resources/plans/client/requests/ListPlanIssuesRequest.d.ts +3 -1
  104. package/dist/api/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +12 -0
  105. package/dist/api/resources/plans/client/requests/index.d.ts +2 -3
  106. package/dist/api/resources/plans/types/CountPlansParams.d.ts +1 -0
  107. package/dist/api/resources/plans/types/DeletePlanVersionResponse.d.ts +6 -0
  108. package/dist/api/resources/plans/types/GetPlanParams.d.ts +7 -0
  109. package/dist/api/resources/plans/types/GetPlanResponse.d.ts +1 -1
  110. package/dist/api/resources/plans/types/ListPlanIssuesParams.d.ts +1 -0
  111. package/dist/api/resources/plans/types/ListPlansParams.d.ts +1 -0
  112. package/dist/api/resources/plans/types/PublishPlanVersionResponse.d.ts +6 -0
  113. package/dist/api/resources/plans/types/index.d.ts +3 -0
  114. package/dist/api/resources/scheduledcheckout/client/Client.d.ts +83 -0
  115. package/dist/api/resources/scheduledcheckout/client/index.d.ts +1 -0
  116. package/dist/api/resources/scheduledcheckout/client/requests/CreateScheduledCheckoutRequest.d.ts +15 -0
  117. package/dist/api/resources/scheduledcheckout/client/requests/ListScheduledCheckoutsRequest.d.ts +18 -0
  118. package/dist/api/resources/scheduledcheckout/client/requests/UpdateScheduledCheckoutRequest.d.ts +9 -0
  119. package/dist/api/resources/scheduledcheckout/client/requests/index.d.ts +3 -0
  120. package/dist/api/resources/scheduledcheckout/index.d.ts +2 -0
  121. package/dist/api/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.d.ts +6 -0
  122. package/dist/api/resources/scheduledcheckout/types/GetScheduledCheckoutResponse.d.ts +6 -0
  123. package/dist/api/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.d.ts +12 -0
  124. package/dist/api/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.d.ts +6 -0
  125. package/dist/api/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.d.ts +6 -0
  126. package/dist/api/resources/scheduledcheckout/types/index.d.ts +5 -0
  127. package/dist/api/types/{PlanChangeActorType.d.ts → ActorType.d.ts} +3 -2
  128. package/dist/api/types/ApiKeyCreateResponseData.d.ts +1 -0
  129. package/dist/api/types/ApiKeyResponseData.d.ts +1 -0
  130. package/dist/api/types/{ApiKeyRequestListResponseData.d.ts → AuditLogListResponseData.d.ts} +4 -4
  131. package/dist/api/types/{ApiKeyRequestResponseData.d.ts → AuditLogResponseData.d.ts} +3 -5
  132. package/dist/api/types/BillingCreditGrantResponseData.d.ts +2 -0
  133. package/dist/api/types/BillingCreditResponseData.d.ts +1 -0
  134. package/dist/api/types/BillingCreditView.d.ts +22 -0
  135. package/dist/api/types/BillingCustomerResponseData.d.ts +0 -1
  136. package/dist/api/types/BillingCustomerWithSubscriptionsResponseData.d.ts +0 -1
  137. package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +9 -2
  138. package/dist/api/types/CheckFlagResponseData.d.ts +8 -5
  139. package/dist/api/types/CompanyDetailResponseData.d.ts +2 -0
  140. package/dist/api/types/CompanyPlanDetailResponseData.d.ts +3 -0
  141. package/dist/api/types/CompanyPlanWithBillingSubView.d.ts +1 -0
  142. package/dist/api/types/ComponentDisplaySettings.d.ts +2 -0
  143. package/dist/api/types/ComponentHydrateResponseData.d.ts +1 -0
  144. package/dist/api/types/ComponentPreviewResponseData.d.ts +1 -0
  145. package/dist/api/types/ComponentSettingsResponseData.d.ts +2 -0
  146. package/dist/api/types/ConditionConditionType.d.ts +1 -1
  147. package/dist/api/types/ConditionGroupResponseData.d.ts +10 -0
  148. package/dist/api/types/ConditionGroupView.d.ts +12 -0
  149. package/dist/api/types/ConditionResponseData.d.ts +28 -0
  150. package/dist/api/types/ConditionView.d.ts +35 -0
  151. package/dist/api/{resources/credits/client/requests → types}/CreateBillingPlanCreditGrantRequestBody.d.ts +2 -11
  152. package/dist/api/types/CreateEntitlementInBundleRequestBody.d.ts +31 -0
  153. package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +7 -0
  154. package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +5 -0
  155. package/dist/api/types/CreateEventRequestBody.d.ts +1 -0
  156. package/dist/api/types/CreatePlanRequestBody.d.ts +7 -0
  157. package/dist/api/types/CreditCompanyGrantView.d.ts +2 -0
  158. package/dist/api/types/CreditEventLedgerResponseData.d.ts +34 -0
  159. package/dist/api/types/CreditEventType.d.ts +7 -0
  160. package/dist/api/types/CreditsAutoTopupCompanySummary.d.ts +4 -0
  161. package/dist/api/types/CreditsAutoTopupCreditSummary.d.ts +4 -0
  162. package/dist/api/types/CreditsAutoTopupHardFailure.d.ts +7 -0
  163. package/dist/api/types/CreditsAutoTopupRetryFailure.d.ts +8 -0
  164. package/dist/api/types/DeleteBillingPlanCreditGrantRequestBody.d.ts +3 -0
  165. package/dist/api/types/EventDetailResponseData.d.ts +1 -1
  166. package/dist/api/types/EventResponseData.d.ts +1 -1
  167. package/dist/api/types/FeatureCompanyResponseData.d.ts +3 -0
  168. package/dist/api/types/FeatureCompanyUserResponseData.d.ts +1 -0
  169. package/dist/api/types/FeatureEntitlement.d.ts +31 -0
  170. package/dist/api/types/FeatureEntitlementMetricPeriod.d.ts +8 -0
  171. package/dist/api/types/FeatureEntitlementMonthReset.d.ts +6 -0
  172. package/dist/api/types/FeatureUsageLegacyResponseData.d.ts +9 -0
  173. package/dist/api/types/FeatureUsageResponseData.d.ts +3 -0
  174. package/dist/api/types/FeatureUsageTimeSeriesResponseData.d.ts +8 -0
  175. package/dist/api/types/FeatureView.d.ts +21 -0
  176. package/dist/api/types/FlagView.d.ts +17 -0
  177. package/dist/api/types/InvoiceRequestBody.d.ts +2 -0
  178. package/dist/api/types/InvoiceResponseData.d.ts +1 -0
  179. package/dist/api/types/InvoiceStatus.d.ts +8 -0
  180. package/dist/api/types/LimitTimeSeriesPointResponseData.d.ts +9 -0
  181. package/dist/api/types/PlanBundleAction.d.ts +6 -0
  182. package/dist/api/types/PlanBundleCreditGrantRequestBody.d.ts +8 -0
  183. package/dist/api/types/PlanBundleEntitlementRequestBody.d.ts +6 -0
  184. package/dist/api/types/PlanBundleResponseData.d.ts +8 -0
  185. package/dist/api/types/PlanChangeAction.d.ts +1 -0
  186. package/dist/api/types/PlanChangeResponseData.d.ts +4 -2
  187. package/dist/api/types/PlanChangeSubscriptionAction.d.ts +1 -0
  188. package/dist/api/types/PlanCreditGrantView.d.ts +10 -3
  189. package/dist/api/types/PlanDetailResponseData.d.ts +3 -0
  190. package/dist/api/types/PlanGroupDetailResponseData.d.ts +2 -0
  191. package/dist/api/types/PlanGroupPlanDetailResponseData.d.ts +3 -0
  192. package/dist/api/types/PlanGroupResponseData.d.ts +2 -0
  193. package/dist/api/types/PlanVersionCompanyMigrationResponseData.d.ts +14 -0
  194. package/dist/api/types/PlanVersionCompanyMigrationStatus.d.ts +8 -0
  195. package/dist/api/types/PlanVersionMigrationResponseData.d.ts +18 -0
  196. package/dist/api/types/PlanVersionMigrationStatus.d.ts +7 -0
  197. package/dist/api/types/PlanVersionMigrationStrategy.d.ts +5 -0
  198. package/dist/api/types/PlanVersionResponseData.d.ts +14 -0
  199. package/dist/api/types/PlanVersionStatus.d.ts +6 -0
  200. package/dist/api/types/PlanViewPublicResponseData.d.ts +32 -0
  201. package/dist/api/types/PreviewSubscriptionChangeResponseData.d.ts +2 -0
  202. package/dist/api/types/PublicPlansResponseData.d.ts +12 -0
  203. package/dist/api/types/RawEventResponseData.d.ts +1 -1
  204. package/dist/api/types/RuleView.d.ts +16 -0
  205. package/dist/api/types/RulesEngineSchemaVersion.d.ts +1 -1
  206. package/dist/api/types/RulesengineCheckFlagResult.d.ts +1 -0
  207. package/dist/api/types/RulesengineCompany.d.ts +2 -1
  208. package/dist/api/types/RulesengineConditionConditionType.d.ts +1 -1
  209. package/dist/api/types/RulesengineEntitlementValueType.d.ts +9 -0
  210. package/dist/api/types/RulesengineFeatureEntitlement.d.ts +31 -0
  211. package/dist/api/types/RulesengineFeatureEntitlementMetricPeriod.d.ts +8 -0
  212. package/dist/api/types/RulesengineFeatureEntitlementMonthReset.d.ts +6 -0
  213. package/dist/api/types/ScheduledCheckoutResponseData.d.ts +17 -0
  214. package/dist/api/types/ScheduledCheckoutStatus.d.ts +8 -0
  215. package/dist/api/types/ScheduledDowngradeConfigBehavior.d.ts +5 -0
  216. package/dist/api/types/ScheduledDowngradeResponseData.d.ts +13 -0
  217. package/dist/api/types/TimeSeriesGranularity.d.ts +7 -0
  218. package/dist/api/{resources/credits/client/requests → types}/UpdateBillingPlanCreditGrantRequestBody.d.ts +1 -8
  219. package/dist/api/{resources/plans/client/requests → types}/UpdatePlanRequestBody.d.ts +0 -6
  220. package/dist/api/{resources/plans/client/requests → types}/UpsertBillingProductRequestBody.d.ts +1 -8
  221. package/dist/api/types/UpsertCompanyRequestBody.d.ts +1 -0
  222. package/dist/api/types/UsageTimeSeriesPointResponseData.d.ts +6 -0
  223. package/dist/api/types/WebFeatureUsageWebhookOutput.d.ts +10 -0
  224. package/dist/api/types/WebhookRequestType.d.ts +3 -0
  225. package/dist/api/types/WhoAmIResponseData.d.ts +12 -0
  226. package/dist/api/types/index.d.ts +58 -6
  227. package/dist/cache/index.d.ts +3 -0
  228. package/dist/{cache.d.ts → cache/local.d.ts} +9 -10
  229. package/dist/cache/redis.d.ts +38 -0
  230. package/dist/cache/types.d.ts +19 -0
  231. package/dist/datastream/datastream-client.d.ts +239 -0
  232. package/dist/datastream/index.d.ts +2 -0
  233. package/dist/datastream/types.d.ts +48 -0
  234. package/dist/datastream/websocket-client.d.ts +127 -0
  235. package/dist/index.d.ts +4 -2
  236. package/dist/index.js +3 -3
  237. package/dist/rules-engine.d.ts +54 -0
  238. package/dist/serialization/resources/accounts/client/requests/CreateApiKeyRequestBody.d.ts +1 -0
  239. package/dist/serialization/resources/accounts/types/CountAuditLogsParams.d.ts +16 -0
  240. package/dist/serialization/resources/accounts/types/CountAuditLogsResponse.d.ts +12 -0
  241. package/dist/serialization/resources/accounts/types/GetAuditLogResponse.d.ts +11 -0
  242. package/dist/serialization/resources/accounts/types/GetWhoAmIResponse.d.ts +11 -0
  243. package/dist/serialization/resources/accounts/types/ListAuditLogsParams.d.ts +16 -0
  244. package/dist/serialization/resources/accounts/types/ListAuditLogsResponse.d.ts +12 -0
  245. package/dist/serialization/resources/accounts/types/index.d.ts +6 -5
  246. package/dist/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +0 -1
  247. package/dist/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.d.ts +2 -0
  248. package/dist/serialization/resources/billing/types/CountCustomersParams.d.ts +0 -1
  249. package/dist/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.d.ts +0 -1
  250. package/dist/serialization/resources/companies/types/CountCompaniesParams.d.ts +13 -0
  251. package/dist/serialization/resources/companies/types/ListCompaniesParams.d.ts +13 -0
  252. package/dist/serialization/resources/companies/types/index.d.ts +0 -4
  253. package/dist/serialization/resources/componentspublic/index.d.ts +1 -0
  254. package/dist/serialization/resources/componentspublic/types/GetPublicPlansResponse.d.ts +11 -0
  255. package/dist/serialization/resources/componentspublic/types/index.d.ts +1 -0
  256. package/dist/serialization/resources/credits/client/requests/index.d.ts +0 -2
  257. package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +1 -0
  258. package/dist/serialization/resources/credits/types/CountCompanyGrantsParams.d.ts +15 -0
  259. package/dist/serialization/resources/credits/types/CountCompanyGrantsResponse.d.ts +12 -0
  260. package/dist/serialization/resources/credits/types/CountCreditEventLedgerParams.d.ts +17 -0
  261. package/dist/serialization/resources/credits/types/CountCreditEventLedgerResponse.d.ts +12 -0
  262. package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +1 -0
  263. package/dist/serialization/resources/credits/types/ListCreditEventLedgerParams.d.ts +17 -0
  264. package/dist/serialization/resources/credits/types/ListCreditEventLedgerResponse.d.ts +12 -0
  265. package/dist/serialization/resources/credits/types/index.d.ts +6 -0
  266. package/dist/serialization/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +1 -0
  267. package/dist/serialization/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +2 -0
  268. package/dist/serialization/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.d.ts +14 -0
  269. package/dist/serialization/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.d.ts +12 -0
  270. package/dist/serialization/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +2 -0
  271. package/dist/serialization/resources/entitlements/types/index.d.ts +2 -0
  272. package/dist/serialization/resources/features/types/CountFeaturesParams.d.ts +1 -0
  273. package/dist/serialization/resources/features/types/ListFeaturesParams.d.ts +1 -0
  274. package/dist/serialization/resources/index.d.ts +10 -0
  275. package/dist/serialization/resources/planbundle/client/index.d.ts +1 -0
  276. package/dist/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.d.ts +18 -0
  277. package/dist/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.d.ts +19 -0
  278. package/dist/serialization/resources/planbundle/client/requests/index.d.ts +2 -0
  279. package/dist/serialization/resources/planbundle/index.d.ts +2 -0
  280. package/dist/serialization/resources/planbundle/types/CreatePlanBundleResponse.d.ts +11 -0
  281. package/dist/serialization/resources/planbundle/types/UpdatePlanBundleResponse.d.ts +11 -0
  282. package/dist/serialization/resources/planbundle/types/index.d.ts +2 -0
  283. package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +5 -0
  284. package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +5 -0
  285. package/dist/serialization/resources/planmigrations/index.d.ts +1 -0
  286. package/dist/serialization/resources/planmigrations/types/CountCompanyMigrationsParams.d.ts +14 -0
  287. package/dist/serialization/resources/planmigrations/types/CountCompanyMigrationsResponse.d.ts +12 -0
  288. package/dist/serialization/resources/planmigrations/types/CountMigrationsParams.d.ts +13 -0
  289. package/dist/serialization/resources/planmigrations/types/CountMigrationsResponse.d.ts +12 -0
  290. package/dist/serialization/resources/planmigrations/types/GetMigrationResponse.d.ts +11 -0
  291. package/dist/serialization/resources/planmigrations/types/ListCompanyMigrationsParams.d.ts +14 -0
  292. package/dist/serialization/resources/planmigrations/types/ListCompanyMigrationsResponse.d.ts +12 -0
  293. package/dist/serialization/resources/planmigrations/types/ListMigrationsParams.d.ts +13 -0
  294. package/dist/serialization/resources/planmigrations/types/ListMigrationsResponse.d.ts +12 -0
  295. package/dist/serialization/resources/planmigrations/types/index.d.ts +9 -0
  296. package/dist/serialization/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +11 -0
  297. package/dist/serialization/resources/plans/client/requests/index.d.ts +1 -3
  298. package/dist/serialization/resources/plans/types/DeletePlanVersionResponse.d.ts +11 -0
  299. package/dist/serialization/resources/plans/types/GetPlanParams.d.ts +9 -0
  300. package/dist/serialization/resources/plans/types/GetPlanResponse.d.ts +2 -1
  301. package/dist/serialization/resources/plans/types/ListPlanIssuesParams.d.ts +1 -0
  302. package/dist/serialization/resources/plans/types/PublishPlanVersionResponse.d.ts +11 -0
  303. package/dist/serialization/resources/plans/types/index.d.ts +3 -0
  304. package/dist/serialization/resources/scheduledcheckout/client/index.d.ts +1 -0
  305. package/dist/serialization/resources/scheduledcheckout/client/requests/CreateScheduledCheckoutRequest.d.ts +12 -0
  306. package/dist/serialization/resources/scheduledcheckout/client/requests/UpdateScheduledCheckoutRequest.d.ts +11 -0
  307. package/dist/serialization/resources/scheduledcheckout/client/requests/index.d.ts +2 -0
  308. package/dist/serialization/resources/scheduledcheckout/index.d.ts +2 -0
  309. package/dist/serialization/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.d.ts +11 -0
  310. package/dist/serialization/resources/scheduledcheckout/types/GetScheduledCheckoutResponse.d.ts +11 -0
  311. package/dist/serialization/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.d.ts +13 -0
  312. package/dist/serialization/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.d.ts +12 -0
  313. package/dist/serialization/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.d.ts +11 -0
  314. package/dist/serialization/resources/scheduledcheckout/types/index.d.ts +5 -0
  315. package/dist/serialization/types/ActorType.d.ts +7 -0
  316. package/dist/serialization/types/ApiKeyCreateResponseData.d.ts +1 -0
  317. package/dist/serialization/types/ApiKeyResponseData.d.ts +1 -0
  318. package/dist/serialization/types/{ApiKeyRequestListResponseData.d.ts → AuditLogListResponseData.d.ts} +5 -5
  319. package/dist/serialization/types/{ApiKeyRequestResponseData.d.ts → AuditLogResponseData.d.ts} +5 -7
  320. package/dist/serialization/types/BillingCreditGrantResponseData.d.ts +3 -0
  321. package/dist/serialization/types/BillingCreditResponseData.d.ts +1 -0
  322. package/dist/serialization/types/BillingCreditView.d.ts +32 -0
  323. package/dist/serialization/types/BillingCustomerResponseData.d.ts +0 -1
  324. package/dist/serialization/types/BillingCustomerWithSubscriptionsResponseData.d.ts +0 -1
  325. package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +7 -2
  326. package/dist/serialization/types/CheckFlagResponseData.d.ts +2 -0
  327. package/dist/serialization/types/CompanyDetailResponseData.d.ts +4 -0
  328. package/dist/serialization/types/CompanyPlanDetailResponseData.d.ts +4 -0
  329. package/dist/serialization/types/CompanyPlanWithBillingSubView.d.ts +1 -0
  330. package/dist/serialization/types/ComponentDisplaySettings.d.ts +2 -0
  331. package/dist/serialization/types/ComponentHydrateResponseData.d.ts +2 -0
  332. package/dist/serialization/types/ComponentPreviewResponseData.d.ts +2 -0
  333. package/dist/serialization/types/ComponentSettingsResponseData.d.ts +2 -0
  334. package/dist/serialization/types/ConditionConditionType.d.ts +1 -1
  335. package/dist/serialization/types/ConditionGroupResponseData.d.ts +16 -0
  336. package/dist/serialization/types/ConditionGroupView.d.ts +18 -0
  337. package/dist/serialization/types/ConditionResponseData.d.ts +34 -0
  338. package/dist/serialization/types/ConditionView.d.ts +43 -0
  339. package/dist/serialization/{resources/credits/client/requests → types}/CreateBillingPlanCreditGrantRequestBody.d.ts +11 -10
  340. package/dist/serialization/types/CreateEntitlementInBundleRequestBody.d.ts +41 -0
  341. package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +7 -0
  342. package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +7 -0
  343. package/dist/serialization/types/CreatePlanRequestBody.d.ts +13 -0
  344. package/dist/serialization/types/CreditCompanyGrantView.d.ts +3 -0
  345. package/dist/serialization/types/CreditEventLedgerResponseData.d.ts +47 -0
  346. package/dist/serialization/types/CreditEventType.d.ts +7 -0
  347. package/dist/serialization/types/CreditsAutoTopupCompanySummary.d.ts +10 -0
  348. package/dist/serialization/types/CreditsAutoTopupCreditSummary.d.ts +10 -0
  349. package/dist/serialization/types/CreditsAutoTopupHardFailure.d.ts +14 -0
  350. package/dist/serialization/types/CreditsAutoTopupRetryFailure.d.ts +15 -0
  351. package/dist/serialization/types/DeleteBillingPlanCreditGrantRequestBody.d.ts +9 -0
  352. package/dist/serialization/types/EventDetailResponseData.d.ts +1 -1
  353. package/dist/serialization/types/EventResponseData.d.ts +1 -1
  354. package/dist/serialization/types/FeatureEntitlement.d.ts +25 -0
  355. package/dist/serialization/types/FeatureEntitlementMetricPeriod.d.ts +7 -0
  356. package/dist/serialization/types/FeatureEntitlementMonthReset.d.ts +7 -0
  357. package/dist/serialization/types/FeatureUsageLegacyResponseData.d.ts +16 -0
  358. package/dist/serialization/types/FeatureUsageTimeSeriesResponseData.d.ts +16 -0
  359. package/dist/serialization/types/FeatureView.d.ts +32 -0
  360. package/dist/serialization/types/FlagView.d.ts +25 -0
  361. package/dist/serialization/types/InvoiceRequestBody.d.ts +2 -0
  362. package/dist/serialization/types/InvoiceResponseData.d.ts +2 -0
  363. package/dist/serialization/types/InvoiceStatus.d.ts +7 -0
  364. package/dist/serialization/types/LimitTimeSeriesPointResponseData.d.ts +16 -0
  365. package/dist/serialization/types/PlanBundleAction.d.ts +7 -0
  366. package/dist/serialization/types/PlanBundleCreditGrantRequestBody.d.ts +17 -0
  367. package/dist/serialization/types/PlanBundleEntitlementRequestBody.d.ts +13 -0
  368. package/dist/serialization/types/PlanBundleResponseData.d.ts +18 -0
  369. package/dist/serialization/types/PlanChangeAction.d.ts +1 -1
  370. package/dist/serialization/types/PlanChangeResponseData.d.ts +4 -4
  371. package/dist/serialization/types/PlanChangeSubscriptionAction.d.ts +1 -1
  372. package/dist/serialization/types/PlanCreditGrantView.d.ts +7 -3
  373. package/dist/serialization/types/PlanDetailResponseData.d.ts +4 -0
  374. package/dist/serialization/types/PlanGroupDetailResponseData.d.ts +2 -0
  375. package/dist/serialization/types/PlanGroupPlanDetailResponseData.d.ts +4 -0
  376. package/dist/serialization/types/PlanGroupResponseData.d.ts +2 -0
  377. package/dist/serialization/types/PlanVersionCompanyMigrationResponseData.d.ts +20 -0
  378. package/dist/serialization/types/PlanVersionCompanyMigrationStatus.d.ts +7 -0
  379. package/dist/serialization/types/PlanVersionMigrationResponseData.d.ts +25 -0
  380. package/dist/serialization/types/PlanVersionMigrationStatus.d.ts +7 -0
  381. package/dist/serialization/types/PlanVersionMigrationStrategy.d.ts +7 -0
  382. package/dist/serialization/types/PlanVersionResponseData.d.ts +21 -0
  383. package/dist/serialization/types/PlanVersionStatus.d.ts +7 -0
  384. package/dist/serialization/types/PlanViewPublicResponseData.d.ts +47 -0
  385. package/dist/serialization/types/PreviewSubscriptionChangeResponseData.d.ts +2 -0
  386. package/dist/serialization/types/PublicPlansResponseData.d.ts +21 -0
  387. package/dist/serialization/types/RawEventResponseData.d.ts +1 -1
  388. package/dist/serialization/types/RuleView.d.ts +23 -0
  389. package/dist/serialization/types/RulesEngineSchemaVersion.d.ts +1 -1
  390. package/dist/serialization/types/RulesengineCheckFlagResult.d.ts +2 -0
  391. package/dist/serialization/types/RulesengineCompany.d.ts +3 -1
  392. package/dist/serialization/types/RulesengineConditionConditionType.d.ts +1 -1
  393. package/dist/serialization/types/RulesengineEntitlementValueType.d.ts +7 -0
  394. package/dist/serialization/types/RulesengineFeatureEntitlement.d.ts +25 -0
  395. package/dist/serialization/types/RulesengineFeatureEntitlementMetricPeriod.d.ts +7 -0
  396. package/dist/serialization/types/RulesengineFeatureEntitlementMonthReset.d.ts +7 -0
  397. package/dist/serialization/types/ScheduledCheckoutResponseData.d.ts +23 -0
  398. package/dist/serialization/types/ScheduledCheckoutStatus.d.ts +7 -0
  399. package/dist/serialization/types/ScheduledDowngradeConfigBehavior.d.ts +7 -0
  400. package/dist/serialization/types/ScheduledDowngradeResponseData.d.ts +19 -0
  401. package/dist/serialization/types/TimeSeriesGranularity.d.ts +7 -0
  402. package/dist/serialization/{resources/credits/client/requests → types}/UpdateBillingPlanCreditGrantRequestBody.d.ts +10 -10
  403. package/dist/serialization/types/UpdatePlanRequestBody.d.ts +11 -0
  404. package/dist/serialization/{resources/plans/client/requests → types}/UpsertBillingProductRequestBody.d.ts +5 -5
  405. package/dist/serialization/types/UpsertCompanyRequestBody.d.ts +1 -0
  406. package/dist/serialization/types/UsageTimeSeriesPointResponseData.d.ts +12 -0
  407. package/dist/serialization/types/WebFeatureUsageWebhookOutput.d.ts +18 -0
  408. package/dist/serialization/types/WebhookRequestType.d.ts +1 -1
  409. package/dist/serialization/types/WhoAmIResponseData.d.ts +18 -0
  410. package/dist/serialization/types/index.d.ts +58 -6
  411. package/dist/wrapper.d.ts +58 -5
  412. package/package.json +4 -2
  413. package/dist/api/resources/accounts/client/requests/CountApiRequestsRequest.d.ts +0 -19
  414. package/dist/api/resources/accounts/client/requests/ListApiRequestsRequest.d.ts +0 -19
  415. package/dist/api/resources/accounts/types/ListApiRequestsResponse.d.ts +0 -6
  416. package/dist/api/resources/companies/client/requests/CountCompaniesForAdvancedFilterRequest.d.ts +0 -46
  417. package/dist/api/resources/companies/client/requests/ListCompaniesForAdvancedFilterRequest.d.ts +0 -46
  418. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.d.ts +0 -35
  419. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterResponse.d.ts +0 -6
  420. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.d.ts +0 -35
  421. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterResponse.d.ts +0 -6
  422. package/dist/api/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -15
  423. package/dist/api/types/CompanyViewWithFeatureUsageResponseData.d.ts +0 -26
  424. package/dist/api/types/CreditUsageResponseData.d.ts +0 -12
  425. package/dist/api/types/FeatureUsageDataResponseData.d.ts +0 -19
  426. package/dist/serialization/resources/accounts/types/CountApiRequestsParams.d.ts +0 -13
  427. package/dist/serialization/resources/accounts/types/CountApiRequestsResponse.d.ts +0 -12
  428. package/dist/serialization/resources/accounts/types/GetApiRequestResponse.d.ts +0 -11
  429. package/dist/serialization/resources/accounts/types/ListApiRequestsParams.d.ts +0 -13
  430. package/dist/serialization/resources/accounts/types/ListApiRequestsResponse.d.ts +0 -12
  431. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterParams.d.ts +0 -26
  432. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterResponse.d.ts +0 -12
  433. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterParams.d.ts +0 -26
  434. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterResponse.d.ts +0 -12
  435. package/dist/serialization/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -13
  436. package/dist/serialization/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -11
  437. package/dist/serialization/types/CompanyViewWithFeatureUsageResponseData.d.ts +0 -39
  438. package/dist/serialization/types/CreditUsageResponseData.d.ts +0 -17
  439. package/dist/serialization/types/FeatureUsageDataResponseData.d.ts +0 -27
  440. package/dist/serialization/types/PlanChangeActorType.d.ts +0 -7
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var Md=Object.create;var ti=Object.defineProperty;var Fd=Object.getOwnPropertyDescriptor;var Id=Object.getOwnPropertyNames;var Kd=Object.getPrototypeOf,Gd=Object.prototype.hasOwnProperty;var fo=(p,o)=>()=>(p&&(o=p(p=0)),o);var Me=(p,o)=>{for(var i in o)ti(p,i,{get:o[i],enumerable:!0})},Wt=(p,o,i,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Id(o))!Gd.call(p,n)&&n!==i&&ti(p,n,{get:()=>o[n],enumerable:!(a=Fd(o,n))||a.enumerable});return p};var _o=(p,o,i)=>(i=p!=null?Md(Kd(p)):{},Wt(o||!p||!p.__esModule?ti(i,"default",{value:p,enumerable:!0}):i,p)),Ld=p=>Wt(ti({},"__esModule",{value:!0}),p);var wa={};Me(wa,{Node18UniversalStreamWrapper:()=>Eo});var Eo,ba=fo(()=>{"use strict";Eo=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(a=>a!==i)}pipe(o){return this.on("data",async i=>{if(o instanceof p)o._write(i);else if(o instanceof WritableStream){let a=o.getWriter();a.write(i).then(()=>a.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 a=o.getWriter();a.write(i).then(()=>a.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(a=>{this.resumeCallback=a});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:a,value:n}=await this.reader.read();if(a)break;n&&o.push(n)}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 a of this.events[o]||[])a(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(a=>{this.resumeCallback=a});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(a=>{this.resumeCallback=a});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 za={};Me(za,{UndiciStreamWrapper:()=>Co});var Co,Ra=fo(()=>{"use strict";Co=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(a=>a!==i)}pipe(o){return this.on("data",i=>{if(o instanceof p)o._write(i);else{let a=o.getWriter();a.write(i).then(()=>a.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 a=o.getWriter();a.write(i).then(()=>a.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(a=>{this.resumeCallback=a});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:a,value:n}=await this.reader.read();if(a)break;n&&o.push(n)}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 a of this.events[o]||[])a(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(a=>{this.resumeCallback=a});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(a=>{this.resumeCallback=a});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 fa={};Me(fa,{NodePre18StreamWrapper:()=>Uo});var Uo,_a=fo(()=>{"use strict";Uo=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 a=this.readableStream.read();a?o(a):(this.readableStream.once("readable",()=>{let n=this.readableStream.read();o(n)}),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 n of this.readableStream)o.push(i.encode(n));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:a,done:n}=await i.next();return{value:a,done:n}},[Symbol.asyncIterator](){return this}}}}});var Ah={};Me(Ah,{LocalCache:()=>mr,Schematic:()=>se,SchematicClient:()=>bo,SchematicEnvironment:()=>S,SchematicError:()=>z,SchematicTimeoutError:()=>cr,WEBHOOK_SIGNATURE_HEADER:()=>Kt,WEBHOOK_TIMESTAMP_HEADER:()=>Gt,WebhookSignatureError:()=>De,computeHexSignature:()=>qd,computeSignature:()=>Ro,verifySignature:()=>Lt,verifyWebhookSignature:()=>Dd});module.exports=Ld(Ah);var se={};Me(se,{ApiKeyScope:()=>Nd,BadRequestError:()=>j,BillingCreditBundleStatus:()=>Hd,BillingCreditBurnStrategy:()=>$d,BillingCreditExpiryType:()=>Zd,BillingCreditExpiryUnit:()=>Jd,BillingCreditGrantReason:()=>Qd,BillingCreditGrantZeroedOutReason:()=>Yd,BillingCreditRolloverPolicy:()=>Xd,BillingPlanCreditGrantResetCadence:()=>em,BillingPlanCreditGrantResetStart:()=>rm,BillingPlanCreditGrantResetType:()=>im,BillingPriceScheme:()=>om,BillingPriceUsageType:()=>tm,BillingProductPriceInterval:()=>am,BillingProviderType:()=>sm,BillingSubscriptionTrialEndSetting:()=>nm,BillingTiersMode:()=>cm,ChargeType:()=>lm,CompanyPlanInvalidReason:()=>pm,ComponentEntityType:()=>um,ComponentState:()=>dm,ConditionConditionType:()=>mm,ConditionMetricPeriod:()=>hm,ConditionMetricPeriodMonthReset:()=>gm,ConditionOperator:()=>ym,CreateCompanyOverrideRequestBodyMetricPeriod:()=>ea,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ra,CreateEntitlementReqCommonMetricPeriod:()=>wm,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>bm,CreateOrUpdateConditionRequestBodyConditionType:()=>zm,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>Rm,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>fm,CreateOrUpdateConditionRequestBodyOperator:()=>_m,CreateOrUpdateRuleRequestBodyRuleType:()=>Sm,CreatePlanEntitlementRequestBodyMetricPeriod:()=>ia,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>oa,CreditGrantSortOrder:()=>Pm,CreditLedgerPeriod:()=>xm,DataExportStatus:()=>Em,EntitlementPriceBehavior:()=>Cm,EntitlementType:()=>Um,EntitlementValueType:()=>Tm,EntityType:()=>vm,EnvironmentType:()=>Om,EventStatus:()=>jm,EventType:()=>km,FeatureLifecyclePhase:()=>Bm,FeatureType:()=>Am,ForbiddenError:()=>x,InternalServerError:()=>E,NotFoundError:()=>C,PlanChangeAction:()=>Vm,PlanChangeActorType:()=>qm,PlanChangeBasePlanAction:()=>Dm,PlanChangeSubscriptionAction:()=>Mm,PlanControlledByType:()=>Fm,PlanType:()=>Im,ProrationBehavior:()=>Km,RuleRuleType:()=>Gm,RulesEngineSchemaVersion:()=>Lm,RulesengineCheckFlagResultFeatureUsagePeriod:()=>Wm,RulesengineCheckFlagResultRuleType:()=>Nm,RulesengineCompanyMetricMonthReset:()=>Hm,RulesengineCompanyMetricPeriod:()=>$m,RulesengineConditionConditionType:()=>Zm,RulesengineConditionMetricPeriod:()=>Jm,RulesengineConditionMetricPeriodMonthReset:()=>Qm,RulesengineConditionOperator:()=>Ym,RulesengineEntityType:()=>Xm,RulesengineRuleRuleType:()=>eh,RulesengineTraitDefinitionComparableType:()=>rh,SortDirection:()=>ih,SubscriptionStatus:()=>oh,SubscriptionType:()=>th,TraitDefinitionComparableType:()=>ah,TraitType:()=>sh,UnauthorizedError:()=>U,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ta,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>aa,UpdateEntitlementReqCommonMetricPeriod:()=>nh,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>ch,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>sa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>na,WebhookEventStatus:()=>lh,WebhookRequestType:()=>ph,WebhookStatus:()=>uh,accesstokens:()=>Nt,accounts:()=>Ht,billing:()=>$t,checkout:()=>Zt,companies:()=>Jt,components:()=>Qt,credits:()=>Yt,dataexports:()=>Xt,entitlements:()=>So,events:()=>ca,features:()=>la,plangroups:()=>pa,plans:()=>ua,webhooks:()=>da});var me=(p,o,i)=>JSON.stringify(p,o,i);function Nr(p,o){return JSON.parse(p,o)}var z=class extends Error{constructor({message:o,statusCode:i,body:a,rawResponse:n}){super(Wd({message:o,statusCode:i,body:a})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=i,this.body=a,this.rawResponse=n}};function Wd({message:p,statusCode:o,body:i}){let a=[];return p!=null&&a.push(p),o!=null&&a.push(`Status code: ${o.toString()}`),i!=null&&a.push(`Body: ${me(i,void 0,2)}`),a.join(`
2
- `)}var cr=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 j=class extends z{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 x=class extends z{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 E=class extends z{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 C=class extends z{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 U=class extends z{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 Nt={};var Ht={};var $t={};var Zt={};var Jt={};var Qt={};var Yt={};var Xt={};var So={};Me(So,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>ea,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ra,CreatePlanEntitlementRequestBodyMetricPeriod:()=>ia,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>oa,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ta,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>aa,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>sa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>na});var ea={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ra={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ia={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var oa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ta={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var aa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var sa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var na={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ca={};var la={};var pa={};var ua={};var da={};var Nd={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var Hd={Active:"active",Inactive:"inactive"};var $d={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var Zd={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var Jd={BillingPeriods:"billing_periods",Days:"days"};var Qd={BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var Yd={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var Xd={Expire:"expire",None:"none",Rollover:"rollover"};var em={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var rm={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var im={NoReset:"no_reset",PlanPeriod:"plan_period"};var om={PerUnit:"per_unit",Tiered:"tiered"};var tm={Licensed:"licensed",Metered:"metered"};var am={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var sm={Schematic:"schematic",Stripe:"stripe"};var nm={Cancel:"cancel",Subscribe:"subscribe"};var cm={Graduated:"graduated",Volume:"volume"};var lm={Free:"free",OneTime:"one_time",Recurring:"recurring"};var pm={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var um={Billing:"billing",Entitlement:"entitlement"};var dm={Draft:"draft",Live:"live"};var mm={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var hm={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var gm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ym={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var wm={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var bm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var zm={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",BasePlan:"base_plan"};var Rm={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var fm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var _m={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Sm={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Pm={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var xm={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var Em={Failure:"failure",Pending:"pending",Success:"success"};var Cm={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var Um={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var Tm={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var vm={Company:"company",User:"user"};var Om={Development:"development",Production:"production",Staging:"staging"};var jm={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var km={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var Bm={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var Am={Boolean:"boolean",Event:"event",Trait:"trait"};var Vm={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",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var qm={ApiKey:"api_key",AppUser:"app_user",System:"system",TemporaryAccessToken:"temporary_access_token"};var Dm={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var Mm={Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var Fm={Schematic:"schematic",Stripe:"stripe"};var Im={Plan:"plan",AddOn:"add_on"};var Km={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};var Gm={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Lm={FiveHundredFortyNineE6Fea:"549e6fea",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var Wm={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Nm={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Hm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var $m={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Zm={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var Jm={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Qm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ym={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Xm={Company:"company",User:"user"};var eh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var rh={Bool:"bool",Date:"date",Int:"int",String:"string"};var ih={Asc:"asc",Desc:"desc"};var oh={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var th={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var ah={Bool:"bool",Date:"date",Int:"int",String:"string"};var sh={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var nh={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ch={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var lh={Failure:"failure",Pending:"pending",Success:"success"};var ph={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",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",RuleDeleted:"rule.deleted",TestSend:"test.send",UserCreated:"user.created",UserDeleted:"user.deleted",UserUpdated:"user.updated"};var uh={Active:"active",Inactive:"inactive"};var Hr=require("timers"),mr=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);if(i){if(i.expiration<=Date.now()){this.evictItem(o,i);return}return this.accessCounter++,i.accessCounter=this.accessCounter,this.cache.set(o,i),i.value}}async set(o,i,a){if(this.maxItems===0)return;let n=a??this.defaultTTL,r=this.cache.get(o);r&&this.evictItem(o,r),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let s={value:i,accessCounter:this.accessCounter,expiration:Date.now()+n,timeoutId:(0,Hr.setTimeout)(()=>this.evictItem(o,s),n)};this.cache.set(o,s)}resetCache(){this.cache.forEach(o=>{o.timeoutId&&(0,Hr.clearTimeout)(o.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(o,i){i.timeoutId&&(0,Hr.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((a,n)=>{a.accessCounter<i&&(o=n,i=a.accessCounter)}),o&&this.evictItem(o,this.cache.get(o))}}};var $r=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var ma={get:async(p,o)=>typeof p=="function"?p(o):p};var Pe={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},ha={[Pe.Debug]:1,[Pe.Info]:2,[Pe.Warn]:3,[Pe.Error]:4},Zr=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)}},hr=class{constructor(o){this.level=ha[o.level],this.logger=o.logger,this.silent=o.silent}shouldLog(o){return!this.silent&&this.level<=ha[o]}isDebug(){return this.shouldLog(Pe.Debug)}debug(o,...i){this.isDebug()&&this.logger.debug(o,...i)}isInfo(){return this.shouldLog(Pe.Info)}info(o,...i){this.isInfo()&&this.logger.info(o,...i)}isWarn(){return this.shouldLog(Pe.Warn)}warn(o,...i){this.isWarn()&&this.logger.warn(o,...i)}isError(){return this.shouldLog(Pe.Error)}error(o,...i){this.isError()&&this.logger.error(o,...i)}};function Po(p){return p==null?dh:p instanceof hr?p:(p=p??{},p.level??=Pe.Info,p.logger??=new Zr,p.silent??=!0,new hr(p))}var dh=new hr({level:Pe.Info,logger:new Zr,silent:!0});var mh={arrayFormat:"indices",encode:!0};function ga(p,o){if(p===void 0||p===null)return"";let i=String(p);return o?encodeURIComponent(i):i}function xo(p,o="",i){let a=[];for(let[n,r]of Object.entries(p)){let s=o?`${o}[${n}]`:n;if(r!==void 0)if(Array.isArray(r)){if(r.length===0)continue;for(let u=0;u<r.length;u++){let g=r[u];if(g!==void 0)if(typeof g=="object"&&!Array.isArray(g)&&g!==null){let d=i.arrayFormat==="indices"?`${s}[${u}]`:s;a.push(...xo(g,d,i))}else{let d=i.arrayFormat==="indices"?`${s}[${u}]`:s,l=i.encode?encodeURIComponent(d):d;a.push(`${l}=${ga(g,i.encode)}`)}}}else if(typeof r=="object"&&r!==null){if(Object.keys(r).length===0)continue;a.push(...xo(r,s,i))}else{let u=i.encode?encodeURIComponent(s):s;a.push(`${u}=${ga(r,i.encode)}`)}}return a}function gr(p,o){return p==null||typeof p!="object"?"":xo(p,"",{...mh,...o}).join("&")}function ai(p,o){let i=gr(o,{arrayFormat:"repeat"});return i?`${p}?${i}`:p}function ya(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 he=hh();function hh(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:{type:"unknown"}}async function Sa(p){return he.type==="node"&&he.parsedVersion!=null&&he.parsedVersion>=18?new(await Promise.resolve().then(()=>(ba(),wa))).Node18UniversalStreamWrapper(p):he.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Ra(),za))).UndiciStreamWrapper(p):new(await Promise.resolve().then(()=>(_a(),fa))).NodePre18StreamWrapper(p)}async function yr(p,o){switch(o){case"binary-response":return ya(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}}:Sa(p.body);case"text":return await p.text()}let i=await p.text();if(i.length>0)try{return Nr(i)}catch{return{ok:!1,error:{reason:"non-json",statusCode:p.status,rawBody:i}}}}async function Pa(p){let o=p.headers.get("Content-Type")?.toLowerCase();if(o==null||o.length===0)return yr(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?Nr(i):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let i=await p.text();return i.length>0?Nr(i):void 0}return await p.text()}}async function si(){return he.type==="node"&&he.parsedVersion!=null&&he.parsedVersion>=18?fetch:he.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function ni({body:p,type:o}){return o==="form"?gr(p,{arrayFormat:"repeat",encode:!0}):o.includes("json")?me(p):p}var Ue;typeof globalThis.Headers<"u"?Ue=globalThis.Headers:Ue=class xa{constructor(o){if(this.headers=new Map,o)if(o instanceof xa)o.forEach((i,a)=>this.append(a,i));else if(Array.isArray(o))for(let[i,a]of o)if(typeof i=="string"&&typeof a=="string")this.append(i,a);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[i,a]of Object.entries(o))if(typeof a=="string")this.append(i,a);else throw new TypeError("Header values must be strings")}append(o,i){let a=o.toLowerCase(),n=this.headers.get(a)||[];this.headers.set(a,[...n,i])}delete(o){let i=o.toLowerCase();this.headers.delete(i)}get(o){let i=o.toLowerCase(),a=this.headers.get(i);return a?a.join(", "):null}has(o){let i=o.toLowerCase();return this.headers.has(i)}set(o,i){let a=o.toLowerCase();this.headers.set(a,[i])}forEach(o,i){let a=i?o.bind(i):o;this.headers.forEach((n,r)=>a(n.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 gh="timeout";function Ea(p){let o=new AbortController,i=setTimeout(()=>o.abort(gh),p);return{signal:o.signal,abortId:i}}function Ca(...p){let o=p.length===1&&Array.isArray(p[0])?p[0]:p,i=new AbortController;for(let a of o){if(a.aborted){i.abort(a?.reason);break}a.addEventListener("abort",()=>i.abort(a?.reason),{signal:i.signal})}return i.signal}var ci=async(p,o,i,a,n,r,s,u,g)=>{let d=[],l;if(r!=null){let{signal:R,abortId:b}=Ea(r);l=b,d.push(R)}s!=null&&d.push(s);let m=Ca(d),y=await p(o,{method:i,headers:a,body:n,signal:m,credentials:u?"include":void 0,duplex:g});return l!=null&&clearTimeout(l),y};var wr={headers:new Ue,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},br={headers:new Ue,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function Jr(p){return{headers:p.headers,redirected:p.redirected,status:p.status,statusText:p.statusText,type:p.type,url:p.url}}function yh(p){let o=1+Math.random()*.2;return p*o}function wh(p){let o=1+(Math.random()-.5)*.2;return p*o}function bh(p,o){let i=p.headers.get("Retry-After");if(i){let n=parseInt(i,10);if(!Number.isNaN(n)&&n>0)return Math.min(n*1e3,6e4);let r=new Date(i);if(!Number.isNaN(r.getTime())){let s=r.getTime()-Date.now();if(s>0)return Math.min(Math.max(s,0),6e4)}}let a=p.headers.get("X-RateLimit-Reset");if(a){let n=parseInt(a,10);if(!Number.isNaN(n)){let r=n*1e3-Date.now();if(r>0)return yh(Math.min(r,6e4))}}return wh(Math.min(1e3*2**o,6e4))}async function li(p,o=2){let i=await p();for(let a=0;a<o&&([408,429].includes(i.status)||i.status>=500);++a){let n=bh(i,a);await new Promise(r=>setTimeout(r,n)),i=await p()}return i}var zh=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 To(p){let o={};for(let[i,a]of p instanceof Ue?p.entries():Object.entries(p))zh.has(i.toLowerCase())?o[i]="[REDACTED]":o[i]=a;return o}var vo=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 Rh(p){if(p==null)return p;let o={};for(let[i,a]of Object.entries(p))vo.has(i.toLowerCase())?o[i]="[REDACTED]":o[i]=a;return o}function lr(p){let o=p.indexOf("://");if(o===-1)return p;let i=o+3,a=p.indexOf("/",i),n=p.indexOf("?",i),r=p.indexOf("#",i),s=Math.min(a===-1?p.length:a,n===-1?p.length:n,r===-1?p.length:r),u=-1;for(let b=i;b<s;b++)p[b]==="@"&&(u=b);if(u!==-1&&(p=`${p.slice(0,i)}[REDACTED]@${p.slice(u+1)}`),n=p.indexOf("?"),n===-1)return p;r=p.indexOf("#",n);let g=r!==-1?r:p.length,d=p.slice(n+1,g);if(d.length===0)return p;let l=d.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 y=[],R=d.split("&");for(let b of R){let v=b.indexOf("=");if(v===-1){y.push(b);continue}let V=b.slice(0,v),H=vo.has(V.toLowerCase());if(!H&&V.includes("%"))try{let O=decodeURIComponent(V);H=vo.has(O.toLowerCase())}catch{}y.push(H?`${V}=[REDACTED]`:b)}return p.slice(0,n+1)+y.join("&")+p.slice(g)}async function fh(p){let o=new Ue;if(o.set("Accept",p.responseType==="json"?"application/json":p.responseType==="text"?"text/plain":"*/*"),p.body!==void 0&&p.contentType!=null&&o.set("Content-Type",p.contentType),p.headers==null)return o;for(let[i,a]of Object.entries(p.headers)){let n=await ma.get(a,{endpointMetadata:p.endpointMetadata??{}});if(typeof n=="string"){o.set(i,n);continue}n!=null&&o.set(i,`${n}`)}return o}async function _h(p){let o=ai(p.url,p.queryParameters),i=await ni({body:p.body,type:p.requestType??"other"}),a=p.fetchFn??await si(),n=await fh(p),r=Po(p.logging);if(r.isDebug()){let s={method:p.method,url:lr(o),headers:To(n),queryParameters:Rh(p.queryParameters),hasBody:i!=null};r.debug("Making HTTP request",s)}try{let s=await li(async()=>ci(a,o,p.method,n,i,p.timeoutMs,p.abortSignal,p.withCredentials,p.duplex),p.maxRetries);if(s.status>=200&&s.status<400){if(r.isDebug()){let g={method:p.method,url:lr(o),statusCode:s.status,responseHeaders:To(s.headers)};r.debug("HTTP request succeeded",g)}return{ok:!0,body:await yr(s,p.responseType),headers:s.headers,rawResponse:Jr(s)}}else{if(r.isError()){let u={method:p.method,url:lr(o),statusCode:s.status,responseHeaders:To(Object.fromEntries(s.headers.entries()))};r.error("HTTP request failed with error status",u)}return{ok:!1,error:{reason:"status-code",statusCode:s.status,body:await Pa(s)},rawResponse:Jr(s)}}}catch(s){if(p.abortSignal?.aborted){if(r.isError()){let u={method:p.method,url:lr(o)};r.error("HTTP request was aborted",u)}return{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:wr}}else if(s instanceof Error&&s.name==="AbortError"){if(r.isError()){let u={method:p.method,url:lr(o),timeoutMs:p.timeoutMs};r.error("HTTP request timed out",u)}return{ok:!1,error:{reason:"timeout"},rawResponse:wr}}else if(s instanceof Error){if(r.isError()){let u={method:p.method,url:lr(o),errorMessage:s.message};r.error("HTTP request failed with error",u)}return{ok:!1,error:{reason:"unknown",errorMessage:s.message},rawResponse:br}}if(r.isError()){let u={method:p.method,url:lr(o),error:me(s)};r.error("HTTP request failed with unknown error",u)}return{ok:!1,error:{reason:"unknown",errorMessage:me(s)},rawResponse:br}}}var P=_h;var f=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}};var h={get:async p=>typeof p=="function"?p():p};var pi={};Me(pi,{ConsoleLogger:()=>Zr,LogLevel:()=>Pe,Logger:()=>hr,createLogger:()=>Po});var e={};Me(e,{JsonError:()=>zr,ParseError:()=>Rr,any:()=>Ka,bigint:()=>Ta,boolean:()=>Ga,booleanLiteral:()=>Fa,date:()=>va,discriminant:()=>Xa,enum_:()=>di,getObjectLikeUtils:()=>xe,getObjectUtils:()=>pr,getSchemaUtils:()=>I,isProperty:()=>We,lazy:()=>Oa,lazyObject:()=>Da,list:()=>hi,never:()=>La,number:()=>Wa,object:()=>mi,objectWithoutOptionalProperties:()=>qa,optional:()=>Oo,property:()=>ka,record:()=>Za,set:()=>Ja,string:()=>Na,stringLiteral:()=>Ia,transform:()=>jo,undiscriminatedUnion:()=>Ya,union:()=>rs,unknown:()=>Ha,withParsedProperties:()=>Bo});var q={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 F(p,o){return`Expected ${o}. Received ${Sh(p)}.`}function Sh(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 oe(p){return{...p,json:Ua(p.json),parse:Ua(p.parse)}}function Ua(p){return(o,i)=>{let a=p(o,i),{skipValidation:n=!1}=i??{};return!a.ok&&n?(console.warn(["Failed to validate.",...a.errors.map(r=>" - "+(r.path.length>0?`${r.path.join(".")}: ${r.message}`:r.message))].join(`
3
- `)),{ok:!0,value:o}):a}}function ui(p){return p.path.length===0?p.message:`${p.path.join(" -> ")}: ${p.message}`}var zr=class p extends Error{constructor(i){super(i.map(ui).join("; "));this.errors=i;Object.setPrototypeOf(this,p.prototype)}};var Rr=class p extends Error{constructor(i){super(i.map(ui).join("; "));this.errors=i;Object.setPrototypeOf(this,p.prototype)}};function I(p){return{nullable:()=>Ph(p),optional:()=>Oo(p),optionalNullable:()=>xh(p),transform:o=>jo(p,o),parseOrThrow:(o,i)=>{let a=p.parse(o,i);if(a.ok)return a.value;throw new Rr(a.errors)},jsonOrThrow:(o,i)=>{let a=p.json(o,i);if(a.ok)return a.value;throw new zr(a.errors)}}}function Ph(p){let o={parse:(i,a)=>i==null?{ok:!0,value:null}:p.parse(i,a),json:(i,a)=>i==null?{ok:!0,value:null}:p.json(i,a),getType:()=>q.NULLABLE};return{...o,...I(o)}}function Oo(p){let o={parse:(i,a)=>i==null?{ok:!0,value:void 0}:p.parse(i,a),json:(i,a)=>a?.omitUndefined&&i===void 0?{ok:!0,value:void 0}:i==null?{ok:!0,value:null}:p.json(i,a),getType:()=>q.OPTIONAL};return{...o,...I(o)}}function xh(p){let o={parse:(i,a)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:p.parse(i,a),json:(i,a)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:p.json(i,a),getType:()=>q.OPTIONAL_NULLABLE};return{...o,...I(o)}}function jo(p,o){let i={parse:(a,n)=>{let r=p.parse(a,n);return r.ok?{ok:!0,value:o.transform(r.value)}:r},json:(a,n)=>{let r=o.untransform(a);return p.json(r,n)},getType:()=>p.getType()};return{...i,...I(i)}}function Ta(){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:F(o,"bigint | number")}]},json:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o!="bigint"?{ok:!1,errors:[{path:i,message:F(o,"bigint")}]}:{ok:!0,value:o},getType:()=>q.BIGINT};return{...oe(p),...I(p)}}var Eh=/^([+-]?\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 va(){let p={parse:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:i,message:F(o,"string")}]}:Eh.test(o)?{ok:!0,value:new Date(o)}:{ok:!1,errors:[{path:i,message:F(o,"ISO 8601 date string")}]},json:(o,{breadcrumbsPrefix:i=[]}={})=>o instanceof Date?{ok:!0,value:o.toISOString()}:{ok:!1,errors:[{path:i,message:F(o,"Date object")}]},getType:()=>q.DATE};return{...oe(p),...I(p)}}function te(p,o){return()=>{let i={parse:o,json:o,getType:()=>p};return{...oe(i),...I(i)}}}function di(p){let o=new Set(p);return te(q.ENUM,(a,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:r=[]}={})=>typeof a!="string"?{ok:!1,errors:[{path:r,message:F(a,"string")}]}:!o.has(a)&&!n?{ok:!1,errors:[{path:r,message:F(a,"enum")}]}:{ok:!0,value:a})()}function Oa(p){let o=ko(p);return{...o,...I(o)}}function ko(p){return{parse:(o,i)=>fr(p).parse(o,i),json:(o,i)=>fr(p).json(o,i),getType:()=>fr(p).getType()}}function fr(p){let o=p;return o.__zurg_memoized==null&&(o.__zurg_memoized=p()),o.__zurg_memoized}function Qr(p){return Object.entries(p)}function Yr(p,o){let i=new Set(o);return Object.entries(p).reduce((a,[n,r])=>(i.has(n)&&(a[n]=r),a),{})}function Fe(p){if(typeof p!="object"||p===null)return!1;if(Object.getPrototypeOf(p)===null)return!0;let o=p;for(;Object.getPrototypeOf(o)!==null;)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(p)===o}function Xr(p){return Object.keys(p)}function ja(p,o){let i=[],a=[];for(let n of p)o(n)?i.push(n):a.push(n);return[i,a]}function xe(p){return{withParsedProperties:o=>Bo(p,o)}}function Bo(p,o){let i={parse:(a,n)=>{let r=p.parse(a,n);if(!r.ok)return r;let s=Object.entries(o).reduce((u,[g,d])=>({...u,[g]:typeof d=="function"?d(r.value):d}),{});return{ok:!0,value:{...r.value,...s}}},json:(a,n)=>{if(!Fe(a))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:F(a,"object")}]};let r=new Set(Object.keys(o)),s=Yr(a,Object.keys(a).filter(u=>!r.has(u)));return p.json(s,n)},getType:()=>p.getType()};return{...i,...I(i),...xe(i)}}function ka(p,o){return{rawKey:p,valueSchema:o,isProperty:!0}}function We(p){return p.isProperty}function mi(p){let o={_getRawProperties:()=>Object.entries(p).map(([i,a])=>We(a)?a.rawKey:i),_getParsedProperties:()=>Xr(p),parse:(i,a)=>{let n={},r=[];for(let[s,u]of Qr(p)){let g=We(u)?u.rawKey:s,d=We(u)?u.valueSchema:u,l={rawKey:g,parsedKey:s,valueSchema:d};n[g]=l,Va(d)&&r.push(g)}return Ba({value:i,requiredKeys:r,getProperty:s=>{let u=n[s];if(u!=null)return{transformedKey:u.parsedKey,transform:g=>u.valueSchema.parse(g,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],s]})}},unrecognizedObjectKeys:a?.unrecognizedObjectKeys,skipValidation:a?.skipValidation,breadcrumbsPrefix:a?.breadcrumbsPrefix,omitUndefined:a?.omitUndefined})},json:(i,a)=>{let n=[];for(let[r,s]of Qr(p)){let u=We(s)?s.valueSchema:s;Va(u)&&n.push(r)}return Ba({value:i,requiredKeys:n,getProperty:r=>{let s=p[r];if(s!=null)return We(s)?{transformedKey:s.rawKey,transform:u=>s.valueSchema.json(u,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]})}:{transformedKey:r,transform:u=>s.json(u,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]})}},unrecognizedObjectKeys:a?.unrecognizedObjectKeys,skipValidation:a?.skipValidation,breadcrumbsPrefix:a?.breadcrumbsPrefix,omitUndefined:a?.omitUndefined})},getType:()=>q.OBJECT};return{...oe(o),...I(o),...xe(o),...pr(o)}}function Ba({value:p,requiredKeys:o,getProperty:i,unrecognizedObjectKeys:a="fail",skipValidation:n=!1,breadcrumbsPrefix:r=[]}){if(!Fe(p))return{ok:!1,errors:[{path:r,message:F(p,"object")}]};let s=new Set(o),u=[],g={};for(let[d,l]of Object.entries(p)){let m=i(d);if(m!=null){s.delete(d);let y=m.transform(l);y.ok?g[m.transformedKey]=y.value:(g[d]=l,u.push(...y.errors))}else switch(a){case"fail":u.push({path:[...r,d],message:`Unexpected key "${d}"`});break;case"strip":break;case"passthrough":g[d]=l;break}}return u.push(...o.filter(d=>s.has(d)).map(d=>({path:r,message:`Missing required key "${d}"`}))),u.length===0||n?{ok:!0,value:g}:{ok:!1,errors:u}}function pr(p){return{extend:o=>{let i={_getParsedProperties:()=>[...p._getParsedProperties(),...o._getParsedProperties()],_getRawProperties:()=>[...p._getRawProperties(),...o._getRawProperties()],parse:(a,n)=>Aa({extensionKeys:o._getRawProperties(),value:a,transformBase:r=>p.parse(r,n),transformExtension:r=>o.parse(r,n),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(a,n)=>Aa({extensionKeys:o._getParsedProperties(),value:a,transformBase:r=>p.json(r,n),transformExtension:r=>o.json(r,n),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>q.OBJECT};return{...i,...I(i),...xe(i),...pr(i)}},passthrough:()=>{let o={_getParsedProperties:()=>p._getParsedProperties(),_getRawProperties:()=>p._getRawProperties(),parse:(i,a)=>{let n=p.parse(i,{...a,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...i,...n.value}}:n},json:(i,a)=>{let n=p.json(i,{...a,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...i,...n.value}}:n},getType:()=>q.OBJECT};return{...o,...I(o),...xe(o),...pr(o)}}}}function Aa({extensionKeys:p,value:o,transformBase:i,transformExtension:a,breadcrumbsPrefix:n=[]}){if(!Fe(o))return{ok:!1,errors:[{path:n,message:F(o,"object")}]};let r=new Set(p),[s,u]=ja(Xr(o),l=>r.has(l)),g=i(Yr(o,u)),d=a(Yr(o,s));return g.ok&&d.ok?{ok:!0,value:{...g.value,...d.value}}:{ok:!1,errors:[...g.ok?[]:g.errors,...d.ok?[]:d.errors]}}function Va(p){return!Ch(p)}function Ch(p){switch(p.getType()){case q.ANY:case q.UNKNOWN:case q.OPTIONAL:case q.OPTIONAL_NULLABLE:return!0;default:return!1}}function qa(p){return mi(p)}function Da(p){let o={...ko(p),_getRawProperties:()=>fr(p)._getRawProperties(),_getParsedProperties:()=>fr(p)._getParsedProperties()};return{...o,...I(o),...xe(o),...pr(o)}}function hi(p){let o={parse:(i,a)=>Ma(i,(n,r)=>p.parse(n,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],`[${r}]`]})),json:(i,a)=>Ma(i,(n,r)=>p.json(n,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],`[${r}]`]})),getType:()=>q.LIST};return{...oe(o),...I(o)}}function Ma(p,o){return Array.isArray(p)?p.map((a,n)=>o(a,n)).reduce((a,n)=>{if(a.ok&&n.ok)return{ok:!0,value:[...a.value,n.value]};let r=[];return a.ok||r.push(...a.errors),n.ok||r.push(...n.errors),{ok:!1,errors:r}},{ok:!0,value:[]}):{ok:!1,errors:[{message:F(p,"list"),path:[]}]}}function Fa(p){return te(q.BOOLEAN_LITERAL,(i,{breadcrumbsPrefix:a=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:a,message:F(i,`${p.toString()}`)}]})()}function Ia(p){return te(q.STRING_LITERAL,(i,{breadcrumbsPrefix:a=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:a,message:F(i,`"${p}"`)}]})()}var Ka=te(q.ANY,p=>({ok:!0,value:p}));var Ga=te(q.BOOLEAN,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="boolean"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"boolean")}]});var La=te(q.NEVER,(p,{breadcrumbsPrefix:o=[]}={})=>({ok:!1,errors:[{path:o,message:"Expected never"}]}));var Wa=te(q.NUMBER,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="number"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"number")}]});var Na=te(q.STRING,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="string"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"string")}]});var Ha=te(q.UNKNOWN,p=>({ok:!0,value:p}));function Za(p,o){let i={parse:(a,n)=>$a({value:a,isKeyNumeric:p.getType()===q.NUMBER,transformKey:r=>p.parse(r,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,s)=>o.parse(r,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(a,n)=>$a({value:a,isKeyNumeric:p.getType()===q.NUMBER,transformKey:r=>p.json(r,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,s)=>o.json(r,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>q.RECORD};return{...oe(i),...I(i)}}function $a({value:p,isKeyNumeric:o,transformKey:i,transformValue:a,breadcrumbsPrefix:n=[]}){return Fe(p)?Qr(p).reduce((r,[s,u])=>{if(u===void 0)return r;let g=r,d=s;if(o){let R=s.length>0?Number(s):NaN;Number.isNaN(R)||(d=R)}let l=i(d),m=a(u,d);if(g.ok&&l.ok&&m.ok)return{ok:!0,value:{...g.value,[l.value]:m.value}};let y=[];return g.ok||y.push(...g.errors),l.ok||y.push(...l.errors),m.ok||y.push(...m.errors),{ok:!1,errors:y}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:F(p,"object")}]}}function Ja(p){let o=hi(p),i={parse:(a,n)=>{let r=o.parse(a,n);return r.ok?{ok:!0,value:new Set(r.value)}:r},json:(a,n)=>a instanceof Set?o.json([...a],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:F(a,"Set")}]},getType:()=>q.SET};return{...oe(i),...I(i)}}function Ya(p){let o={parse:(i,a)=>Qa((n,r)=>n.parse(i,r),p,a),json:(i,a)=>Qa((n,r)=>n.json(i,r),p,a),getType:()=>q.UNDISCRIMINATED_UNION};return{...oe(o),...I(o)}}function Qa(p,o,i){let a=[];for(let[n,r]of o.entries()){let s=p(r,{...i,skipValidation:!1});if(s.ok)return s;for(let u of s.errors)a.push({path:u.path,message:`[Variant ${n}] ${u.message}`})}return{ok:!1,errors:a}}function Xa(p,o){return{parsedDiscriminant:p,rawDiscriminant:o}}function rs(p,o){let i=typeof p=="string"?p:p.rawDiscriminant,a=typeof p=="string"?p:p.parsedDiscriminant,n=di(Xr(o)),r={parse:(s,u)=>es({value:s,discriminant:i,transformedDiscriminant:a,transformDiscriminantValue:g=>n.parse(g,{allowUnrecognizedEnumValues:u?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...u?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:g=>o[g],allowUnrecognizedUnionMembers:u?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,d)=>d.parse(g,u),breadcrumbsPrefix:u?.breadcrumbsPrefix}),json:(s,u)=>es({value:s,discriminant:a,transformedDiscriminant:i,transformDiscriminantValue:g=>n.json(g,{allowUnrecognizedEnumValues:u?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...u?.breadcrumbsPrefix??[],a]}),getAdditionalPropertiesSchema:g=>o[g],allowUnrecognizedUnionMembers:u?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(g,d)=>d.json(g,u),breadcrumbsPrefix:u?.breadcrumbsPrefix}),getType:()=>q.UNION};return{...oe(r),...I(r),...xe(r)}}function es({value:p,discriminant:o,transformedDiscriminant:i,transformDiscriminantValue:a,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:r=!1,transformAdditionalProperties:s,breadcrumbsPrefix:u=[]}){if(!Fe(p))return{ok:!1,errors:[{path:u,message:F(p,"object")}]};let{[o]:g,...d}=p;if(g==null)return{ok:!1,errors:[{path:u,message:`Missing discriminant ("${o}")`}]};let l=a(g);if(!l.ok)return{ok:!1,errors:l.errors};let m=n(l.value);if(m==null)return r?{ok:!0,value:{[i]:l.value,...d}}:{ok:!1,errors:[{path:[...u,o],message:"Unexpected discriminant value"}]};let y=s(d,m);return y.ok?{ok:!0,value:{[i]:g,...y.value}}:y}var w={};Me(w,{encodePathParam:()=>is,join:()=>ts,toQueryString:()=>gr});function is(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 ts(p,...o){if(!p)return"";if(o.length===0)return p;if(p.includes("://")){let i;try{i=new URL(p)}catch{return os(p,...o)}let n=o[o.length-1]?.endsWith("/");for(let r of o){let s=ss(r);s&&(i.pathname=as(i.pathname,s))}return n&&!i.pathname.endsWith("/")&&(i.pathname+="/"),i.toString()}return os(p,...o)}function os(p,...o){if(o.length===0)return p;let i=p,n=o[o.length-1]?.endsWith("/");for(let r of o){let s=ss(r);s&&(i=as(i,s))}return n&&!i.endsWith("/")&&(i+="/"),i}function as(p,o){return p.endsWith("/")?p+o:`${p}/${o}`}function ss(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 gi=class{constructor(o){this.headerValue=o.apiKey}static canCreate(o){return o.apiKey!=null}async getAuthRequest(o){let i=await h.get(this.headerValue);if(i==null)throw new z({message:"Please specify a apiKey by passing it in to the constructor"});return{headers:{"X-Schematic-Api-Key":i}}}};function _(...p){let o={};for(let[i,a]of p.filter(n=>n!=null).flatMap(n=>Object.entries(n))){let n=i.toLowerCase();a!=null?o[n]=a:n in o&&delete o[n]}return o}function Uh(p){let o=_({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.3.0","User-Agent":"@schematichq/schematic-typescript-node/1.3.0","X-Fern-Runtime":he.type,"X-Fern-Runtime-Version":he.version},p?.headers);return{...p,logging:pi.createLogger(p?.logging),headers:o}}function K(p){let o=Uh(p),i=Th(o);return o.authProvider??=new gi(i),o}function Th(p){return{...p,authProvider:new $r}}var S={Default:"https://api.schematichq.com"};function T(p,o,i,a){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 cr(`Timeout exceeded when calling ${i} ${a}.`);case"unknown":throw new z({message:p.errorMessage,rawResponse:o});default:throw new z({message:"Unknown error",rawResponse:o})}}var Ao=e.object({lookup:e.record(e.string(),e.string())});var ns=e.stringLiteral("company");var cs=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",ns),token:e.string(),updatedAt:e.property("updated_at",e.date())});var ls=e.object({data:cs,params:e.record(e.string(),e.unknown())});var Vo=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var Ne=e.enum_(["development","production","staging"]);var qo=e.object({environmentType:e.property("environment_type",Ne),name:e.string()});var Do=e.object({description:e.string().optional(),name:e.string().optional()});var Mo=e.object({environmentType:e.property("environment_type",Ne.optional()),name:e.string().optional()});var ps=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 A=e.object({count:e.number().optional()});var us=e.object({data:A,params:ps});var ds=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var ms=e.object({data:A,params:ds});var yi=e.enum_(["admin","capture","read","write"]);var hs=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(),scopes:e.list(yi),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var gs=e.object({data:hs,params:e.record(e.string(),e.unknown())});var be=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(),scopes:e.list(yi),updatedAt:e.property("updated_at",e.date())});var ys=e.object({apiKeys:e.property("api_keys",e.list(be)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ne),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var ws=e.object({data:ys,params:e.record(e.string(),e.unknown())});var D=e.object({deleted:e.boolean().optional()});var bs=e.object({data:D,params:e.record(e.string(),e.unknown())});var zs=e.object({data:D,params:e.record(e.string(),e.unknown())});var Rs=e.object({data:be,params:e.record(e.string(),e.unknown())});var fs=e.object({apiKey:e.property("api_key",be.optional()),apiKeyId:e.property("api_key_id",e.string()),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()),requestType:e.property("request_type",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(),userAgent:e.property("user_agent",e.string().optional()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var _s=e.object({data:fs,params:e.record(e.string(),e.unknown())});var _r=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ne),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Ss=e.object({data:_r,params:e.record(e.string(),e.unknown())});var Ps=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 xs=e.object({data:e.list(be),params:Ps});var Es=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var wi=e.object({apiKeyId:e.property("api_key_id",e.string()),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()),requestType:e.property("request_type",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()),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 Cs=e.object({data:e.list(wi),params:Es});var Us=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Ts=e.object({data:e.list(_r),params:Us});var vs=e.object({ok:e.boolean()});var Os=e.object({data:vs,params:e.record(e.string(),e.unknown())});var js=e.object({data:be,params:e.record(e.string(),e.unknown())});var ks=e.object({data:_r,params:e.record(e.string(),e.unknown())});var B=e.enum_(["schematic","stripe"]);var Fo=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()),failedToImport:e.property("failed_to_import",e.boolean()),meta:e.record(e.string(),e.string()),name:e.string(),providerType:e.property("provider_type",B.optional())});var Te=e.enum_(["per_unit","tiered"]);var $=e.enum_(["licensed","metered"]);var ne=e.enum_(["graduated","volume"]);var Bs=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",B.optional()),upTo:e.property("up_to",e.number().optional())});var Io=e.object({billingScheme:e.property("billing_scheme",Te),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(Bs)),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",B.optional()),tiersMode:e.property("tiers_mode",ne.optional()),usageType:e.property("usage_type",$)});var Ko=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),price:e.number(),providerType:e.property("provider_type",B.optional())});var As=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",$)});var Vs=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 He=e.enum_(["cancel","subscribe"]);var Go=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(Vs),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(As)),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",He.optional())});var Lo=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 Wo=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()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var No=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 Ho=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 qs=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",$.optional()),providerType:e.property("provider_type",B.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 Ds=e.object({data:A,params:qs});var Ms=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",B.optional()),q:e.string().optional()});var Fs=e.object({data:A,params:Ms});var Is=e.object({data:D,params:e.record(e.string(),e.unknown())});var Ks=e.object({data:D,params:e.record(e.string(),e.unknown())});var Gs=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",B.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",ne.optional()),usageType:e.property("usage_type",$.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Sr=e.enum_(["day","month","one-time","year"]);var bi=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 Z=e.object({billingScheme:e.property("billing_scheme",Te),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Sr,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(bi)),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",B),tiersMode:e.property("tiers_mode",ne.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",$)});var Ls=e.object({data:e.list(Z),params:Gs});var Ws=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",B.optional()),q:e.string().optional(),tiersMode:e.property("tiers_mode",ne.optional()),usageType:e.property("usage_type",$.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Ns=e.object({data:e.list(Z),params:Ws});var Hs=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",$.optional()),providerType:e.property("provider_type",B.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 J=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:Sr,price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),providerType:e.property("provider_type",B),scheme:Te});var $e=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(J),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",B),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var $s=e.object({data:e.list($e),params:Hs});var Zs=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var zi=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",B),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var Js=e.object({data:e.list(zi),params:Zs});var Qs=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",B.optional()),q:e.string().optional()});var Ys=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 Xs=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()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),providerType:e.property("provider_type",B),subscriptions:e.list(Ys),updatedAt:e.property("updated_at",e.date())});var en=e.object({data:e.list(Xs),params:Qs});var rn=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 Ee=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",B),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var on=e.object({data:e.list(Ee),params:rn});var tn=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Ri=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",B)});var an=e.object({data:e.list(Ri),params:tn});var sn=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 ge=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",B),updatedAt:e.property("updated_at",e.date())});var nn=e.object({data:e.list(ge),params:sn});var cn=e.object({data:zi,params:e.record(e.string(),e.unknown())});var ln=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()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),providerType:e.property("provider_type",B),updatedAt:e.property("updated_at",e.date())});var pn=e.object({data:ln,params:e.record(e.string(),e.unknown())});var un=e.object({data:Ri,params:e.record(e.string(),e.unknown())});var dn=e.object({data:J,params:e.record(e.string(),e.unknown())});var Pr=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",B),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var mn=e.object({data:Pr,params:e.record(e.string(),e.unknown())});var hn=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",B),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",He.optional())});var gn=e.object({data:hn,params:e.record(e.string(),e.unknown())});var yn=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var wn=e.object({data:ge,params:e.record(e.string(),e.unknown())});var $o=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var Zo=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var Jo=e.object({trialEnd:e.property("trial_end",e.date().optional())});var fi=e.object({billingScheme:e.property("billing_scheme",Te),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(bi)),providerType:e.property("provider_type",B),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",$)});var _i=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 Ze=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(_i),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",Ee.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",ge.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(fi),providerType:e.property("provider_type",B),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",He.optional())});var Si=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 N=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 Je=e.enum_(["daily","monthly","weekly","yearly"]);var ve=e.enum_(["billing_period","first_of_month"]);var Qe=e.enum_(["no_reset","plan_period"]);var Pi=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",N.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()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),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",N.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",Je),resetStart:e.property("reset_start",ve),resetType:e.property("reset_type",Qe),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var xr=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(Pi)),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional())});var W=e.enum_(["company","user"]);var xi=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",W),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var Er=e.object({createdAt:e.property("created_at",e.date()),definition:xi.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",W),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Y=e.enum_(["boolean","currency","date","number","string","url"]);var re=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",W),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",Y),updatedAt:e.property("updated_at",e.date())});var Cr=e.object({createdAt:e.property("created_at",e.date()),definition:re.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 Ei=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var bn=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var zn=e.enum_(["all_time","current_day","current_month","current_week"]);var Rn=e.enum_(["first_of_month","billing_cycle"]);var fn=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var _n=e.enum_(["bool","date","int","string"]);var Qo=e.object({comparableType:e.property("comparable_type",_n),entityType:e.property("entity_type",W),id:e.string()});var Ci=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",Qo.optional()),conditionType:e.property("condition_type",bn),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",zn.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Rn.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:fn,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",Qo.optional()),traitValue:e.property("trait_value",e.string())});var Sn=e.object({conditions:e.list(Ci)});var Pn=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Ui=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(Sn)),conditions:e.list(Ci),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",Pn),value:e.boolean()});var L=e.object({addOns:e.property("add_ons",e.list(xr)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Ze.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Ze)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ge.optional()),entityTraits:e.property("entity_traits",e.list(Cr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Er),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Si),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ge)),plan:xr.optional(),plans:e.list(Ei),rules:e.list(Ui),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Ti=e.object({company:L.optional(),success:e.boolean()});var xn=e.object({data:Ti,params:e.record(e.string(),e.unknown())});var En=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",B),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",He.optional())});var Cn=e.object({data:En,params:e.record(e.string(),e.unknown())});var ue=e.enum_(["active","inactive"]);var ye=e.stringLiteral("fixed");var ze=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",ye),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",N),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:J.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ue,unitPrice:e.property("unit_price",J.optional()),updatedAt:e.property("updated_at",e.date())});var Ur=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(_i),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",Ee.optional()),paymentMethod:e.property("payment_method",ge.optional()),products:e.list(fi),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 Un=e.object({bundle:ze.optional(),quantity:e.number(),total:e.number()});var Re=e.enum_(["billing_credit_auto_topup","free","plan","purchased"]);var Tn=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 X=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var Ye=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var ie=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",ie),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",Ye.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 fe=e.object({company:L.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",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),notes:e.list(Tn),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",re.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",X)});var Xe=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 vr=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 _e=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var Or=e.enum_(["company_override","plan_entitlement","unknown"]);var vi=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 er=e.stringLiteral("boolean");var vn=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Oi=e.object({comparisonTrait:e.property("comparison_trait",re.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(vn),ruleId:e.property("rule_id",e.string()),trait:re.optional(),traitEntityType:e.property("trait_entity_type",W.optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var On=e.object({conditions:e.list(Oi),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 ji=e.object({conditionGroups:e.property("condition_groups",e.list(On)),conditions:e.list(Oi),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 Oe=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",er),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(ji),updatedAt:e.property("updated_at",e.date())});var jr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var ee=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",vi.optional()),featureType:e.property("feature_type",ie),flags:e.list(Oe),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",Ye.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(jr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:re.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var kr=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var Br=e.enum_(["expire","none","rollover"]);var je=e.object({burnStrategy:e.property("burn_strategy",kr),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",G),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Br),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:J.optional(),product:Pr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ce=e.enum_(["plan","add_on"]);var rr=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",ce),updatedAt:e.property("updated_at",e.date())});var ae=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:Tr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",Z.optional()),meteredYearlyPrice:e.property("metered_yearly_price",Z.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:rr.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",_e.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",Pr.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",je.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",re.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",X)});var ir=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",X),companyOverride:e.property("company_override",fe.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(Xe).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",vr.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:ee.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",Z.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:rr.optional(),planEntitlement:e.property("plan_entitlement",ae.optional()),priceBehavior:e.property("price_behavior",_e.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Z.optional())});var Ar=e.object({features:e.list(ir)});var ke=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",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.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()),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",N.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),resetCadence:e.property("reset_cadence",Je),resetStart:e.property("reset_start",ve),resetType:e.property("reset_type",Qe.optional()),updatedAt:e.property("updated_at",e.date())});var Be=e.enum_(["free","one_time","recurring"]);var or=e.enum_(["schematic","stripe"]);var de=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",$e.optional()),chargeType:e.property("charge_type",Be),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",or),createdAt:e.property("created_at",e.date()),description:e.string(),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(ke).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",J.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",J.optional()),planType:e.property("plan_type",ce),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",J.optional())});var ei=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",Z.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",Z.optional()),priceBehavior:e.property("price_behavior",_e.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",X),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Z.optional())});var jn=e.object({activeAddOns:e.property("active_add_ons",e.list(de)),activePlan:e.property("active_plan",de.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(ei)),availableCreditBundles:e.property("available_credit_bundles",e.list(ze)),company:L.optional(),featureUsage:e.property("feature_usage",Ar.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Un)),selectedPlan:e.property("selected_plan",de.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(ei)),subscription:Ur.optional()});var kn=e.object({data:jn,params:e.record(e.string(),e.unknown())});var Bn=e.object({data:Ti,params:e.record(e.string(),e.unknown())});var An=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Vn=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(An))});var ki=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Vn.optional(),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(),trialEnd:e.property("trial_end",e.date().optional()),usageViolations:e.property("usage_violations",e.list(ir))});var qn=e.object({data:ki,params:e.record(e.string(),e.unknown())});var Dn=e.object({subscriptionChangePreview:e.property("subscription_change_preview",ki.optional())});var Mn=e.object({data:Dn,params:e.record(e.string(),e.unknown())});var Fn=e.object({data:Ze,params:e.record(e.string(),e.unknown())});var Yo=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",W),hierarchy:e.list(e.string()),traitType:e.property("trait_type",Y)});var Xo=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var et=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var rt=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",Y)});var In=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var it=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(In)});var ot=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var Ce=e.enum_(["asc","desc"]);var Ie=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var Ke=e.enum_(["free","one_time","paid","trial"]);var Kn=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_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(),planIds:e.property("plan_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",Ce.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Ie).optional()),subscriptionTypes:e.property("subscription_types",e.list(Ke).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Gn=e.object({data:A,params:Kn});var Ln=e.object({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(),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())});var Wn=e.object({data:A,params:Ln});var Nn=e.object({entityType:e.property("entity_type",W.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Hn=e.object({data:A,params:Nn});var $n=e.object({entityType:e.property("entity_type",W.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Y.optional()),traitTypes:e.property("trait_types",e.list(Y).optional())});var Zn=e.object({data:A,params:$n});var Jn=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 Qn=e.object({data:A,params:Jn});var Yn=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 Xn=e.object({data:A,params:Yn});var ec=e.object({data:L,params:e.record(e.string(),e.unknown())});var Ae=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 rc=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var Vr=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 qr=e.object({company:Vr.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 Se=e.object({companyMemberships:e.property("company_memberships",e.list(qr)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(Cr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Er),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 ic=e.object({data:Se,params:e.record(e.string(),e.unknown())});var oc=e.object({data:Vr,params:e.record(e.string(),e.unknown())});var tc=e.object({data:D,params:e.record(e.string(),e.unknown())});var ac=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var sc=e.object({data:D,params:ac});var nc=e.object({data:D,params:e.record(e.string(),e.unknown())});var Bi=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 cc=e.object({data:Bi,params:e.record(e.string(),e.unknown())});var lc=e.object({data:D,params:e.record(e.string(),e.unknown())});var pc=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 uc=e.object({data:e.list(Ur),params:pc});var dc=e.object({data:L,params:e.record(e.string(),e.unknown())});var mc=e.object({data:re,params:e.record(e.string(),e.unknown())});var hc=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var gc=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var yc=e.object({data:e.list(gc),params:hc});var wc=e.object({data:qr,params:e.record(e.string(),e.unknown())});var bc=e.object({data:re,params:e.record(e.string(),e.unknown())});var zc=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","plan_trait_change","quickstart","subscription_change"]);var Rc=e.enum_(["api_key","app_user","system","temporary_access_token"]);var fc=e.enum_(["fallback","initial","trait","trial_expiry"]);var _c=e.enum_(["downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var ri=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Sc=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",Y),value:e.string()});var Ai=e.object({action:zc,actorType:e.property("actor_type",Rc),addOnsAdded:e.property("add_ons_added",e.list(ri)),addOnsRemoved:e.property("add_ons_removed",e.list(ri)),apiKey:e.property("api_key",be.optional()),apiKeyRequest:e.property("api_key_request",wi.optional()),basePlan:e.property("base_plan",ri.optional()),basePlanAction:e.property("base_plan_action",fc.optional()),company:Vr.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",ri.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",_c.optional()),traitsUpdated:e.property("traits_updated",e.list(Sc)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Pc=e.object({data:Ai,params:e.record(e.string(),e.unknown())});var xc=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var Ec=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Cc=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_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(),planIds:e.property("plan_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",Ce.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Ie).optional()),subscriptionTypes:e.property("subscription_types",e.list(Ke).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Uc=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(Xe)),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())});var Tc=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Uc.optional()),entitlementSource:e.property("entitlement_source",e.string()),entitlementValueType:e.property("entitlement_value_type",e.string()),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string()),featureType:e.property("feature_type",ie),hardLimit:e.property("hard_limit",e.string()),hasAccess:e.property("has_access",e.boolean()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",Z.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.string()),usage:e.string(),valueNumeric:e.property("value_numeric",e.number().optional()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Z.optional())});var vc=e.object({addOns:e.property("add_ons",e.list(xr)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Ze.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Ze)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ge.optional()),entityTraits:e.property("entity_traits",e.list(Cr)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Tc)),id:e.string(),keys:e.list(Er),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Si),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ge)),plan:xr.optional(),plans:e.list(Ei),rules:e.list(Ui),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Oc=e.object({data:e.list(vc),params:Cc});var jc=e.object({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(),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())});var kc=e.object({data:e.list(L),params:jc});var Bc=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 Ac=e.object({data:e.list(qr),params:Bc});var Vc=e.object({entityType:e.property("entity_type",W.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var qc=e.object({data:e.list(xi),params:Vc});var Dc=e.object({entityType:e.property("entity_type",W.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Y.optional()),traitTypes:e.property("trait_types",e.list(Y).optional())});var Mc=e.object({data:e.list(re),params:Dc});var Fc=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 Ic=e.object({data:e.list(Ai),params:Fc});var Kc=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 Gc=e.object({data:e.list(Ae),params:Kc});var Lc=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 Wc=e.object({data:e.list(Se),params:Lc});var Nc=e.object({keys:e.record(e.string(),e.string()).optional()});var Hc=e.object({data:L,params:Nc});var $c=e.object({keys:e.record(e.string(),e.string()).optional()});var Zc=e.object({data:Se,params:$c});var Jc=e.object({data:re,params:e.record(e.string(),e.unknown())});var Qc=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var Yc=e.object({data:e.list(Ae),params:e.record(e.string(),e.unknown())});var Xc=e.object({data:L,params:e.record(e.string(),e.unknown())});var el=e.object({data:L,params:e.record(e.string(),e.unknown())});var rl=e.object({data:Se,params:e.record(e.string(),e.unknown())});var il=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Dr=e.enum_(["billing","entitlement"]);var tt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Dr),name:e.string()});var Vi=e.enum_(["draft","live"]);var at=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Dr.optional()),name:e.string().optional(),state:Vi.optional()});var ol=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var tl=e.object({data:A,params:ol});var Ve=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:Vi,type:Dr,updatedAt:e.property("updated_at",e.date())});var al=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var sl=e.object({data:D,params:e.record(e.string(),e.unknown())});var nl=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var cl=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ll=e.object({data:e.list(Ve),params:cl});var pl=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var ii=e.object({billingScheme:e.property("billing_scheme",Te),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Sr,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",B),tiersMode:e.property("tiers_mode",ne.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",$)});var ul=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",ye),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",N),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:ii.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ue,unitPrice:e.property("unit_price",ii.optional()),updatedAt:e.property("updated_at",e.date())});var dl=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var Mr=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 st=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",$e.optional()),chargeType:e.property("charge_type",Be),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",or),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",Mr.optional()),description:e.string(),entitlements:e.list(ae),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Pi)),invalidReason:e.property("invalid_reason",dl.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",J.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",J.optional()),planType:e.property("plan_type",ce),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(ir)),valid:e.boolean(),yearlyPrice:e.property("yearly_price",J.optional())});var Fr=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var ml=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var hl=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 gl=e.object({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 Ir=e.enum_(["expired","manual","plan_change","plan_period_reset"]);var yl=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 wl=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",N.optional()),expiryUnit:e.property("expiry_unit",G.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:ii.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(yl).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",Ir.optional())});var bl=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 zl=e.object({activeAddOns:e.property("active_add_ons",e.list(st)),activePlans:e.property("active_plans",e.list(st)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(ei)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fr)),capabilities:ml.optional(),checkoutSettings:e.property("checkout_settings",hl),company:L.optional(),component:Ve.optional(),creditBundles:e.property("credit_bundles",e.list(ul)),creditGrants:e.property("credit_grants",e.list(wl)),defaultPlan:e.property("default_plan",de.optional()),displaySettings:e.property("display_settings",gl),featureUsage:e.property("feature_usage",Ar.optional()),invoices:e.list(Ee),postTrialPlan:e.property("post_trial_plan",de.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()),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",bl.optional()),subscription:Ur.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Ee.optional())});var Rl=e.object({data:zl,params:pl});var fl=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var nt=e.object({burnStrategy:e.property("burn_strategy",kr.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",G.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Br.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 qi=e.stringLiteral("credit");var ct=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",qi.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.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",N.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",Je),resetStart:e.property("reset_start",ve),resetType:e.property("reset_type",Qe.optional())});var lt=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",N.optional()),expiryUnit:e.property("expiry_unit",G.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",ve.optional())});var pt=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",ye.optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",N.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:ue.optional()});var ut=e.object({burnStrategy:e.property("burn_strategy",kr.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",Br.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 dt=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",qi.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",G.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",N.optional()),expiryUnit:e.property("expiry_unit",G.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Je),resetStart:e.property("reset_start",ve),resetType:e.property("reset_type",Qe.optional())});var mt=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",N.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:ue.optional()});var ht=e.object({reason:Ir.optional()});var _l=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 Sl=e.object({data:A,params:_l});var Pl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var xl=e.object({data:A,params:Pl});var El=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())});var Cl=e.object({data:A,params:El});var Ul=e.object({bundleType:e.property("bundle_type",ye.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ue.optional()});var Tl=e.object({data:A,params:Ul});var ur=e.enum_(["daily","monthly","raw","weekly"]);var vl=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:ur.optional(),startTime:e.property("start_time",e.string().optional())});var Ol=e.object({data:A,params:vl});var jl=e.object({data:je,params:e.record(e.string(),e.unknown())});var kl=e.object({data:ke,params:e.record(e.string(),e.unknown())});var Bl=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Al=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Vl=e.object({data:D,params:Al});var ql=e.object({data:D,params:e.record(e.string(),e.unknown())});var Dl=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Ml=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:ur.optional(),startTime:e.property("start_time",e.string().optional())});var Fl=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 Il=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var Kl=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var Gl=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:Il.optional(),companyId:e.property("company_id",e.string()),credit:Fl.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:Kl.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 Ll=e.object({data:e.list(Gl),params:Ml});var Wl=e.object({data:je,params:e.record(e.string(),e.unknown())});var Nl=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 tr=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:J.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(Nl).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",Ir.optional())});var Hl=e.object({data:tr,params:e.record(e.string(),e.unknown())});var $l=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Zl=e.object({data:e.list(je),params:$l});var Jl=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())});var Ql=e.object({data:e.list(ke),params:Jl});var Di=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Yl=e.object({companyId:e.property("company_id",e.string().optional()),dir:Ce.optional(),limit:e.number().optional(),offset:e.number().optional(),order:Di.optional()});var Xl=e.object({data:e.list(tr),params:Yl});var ep=e.object({bundleType:e.property("bundle_type",ye.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ue.optional()});var rp=e.object({data:e.list(ze),params:ep});var ip=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 op=e.object({data:e.list(tr),params:ip});var tp=e.object({data:D,params:e.record(e.string(),e.unknown())});var ap=e.object({data:je,params:e.record(e.string(),e.unknown())});var sp=e.object({data:ke,params:e.record(e.string(),e.unknown())});var np=e.object({data:ze,params:e.record(e.string(),e.unknown())});var cp=e.object({data:tr,params:e.record(e.string(),e.unknown())});var gt=e.object({metadata:e.string()});var lp=e.stringLiteral("csv");var pp=e.enum_(["failure","pending","success"]);var up=e.stringLiteral("company-feature-usage");var dp=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",up),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",lp),status:pp,updatedAt:e.property("updated_at",e.date())});var mp=e.object({data:dp,params:e.record(e.string(),e.unknown())});var hp=e.enum_(["all_time","current_month","current_week","current_day"]);var gp=e.enum_(["first_of_month","billing_cycle"]);var yt=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",hp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",gp.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",X)});var ar=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 yp=e.enum_(["all_time","current_month","current_week","current_day"]);var wp=e.enum_(["first_of_month","billing_cycle"]);var wt=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",yp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",wp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ar).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()),priceBehavior:e.property("price_behavior",_e.optional()),priceTiers:e.property("price_tiers",e.list(ar).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ne.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",X),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ar).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var bt=e.object({sourcePlanId:e.property("source_plan_id",e.string()),targetPlanId:e.property("target_plan_id",e.string())});var bp=e.enum_(["all_time","current_month","current_week","current_day"]);var zp=e.enum_(["first_of_month","billing_cycle"]);var zt=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",bp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",zp.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",X)});var Rp=e.enum_(["all_time","current_month","current_week","current_day"]);var fp=e.enum_(["first_of_month","billing_cycle"]);var Rt=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",Rp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",fp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ar).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",_e.optional()),priceTiers:e.property("price_tiers",e.list(ar).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ne.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",X),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ar).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var _p=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 Sp=e.object({data:A,params:_p});var Pp=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var xp=e.object({data:A,params:Pp});var Ep=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 Cp=e.object({data:A,params:Ep});var Up=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Tp=e.object({data:A,params:Up});var vp=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()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var Op=e.object({data:A,params:vp});var jp=e.object({data:fe,params:e.record(e.string(),e.unknown())});var kp=e.object({data:ae,params:e.record(e.string(),e.unknown())});var Bp=e.object({data:D,params:e.record(e.string(),e.unknown())});var Ap=e.object({data:D,params:e.record(e.string(),e.unknown())});var Vp=e.object({message:e.string()});var qp=e.object({entitlementId:e.property("entitlement_id",e.string()),errors:e.list(Vp),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string())});var Dp=e.object({data:e.list(ae),skipped:e.list(qp)});var Mp=e.object({data:Dp,params:e.record(e.string(),e.unknown())});var Fp=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Ip=e.object({keys:e.record(e.string(),e.string()).optional()});var Kp=e.object({data:Ar,params:Ip});var Gp=e.object({data:ae,params:e.record(e.string(),e.unknown())});var Lp=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 Wp=e.object({data:e.list(fe),params:Lp});var Np=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Hp=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(Xe).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",vr.optional())});var $p=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",X),company:L.optional(),companyOverride:e.property("company_override",fe.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(Xe).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",Hp.optional()),creditUsageAggregation:e.property("credit_usage_aggregation",vr.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:ee.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",Z.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:rr.optional(),planEntitlement:e.property("plan_entitlement",ae.optional()),priceBehavior:e.property("price_behavior",_e.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Z.optional())});var Zp=e.object({data:e.list($p),params:Np});var Jp=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 Qp=e.object({data:e.list(ir),params:Jp});var Yp=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Xp=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",X),company:L.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",Or),feature:ee.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:rr.optional(),usage:e.number().optional(),user:Bi.optional()});var eu=e.object({data:e.list(Xp),params:Yp});var ru=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()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var iu=e.object({data:e.list(ae),params:ru});var ou=e.object({data:fe,params:e.record(e.string(),e.unknown())});var tu=e.object({data:ae,params:e.record(e.string(),e.unknown())});var au=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 su=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var nu=e.object({company:su.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var cu=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 lu=e.undiscriminatedUnion([cu,au,nu]);var Ge=e.enum_(["flag_check","identify","track"]);var Mi=e.object({body:lu.optional(),eventType:e.property("event_type",Ge),sentAt:e.property("sent_at",e.date().optional())});var ft=e.object({events:e.list(Mi)});var Fi=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var pu=e.object({events:e.list(Fi)});var uu=e.object({data:pu,params:e.record(e.string(),e.unknown())});var du=e.object({data:Fi,params:e.record(e.string(),e.unknown())});var mu=e.enum_(["enriched","failed","pending","processed","unknown"]);var Ii=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:jr.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(jr),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:mu,subtype:e.string().optional(),type:Ge,updatedAt:e.property("updated_at",e.date()),user:jr.optional(),userId:e.property("user_id",e.string().optional())});var hu=e.object({data:Ii,params:e.record(e.string(),e.unknown())});var gu=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 yu=e.object({data:e.list(vi),params:gu});var wu=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var bu=e.object({data:wu,params:e.record(e.string(),e.unknown())});var zu=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(Ge).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 Ru=e.object({data:e.list(Ii),params:zu});var oi=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var _t=e.object({contexts:e.list(oi)});var Ki=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",er),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var St=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ie),flag:Ki.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ye.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 Pt=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ie.optional()),flag:Ki.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ye.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 fu=e.enum_(["company","metric","trait","user","plan","billing_product","base_plan"]);var _u=e.enum_(["all_time","current_month","current_week","current_day"]);var Su=e.enum_(["first_of_month","billing_cycle"]);var Pu=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var Gi=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",fu),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",_u.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Su.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Pu,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 xu=e.object({conditions:e.list(Gi),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Eu=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var Cu=e.object({conditionGroups:e.property("condition_groups",e.list(xu)),conditions:e.list(Gi),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Eu.optional()),value:e.boolean()});var xt=e.object({rules:e.list(Cu)});var Li=e.object({companyId:e.property("company_id",e.string().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 Uu=e.object({data:Li,params:e.record(e.string(),e.unknown())});var Wi=e.object({flags:e.list(Li)});var Tu=e.object({data:e.list(Wi)});var vu=e.object({data:Tu,params:e.record(e.string(),e.unknown())});var Ou=e.object({data:Wi,params:e.record(e.string(),e.unknown())});var ju=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(ie).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().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 ku=e.object({data:A,params:ju});var Bu=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 Au=e.object({data:A,params:Bu});var Vu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var qu=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var Du=e.object({data:D,params:e.record(e.string(),e.unknown())});var Mu=e.object({data:D,params:e.record(e.string(),e.unknown())});var Fu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Iu=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var Ku=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(ie).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().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 Gu=e.object({data:e.list(ee),params:Ku});var Lu=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 Wu=e.object({data:e.list(Oe),params:Lu});var Nu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Hu=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var $u=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",er),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 Zu=e.object({flag:$u.optional(),rules:e.list(ji)});var Ju=e.object({data:Zu,params:e.record(e.string(),e.unknown())});var Qu=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var Le=e.object({entitlements:e.list(Qu).optional(),planId:e.property("plan_id",e.string())});var Kr=e.object({bundleId:e.string()});var Ni=e.enum_(["create_prorations","invoice_immediately"]);var Et=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fr).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",Mr.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(Le)),orderedBundleList:e.property("ordered_bundle_list",e.list(Kr)),orderedPlans:e.property("ordered_plans",e.list(Le)),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",Ni),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()),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 Ct=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fr).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",Mr.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(Le)),orderedBundleList:e.property("ordered_bundle_list",e.list(Kr)),orderedPlans:e.property("ordered_plans",e.list(Le)),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",Ni),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()),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 Hi=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var Yu=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var $i=e.object({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 Zi=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Yu)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",Hi),componentSettings:e.property("component_settings",$i),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(Le)),planIds:e.property("plan_ids",e.list(Le)),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()),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 Xu=e.object({data:Zi,params:e.record(e.string(),e.unknown())});var Ji=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 dr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",$e.optional()),chargeType:e.property("charge_type",Be),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",or),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",Ji.optional()),description:e.string(),entitlements:e.list(ae),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(ke).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",J.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",J.optional()),planType:e.property("plan_type",ce),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",J.optional())});var ed=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Ut=e.object({entitlements:e.list(ed).optional(),planId:e.property("plan_id",e.string())});var rd=e.object({addOns:e.property("add_ons",e.list(dr)),checkoutSettings:e.property("checkout_settings",Hi),componentSettings:e.property("component_settings",$i),customPlanConfig:e.property("custom_plan_config",Ji.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",dr.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",dr.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",dr.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",Z.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Ut)),orderedBundleList:e.property("ordered_bundle_list",e.list(Kr)),orderedPlanList:e.property("ordered_plan_list",e.list(Ut)),plans:e.list(dr),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()),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",dr.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",Z.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var id=e.object({data:rd,params:e.record(e.string(),e.unknown())});var od=e.object({data:Zi,params:e.record(e.string(),e.unknown())});var Tt=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",ce)});var vt=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Ot=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var jt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",Be),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 td=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(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",ce.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 ad=e.object({data:A,params:td});var sd=e.object({data:de,params:e.record(e.string(),e.unknown())});var nd=e.object({data:D,params:e.record(e.string(),e.unknown())});var cd=e.object({data:de,params:e.record(e.string(),e.unknown())});var ld=e.object({planId:e.property("plan_id",e.string().optional())});var pd=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var ud=e.object({data:e.list(pd),params:ld});var dd=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(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",ce.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 md=e.object({data:e.list(de),params:dd});var hd=e.object({data:L,params:e.record(e.string(),e.unknown())});var gd=e.object({data:de,params:e.record(e.string(),e.unknown())});var yd=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",Be),controlledBy:e.property("controlled_by",or),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 wd=e.object({data:yd,params:e.record(e.string(),e.unknown())});var Gr=e.object({creditId:e.property("credit_id",e.string())});var Lr=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.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","rule.deleted","test.send","user.created","user.deleted","user.updated"]);var kt=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Gr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Lr).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(sr)),url:e.string()});var Qi=e.enum_(["active","inactive"]);var Bt=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Gr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Lr).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(sr).optional()),status:Qi.optional(),url:e.string().optional()});var bd=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 zd=e.object({data:A,params:bd});var Rd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var fd=e.object({data:A,params:Rd});var qe=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Gr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Lr).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(sr)),secret:e.string(),status:Qi,updatedAt:e.property("updated_at",e.date()),url:e.string()});var _d=e.object({data:qe,params:e.record(e.string(),e.unknown())});var Sd=e.object({data:D,params:e.record(e.string(),e.unknown())});var Pd=e.enum_(["failure","pending","success"]);var Yi=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:Pd,updatedAt:e.property("updated_at",e.date()),webhook:qe.optional(),webhookId:e.property("webhook_id",e.string())});var xd=e.object({data:Yi,params:e.record(e.string(),e.unknown())});var Ed=e.object({data:qe,params:e.record(e.string(),e.unknown())});var Cd=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 Ud=e.object({data:e.list(Yi),params:Cd});var Td=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var vd=e.object({data:e.list(qe),params:Td});var Od=e.object({data:qe,params:e.record(e.string(),e.unknown())});var t=e.object({error:e.string()});var jd=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var Xi=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var eo=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var At=e.object({addOnIds:e.property("add_on_ids",e.list(jd)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(Xi)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(eo)),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 Vt=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",er),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var qt=e.object({keys:e.record(e.string(),e.string())});var kd=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var Dt=e.object({addOnSelections:e.property("add_on_selections",e.list(kd)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_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(Xi)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(eo)),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 Mt=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(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var Ft=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 It=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 ro=class{constructor(o){this._options=K(o)}issueTemporaryAccessToken(o,i){return f.fromPromise(this.__issueTemporaryAccessToken(o,i))}async __issueTemporaryAccessToken(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"temporary-access-tokens"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...Ao.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:ls.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/temporary-access-tokens")}};var io=class{constructor(o){this._options=K(o)}listApiKeys(o,i){return f.fromPromise(this.__listApiKeys(o,i))}async __listApiKeys(o,i){let{environmentId:a,requireEnvironment:n,limit:r,offset:s}=o,u={};a!=null&&(u.environment_id=a),u.require_environment=n.toString(),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"api-keys"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:xs.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/api-keys")}createApiKey(o,i){return f.fromPromise(this.__createApiKey(o,i))}async __createApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"api-keys"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Vo.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:gs.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/api-keys")}getApiKey(o,i){return f.fromPromise(this.__getApiKey(o,i))}async __getApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/api-keys/{api_key_id}")}updateApiKey(o,i={},a){return f.fromPromise(this.__updateApiKey(o,i,a))}async __updateApiKey(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Do.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:js.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/api-keys/{api_key_id}")}deleteApiKey(o,i){return f.fromPromise(this.__deleteApiKey(o,i))}async __deleteApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:bs.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/api-keys/{api_key_id}")}countApiKeys(o,i){return f.fromPromise(this.__countApiKeys(o,i))}async __countApiKeys(o,i){let{environmentId:a,requireEnvironment:n,limit:r,offset:s}=o,u={};a!=null&&(u.environment_id=a),u.require_environment=n.toString(),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"api-keys/count"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:us.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/api-keys/count")}listApiRequests(o={},i){return f.fromPromise(this.__listApiRequests(o,i))}async __listApiRequests(o={},i){let{q:a,requestType:n,environmentId:r,limit:s,offset:u}=o,g={};a!=null&&(g.q=a),n!=null&&(g.request_type=n),r!=null&&(g.environment_id=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"api-requests"),method:"GET",headers:l,queryParameters:{...g,...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:Cs.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/api-requests")}getApiRequest(o,i){return f.fromPromise(this.__getApiRequest(o,i))}async __getApiRequest(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`api-requests/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/api-requests/{api_request_id}")}countApiRequests(o={},i){return f.fromPromise(this.__countApiRequests(o,i))}async __countApiRequests(o={},i){let{q:a,requestType:n,environmentId:r,limit:s,offset:u}=o,g={};a!=null&&(g.q=a),n!=null&&(g.request_type=n),r!=null&&(g.environment_id=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"api-requests/count"),method:"GET",headers:l,queryParameters:{...g,...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:ms.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/api-requests/count")}listEnvironments(o={},i){return f.fromPromise(this.__listEnvironments(o,i))}async __listEnvironments(o={},i){let{ids:a,limit:n,offset:r}=o,s={};a!=null&&(Array.isArray(a)?s.ids=a.map(l=>l):s.ids=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"environments"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:Ts.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/environments")}createEnvironment(o,i){return f.fromPromise(this.__createEnvironment(o,i))}async __createEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"environments"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qo.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:ws.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/environments")}getEnvironment(o,i){return f.fromPromise(this.__getEnvironment(o,i))}async __getEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/environments/{environment_id}")}updateEnvironment(o,i={},a){return f.fromPromise(this.__updateEnvironment(o,i,a))}async __updateEnvironment(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Mo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:ks.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/environments/{environment_id}")}deleteEnvironment(o,i){return f.fromPromise(this.__deleteEnvironment(o,i))}async __deleteEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:zs.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/environments/{environment_id}")}quickstart(o){return f.fromPromise(this.__quickstart(o))}async __quickstart(o){let i=await this._options.authProvider.getAuthRequest(),a=_(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"quickstart"),method:"POST",headers:a,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(n.ok)return{data:Os.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 j(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new U(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new x(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new E(t.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 T(n.error,n.rawResponse,"POST","/quickstart")}};var oo=class{constructor(o){this._options=K(o)}listCoupons(o={},i){return f.fromPromise(this.__listCoupons(o,i))}async __listCoupons(o={},i){let{isActive:a,q:n,limit:r,offset:s}=o,u={};a!=null&&(u.is_active=a.toString()),n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/coupons"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:Js.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/coupons")}upsertBillingCoupon(o,i){return f.fromPromise(this.__upsertBillingCoupon(o,i))}async __upsertBillingCoupon(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/coupons"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Lo.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:cn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/coupons")}upsertBillingCustomer(o,i){return f.fromPromise(this.__upsertBillingCustomer(o,i))}async __upsertBillingCustomer(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/customer/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Fo.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:pn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/customer/upsert")}listCustomersWithSubscriptions(o={},i){return f.fromPromise(this.__listCustomersWithSubscriptions(o,i))}async __listCustomersWithSubscriptions(o={},i){let{companyIds:a,failedToImport:n,name:r,providerType:s,q:u,limit:g,offset:d}=o,l={};a!=null&&(Array.isArray(a)?l.company_ids=a.map(b=>b):l.company_ids=a),n!=null&&(l.failed_to_import=n.toString()),r!=null&&(l.name=r),s!=null&&(l.provider_type=B.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(l.q=u),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/customers"),method:"GET",headers:y,queryParameters:{...l,...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(R.ok)return{data:en.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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/billing/customers")}countCustomers(o={},i){return f.fromPromise(this.__countCustomers(o,i))}async __countCustomers(o={},i){let{companyIds:a,failedToImport:n,name:r,providerType:s,q:u,limit:g,offset:d}=o,l={};a!=null&&(Array.isArray(a)?l.company_ids=a.map(b=>b):l.company_ids=a),n!=null&&(l.failed_to_import=n.toString()),r!=null&&(l.name=r),s!=null&&(l.provider_type=B.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(l.q=u),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/customers/count"),method:"GET",headers:y,queryParameters:{...l,...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(R.ok)return{data:Fs.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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/billing/customers/count")}listInvoices(o,i){return f.fromPromise(this.__listInvoices(o,i))}async __listInvoices(o,i){let{companyId:a,customerExternalId:n,subscriptionExternalId:r,limit:s,offset:u}=o,g={};a!=null&&(g.company_id=a),g.customer_external_id=n,g.subscription_external_id=r,s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/invoices"),method:"GET",headers:l,queryParameters:{...g,...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:on.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/billing/invoices")}upsertInvoice(o,i){return f.fromPromise(this.__upsertInvoice(o,i))}async __upsertInvoice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/invoices"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Wo.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:yn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/invoices")}listMeters(o={},i){return f.fromPromise(this.__listMeters(o,i))}async __listMeters(o={},i){let{displayName:a,limit:n,offset:r}=o,s={};a!=null&&(s.display_name=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/meter"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:an.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/billing/meter")}upsertBillingMeter(o,i){return f.fromPromise(this.__upsertBillingMeter(o,i))}async __upsertBillingMeter(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/meter/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:No.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:un.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/meter/upsert")}listPaymentMethods(o,i){return f.fromPromise(this.__listPaymentMethods(o,i))}async __listPaymentMethods(o,i){let{companyId:a,customerExternalId:n,limit:r,offset:s}=o,u={};a!=null&&(u.company_id=a),u.customer_external_id=n,r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/payment-methods"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:nn.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/payment-methods")}upsertPaymentMethod(o,i){return f.fromPromise(this.__upsertPaymentMethod(o,i))}async __upsertPaymentMethod(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/payment-methods"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ho.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:wn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/payment-methods")}listBillingPrices(o={},i){return f.fromPromise(this.__listBillingPrices(o,i))}async __listBillingPrices(o={},i){let{forInitialPlan:a,forTrialExpiryPlan:n,ids:r,interval:s,isActive:u,price:g,productId:d,productIds:l,providerType:m,q:y,tiersMode:R,usageType:b,withMeter:v,limit:V,offset:H}=o,O={};a!=null&&(O.for_initial_plan=a.toString()),n!=null&&(O.for_trial_expiry_plan=n.toString()),r!=null&&(Array.isArray(r)?O.ids=r.map(M=>M):O.ids=r),s!=null&&(O.interval=s),u!=null&&(O.is_active=u.toString()),g!=null&&(O.price=g.toString()),d!=null&&(O.product_id=d),l!=null&&(Array.isArray(l)?O.product_ids=l.map(M=>M):O.product_ids=l),m!=null&&(O.provider_type=B.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),y!=null&&(O.q=y),R!=null&&(O.tiers_mode=ne.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})),b!=null&&(O.usage_type=$.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),v!=null&&(O.with_meter=v.toString()),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let le=await this._options.authProvider.getAuthRequest(),nr=_(le.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/price"),method:"GET",headers:nr,queryParameters:{...O,...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(k.ok)return{data:Ls.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 j(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(t.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 T(k.error,k.rawResponse,"GET","/billing/price")}upsertBillingPrice(o,i){return f.fromPromise(this.__upsertBillingPrice(o,i))}async __upsertBillingPrice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/price/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,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:dn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/price/upsert")}deleteBillingProduct(o,i){return f.fromPromise(this.__deleteBillingProduct(o,i))}async __deleteBillingProduct(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/product/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:Is.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/billing/product/{billing_id}")}listBillingProductPrices(o={},i){return f.fromPromise(this.__listBillingProductPrices(o,i))}async __listBillingProductPrices(o={},i){let{forInitialPlan:a,forTrialExpiryPlan:n,ids:r,interval:s,isActive:u,price:g,productId:d,productIds:l,providerType:m,q:y,tiersMode:R,usageType:b,withMeter:v,limit:V,offset:H}=o,O={};a!=null&&(O.for_initial_plan=a.toString()),n!=null&&(O.for_trial_expiry_plan=n.toString()),r!=null&&(Array.isArray(r)?O.ids=r.map(M=>M):O.ids=r),s!=null&&(O.interval=s),u!=null&&(O.is_active=u.toString()),g!=null&&(O.price=g.toString()),d!=null&&(O.product_id=d),l!=null&&(Array.isArray(l)?O.product_ids=l.map(M=>M):O.product_ids=l),m!=null&&(O.provider_type=B.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),y!=null&&(O.q=y),R!=null&&(O.tiers_mode=ne.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})),b!=null&&(O.usage_type=$.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),v!=null&&(O.with_meter=v.toString()),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let le=await this._options.authProvider.getAuthRequest(),nr=_(le.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/product/prices"),method:"GET",headers:nr,queryParameters:{...O,...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(k.ok)return{data:Ns.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 j(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(t.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 T(k.error,k.rawResponse,"GET","/billing/product/prices")}deleteProductPrice(o,i){return f.fromPromise(this.__deleteProductPrice(o,i))}async __deleteProductPrice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/product/prices/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:Ks.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/billing/product/prices/{billing_id}")}upsertBillingProduct(o,i){return f.fromPromise(this.__upsertBillingProduct(o,i))}async __upsertBillingProduct(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/product/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ko.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:mn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/product/upsert")}listBillingProducts(o={},i){return f.fromPromise(this.__listBillingProducts(o,i))}async __listBillingProducts(o={},i){let{ids:a,isActive:n,name:r,priceUsageType:s,providerType:u,q:g,withOneTimeCharges:d,withPricesOnly:l,withZeroPrice:m,withoutLinkedToPlan:y,limit:R,offset:b}=o,v={};a!=null&&(Array.isArray(a)?v.ids=a.map(le=>le):v.ids=a),n!=null&&(v.is_active=n.toString()),r!=null&&(v.name=r),s!=null&&(v.price_usage_type=$.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(v.provider_type=B.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(v.q=g),d!=null&&(v.with_one_time_charges=d.toString()),l!=null&&(v.with_prices_only=l.toString()),m!=null&&(v.with_zero_price=m.toString()),y!=null&&(v.without_linked_to_plan=y.toString()),R!=null&&(v.limit=R.toString()),b!=null&&(v.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=_(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/products"),method:"GET",headers:H,queryParameters:{...v,...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(O.ok)return{data:$s.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 j(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(t.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 T(O.error,O.rawResponse,"GET","/billing/products")}countBillingProducts(o={},i){return f.fromPromise(this.__countBillingProducts(o,i))}async __countBillingProducts(o={},i){let{ids:a,isActive:n,name:r,priceUsageType:s,providerType:u,q:g,withOneTimeCharges:d,withPricesOnly:l,withZeroPrice:m,withoutLinkedToPlan:y,limit:R,offset:b}=o,v={};a!=null&&(Array.isArray(a)?v.ids=a.map(le=>le):v.ids=a),n!=null&&(v.is_active=n.toString()),r!=null&&(v.name=r),s!=null&&(v.price_usage_type=$.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(v.provider_type=B.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(v.q=g),d!=null&&(v.with_one_time_charges=d.toString()),l!=null&&(v.with_prices_only=l.toString()),m!=null&&(v.with_zero_price=m.toString()),y!=null&&(v.without_linked_to_plan=y.toString()),R!=null&&(v.limit=R.toString()),b!=null&&(v.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=_(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/products/count"),method:"GET",headers:H,queryParameters:{...v,...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(O.ok)return{data:Ds.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 j(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(t.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 T(O.error,O.rawResponse,"GET","/billing/products/count")}upsertBillingSubscription(o,i){return f.fromPromise(this.__upsertBillingSubscription(o,i))}async __upsertBillingSubscription(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/subscription/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Go.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:gn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/subscription/upsert")}};var to=class{constructor(o){this._options=K(o)}internal(o,i){return f.fromPromise(this.__internal(o,i))}async __internal(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"checkout-internal"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:At.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:Cn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/checkout-internal")}getCheckoutData(o,i){return f.fromPromise(this.__getCheckoutData(o,i))}async __getCheckoutData(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"checkout-internal/data"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Zo.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:kn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/checkout-internal/data")}previewCheckoutInternal(o,i){return f.fromPromise(this.__previewCheckoutInternal(o,i))}async __previewCheckoutInternal(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"checkout-internal/preview"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:At.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:qn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/checkout-internal/preview")}managePlan(o,i){return f.fromPromise(this.__managePlan(o,i))}async __managePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"manage-plan"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Dt.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:Bn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/manage-plan")}previewManagePlan(o,i){return f.fromPromise(this.__previewManagePlan(o,i))}async __previewManagePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"manage-plan/preview"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Dt.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:Mn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/manage-plan/preview")}cancelSubscription(o,i){return f.fromPromise(this.__cancelSubscription(o,i))}async __cancelSubscription(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"manage-plan/subscription/cancel"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:$o.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:xn.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/manage-plan/subscription/cancel")}updateCustomerSubscriptionTrialEnd(o,i={},a){return f.fromPromise(this.__updateCustomerSubscriptionTrialEnd(o,i,a))}async __updateCustomerSubscriptionTrialEnd(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`subscription/${w.encodePathParam(o)}/edit-trial-end`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Jo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Fn.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/subscription/{subscription_id}/edit-trial-end")}};var ao=class{constructor(o){this._options=K(o)}listCompanies(o={},i){return f.fromPromise(this.__listCompanies(o,i))}async __listCompanies(o={},i){let{ids:a,planId:n,q:r,withoutFeatureOverrideFor:s,withoutPlan:u,withSubscription:g,limit:d,offset:l}=o,m={};a!=null&&(Array.isArray(a)?m.ids=a.map(v=>v):m.ids=a),n!=null&&(m.plan_id=n),r!=null&&(m.q=r),s!=null&&(m.without_feature_override_for=s),u!=null&&(m.without_plan=u.toString()),g!=null&&(m.with_subscription=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:kc.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/companies")}upsertCompany(o,i){return f.fromPromise(this.__upsertCompany(o,i))}async __upsertCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Mt.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:Xc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/companies")}getCompany(o,i){return f.fromPromise(this.__getCompany(o,i))}async __getCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`companies/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:dc.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/companies/{company_id}")}deleteCompany(o,i={},a){return f.fromPromise(this.__deleteCompany(o,i,a))}async __deleteCompany(o,i={},a){let{cancelSubscription:n,prorate:r}=i,s={};n!=null&&(s.cancel_subscription=n.toString()),r!=null&&(s.prorate=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,a?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`companies/${w.encodePathParam(o)}`),method:"DELETE",headers:g,queryParameters:{...s,...a?.queryParams},timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(d.ok)return{data:sc.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"DELETE","/companies/{company_id}")}countCompanies(o={},i){return f.fromPromise(this.__countCompanies(o,i))}async __countCompanies(o={},i){let{ids:a,planId:n,q:r,withoutFeatureOverrideFor:s,withoutPlan:u,withSubscription:g,limit:d,offset:l}=o,m={};a!=null&&(Array.isArray(a)?m.ids=a.map(v=>v):m.ids=a),n!=null&&(m.plan_id=n),r!=null&&(m.q=r),s!=null&&(m.without_feature_override_for=s),u!=null&&(m.without_plan=u.toString()),g!=null&&(m.with_subscription=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/count"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:Wn.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/companies/count")}countCompaniesForAdvancedFilter(o={},i){return f.fromPromise(this.__countCompaniesForAdvancedFilter(o,i))}async __countCompaniesForAdvancedFilter(o={},i){let{ids:a,planIds:n,featureIds:r,creditTypeIds:s,subscriptionStatuses:u,subscriptionTypes:g,monetizedSubscriptions:d,q:l,withoutPlan:m,withoutSubscription:y,sortOrderColumn:R,sortOrderDirection:b,displayProperties:v,limit:V,offset:H}=o,O={};a!=null&&(Array.isArray(a)?O.ids=a.map(M=>M):O.ids=a),n!=null&&(Array.isArray(n)?O.plan_ids=n.map(M=>M):O.plan_ids=n),r!=null&&(Array.isArray(r)?O.feature_ids=r.map(M=>M):O.feature_ids=r),s!=null&&(Array.isArray(s)?O.credit_type_ids=s.map(M=>M):O.credit_type_ids=s),u!=null&&(Array.isArray(u)?O.subscription_statuses=u.map(M=>Ie.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_statuses=Ie.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(Array.isArray(g)?O.subscription_types=g.map(M=>Ke.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_types=Ke.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),d!=null&&(O.monetized_subscriptions=d.toString()),l!=null&&(O.q=l),m!=null&&(O.without_plan=m.toString()),y!=null&&(O.without_subscription=y.toString()),R!=null&&(O.sort_order_column=R),b!=null&&(O.sort_order_direction=Ce.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),v!=null&&(Array.isArray(v)?O.display_properties=v.map(M=>M):O.display_properties=v),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let le=await this._options.authProvider.getAuthRequest(),nr=_(le.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/count2"),method:"GET",headers:nr,queryParameters:{...O,...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(k.ok)return{data:Gn.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 j(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(t.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 T(k.error,k.rawResponse,"GET","/companies/count2")}createCompany(o,i){return f.fromPromise(this.__createCompany(o,i))}async __createCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/create"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Mt.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:ec.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/companies/create")}deleteCompanyByKeys(o,i){return f.fromPromise(this.__deleteCompanyByKeys(o,i))}async __deleteCompanyByKeys(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/delete"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qt.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:oc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/companies/delete")}listCompaniesForAdvancedFilter(o={},i){return f.fromPromise(this.__listCompaniesForAdvancedFilter(o,i))}async __listCompaniesForAdvancedFilter(o={},i){let{ids:a,planIds:n,featureIds:r,creditTypeIds:s,subscriptionStatuses:u,subscriptionTypes:g,monetizedSubscriptions:d,q:l,withoutPlan:m,withoutSubscription:y,sortOrderColumn:R,sortOrderDirection:b,displayProperties:v,limit:V,offset:H}=o,O={};a!=null&&(Array.isArray(a)?O.ids=a.map(M=>M):O.ids=a),n!=null&&(Array.isArray(n)?O.plan_ids=n.map(M=>M):O.plan_ids=n),r!=null&&(Array.isArray(r)?O.feature_ids=r.map(M=>M):O.feature_ids=r),s!=null&&(Array.isArray(s)?O.credit_type_ids=s.map(M=>M):O.credit_type_ids=s),u!=null&&(Array.isArray(u)?O.subscription_statuses=u.map(M=>Ie.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_statuses=Ie.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(Array.isArray(g)?O.subscription_types=g.map(M=>Ke.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_types=Ke.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),d!=null&&(O.monetized_subscriptions=d.toString()),l!=null&&(O.q=l),m!=null&&(O.without_plan=m.toString()),y!=null&&(O.without_subscription=y.toString()),R!=null&&(O.sort_order_column=R),b!=null&&(O.sort_order_direction=Ce.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),v!=null&&(Array.isArray(v)?O.display_properties=v.map(M=>M):O.display_properties=v),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let le=await this._options.authProvider.getAuthRequest(),nr=_(le.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/list2"),method:"GET",headers:nr,queryParameters:{...O,...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(k.ok)return{data:Oc.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 j(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(t.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 T(k.error,k.rawResponse,"GET","/companies/list2")}lookupCompany(o,i){return f.fromPromise(this.__lookupCompany(o,i))}async __lookupCompany(o,i){let{keys:a}=o,n={};n.keys=me(a);let r=await this._options.authProvider.getAuthRequest(),s=_(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"companies/lookup"),method:"GET",headers:s,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(u.ok)return{data:Hc.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 U(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new E(t.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 T(u.error,u.rawResponse,"GET","/companies/lookup")}listCompanyMemberships(o={},i){return f.fromPromise(this.__listCompanyMemberships(o,i))}async __listCompanyMemberships(o={},i){let{companyId:a,userId:n,limit:r,offset:s}=o,u={};a!=null&&(u.company_id=a),n!=null&&(u.user_id=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-memberships"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:Ac.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/company-memberships")}getOrCreateCompanyMembership(o,i){return f.fromPromise(this.__getOrCreateCompanyMembership(o,i))}async __getOrCreateCompanyMembership(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-memberships"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:et.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/company-memberships")}deleteCompanyMembership(o,i){return f.fromPromise(this.__deleteCompanyMembership(o,i))}async __deleteCompanyMembership(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`company-memberships/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:tc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/company-memberships/{company_membership_id}")}getActiveCompanySubscription(o={},i){return f.fromPromise(this.__getActiveCompanySubscription(o,i))}async __getActiveCompanySubscription(o={},i){let{companyId:a,companyIds:n,limit:r,offset:s}=o,u={};a!=null&&(u.company_id=a),n!=null&&(Array.isArray(n)?u.company_ids=n.map(m=>m):u.company_ids=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-subscriptions"),method:"GET",headers:d,queryParameters:{...u,...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(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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/company-subscriptions")}upsertCompanyTrait(o,i){return f.fromPromise(this.__upsertCompanyTrait(o,i))}async __upsertCompanyTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-traits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ft.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:el.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/company-traits")}listEntityKeyDefinitions(o={},i){return f.fromPromise(this.__listEntityKeyDefinitions(o,i))}async __listEntityKeyDefinitions(o={},i){let{entityType:a,ids:n,q:r,limit:s,offset:u}=o,g={};a!=null&&(g.entity_type=W.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),n!=null&&(Array.isArray(n)?g.ids=n.map(y=>y):g.ids=n),r!=null&&(g.q=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-key-definitions"),method:"GET",headers:l,queryParameters:{...g,...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:qc.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/entity-key-definitions")}countEntityKeyDefinitions(o={},i){return f.fromPromise(this.__countEntityKeyDefinitions(o,i))}async __countEntityKeyDefinitions(o={},i){let{entityType:a,ids:n,q:r,limit:s,offset:u}=o,g={};a!=null&&(g.entity_type=W.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),n!=null&&(Array.isArray(n)?g.ids=n.map(y=>y):g.ids=n),r!=null&&(g.q=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-key-definitions/count"),method:"GET",headers:l,queryParameters:{...g,...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:Hn.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/entity-key-definitions/count")}listEntityTraitDefinitions(o={},i){return f.fromPromise(this.__listEntityTraitDefinitions(o,i))}async __listEntityTraitDefinitions(o={},i){let{entityType:a,ids:n,q:r,traitType:s,traitTypes:u,limit:g,offset:d}=o,l={};a!=null&&(l.entity_type=W.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),n!=null&&(Array.isArray(n)?l.ids=n.map(b=>b):l.ids=n),r!=null&&(l.q=r),s!=null&&(l.trait_type=Y.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(Array.isArray(u)?l.trait_types=u.map(b=>Y.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.trait_types=Y.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-trait-definitions"),method:"GET",headers:y,queryParameters:{...l,...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(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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/entity-trait-definitions")}getOrCreateEntityTraitDefinition(o,i){return f.fromPromise(this.__getOrCreateEntityTraitDefinition(o,i))}async __getOrCreateEntityTraitDefinition(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-trait-definitions"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Yo.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/entity-trait-definitions")}getEntityTraitDefinition(o,i){return f.fromPromise(this.__getEntityTraitDefinition(o,i))}async __getEntityTraitDefinition(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`entity-trait-definitions/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/entity-trait-definitions/{entity_trait_definition_id}")}updateEntityTraitDefinition(o,i,a){return f.fromPromise(this.__updateEntityTraitDefinition(o,i,a))}async __updateEntityTraitDefinition(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`entity-trait-definitions/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:rt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/entity-trait-definitions/{entity_trait_definition_id}")}countEntityTraitDefinitions(o={},i){return f.fromPromise(this.__countEntityTraitDefinitions(o,i))}async __countEntityTraitDefinitions(o={},i){let{entityType:a,ids:n,q:r,traitType:s,traitTypes:u,limit:g,offset:d}=o,l={};a!=null&&(l.entity_type=W.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),n!=null&&(Array.isArray(n)?l.ids=n.map(b=>b):l.ids=n),r!=null&&(l.q=r),s!=null&&(l.trait_type=Y.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(Array.isArray(u)?l.trait_types=u.map(b=>Y.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.trait_types=Y.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-trait-definitions/count"),method:"GET",headers:y,queryParameters:{...l,...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(R.ok)return{data:Zn.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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/entity-trait-definitions/count")}getEntityTraitValues(o,i){return f.fromPromise(this.__getEntityTraitValues(o,i))}async __getEntityTraitValues(o,i){let{definitionId:a,q:n,limit:r,offset:s}=o,u={};u.definition_id=a,n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"entity-trait-values"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:yc.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/entity-trait-values")}listPlanChanges(o={},i){return f.fromPromise(this.__listPlanChanges(o,i))}async __listPlanChanges(o={},i){let{action:a,basePlanAction:n,companyId:r,companyIds:s,planIds:u,limit:g,offset:d}=o,l={};a!=null&&(l.action=a),n!=null&&(l.base_plan_action=n),r!=null&&(l.company_id=r),s!=null&&(Array.isArray(s)?l.company_ids=s.map(b=>b):l.company_ids=s),u!=null&&(Array.isArray(u)?l.plan_ids=u.map(b=>b):l.plan_ids=u),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-changes"),method:"GET",headers:y,queryParameters:{...l,...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(R.ok)return{data:Ic.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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/plan-changes")}getPlanChange(o,i){return f.fromPromise(this.__getPlanChange(o,i))}async __getPlanChange(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-changes/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:Pc.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/plan-changes/{plan_change_id}")}listPlanTraits(o={},i){return f.fromPromise(this.__listPlanTraits(o,i))}async __listPlanTraits(o={},i){let{ids:a,planId:n,traitId:r,traitIds:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.ids=a.map(R=>R):d.ids=a),n!=null&&(d.plan_id=n),r!=null&&(d.trait_id=r),s!=null&&(Array.isArray(s)?d.trait_ids=s.map(R=>R):d.trait_ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-traits"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Gc.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/plan-traits")}createPlanTrait(o,i){return f.fromPromise(this.__createPlanTrait(o,i))}async __createPlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-traits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Xo.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:rc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plan-traits")}getPlanTrait(o,i){return f.fromPromise(this.__getPlanTrait(o,i))}async __getPlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:xc.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/plan-traits/{plan_trait_id}")}updatePlanTrait(o,i,a){return f.fromPromise(this.__updatePlanTrait(o,i,a))}async __updatePlanTrait(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:ot.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Qc.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/plan-traits/{plan_trait_id}")}deletePlanTrait(o,i){return f.fromPromise(this.__deletePlanTrait(o,i))}async __deletePlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:nc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/plan-traits/{plan_trait_id}")}updatePlanTraitsBulk(o,i){return f.fromPromise(this.__updatePlanTraitsBulk(o,i))}async __updatePlanTraitsBulk(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-traits/bulk"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:it.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plan-traits/bulk")}countPlanTraits(o={},i){return f.fromPromise(this.__countPlanTraits(o,i))}async __countPlanTraits(o={},i){let{ids:a,planId:n,traitId:r,traitIds:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.ids=a.map(R=>R):d.ids=a),n!=null&&(d.plan_id=n),r!=null&&(d.trait_id=r),s!=null&&(Array.isArray(s)?d.trait_ids=s.map(R=>R):d.trait_ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-traits/count"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Qn.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/plan-traits/count")}upsertUserTrait(o,i){return f.fromPromise(this.__upsertUserTrait(o,i))}async __upsertUserTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"user-traits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ft.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/user-traits")}listUsers(o={},i){return f.fromPromise(this.__listUsers(o,i))}async __listUsers(o={},i){let{companyId:a,ids:n,planId:r,q:s,limit:u,offset:g}=o,d={};a!=null&&(d.company_id=a),n!=null&&(Array.isArray(n)?d.ids=n.map(R=>R):d.ids=n),r!=null&&(d.plan_id=r),s!=null&&(d.q=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Wc.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/users")}upsertUser(o,i){return f.fromPromise(this.__upsertUser(o,i))}async __upsertUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:It.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/users")}getUser(o,i){return f.fromPromise(this.__getUser(o,i))}async __getUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`users/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:Ec.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/users/{user_id}")}deleteUser(o,i){return f.fromPromise(this.__deleteUser(o,i))}async __deleteUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`users/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:lc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/users/{user_id}")}countUsers(o={},i){return f.fromPromise(this.__countUsers(o,i))}async __countUsers(o={},i){let{companyId:a,ids:n,planId:r,q:s,limit:u,offset:g}=o,d={};a!=null&&(d.company_id=a),n!=null&&(Array.isArray(n)?d.ids=n.map(R=>R):d.ids=n),r!=null&&(d.plan_id=r),s!=null&&(d.q=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users/count"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Xn.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/users/count")}createUser(o,i){return f.fromPromise(this.__createUser(o,i))}async __createUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users/create"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:It.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:ic.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/users/create")}deleteUserByKeys(o,i){return f.fromPromise(this.__deleteUserByKeys(o,i))}async __deleteUserByKeys(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users/delete"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qt.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:cc.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/users/delete")}lookupUser(o,i){return f.fromPromise(this.__lookupUser(o,i))}async __lookupUser(o,i){let{keys:a}=o,n={};n.keys=me(a);let r=await this._options.authProvider.getAuthRequest(),s=_(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"users/lookup"),method:"GET",headers:s,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(u.ok)return{data:Zc.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 U(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new E(t.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 T(u.error,u.rawResponse,"GET","/users/lookup")}};var so=class{constructor(o){this._options=K(o)}listComponents(o={},i){return f.fromPromise(this.__listComponents(o,i))}async __listComponents(o={},i){let{q:a,limit:n,offset:r}=o,s={};a!=null&&(s.q=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"components"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:ll.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/components")}createComponent(o,i){return f.fromPromise(this.__createComponent(o,i))}async __createComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"components"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,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:al.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/components")}getComponent(o,i){return f.fromPromise(this.__getComponent(o,i))}async __getComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`components/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:nl.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/components/{component_id}")}updateComponent(o,i={},a){return f.fromPromise(this.__updateComponent(o,i,a))}async __updateComponent(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`components/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:at.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:fl.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/components/{component_id}")}deleteComponent(o,i){return f.fromPromise(this.__deleteComponent(o,i))}async __deleteComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`components/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:sl.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/components/{component_id}")}countComponents(o={},i){return f.fromPromise(this.__countComponents(o,i))}async __countComponents(o={},i){let{q:a,limit:n,offset:r}=o,s={};a!=null&&(s.q=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"components/count"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:tl.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/components/count")}previewComponentData(o={},i){return f.fromPromise(this.__previewComponentData(o,i))}async __previewComponentData(o={},i){let{companyId:a,componentId:n}=o,r={};a!=null&&(r.company_id=a),n!=null&&(r.component_id=n);let s=await this._options.authProvider.getAuthRequest(),u=_(s.headers,this._options?.headers,i?.headers),g=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"components/preview-data"),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(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 401:throw new U(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new E(t.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 T(g.error,g.rawResponse,"GET","/components/preview-data")}};var no=class{constructor(o){this._options=K(o)}listBillingCredits(o={},i){return f.fromPromise(this.__listBillingCredits(o,i))}async __listBillingCredits(o={},i){let{ids:a,name:n,limit:r,offset:s}=o,u={};a!=null&&(Array.isArray(a)?u.ids=a.map(m=>m):u.ids=a),n!=null&&(u.name=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits"),method:"GET",headers:d,queryParameters:{...u,...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(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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/credits")}createBillingCredit(o,i){return f.fromPromise(this.__createBillingCredit(o,i))}async __createBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,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: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 400:throw new j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/credits")}getSingleBillingCredit(o,i){return f.fromPromise(this.__getSingleBillingCredit(o,i))}async __getSingleBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/billing/credits/{credit_id}")}updateBillingCredit(o,i,a){return f.fromPromise(this.__updateBillingCredit(o,i,a))}async __updateBillingCredit(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:ut.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:ap.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/billing/credits/{credit_id}")}softDeleteBillingCredit(o,i){return f.fromPromise(this.__softDeleteBillingCredit(o,i))}async __softDeleteBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/billing/credits/{credit_id}")}listCreditBundles(o={},i){return f.fromPromise(this.__listCreditBundles(o,i))}async __listCreditBundles(o={},i){let{ids:a,creditId:n,status:r,bundleType:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.ids=a.map(R=>R):d.ids=a),n!=null&&(d.credit_id=n),r!=null&&(d.status=ue.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(d.bundle_type=ye.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/bundles"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:rp.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/billing/credits/bundles")}createCreditBundle(o,i){return f.fromPromise(this.__createCreditBundle(o,i))}async __createCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/bundles"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:pt.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/credits/bundles")}getCreditBundle(o,i){return f.fromPromise(this.__getCreditBundle(o,i))}async __getCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/billing/credits/bundles/{bundle_id}")}updateCreditBundleDetails(o,i,a){return f.fromPromise(this.__updateCreditBundleDetails(o,i,a))}async __updateCreditBundleDetails(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:mt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:np.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/billing/credits/bundles/{bundle_id}")}deleteCreditBundle(o,i){return f.fromPromise(this.__deleteCreditBundle(o,i))}async __deleteCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:ql.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/billing/credits/bundles/{bundle_id}")}countCreditBundles(o={},i){return f.fromPromise(this.__countCreditBundles(o,i))}async __countCreditBundles(o={},i){let{ids:a,creditId:n,status:r,bundleType:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.ids=a.map(R=>R):d.ids=a),n!=null&&(d.credit_id=n),r!=null&&(d.status=ue.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(d.bundle_type=ye.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/bundles/count"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Tl.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/billing/credits/bundles/count")}countBillingCredits(o={},i){return f.fromPromise(this.__countBillingCredits(o,i))}async __countBillingCredits(o={},i){let{ids:a,name:n,limit:r,offset:s}=o,u={};a!=null&&(Array.isArray(a)?u.ids=a.map(m=>m):u.ids=a),n!=null&&(u.name=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/count"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:xl.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/credits/count")}zeroOutGrant(o,i={},a){return f.fromPromise(this.__zeroOutGrant(o,i,a))}async __zeroOutGrant(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/grants/${w.encodePathParam(o)}/zero-out`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:ht.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:cp.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/billing/credits/grants/{grant_id}/zero-out")}grantBillingCreditsToCompany(o,i){return f.fromPromise(this.__grantBillingCreditsToCompany(o,i))}async __grantBillingCreditsToCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/grants/company"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:lt.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/credits/grants/company")}listCompanyGrants(o={},i){return f.fromPromise(this.__listCompanyGrants(o,i))}async __listCompanyGrants(o={},i){let{companyId:a,order:n,dir:r,limit:s,offset:u}=o,g={};a!=null&&(g.company_id=a),n!=null&&(g.order=Di.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"})),r!=null&&(g.dir=Ce.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/grants/company/list"),method:"GET",headers:l,queryParameters:{...g,...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:Xl.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/billing/credits/grants/company/list")}countBillingCreditsGrants(o={},i){return f.fromPromise(this.__countBillingCreditsGrants(o,i))}async __countBillingCreditsGrants(o={},i){let{creditId:a,ids:n,limit:r,offset:s}=o,u={};a!=null&&(u.credit_id=a),n!=null&&(Array.isArray(n)?u.ids=n.map(m=>m):u.ids=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/grants/count"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:Sl.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/credits/grants/count")}listGrantsForCredit(o={},i){return f.fromPromise(this.__listGrantsForCredit(o,i))}async __listGrantsForCredit(o={},i){let{creditId:a,ids:n,limit:r,offset:s}=o,u={};a!=null&&(u.credit_id=a),n!=null&&(Array.isArray(n)?u.ids=n.map(m=>m):u.ids=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/grants/list"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:op.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/billing/credits/grants/list")}getEnrichedCreditLedger(o,i){return f.fromPromise(this.__getEnrichedCreditLedger(o,i))}async __getEnrichedCreditLedger(o,i){let{companyId:a,billingCreditId:n,featureId:r,period:s,startTime:u,endTime:g,limit:d,offset:l}=o,m={};m.company_id=a,n!=null&&(m.billing_credit_id=n),r!=null&&(m.feature_id=r),m.period=ur.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}),u!=null&&(m.start_time=u),g!=null&&(m.end_time=g),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/ledger"),method:"GET",headers:R,queryParameters:{...m,...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(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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/billing/credits/ledger")}countCreditLedger(o,i){return f.fromPromise(this.__countCreditLedger(o,i))}async __countCreditLedger(o,i){let{companyId:a,billingCreditId:n,featureId:r,period:s,startTime:u,endTime:g,limit:d,offset:l}=o,m={};m.company_id=a,n!=null&&(m.billing_credit_id=n),r!=null&&(m.feature_id=r),m.period=ur.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}),u!=null&&(m.start_time=u),g!=null&&(m.end_time=g),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/ledger/count"),method:"GET",headers:R,queryParameters:{...m,...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(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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/billing/credits/ledger/count")}listBillingPlanCreditGrants(o={},i){return f.fromPromise(this.__listBillingPlanCreditGrants(o,i))}async __listBillingPlanCreditGrants(o={},i){let{creditId:a,planId:n,planIds:r,ids:s,limit:u,offset:g}=o,d={};a!=null&&(d.credit_id=a),n!=null&&(d.plan_id=n),r!=null&&(Array.isArray(r)?d.plan_ids=r.map(R=>R):d.plan_ids=r),s!=null&&(Array.isArray(s)?d.ids=s.map(R=>R):d.ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/plan-grants"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Ql.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/billing/credits/plan-grants")}createBillingPlanCreditGrant(o,i){return f.fromPromise(this.__createBillingPlanCreditGrant(o,i))}async __createBillingPlanCreditGrant(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/plan-grants"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ct.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: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 400:throw new j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/billing/credits/plan-grants")}updateBillingPlanCreditGrant(o,i,a){return f.fromPromise(this.__updateBillingPlanCreditGrant(o,i,a))}async __updateBillingPlanCreditGrant(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/plan-grants/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:dt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.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 400:throw new j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/billing/credits/plan-grants/{plan_grant_id}")}deleteBillingPlanCreditGrant(o,i={},a){return f.fromPromise(this.__deleteBillingPlanCreditGrant(o,i,a))}async __deleteBillingPlanCreditGrant(o,i={},a){let{applyToExisting:n}=i,r={};n!=null&&(r.apply_to_existing=n.toString());let s=await this._options.authProvider.getAuthRequest(),u=_(s.headers,this._options?.headers,a?.headers),g=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`billing/credits/plan-grants/${w.encodePathParam(o)}`),method:"DELETE",headers:u,queryParameters:{...r,...a?.queryParams},timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(g.ok)return{data:Vl.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 j(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new U(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new C(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new E(t.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 T(g.error,g.rawResponse,"DELETE","/billing/credits/plan-grants/{plan_grant_id}")}countBillingPlanCreditGrants(o={},i){return f.fromPromise(this.__countBillingPlanCreditGrants(o,i))}async __countBillingPlanCreditGrants(o={},i){let{creditId:a,planId:n,planIds:r,ids:s,limit:u,offset:g}=o,d={};a!=null&&(d.credit_id=a),n!=null&&(d.plan_id=n),r!=null&&(Array.isArray(r)?d.plan_ids=r.map(R=>R):d.plan_ids=r),s!=null&&(Array.isArray(s)?d.ids=s.map(R=>R):d.ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=_(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"billing/credits/plan-grants/count"),method:"GET",headers:m,queryParameters:{...d,...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(y.ok)return{data:Cl.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 j(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return T(y.error,y.rawResponse,"GET","/billing/credits/plan-grants/count")}};var co=class{constructor(o){this._options=K(o)}createDataExport(o,i){return f.fromPromise(this.__createDataExport(o,i))}async __createDataExport(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"data-exports"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...gt.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/data-exports")}getDataExportArtifact(o,i){return f.fromPromise(this.__getDataExportArtifact(o,i))}async __getDataExportArtifact(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`data-exports/${w.encodePathParam(o)}/artifact`),method:"GET",headers:n,queryParameters:i?.queryParams,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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/data-exports/{data_export_id}/artifact")}};var lo=class{constructor(o){this._options=K(o)}listCompanyOverrides(o={},i){return f.fromPromise(this.__listCompanyOverrides(o,i))}async __listCompanyOverrides(o={},i){let{companyId:a,companyIds:n,featureId:r,featureIds:s,ids:u,withoutExpired:g,q:d,limit:l,offset:m}=o,y={};a!=null&&(y.company_id=a),n!=null&&(Array.isArray(n)?y.company_ids=n.map(V=>V):y.company_ids=n),r!=null&&(y.feature_id=r),s!=null&&(Array.isArray(s)?y.feature_ids=s.map(V=>V):y.feature_ids=s),u!=null&&(Array.isArray(u)?y.ids=u.map(V=>V):y.ids=u),g!=null&&(y.without_expired=g.toString()),d!=null&&(y.q=d),l!=null&&(y.limit=l.toString()),m!=null&&(y.offset=m.toString());let R=await this._options.authProvider.getAuthRequest(),b=_(R.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-overrides"),method:"GET",headers:b,queryParameters:{...y,...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(v.ok)return{data:Wp.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 j(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new U(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new E(t.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 T(v.error,v.rawResponse,"GET","/company-overrides")}createCompanyOverride(o,i){return f.fromPromise(this.__createCompanyOverride(o,i))}async __createCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-overrides"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:yt.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:jp.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/company-overrides")}getCompanyOverride(o,i){return f.fromPromise(this.__getCompanyOverride(o,i))}async __getCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(r.ok)return{data:Fp.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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/company-overrides/{company_override_id}")}updateCompanyOverride(o,i,a){return f.fromPromise(this.__updateCompanyOverride(o,i,a))}async __updateCompanyOverride(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:zt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:ou.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/company-overrides/{company_override_id}")}deleteCompanyOverride(o,i){return f.fromPromise(this.__deleteCompanyOverride(o,i))}async __deleteCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/company-overrides/{company_override_id}")}countCompanyOverrides(o={},i){return f.fromPromise(this.__countCompanyOverrides(o,i))}async __countCompanyOverrides(o={},i){let{companyId:a,companyIds:n,featureId:r,featureIds:s,ids:u,withoutExpired:g,q:d,limit:l,offset:m}=o,y={};a!=null&&(y.company_id=a),n!=null&&(Array.isArray(n)?y.company_ids=n.map(V=>V):y.company_ids=n),r!=null&&(y.feature_id=r),s!=null&&(Array.isArray(s)?y.feature_ids=s.map(V=>V):y.feature_ids=s),u!=null&&(Array.isArray(u)?y.ids=u.map(V=>V):y.ids=u),g!=null&&(y.without_expired=g.toString()),d!=null&&(y.q=d),l!=null&&(y.limit=l.toString()),m!=null&&(y.offset=m.toString());let R=await this._options.authProvider.getAuthRequest(),b=_(R.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"company-overrides/count"),method:"GET",headers:b,queryParameters:{...y,...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(v.ok)return{data:Sp.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 j(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new U(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new E(t.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 T(v.error,v.rawResponse,"GET","/company-overrides/count")}listFeatureCompanies(o,i){return f.fromPromise(this.__listFeatureCompanies(o,i))}async __listFeatureCompanies(o,i){let{featureId:a,q:n,limit:r,offset:s}=o,u={};u.feature_id=a,n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-companies"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:Zp.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/feature-companies")}countFeatureCompanies(o,i){return f.fromPromise(this.__countFeatureCompanies(o,i))}async __countFeatureCompanies(o,i){let{featureId:a,q:n,limit:r,offset:s}=o,u={};u.feature_id=a,n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-companies/count"),method:"GET",headers:d,queryParameters:{...u,...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(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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/feature-companies/count")}listFeatureUsage(o={},i){return f.fromPromise(this.__listFeatureUsage(o,i))}async __listFeatureUsage(o={},i){let{companyId:a,companyKeys:n,featureIds:r,includeUsageAggregation:s,q:u,withoutNegativeEntitlements:g,limit:d,offset:l}=o,m={};a!=null&&(m.company_id=a),n!=null&&(m.company_keys=me(n)),r!=null&&(Array.isArray(r)?m.feature_ids=r.map(v=>v):m.feature_ids=r),s!=null&&(m.include_usage_aggregation=s.toString()),u!=null&&(m.q=u),g!=null&&(m.without_negative_entitlements=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-usage"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:Qp.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/feature-usage")}countFeatureUsage(o={},i){return f.fromPromise(this.__countFeatureUsage(o,i))}async __countFeatureUsage(o={},i){let{companyId:a,companyKeys:n,featureIds:r,includeUsageAggregation:s,q:u,withoutNegativeEntitlements:g,limit:d,offset:l}=o,m={};a!=null&&(m.company_id=a),n!=null&&(m.company_keys=me(n)),r!=null&&(Array.isArray(r)?m.feature_ids=r.map(v=>v):m.feature_ids=r),s!=null&&(m.include_usage_aggregation=s.toString()),u!=null&&(m.q=u),g!=null&&(m.without_negative_entitlements=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-usage/count"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:Cp.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/feature-usage/count")}listFeatureUsers(o,i){return f.fromPromise(this.__listFeatureUsers(o,i))}async __listFeatureUsers(o,i){let{featureId:a,q:n,limit:r,offset:s}=o,u={};u.feature_id=a,n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-users"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:eu.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/feature-users")}countFeatureUsers(o,i){return f.fromPromise(this.__countFeatureUsers(o,i))}async __countFeatureUsers(o,i){let{featureId:a,q:n,limit:r,offset:s}=o,u={};u.feature_id=a,n!=null&&(u.q=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"feature-users/count"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:Tp.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/feature-users/count")}listPlanEntitlements(o={},i){return f.fromPromise(this.__listPlanEntitlements(o,i))}async __listPlanEntitlements(o={},i){let{featureId:a,featureIds:n,ids:r,planId:s,planIds:u,q:g,withMeteredProducts:d,limit:l,offset:m}=o,y={};a!=null&&(y.feature_id=a),n!=null&&(Array.isArray(n)?y.feature_ids=n.map(V=>V):y.feature_ids=n),r!=null&&(Array.isArray(r)?y.ids=r.map(V=>V):y.ids=r),s!=null&&(y.plan_id=s),u!=null&&(Array.isArray(u)?y.plan_ids=u.map(V=>V):y.plan_ids=u),g!=null&&(y.q=g),d!=null&&(y.with_metered_products=d.toString()),l!=null&&(y.limit=l.toString()),m!=null&&(y.offset=m.toString());let R=await this._options.authProvider.getAuthRequest(),b=_(R.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-entitlements"),method:"GET",headers:b,queryParameters:{...y,...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(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 j(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new U(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new E(t.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 T(v.error,v.rawResponse,"GET","/plan-entitlements")}createPlanEntitlement(o,i){return f.fromPromise(this.__createPlanEntitlement(o,i))}async __createPlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-entitlements"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:wt.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:kp.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plan-entitlements")}getPlanEntitlement(o,i){return f.fromPromise(this.__getPlanEntitlement(o,i))}async __getPlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/plan-entitlements/{plan_entitlement_id}")}updatePlanEntitlement(o,i,a){return f.fromPromise(this.__updatePlanEntitlement(o,i,a))}async __updatePlanEntitlement(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Rt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:tu.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/plan-entitlements/{plan_entitlement_id}")}deletePlanEntitlement(o,i){return f.fromPromise(this.__deletePlanEntitlement(o,i))}async __deletePlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/plan-entitlements/{plan_entitlement_id}")}countPlanEntitlements(o={},i){return f.fromPromise(this.__countPlanEntitlements(o,i))}async __countPlanEntitlements(o={},i){let{featureId:a,featureIds:n,ids:r,planId:s,planIds:u,q:g,withMeteredProducts:d,limit:l,offset:m}=o,y={};a!=null&&(y.feature_id=a),n!=null&&(Array.isArray(n)?y.feature_ids=n.map(V=>V):y.feature_ids=n),r!=null&&(Array.isArray(r)?y.ids=r.map(V=>V):y.ids=r),s!=null&&(y.plan_id=s),u!=null&&(Array.isArray(u)?y.plan_ids=u.map(V=>V):y.plan_ids=u),g!=null&&(y.q=g),d!=null&&(y.with_metered_products=d.toString()),l!=null&&(y.limit=l.toString()),m!=null&&(y.offset=m.toString());let R=await this._options.authProvider.getAuthRequest(),b=_(R.headers,this._options?.headers,i?.headers),v=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-entitlements/count"),method:"GET",headers:b,queryParameters:{...y,...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(v.ok)return{data:Op.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 j(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new U(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new C(t.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new E(t.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 T(v.error,v.rawResponse,"GET","/plan-entitlements/count")}duplicatePlanEntitlements(o,i){return f.fromPromise(this.__duplicatePlanEntitlements(o,i))}async __duplicatePlanEntitlements(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-entitlements/duplicate"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:bt.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plan-entitlements/duplicate")}getFeatureUsageByCompany(o,i){return f.fromPromise(this.__getFeatureUsageByCompany(o,i))}async __getFeatureUsageByCompany(o,i){let{keys:a}=o,n={};n.keys=me(a);let r=await this._options.authProvider.getAuthRequest(),s=_(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"usage-by-company"),method:"GET",headers:s,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(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 401:throw new U(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new E(t.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 T(u.error,u.rawResponse,"GET","/usage-by-company")}};var po=class{constructor(o){this._options=K(o)}createEventBatch(o,i){return f.fromPromise(this.__createEventBatch(o,i))}async __createEventBatch(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"event-batch"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ft.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:uu.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/event-batch")}getEventSummaries(o={},i){return f.fromPromise(this.__getEventSummaries(o,i))}async __getEventSummaries(o={},i){let{q:a,eventSubtypes:n,limit:r,offset:s}=o,u={};a!=null&&(u.q=a),n!=null&&(Array.isArray(n)?u.event_subtypes=n.map(m=>m):u.event_subtypes=n),r!=null&&(u.limit=r.toString()),s!=null&&(u.offset=s.toString());let g=await this._options.authProvider.getAuthRequest(),d=_(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"event-types"),method:"GET",headers:d,queryParameters:{...u,...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(l.ok)return{data:yu.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 j(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new U(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new E(t.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 T(l.error,l.rawResponse,"GET","/event-types")}listEvents(o={},i){return f.fromPromise(this.__listEvents(o,i))}async __listEvents(o={},i){let{companyId:a,eventSubtype:n,eventTypes:r,flagId:s,userId:u,limit:g,offset:d}=o,l={};a!=null&&(l.company_id=a),n!=null&&(l.event_subtype=n),r!=null&&(Array.isArray(r)?l.event_types=r.map(b=>Ge.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.event_types=Ge.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(l.flag_id=s),u!=null&&(l.user_id=u),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=_(m.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"events"),method:"GET",headers:y,queryParameters:{...l,...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(R.ok)return{data:Ru.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 j(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(t.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(t.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 T(R.error,R.rawResponse,"GET","/events")}createEvent(o,i){return f.fromPromise(this.__createEvent(o,i))}async __createEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"events"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Mi.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:du.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/events")}getEvent(o,i){return f.fromPromise(this.__getEvent(o,i))}async __getEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`events/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/events/{event_id}")}getSegmentIntegrationStatus(o){return f.fromPromise(this.__getSegmentIntegrationStatus(o))}async __getSegmentIntegrationStatus(o){let i=await this._options.authProvider.getAuthRequest(),a=_(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"segment-integration"),method:"GET",headers:a,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(n.ok)return{data:bu.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 401:throw new U(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new x(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new E(t.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 T(n.error,n.rawResponse,"GET","/segment-integration")}};var uo=class{constructor(o){this._options=K(o)}listFeatures(o={},i){return f.fromPromise(this.__listFeatures(o,i))}async __listFeatures(o={},i){let{ids:a,q:n,withoutCompanyOverrideFor:r,withoutPlanEntitlementFor:s,featureType:u,booleanRequireEvent:g,limit:d,offset:l}=o,m={};a!=null&&(Array.isArray(a)?m.ids=a.map(v=>v):m.ids=a),n!=null&&(m.q=n),r!=null&&(m.without_company_override_for=r),s!=null&&(m.without_plan_entitlement_for=s),u!=null&&(Array.isArray(u)?m.feature_type=u.map(v=>ie.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):m.feature_type=ie.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(m.boolean_require_event=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"features"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:Gu.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/features")}createFeature(o,i){return f.fromPromise(this.__createFeature(o,i))}async __createFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"features"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:St.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:Vu.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/features")}getFeature(o,i){return f.fromPromise(this.__getFeature(o,i))}async __getFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`features/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/features/{feature_id}")}updateFeature(o,i={},a){return f.fromPromise(this.__updateFeature(o,i,a))}async __updateFeature(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`features/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Pt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Nu.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/features/{feature_id}")}deleteFeature(o,i){return f.fromPromise(this.__deleteFeature(o,i))}async __deleteFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`features/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:Du.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/features/{feature_id}")}countFeatures(o={},i){return f.fromPromise(this.__countFeatures(o,i))}async __countFeatures(o={},i){let{ids:a,q:n,withoutCompanyOverrideFor:r,withoutPlanEntitlementFor:s,featureType:u,booleanRequireEvent:g,limit:d,offset:l}=o,m={};a!=null&&(Array.isArray(a)?m.ids=a.map(v=>v):m.ids=a),n!=null&&(m.q=n),r!=null&&(m.without_company_override_for=r),s!=null&&(m.without_plan_entitlement_for=s),u!=null&&(Array.isArray(u)?m.feature_type=u.map(v=>ie.jsonOrThrow(v,{unrecognizedObjectKeys:"strip"})):m.feature_type=ie.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(m.boolean_require_event=g.toString()),d!=null&&(m.limit=d.toString()),l!=null&&(m.offset=l.toString());let y=await this._options.authProvider.getAuthRequest(),R=_(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"features/count"),method:"GET",headers:R,queryParameters:{...m,...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(b.ok)return{data:ku.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 j(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(t.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 T(b.error,b.rawResponse,"GET","/features/count")}listFlags(o={},i){return f.fromPromise(this.__listFlags(o,i))}async __listFlags(o={},i){let{featureId:a,ids:n,q:r,limit:s,offset:u}=o,g={};a!=null&&(g.feature_id=a),n!=null&&(Array.isArray(n)?g.ids=n.map(y=>y):g.ids=n),r!=null&&(g.q=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"flags"),method:"GET",headers:l,queryParameters:{...g,...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:Wu.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/flags")}createFlag(o,i){return f.fromPromise(this.__createFlag(o,i))}async __createFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"flags"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Vt.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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/flags")}getFlag(o,i){return f.fromPromise(this.__getFlag(o,i))}async __getFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/flags/{flag_id}")}updateFlag(o,i,a){return f.fromPromise(this.__updateFlag(o,i,a))}async __updateFlag(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Vt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.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 400:throw new j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/flags/{flag_id}")}deleteFlag(o,i){return f.fromPromise(this.__deleteFlag(o,i))}async __deleteFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/flags/{flag_id}")}updateFlagRules(o,i,a){return f.fromPromise(this.__updateFlagRules(o,i,a))}async __updateFlagRules(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(o)}/rules`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:xt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Ju.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/flags/{flag_id}/rules")}checkFlag(o,i,a){return f.fromPromise(this.__checkFlag(o,i,a))}async __checkFlag(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(o)}/check`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:oi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Uu.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"POST","/flags/{key}/check")}checkFlags(o,i){return f.fromPromise(this.__checkFlags(o,i))}async __checkFlags(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"flags/check"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:oi.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/flags/check")}checkFlagsBulk(o,i){return f.fromPromise(this.__checkFlagsBulk(o,i))}async __checkFlagsBulk(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"flags/check-bulk"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:_t.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:vu.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/flags/check-bulk")}countFlags(o={},i){return f.fromPromise(this.__countFlags(o,i))}async __countFlags(o={},i){let{featureId:a,ids:n,q:r,limit:s,offset:u}=o,g={};a!=null&&(g.feature_id=a),n!=null&&(Array.isArray(n)?g.ids=n.map(y=>y):g.ids=n),r!=null&&(g.q=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"flags/count"),method:"GET",headers:l,queryParameters:{...g,...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:Au.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/flags/count")}};var mo=class{constructor(o){this._options=K(o)}getPlanGroup(o){return f.fromPromise(this.__getPlanGroup(o))}async __getPlanGroup(o){let i=await this._options.authProvider.getAuthRequest(),a=_(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-groups"),method:"GET",headers:a,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(n.ok)return{data:id.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 401:throw new U(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new x(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new E(t.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 T(n.error,n.rawResponse,"GET","/plan-groups")}createPlanGroup(o,i){return f.fromPromise(this.__createPlanGroup(o,i))}async __createPlanGroup(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plan-groups"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Et.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:Xu.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plan-groups")}updatePlanGroup(o,i,a){return f.fromPromise(this.__updatePlanGroup(o,i,a))}async __updatePlanGroup(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-groups/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Ct.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:od.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/plan-groups/{plan_group_id}")}};var ho=class{constructor(o){this._options=K(o)}updateCompanyPlans(o,i,a){return f.fromPromise(this.__updateCompanyPlans(o,i,a))}async __updateCompanyPlans(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`company-plans/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:vt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:hd.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/company-plans/{company_plan_id}")}listPlans(o={},i){return f.fromPromise(this.__listPlans(o,i))}async __listPlans(o={},i){let{companyId:a,forFallbackPlan:n,forInitialPlan:r,forTrialExpiryPlan:s,hasProductId:u,ids:g,planType:d,q:l,withoutEntitlementFor:m,withoutPaidProductId:y,limit:R,offset:b}=o,v={};a!=null&&(v.company_id=a),n!=null&&(v.for_fallback_plan=n.toString()),r!=null&&(v.for_initial_plan=r.toString()),s!=null&&(v.for_trial_expiry_plan=s.toString()),u!=null&&(v.has_product_id=u.toString()),g!=null&&(Array.isArray(g)?v.ids=g.map(le=>le):v.ids=g),d!=null&&(v.plan_type=ce.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),l!=null&&(v.q=l),m!=null&&(v.without_entitlement_for=m),y!=null&&(v.without_paid_product_id=y.toString()),R!=null&&(v.limit=R.toString()),b!=null&&(v.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=_(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plans"),method:"GET",headers:H,queryParameters:{...v,...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(O.ok)return{data:md.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 j(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(t.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 T(O.error,O.rawResponse,"GET","/plans")}createPlan(o,i){return f.fromPromise(this.__createPlan(o,i))}async __createPlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plans"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,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: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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/plans")}getPlan(o,i){return f.fromPromise(this.__getPlan(o,i))}async __getPlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/plans/{plan_id}")}updatePlan(o,i,a){return f.fromPromise(this.__updatePlan(o,i,a))}async __updatePlan(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Ot.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:gd.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/plans/{plan_id}")}deletePlan(o,i){return f.fromPromise(this.__deletePlan(o,i))}async __deletePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(r.ok)return{data:nd.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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/plans/{plan_id}")}upsertBillingProductPlan(o,i,a){return f.fromPromise(this.__upsertBillingProductPlan(o,i,a))}async __upsertBillingProductPlan(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(o)}/billing_products`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:jt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:wd.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/plans/{plan_id}/billing_products")}countPlans(o={},i){return f.fromPromise(this.__countPlans(o,i))}async __countPlans(o={},i){let{companyId:a,forFallbackPlan:n,forInitialPlan:r,forTrialExpiryPlan:s,hasProductId:u,ids:g,planType:d,q:l,withoutEntitlementFor:m,withoutPaidProductId:y,limit:R,offset:b}=o,v={};a!=null&&(v.company_id=a),n!=null&&(v.for_fallback_plan=n.toString()),r!=null&&(v.for_initial_plan=r.toString()),s!=null&&(v.for_trial_expiry_plan=s.toString()),u!=null&&(v.has_product_id=u.toString()),g!=null&&(Array.isArray(g)?v.ids=g.map(le=>le):v.ids=g),d!=null&&(v.plan_type=ce.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),l!=null&&(v.q=l),m!=null&&(v.without_entitlement_for=m),y!=null&&(v.without_paid_product_id=y.toString()),R!=null&&(v.limit=R.toString()),b!=null&&(v.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=_(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plans/count"),method:"GET",headers:H,queryParameters:{...v,...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(O.ok)return{data:ad.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 j(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(t.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 T(O.error,O.rawResponse,"GET","/plans/count")}listPlanIssues(o,i){return f.fromPromise(this.__listPlanIssues(o,i))}async __listPlanIssues(o,i){let{planId:a}=o,n={};n.plan_id=a;let r=await this._options.authProvider.getAuthRequest(),s=_(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"plans/issues"),method:"GET",headers:s,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(u.ok)return{data:ud.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 j(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new U(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new E(t.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 T(u.error,u.rawResponse,"GET","/plans/issues")}};var go=class{constructor(o){this._options=K(o)}listWebhookEvents(o={},i){return f.fromPromise(this.__listWebhookEvents(o,i))}async __listWebhookEvents(o={},i){let{ids:a,q:n,webhookId:r,limit:s,offset:u}=o,g={};a!=null&&(Array.isArray(a)?g.ids=a.map(y=>y):g.ids=a),n!=null&&(g.q=n),r!=null&&(g.webhook_id=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"webhook-events"),method:"GET",headers:l,queryParameters:{...g,...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:Ud.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/webhook-events")}getWebhookEvent(o,i){return f.fromPromise(this.__getWebhookEvent(o,i))}async __getWebhookEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`webhook-events/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/webhook-events/{webhook_event_id}")}countWebhookEvents(o={},i){return f.fromPromise(this.__countWebhookEvents(o,i))}async __countWebhookEvents(o={},i){let{ids:a,q:n,webhookId:r,limit:s,offset:u}=o,g={};a!=null&&(Array.isArray(a)?g.ids=a.map(y=>y):g.ids=a),n!=null&&(g.q=n),r!=null&&(g.webhook_id=r),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=_(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"webhook-events/count"),method:"GET",headers:l,queryParameters:{...g,...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:zd.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 j(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(t.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 T(m.error,m.rawResponse,"GET","/webhook-events/count")}listWebhooks(o={},i){return f.fromPromise(this.__listWebhooks(o,i))}async __listWebhooks(o={},i){let{q:a,limit:n,offset:r}=o,s={};a!=null&&(s.q=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"webhooks"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:vd.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/webhooks")}createWebhook(o,i){return f.fromPromise(this.__createWebhook(o,i))}async __createWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"webhooks"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:kt.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:_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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"POST","/webhooks")}getWebhook(o,i){return f.fromPromise(this.__getWebhook(o,i))}async __getWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(o)}`),method:"GET",headers:n,queryParameters: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(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 U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"GET","/webhooks/{webhook_id}")}updateWebhook(o,i={},a){return f.fromPromise(this.__updateWebhook(o,i,a))}async __updateWebhook(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=_(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Bt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(a?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:a?.maxRetries??this._options?.maxRetries,abortSignal:a?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(s.ok)return{data:Od.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 j(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(t.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 T(s.error,s.rawResponse,"PUT","/webhooks/{webhook_id}")}deleteWebhook(o,i){return f.fromPromise(this.__deleteWebhook(o,i))}async __deleteWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 j(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(t.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 T(r.error,r.rawResponse,"DELETE","/webhooks/{webhook_id}")}countWebhooks(o={},i){return f.fromPromise(this.__countWebhooks(o,i))}async __countWebhooks(o={},i){let{q:a,limit:n,offset:r}=o,s={};a!=null&&(s.q=a),n!=null&&(s.limit=n.toString()),r!=null&&(s.offset=r.toString());let u=await this._options.authProvider.getAuthRequest(),g=_(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,"webhooks/count"),method:"GET",headers:g,queryParameters:{...s,...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(d.ok)return{data:fd.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 j(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return T(d.error,d.rawResponse,"GET","/webhooks/count")}};var yo=class{constructor(o){this._options=K(o)}get accounts(){return this._accounts??=new io(this._options)}get billing(){return this._billing??=new oo(this._options)}get credits(){return this._credits??=new no(this._options)}get checkout(){return this._checkout??=new to(this._options)}get companies(){return this._companies??=new ao(this._options)}get entitlements(){return this._entitlements??=new lo(this._options)}get plans(){return this._plans??=new ho(this._options)}get components(){return this._components??=new so(this._options)}get dataexports(){return this._dataexports??=new co(this._options)}get events(){return this._events??=new po(this._options)}get features(){return this._features??=new uo(this._options)}get plangroups(){return this._plangroups??=new mo(this._options)}get accesstokens(){return this._accesstokens??=new ro(this._options)}get webhooks(){return this._webhooks??=new go(this._options)}putPlanAudiencesPlanAudienceId(o,i){return f.fromPromise(this.__putPlanAudiencesPlanAudienceId(o,i))}async __putPlanAudiencesPlanAudienceId(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-audiences/${w.encodePathParam(o)}`),method:"PUT",headers:n,queryParameters: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(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 T(r.error,r.rawResponse,"PUT","/plan-audiences/{plan_audience_id}")}deletePlanAudiencesPlanAudienceId(o,i){return f.fromPromise(this.__deletePlanAudiencesPlanAudienceId(o,i))}async __deletePlanAudiencesPlanAudienceId(o,i){let a=await this._options.authProvider.getAuthRequest(),n=_(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??S.Default,`plan-audiences/${w.encodePathParam(o)}`),method:"DELETE",headers:n,queryParameters: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(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 T(r.error,r.rawResponse,"DELETE","/plan-audiences/{plan_audience_id}")}};var Wr=class{error(o,...i){console.error(o,...i)}warn(o,...i){console.warn(o,...i)}info(o,...i){console.info(o,...i)}debug(o,...i){console.debug(o,...i)}};var vh=1e3,Oh=1e3,jh=3,kh=1e3,wo=class{constructor(o,i){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:a=new Wr,maxSize:n=Oh,interval:r=vh,offline:s=!1,maxRetries:u=jh,initialRetryDelay:g=kh}=i||{};this.eventsApi=o,this.interval=r,this.logger=a,this.maxSize=n,this.offline=s,this.maxRetries=u,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,a=!1,n=null;for(;i<=this.maxRetries&&!a;)try{i>0&&this.logger.info(`Retrying event batch submission (attempt ${i} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:o}),a=!0}catch(r){if(n=r,i++,i<=this.maxRetries){let s=this.initialRetryDelay*Math.pow(2,i-1),u=Math.random()*.1*s,g=s+u;this.logger.warn(`Event batch submission failed: ${r}. Retrying in ${(g/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(d=>setTimeout(d,g))}}a?i>0&&this.logger.info(`Event batch submission succeeded after ${i} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,n)}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))}};function Bd(p){return async function(i){let a={};if(p&&Object.assign(a,p),i.body!==void 0&&i.contentType!=null&&(a["Content-Type"]=i.contentType),i.headers!=null)for(let[u,g]of Object.entries(i.headers))g!=null&&typeof g=="string"&&(a[u]=g);let n=ai(i.url,i.queryParameters),r=await ni({body:i.body,type:i.requestType==="json"?"json":"other"}),s=await si();try{let u=await li(async()=>ci(s,n,i.method,a,r,i.timeoutMs,i.abortSignal,i.withCredentials,i.duplex),i.maxRetries),g=await yr(u,i.responseType),d=Jr(u);return u.status>=200&&u.status<400?{ok:!0,body:g,headers:u.headers,rawResponse:d}:{ok:!1,error:{reason:"status-code",statusCode:u.status,body:g},rawResponse:d}}catch(u){return i.abortSignal!=null&&i.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:wr}:u instanceof Error&&u.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:wr}:u instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:u.message},rawResponse:br}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(u)},rawResponse:br}}}}async function Bh(p){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ue,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Ad=Bh;var bo=class extends yo{constructor(o){let{apiKey:i="",basePath:a,eventBufferInterval:n,flagDefaults:r={},logger:s=new Wr}=o??{},{offline:u=!1}=o??{},g={};o?.environmentId&&(g["X-Schematic-Environment-Id"]=o.environmentId),o?.headers&&Object.assign(g,o.headers),u?i!==""&&s.debug("Offline mode enabled, ignoring API key"):i===""&&!u&&(s.warn("No API key was provided, running in offline mode"),u=!0),super({apiKey:i,environment:a,fetcher:u?Ad:Bd(g)}),this.logger=s,this.eventBuffer=new wo(this.events,{interval:n,logger:s,offline:u}),this.flagCheckCacheProviders=o?.cacheProviders?.flagChecks??[new mr],this.flagDefaults=r,this.offline=u}async checkFlag(o,i){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${i}`),this.getFlagDefault(i);try{let a=JSON.stringify({evalCtx:o,key:i});for(let r of this.flagCheckCacheProviders){let s=await r.get(a);if(s!==void 0)return this.logger.debug(`${r.constructor.name} cache hit for flag ${i}`),s}let n=await this.features.checkFlag(i,o);if(n.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${i}, falling back to default`),this.getFlagDefault(i);for(let r of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${i} in ${r.constructor.name}`),await r.set(a,n.data.value);return this.logger.debug(`Feature flag API response for ${i}: ${JSON.stringify(n.data)}`),n.data.value}catch(a){return this.logger.error(`Error checking flag ${i}: ${a}`),this.getFlagDefault(i)}}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(a=>({flag:a,value:this.getFlagDefault(a),reason:"Offline mode - using default value"})):[];try{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 a=new Map,n=[];for(let g of i){let d=JSON.stringify({evalCtx:o,key:g}),l=!1;for(let m of this.flagCheckCacheProviders){let y=await m.get(d);if(y!==void 0){this.logger.debug(`${m.constructor.name} cache hit for flag ${g}`),a.set(g,{flag:g,value:y,reason:"Retrieved from cache"}),l=!0;break}}l||n.push(g)}if(n.length===0)return this.logger.debug(`All ${i.length} flags found in cache`),i.map(g=>a.get(g));this.logger.debug(`Cache miss for ${n.length} flags: ${n.join(", ")}, calling API`);let s=(await this.features.checkFlags(o)).data.flags,u=[];for(let g of i){let d=s.find(l=>l.flag===g);if(d){let l=JSON.stringify({evalCtx:o,key:g});for(let m of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${l} in ${m.constructor.name}`),await m.set(l,d.value);u.push(d)}else{let l=a.get(g);if(l)u.push(l);else{this.logger.debug(`Flag ${g} not found in API response or cache, using default value`);let m={flag:g,value:this.getFlagDefault(g),reason:"Flag not found - using default value"};u.push(m)}}}return this.logger.debug(`Checked ${i.length} flags: used fresh API values for consistency (${n.length} were cache misses)`),u}catch(a){return this.logger.error(`Error checking flags ${i?i.join(", "):"all"}: ${a}`),i&&i.length>0?i.map(n=>({flag:n,value:this.getFlagDefault(n),reason:`Error occurred - using default value: ${a}`})):[]}}async close(){return this.eventBuffer.stop()}async identify(o){if(!this.offline)try{await this.enqueueEvent("identify",o)}catch(i){this.logger.error(`Error sending identify event: ${i}`)}}async track(o){if(!this.offline)try{await this.enqueueEvent("track",o)}catch(i){this.logger.error(`Error sending track event: ${i}`)}}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){try{this.eventBuffer.push({eventType:o,body:i,sentAt:new Date})}catch(a){this.logger.error(`Error enqueueing ${o} event: ${a}`)}}};var zo=_o(require("crypto")),Kt="X-Schematic-Webhook-Signature",Gt="X-Schematic-Webhook-Timestamp",De=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 Ro(p,o,i){let a=Buffer.isBuffer(p)?p:Buffer.from(p),n=Buffer.concat([a,Buffer.from(`+${o}`)]),r=zo.createHmac("sha256",i);return r.update(n),r.digest()}function qd(p,o,i){return Ro(p,o,i).toString("hex")}function Lt(p,o,i,a){if(!o)throw De.missingSignature();if(!i)throw De.missingTimestamp();let n;try{n=Buffer.from(o,"hex")}catch(s){throw new De(`Invalid signature format: ${s?.message||"Unknown error"}`)}let r=Ro(p,i,a);if(n.length!==r.length||!zo.timingSafeEqual(n,r))throw De.invalidSignature()}function Dd(p,o,i,a={}){let n=p.headers,r=a.signatureHeader||Kt,s=a.timestampHeader||Gt,u=Vd(n,r),g=Vd(n,s),d;if(i!==void 0)d=i;else if("rawBody"in p&&p.rawBody)d=p.rawBody;else throw new De("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");Lt(d,u,g,o)}function Vd(p,o){let i=p[o]||p[o.toLowerCase()];return Array.isArray(i)?i[0]||"":i||""}0&&(module.exports={LocalCache,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});
1
+ "use strict";var Th=Object.create;var Pi=Object.defineProperty;var Oh=Object.getOwnPropertyDescriptor;var kh=Object.getOwnPropertyNames;var jh=Object.getPrototypeOf,Bh=Object.prototype.hasOwnProperty;var wo=(u,t)=>()=>(u&&(t=u(u=0)),t);var Vh=(u,t)=>()=>(t||u((t={exports:{}}).exports,t),t.exports),Ye=(u,t)=>{for(var i in t)Pi(u,i,{get:t[i],enumerable:!0})},Wa=(u,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of kh(t))!Bh.call(u,s)&&s!==i&&Pi(u,s,{get:()=>t[s],enumerable:!(o=Oh(t,s))||o.enumerable});return u};var si=(u,t,i)=>(i=u!=null?Th(jh(u)):{},Wa(t||!u||!u.__esModule?Pi(i,"default",{value:u,enumerable:!0}):i,u)),Ah=u=>Wa(Pi({},"__esModule",{value:!0}),u);var _n={};Ye(_n,{Node18UniversalStreamWrapper:()=>_o});var _o,Sn=wo(()=>{"use strict";_o=class u{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,i){this.events[t]?.push(i)}off(t,i){this.events[t]=this.events[t]?.filter(o=>o!==i)}pipe(t){return this.on("data",async i=>{if(t instanceof u)t._write(i);else if(t instanceof WritableStream){let o=t.getWriter();o.write(i).then(()=>o.releaseLock())}else t.write(i)}),this.on("end",async()=>{t instanceof u?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.on("error",async i=>{t instanceof u?t._error(i):t instanceof WritableStream?t.getWriter().abort(i):t.destroy(i)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async i=>{if(t instanceof u)t._write(i);else if(t instanceof WritableStream){let o=t.getWriter();o.write(i).then(()=>o.releaseLock())}else t.write(i)}),this.off("end",async()=>{t instanceof u?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.off("error",async i=>{t instanceof u?t._error(i):t instanceof WritableStream?t.getWriter().abort(i):t.destroy(i)})}destroy(t){this.reader.cancel(t).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(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();if(!t)return i}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:o,value:s}=await this.reader.read();if(o)break;s&&t.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,i){if(this.events[t])for(let o of this.events[t]||[])o(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}i&&this._emit("data",i)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:i}},[Symbol.asyncIterator](){return this}}}}});var Pn={};Ye(Pn,{UndiciStreamWrapper:()=>So});var So,xn=wo(()=>{"use strict";So=class u{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,i){this.events[t]?.push(i)}off(t,i){this.events[t]=this.events[t]?.filter(o=>o!==i)}pipe(t){return this.on("data",i=>{if(t instanceof u)t._write(i);else{let o=t.getWriter();o.write(i).then(()=>o.releaseLock())}}),this.on("end",()=>{t instanceof u?t._end():t.getWriter().close()}),this.on("error",i=>{t instanceof u?t._error(i):t.getWriter().abort(i)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",i=>{if(t instanceof u)t._write(i);else{let o=t.getWriter();o.write(i).then(()=>o.releaseLock())}}),this.off("end",()=>{t instanceof u?t._end():t.getWriter().close()}),this.off("error",i=>{t instanceof u?t._error(i):t.getWriter().abort(i)})}destroy(t){this.reader.cancel(t).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(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();if(!t)return i}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:o,value:s}=await this.reader.read();if(o)break;s&&t.push(s)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,i){if(this.events[t])for(let o of this.events[t]||[])o(i)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}i&&this._emit("data",i)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o});let{done:t,value:i}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:i}},[Symbol.asyncIterator](){return this}}}}});var En={};Ye(En,{NodePre18StreamWrapper:()=>Po});var Po,Cn=wo(()=>{"use strict";Po=class{constructor(t){this.readableStream=t}on(t,i){this.readableStream.on(t,i)}off(t,i){this.readableStream.off(t,i)}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe()}destroy(t){this.readableStream.destroy(t)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((t,i)=>{let o=this.readableStream.read();o?t(o):(this.readableStream.once("readable",()=>{let s=this.readableStream.read();t(s)}),this.readableStream.once("error",i))})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t}async text(){let t=[],i=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let s of this.readableStream)t.push(i.encode(s));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(t))}async json(){let t=await this.text();return JSON.parse(t)}[Symbol.asyncIterator](){let i=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:o,done:s}=await i.next();return{value:o,done:s}},[Symbol.asyncIterator](){return this}}}}});var Ph=Vh((xr,Sh)=>{"use strict";var fh={};fh.__wbindgen_placeholder__=Sh.exports;var lo=null;function po(){return(lo===null||lo.byteLength===0)&&(lo=new Uint8Array(de.memory.buffer)),lo}var _h=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});_h.decode();function Zy(u,t){return _h.decode(po().subarray(u,u+t))}function uo(u,t){return u=u>>>0,Zy(u,t)}var Ri=0,fi=new TextEncoder;"encodeInto"in fi||(fi.encodeInto=function(u,t){let i=fi.encode(u);return t.set(i),{read:u.length,written:i.length}});function Ia(u,t,i){if(i===void 0){let p=fi.encode(u),d=t(p.length,1)>>>0;return po().subarray(d,d+p.length).set(p),Ri=p.length,d}let o=u.length,s=t(o,1)>>>0,r=po(),a=0;for(;a<o;a++){let p=u.charCodeAt(a);if(p>127)break;r[s+a]=p}if(a!==o){a!==0&&(u=u.slice(a)),s=i(s,o,o=a+u.length*3,1)>>>0;let p=po().subarray(s+a,s+o),d=fi.encodeInto(u,p);a+=d.written,s=i(s,o,a,1)>>>0}return Ri=a,s}function zh(u){return u==null}function Yy(u){let t=de.__wbindgen_externrefs.get(u);return de.__externref_table_dealloc(u),t}var Rh=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(u=>de.__wbg_rulesenginejs_free(u>>>0,1)),_i=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Rh.unregister(this),t}free(){let t=this.__destroy_into_raw();de.__wbg_rulesenginejs_free(t,0)}checkFlag(t,i,o){let s,r;try{let y=Ia(t,de.__wbindgen_malloc,de.__wbindgen_realloc),b=Ri;var a=zh(i)?0:Ia(i,de.__wbindgen_malloc,de.__wbindgen_realloc),p=Ri,d=zh(o)?0:Ia(o,de.__wbindgen_malloc,de.__wbindgen_realloc),m=Ri;let R=de.rulesenginejs_checkFlag(this.__wbg_ptr,y,b,a,p,d,m);var c=R[0],h=R[1];if(R[3])throw c=0,h=0,Yy(R[2]);return s=c,r=h,uo(c,h)}finally{de.__wbindgen_free(s,r,1)}}getVersionKey(){let t,i;try{let o=de.rulesenginejs_getVersionKey(this.__wbg_ptr);return t=o[0],i=o[1],uo(o[0],o[1])}finally{de.__wbindgen_free(t,i,1)}}constructor(){let t=de.rulesenginejs_new();return this.__wbg_ptr=t>>>0,Rh.register(this,this.__wbg_ptr,this),this}};Symbol.dispose&&(_i.prototype[Symbol.dispose]=_i.prototype.free);xr.RulesEngineJS=_i;xr.__wbg___wbindgen_throw_b855445ff6a94295=function(u,t){throw new Error(uo(u,t))};xr.__wbg_getTime_14776bfb48a1bff9=function(u){return u.getTime()};xr.__wbg_new_0_f9740686d739025c=function(){return new Date};xr.__wbindgen_cast_2241b6af4c4b2941=function(u,t){return uo(u,t)};xr.__wbindgen_init_externref_table=function(){let u=de.__wbindgen_externrefs,t=u.grow(4);u.set(0,void 0),u.set(t+0,void 0),u.set(t+1,null),u.set(t+2,!0),u.set(t+3,!1)};var Qy=`${__dirname}/rulesengine_bg.wasm`,Xy=require("fs").readFileSync(Qy),ew=new WebAssembly.Module(Xy),de=xr.__wasm=new WebAssembly.Instance(ew,fh).exports;de.__wbindgen_start()});var ow={};Ye(ow,{LocalCache:()=>qe,RedisCacheProvider:()=>vr,RulesEngineClient:()=>ni,Schematic:()=>Q,SchematicClient:()=>mo,SchematicEnvironment:()=>S,SchematicError:()=>z,SchematicTimeoutError:()=>Ur,WEBHOOK_SIGNATURE_HEADER:()=>Ka,WEBHOOK_TIMESTAMP_HEADER:()=>La,WebhookSignatureError:()=>Je,computeHexSignature:()=>Uh,computeSignature:()=>go,verifySignature:()=>Ga,verifyWebhookSignature:()=>vh});module.exports=Ah(ow);var Q={};Ye(Q,{ActorType:()=>qh,ApiKeyScope:()=>Mh,BadRequestError:()=>T,BillingCreditBundleStatus:()=>Ih,BillingCreditBurnStrategy:()=>Fh,BillingCreditExpiryType:()=>Kh,BillingCreditExpiryUnit:()=>Lh,BillingCreditGrantReason:()=>Gh,BillingCreditGrantZeroedOutReason:()=>Wh,BillingCreditRolloverPolicy:()=>Hh,BillingPlanCreditGrantResetCadence:()=>Nh,BillingPlanCreditGrantResetStart:()=>$h,BillingPlanCreditGrantResetType:()=>Jh,BillingPriceScheme:()=>Zh,BillingPriceUsageType:()=>Yh,BillingProductPriceInterval:()=>Qh,BillingProviderType:()=>Xh,BillingSubscriptionTrialEndSetting:()=>eg,BillingTiersMode:()=>rg,ChargeType:()=>ig,CompanyPlanInvalidReason:()=>tg,ComponentEntityType:()=>og,ComponentState:()=>ag,ConditionConditionType:()=>ng,ConditionMetricPeriod:()=>sg,ConditionMetricPeriodMonthReset:()=>cg,ConditionOperator:()=>lg,CreateCompanyOverrideRequestBodyMetricPeriod:()=>rn,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>tn,CreateEntitlementInBundleRequestBodyMetricPeriod:()=>pg,CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset:()=>ug,CreateEntitlementReqCommonMetricPeriod:()=>dg,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>mg,CreateOrUpdateConditionRequestBodyConditionType:()=>hg,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>gg,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>yg,CreateOrUpdateConditionRequestBodyOperator:()=>wg,CreateOrUpdateRuleRequestBodyRuleType:()=>bg,CreatePlanEntitlementRequestBodyMetricPeriod:()=>on,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>an,CreditEventType:()=>zg,CreditGrantSortOrder:()=>Rg,CreditLedgerPeriod:()=>fg,DataExportStatus:()=>_g,EntitlementPriceBehavior:()=>Sg,EntitlementType:()=>Pg,EntitlementValueType:()=>xg,EntityType:()=>Eg,EnvironmentType:()=>Cg,EventStatus:()=>Ug,EventType:()=>zo,FeatureEntitlementMetricPeriod:()=>vg,FeatureEntitlementMonthReset:()=>Tg,FeatureLifecyclePhase:()=>Og,FeatureType:()=>kg,ForbiddenError:()=>x,InternalServerError:()=>E,InvoiceStatus:()=>jg,NotFoundError:()=>C,PlanBundleAction:()=>Bg,PlanChangeAction:()=>Vg,PlanChangeBasePlanAction:()=>Ag,PlanChangeSubscriptionAction:()=>Dg,PlanControlledByType:()=>qg,PlanType:()=>Mg,PlanVersionCompanyMigrationStatus:()=>Ig,PlanVersionMigrationStatus:()=>Fg,PlanVersionMigrationStrategy:()=>Kg,PlanVersionStatus:()=>Lg,ProrationBehavior:()=>Gg,RuleRuleType:()=>Wg,RulesEngineSchemaVersion:()=>Hg,RulesengineCheckFlagResultFeatureUsagePeriod:()=>Ng,RulesengineCheckFlagResultRuleType:()=>$g,RulesengineCompanyMetricMonthReset:()=>Jg,RulesengineCompanyMetricPeriod:()=>Zg,RulesengineConditionConditionType:()=>Yg,RulesengineConditionMetricPeriod:()=>Qg,RulesengineConditionMetricPeriodMonthReset:()=>Xg,RulesengineConditionOperator:()=>ey,RulesengineEntitlementValueType:()=>ry,RulesengineEntityType:()=>iy,RulesengineFeatureEntitlementMetricPeriod:()=>ty,RulesengineFeatureEntitlementMonthReset:()=>oy,RulesengineRuleRuleType:()=>ay,RulesengineTraitDefinitionComparableType:()=>ny,ScheduledCheckoutStatus:()=>sy,ScheduledDowngradeConfigBehavior:()=>cy,SortDirection:()=>ly,SubscriptionStatus:()=>py,SubscriptionType:()=>uy,TimeSeriesGranularity:()=>dy,TraitDefinitionComparableType:()=>my,TraitType:()=>hy,UnauthorizedError:()=>U,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>nn,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>sn,UpdateEntitlementReqCommonMetricPeriod:()=>gy,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>yy,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>cn,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ln,WebhookEventStatus:()=>wy,WebhookRequestType:()=>by,WebhookStatus:()=>zy,accesstokens:()=>Ha,accounts:()=>Na,billing:()=>$a,checkout:()=>Ja,companies:()=>Za,components:()=>Ya,componentspublic:()=>Qa,credits:()=>Xa,dataexports:()=>en,entitlements:()=>bo,events:()=>pn,features:()=>un,planbundle:()=>dn,plangroups:()=>mn,planmigrations:()=>hn,plans:()=>gn,scheduledcheckout:()=>yn,webhooks:()=>wn});var be=(u,t,i)=>JSON.stringify(u,t,i);function ci(u,t){return JSON.parse(u,t)}var z=class extends Error{constructor({message:t,statusCode:i,body:o,rawResponse:s}){super(Dh({message:t,statusCode:i,body:o})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=i,this.body=o,this.rawResponse=s}};function Dh({message:u,statusCode:t,body:i}){let o=[];return u!=null&&o.push(u),t!=null&&o.push(`Status code: ${t.toString()}`),i!=null&&o.push(`Body: ${be(i,void 0,2)}`),o.join(`
2
+ `)}var Ur=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var T=class extends z{constructor(t,i){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var x=class extends z{constructor(t,i){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var E=class extends z{constructor(t,i){super({message:"InternalServerError",statusCode:500,body:t,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var C=class extends z{constructor(t,i){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var U=class extends z{constructor(t,i){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:i}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Ha={};var Na={};var $a={};var Ja={};var Za={};var Ya={};var Qa={};var Xa={};var en={};var bo={};Ye(bo,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>rn,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>tn,CreatePlanEntitlementRequestBodyMetricPeriod:()=>on,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>an,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>nn,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>sn,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>cn,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ln});var rn={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var tn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var on={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var an={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var nn={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var sn={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var cn={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ln={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var pn={};var un={};var dn={};var mn={};var hn={};var gn={};var yn={};var wn={};var qh={ApiKey:"api_key",AppUser:"app_user",StripeApp:"stripe_app",System:"system",TemporaryAccessToken:"temporary_access_token"};var Mh={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var Ih={Active:"active",Inactive:"inactive"};var Fh={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var Kh={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var Lh={BillingPeriods:"billing_periods",Days:"days"};var Gh={BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var Wh={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var Hh={Expire:"expire",None:"none",Rollover:"rollover"};var Nh={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var $h={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var Jh={NoReset:"no_reset",PlanPeriod:"plan_period"};var Zh={PerUnit:"per_unit",Tiered:"tiered"};var Yh={Licensed:"licensed",Metered:"metered"};var Qh={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var Xh={Schematic:"schematic",Stripe:"stripe"};var eg={Cancel:"cancel",Subscribe:"subscribe"};var rg={Graduated:"graduated",Volume:"volume"};var ig={Free:"free",OneTime:"one_time",Recurring:"recurring"};var tg={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var og={Billing:"billing",Entitlement:"entitlement"};var ag={Draft:"draft",Live:"live"};var ng={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var sg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var cg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var lg={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var pg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ug={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};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={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",BasePlan:"base_plan"};var gg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var yg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var wg={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var bg={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var zg={Grant:"grant",Transfer:"transfer",Usage:"usage",ZeroOut:"zero_out"};var Rg={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var fg={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var _g={Failure:"failure",Pending:"pending",Success:"success"};var Sg={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var Pg={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var xg={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Eg={Company:"company",User:"user"};var Cg={Development:"development",Production:"production",Staging:"staging"};var Ug={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var zo={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var vg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Tg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Og={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var kg={Boolean:"boolean",Event:"event",Trait:"trait"};var jg={Draft:"draft",Open:"open",Paid:"paid",Uncollectible:"uncollectible",Void:"void"};var Bg={Create:"create",Update:"update",Delete:"delete"};var Vg={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 Ag={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var Dg={Adjustment:"adjustment",Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var qg={Schematic:"schematic",Stripe:"stripe"};var Mg={Plan:"plan",AddOn:"add_on"};var Ig={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending",Skipped:"skipped"};var Fg={Completed:"completed",Failed:"failed",InProgress:"in_progress",Pending:"pending"};var Kg={Immediate:"immediate",Leave:"leave"};var Lg={Published:"published",Draft:"draft",Archived:"archived"};var Gg={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};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={V0F048Dd3:"v0f048dd3",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var Ng={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var $g={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Jg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Zg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Yg={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",Metric:"metric",Plan:"plan",PlanVersion:"plan_version",Trait:"trait",User:"user"};var Qg={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Xg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ey={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var ry={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var iy={Company:"company",User:"user"};var ty={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var oy={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ay={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var ny={Bool:"bool",Date:"date",Int:"int",String:"string"};var sy={Cancelled:"cancelled",Error:"error",Executing:"executing",Pending:"pending",Success:"success"};var cy={EndOfBillingPeriod:"end_of_billing_period",None:"none"};var ly={Asc:"asc",Desc:"desc"};var py={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var uy={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var dy={Daily:"daily",Hourly:"hourly",Monthly:"monthly",Weekly:"weekly"};var my={Bool:"bool",Date:"date",Int:"int",String:"string"};var hy={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var gy={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var yy={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var wy={Failure:"failure",Pending:"pending",Success:"success"};var by={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",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 zy={Active:"active",Inactive:"inactive"};var xi=require("timers"),Ry=2147483647,qe=class{constructor({maxItems:t=1e3,ttl:i=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=t,this.defaultTTL=i}async get(t){let i=this.cache.get(t);return i?i.expiration<=Date.now()?(this.evictItem(t,i),null):(this.accessCounter++,i.accessCounter=this.accessCounter,this.cache.set(t,i),i.value):null}async set(t,i,o){if(this.maxItems===0)return;let s=o??this.defaultTTL,r=this.cache.get(t);r&&this.evictItem(t,r),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let a={value:i,accessCounter:this.accessCounter,expiration:Date.now()+s};a.timeoutId=(0,xi.setTimeout)(()=>this.evictItem(t,a),Math.min(s,Ry)),this.cache.set(t,a)}async delete(t){let i=this.cache.get(t);i&&this.evictItem(t,i)}async deleteMissing(t,i){let o=new Set(t);for(let[s,r]of this.cache)o.has(s)||this.evictItem(s,r)}evictItem(t,i){i.timeoutId&&(0,xi.clearTimeout)(i.timeoutId),this.cache.delete(t)}evictExpiredItems(){this.cache.forEach((t,i)=>{t.expiration<=Date.now()&&this.evictItem(i,t)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let t,i=Number.MAX_SAFE_INTEGER;this.cache.forEach((o,s)=>{o.accessCounter<i&&(t=s,i=o.accessCounter)}),t&&this.evictItem(t,this.cache.get(t))}}};var vr=class{constructor(t){this.client=t.client,this.defaultTTL=Math.floor((t.ttl||5e3)/1e3),this.keyPrefix=t.keyPrefix||"schematic:"}getFullKey(t){return this.keyPrefix+t}async get(t){let i=this.getFullKey(t),o=await this.client.get(i);return o===null?null:JSON.parse(o)}async set(t,i,o){let s=this.getFullKey(t),r=JSON.stringify(i),a=o?Math.floor(o/1e3):this.defaultTTL;a>0?await this.client.setEx(s,a,r):await this.client.set(s,r)}async delete(t){let i=this.getFullKey(t);await this.client.del(i)}async deleteMissing(t,i){let o=i?.scanPattern?this.keyPrefix+i.scanPattern:this.keyPrefix+"*",s=new Set(t.map(p=>this.getFullKey(p))),r=[],a=1e3;for await(let p of this.client.scanIterator({MATCH:o,COUNT:1e3}))s.has(p)||(r.push(p),r.length>=a&&(await this.client.del(r),r.length=0));r.length>0&&await this.client.del(r)}};var li=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var bn={get:async(u,t)=>typeof u=="function"?u(t):u};var Be={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},zn={[Be.Debug]:1,[Be.Info]:2,[Be.Warn]:3,[Be.Error]:4},pi=class{debug(t,...i){console.debug(t,...i)}info(t,...i){console.info(t,...i)}warn(t,...i){console.warn(t,...i)}error(t,...i){console.error(t,...i)}},Vr=class{constructor(t){this.level=zn[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=zn[t]}isDebug(){return this.shouldLog(Be.Debug)}debug(t,...i){this.isDebug()&&this.logger.debug(t,...i)}isInfo(){return this.shouldLog(Be.Info)}info(t,...i){this.isInfo()&&this.logger.info(t,...i)}isWarn(){return this.shouldLog(Be.Warn)}warn(t,...i){this.isWarn()&&this.logger.warn(t,...i)}isError(){return this.shouldLog(Be.Error)}error(t,...i){this.isError()&&this.logger.error(t,...i)}};function Ro(u){return u==null?fy:u instanceof Vr?u:(u=u??{},u.level??=Be.Info,u.logger??=new pi,u.silent??=!0,new Vr(u))}var fy=new Vr({level:Be.Info,logger:new pi,silent:!0});var _y={arrayFormat:"indices",encode:!0};function Rn(u,t){if(u===void 0||u===null)return"";let i=String(u);return t?encodeURIComponent(i):i}function fo(u,t="",i){let o=[];for(let[s,r]of Object.entries(u)){let a=t?`${t}[${s}]`:s;if(r!==void 0)if(Array.isArray(r)){if(r.length===0)continue;for(let p=0;p<r.length;p++){let d=r[p];if(d!==void 0)if(typeof d=="object"&&!Array.isArray(d)&&d!==null){let m=i.arrayFormat==="indices"?`${a}[${p}]`:a;o.push(...fo(d,m,i))}else{let m=i.arrayFormat==="indices"?`${a}[${p}]`:a,c=i.encode?encodeURIComponent(m):m;o.push(`${c}=${Rn(d,i.encode)}`)}}}else if(typeof r=="object"&&r!==null){if(Object.keys(r).length===0)continue;o.push(...fo(r,a,i))}else{let p=i.encode?encodeURIComponent(a):a;o.push(`${p}=${Rn(r,i.encode)}`)}}return o}function Ar(u,t){return u==null||typeof u!="object"?"":fo(u,"",{..._y,...t}).join("&")}function Ei(u,t){let i=Ar(t,{arrayFormat:"repeat"});return i?`${u}?${i}`:u}function fn(u){let t={get bodyUsed(){return u.bodyUsed},stream:()=>u.body,arrayBuffer:u.arrayBuffer.bind(u),blob:u.blob.bind(u)};return"bytes"in u&&typeof u.bytes=="function"&&(t.bytes=u.bytes.bind(u)),t}var ze=Sy();function Sy(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:{type:"unknown"}}async function Un(u){return ze.type==="node"&&ze.parsedVersion!=null&&ze.parsedVersion>=18?new(await Promise.resolve().then(()=>(Sn(),_n))).Node18UniversalStreamWrapper(u):ze.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(xn(),Pn))).UndiciStreamWrapper(u):new(await Promise.resolve().then(()=>(Cn(),En))).NodePre18StreamWrapper(u)}async function Dr(u,t){switch(t){case"binary-response":return fn(u);case"blob":return await u.blob();case"arrayBuffer":return await u.arrayBuffer();case"sse":return u.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:u.status}}:u.body;case"streaming":return u.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:u.status}}:Un(u.body);case"text":return await u.text()}let i=await u.text();if(i.length>0)try{return ci(i)}catch{return{ok:!1,error:{reason:"non-json",statusCode:u.status,rawBody:i}}}}async function vn(u){let t=u.headers.get("Content-Type")?.toLowerCase();if(t==null||t.length===0)return Dr(u);switch(t.indexOf(";")!==-1&&(t=t.split(";")[0]?.trim()??""),t){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 u.text();return i.length>0?ci(i):void 0}default:if(t.startsWith("application/vnd.")&&t.endsWith("+json")){let i=await u.text();return i.length>0?ci(i):void 0}return await u.text()}}async function Ci(){return ze.type==="node"&&ze.parsedVersion!=null&&ze.parsedVersion>=18?fetch:ze.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function Ui({body:u,type:t}){return t==="form"?Ar(u,{arrayFormat:"repeat",encode:!0}):t.includes("json")?be(u):u}var Me;typeof globalThis.Headers<"u"?Me=globalThis.Headers:Me=class Tn{constructor(t){if(this.headers=new Map,t)if(t instanceof Tn)t.forEach((i,o)=>this.append(o,i));else if(Array.isArray(t))for(let[i,o]of t)if(typeof i=="string"&&typeof o=="string")this.append(i,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[i,o]of Object.entries(t))if(typeof o=="string")this.append(i,o);else throw new TypeError("Header values must be strings")}append(t,i){let o=t.toLowerCase(),s=this.headers.get(o)||[];this.headers.set(o,[...s,i])}delete(t){let i=t.toLowerCase();this.headers.delete(i)}get(t){let i=t.toLowerCase(),o=this.headers.get(i);return o?o.join(", "):null}has(t){let i=t.toLowerCase();return this.headers.has(i)}set(t,i){let o=t.toLowerCase();this.headers.set(o,[i])}forEach(t,i){let o=i?t.bind(i):t;this.headers.forEach((s,r)=>o(s.join(", "),r,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,i]of this.headers.entries())yield[t,i.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var Py="timeout";function On(u){let t=new AbortController,i=setTimeout(()=>t.abort(Py),u);return{signal:t.signal,abortId:i}}function kn(...u){let t=u.length===1&&Array.isArray(u[0])?u[0]:u,i=new AbortController;for(let o of t){if(o.aborted){i.abort(o?.reason);break}o.addEventListener("abort",()=>i.abort(o?.reason),{signal:i.signal})}return i.signal}var vi=async(u,t,i,o,s,r,a,p,d)=>{let m=[],c;if(r!=null){let{signal:b,abortId:R}=On(r);c=R,m.push(b)}a!=null&&m.push(a);let h=kn(m),y=await u(t,{method:i,headers:o,body:s,signal:h,credentials:p?"include":void 0,duplex:d});return c!=null&&clearTimeout(c),y};var qr={headers:new Me,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},Mr={headers:new Me,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function ui(u){return{headers:u.headers,redirected:u.redirected,status:u.status,statusText:u.statusText,type:u.type,url:u.url}}function xy(u){let t=1+Math.random()*.2;return u*t}function Ey(u){let t=1+(Math.random()-.5)*.2;return u*t}function Cy(u,t){let i=u.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 a=r.getTime()-Date.now();if(a>0)return Math.min(Math.max(a,0),6e4)}}let o=u.headers.get("X-RateLimit-Reset");if(o){let s=parseInt(o,10);if(!Number.isNaN(s)){let r=s*1e3-Date.now();if(r>0)return xy(Math.min(r,6e4))}}return Ey(Math.min(1e3*2**t,6e4))}async function Ti(u,t=2){let i=await u();for(let o=0;o<t&&([408,429].includes(i.status)||i.status>=500);++o){let s=Cy(i,o);await new Promise(r=>setTimeout(r,s)),i=await u()}return i}var Uy=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 xo(u){let t={};for(let[i,o]of u instanceof Me?u.entries():Object.entries(u))Uy.has(i.toLowerCase())?t[i]="[REDACTED]":t[i]=o;return t}var Eo=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 vy(u){if(u==null)return u;let t={};for(let[i,o]of Object.entries(u))Eo.has(i.toLowerCase())?t[i]="[REDACTED]":t[i]=o;return t}function Tr(u){let t=u.indexOf("://");if(t===-1)return u;let i=t+3,o=u.indexOf("/",i),s=u.indexOf("?",i),r=u.indexOf("#",i),a=Math.min(o===-1?u.length:o,s===-1?u.length:s,r===-1?u.length:r),p=-1;for(let R=i;R<a;R++)u[R]==="@"&&(p=R);if(p!==-1&&(u=`${u.slice(0,i)}[REDACTED]@${u.slice(p+1)}`),s=u.indexOf("?"),s===-1)return u;r=u.indexOf("#",s);let d=r!==-1?r:u.length,m=u.slice(s+1,d);if(m.length===0)return u;let c=m.toLowerCase();if(!(c.includes("token")||c.includes("key")||c.includes("password")||c.includes("passwd")||c.includes("secret")||c.includes("session")||c.includes("auth")))return u;let y=[],b=m.split("&");for(let R of b){let O=R.indexOf("=");if(O===-1){y.push(R);continue}let D=R.slice(0,O),B=Eo.has(D.toLowerCase());if(!B&&D.includes("%"))try{let k=decodeURIComponent(D);B=Eo.has(k.toLowerCase())}catch{}y.push(B?`${D}=[REDACTED]`:R)}return u.slice(0,s+1)+y.join("&")+u.slice(d)}async function Ty(u){let t=new Me;if(t.set("Accept",u.responseType==="json"?"application/json":u.responseType==="text"?"text/plain":"*/*"),u.body!==void 0&&u.contentType!=null&&t.set("Content-Type",u.contentType),u.headers==null)return t;for(let[i,o]of Object.entries(u.headers)){let s=await bn.get(o,{endpointMetadata:u.endpointMetadata??{}});if(typeof s=="string"){t.set(i,s);continue}s!=null&&t.set(i,`${s}`)}return t}async function Oy(u){let t=Ei(u.url,u.queryParameters),i=await Ui({body:u.body,type:u.requestType??"other"}),o=u.fetchFn??await Ci(),s=await Ty(u),r=Ro(u.logging);if(r.isDebug()){let a={method:u.method,url:Tr(t),headers:xo(s),queryParameters:vy(u.queryParameters),hasBody:i!=null};r.debug("Making HTTP request",a)}try{let a=await Ti(async()=>vi(o,t,u.method,s,i,u.timeoutMs,u.abortSignal,u.withCredentials,u.duplex),u.maxRetries);if(a.status>=200&&a.status<400){if(r.isDebug()){let d={method:u.method,url:Tr(t),statusCode:a.status,responseHeaders:xo(a.headers)};r.debug("HTTP request succeeded",d)}return{ok:!0,body:await Dr(a,u.responseType),headers:a.headers,rawResponse:ui(a)}}else{if(r.isError()){let p={method:u.method,url:Tr(t),statusCode:a.status,responseHeaders:xo(Object.fromEntries(a.headers.entries()))};r.error("HTTP request failed with error status",p)}return{ok:!1,error:{reason:"status-code",statusCode:a.status,body:await vn(a)},rawResponse:ui(a)}}}catch(a){if(u.abortSignal?.aborted){if(r.isError()){let p={method:u.method,url:Tr(t)};r.error("HTTP request was aborted",p)}return{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:qr}}else if(a instanceof Error&&a.name==="AbortError"){if(r.isError()){let p={method:u.method,url:Tr(t),timeoutMs:u.timeoutMs};r.error("HTTP request timed out",p)}return{ok:!1,error:{reason:"timeout"},rawResponse:qr}}else if(a instanceof Error){if(r.isError()){let p={method:u.method,url:Tr(t),errorMessage:a.message};r.error("HTTP request failed with error",p)}return{ok:!1,error:{reason:"unknown",errorMessage:a.message},rawResponse:Mr}}if(r.isError()){let p={method:u.method,url:Tr(t),error:be(a)};r.error("HTTP request failed with unknown error",p)}return{ok:!1,error:{reason:"unknown",errorMessage:be(a)},rawResponse:Mr}}}var P=Oy;var f=class u extends Promise{constructor(t){super(i=>{i(void 0)}),this.innerPromise=t}static fromFunction(t,...i){return new u(t(...i))}static interceptFunction(t){return(...i)=>u.fromPromise(t(...i))}static fromPromise(t){return new u(t)}static fromExecutor(t){let i=new Promise(t);return new u(i)}static fromResult(t){let i=Promise.resolve(t);return new u(i)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,i){return this.unwrap().then(t,i)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var g={get:async u=>typeof u=="function"?u():u};var Oi={};Ye(Oi,{ConsoleLogger:()=>pi,LogLevel:()=>Be,Logger:()=>Vr,createLogger:()=>Ro});var e={};Ye(e,{JsonError:()=>Ir,ParseError:()=>Fr,any:()=>Nn,bigint:()=>Bn,boolean:()=>$n,booleanLiteral:()=>Wn,date:()=>Vn,discriminant:()=>os,enum_:()=>ji,getObjectLikeUtils:()=>Ve,getObjectUtils:()=>Or,getSchemaUtils:()=>G,isProperty:()=>nr,lazy:()=>An,lazyObject:()=>Ln,list:()=>Vi,never:()=>Jn,number:()=>Zn,object:()=>Bi,objectWithoutOptionalProperties:()=>Kn,optional:()=>Co,property:()=>qn,record:()=>es,set:()=>rs,string:()=>Yn,stringLiteral:()=>Hn,transform:()=>Uo,undiscriminatedUnion:()=>ts,union:()=>ns,unknown:()=>Qn,withParsedProperties:()=>To});var q={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 L(u,t){return`Expected ${t}. Received ${ky(u)}.`}function ky(u){if(Array.isArray(u))return"list";if(u===null)return"null";if(u instanceof BigInt)return"BigInt";switch(typeof u){case"string":return`"${u}"`;case"bigint":case"number":case"boolean":case"undefined":return`${u}`}return typeof u}function le(u){return{...u,json:jn(u.json),parse:jn(u.parse)}}function jn(u){return(t,i)=>{let o=u(t,i),{skipValidation:s=!1}=i??{};return!o.ok&&s?(console.warn(["Failed to validate.",...o.errors.map(r=>" - "+(r.path.length>0?`${r.path.join(".")}: ${r.message}`:r.message))].join(`
3
+ `)),{ok:!0,value:t}):o}}function ki(u){return u.path.length===0?u.message:`${u.path.join(" -> ")}: ${u.message}`}var Ir=class u extends Error{constructor(i){super(i.map(ki).join("; "));this.errors=i;Object.setPrototypeOf(this,u.prototype)}};var Fr=class u extends Error{constructor(i){super(i.map(ki).join("; "));this.errors=i;Object.setPrototypeOf(this,u.prototype)}};function G(u){return{nullable:()=>jy(u),optional:()=>Co(u),optionalNullable:()=>By(u),transform:t=>Uo(u,t),parseOrThrow:(t,i)=>{let o=u.parse(t,i);if(o.ok)return o.value;throw new Fr(o.errors)},jsonOrThrow:(t,i)=>{let o=u.json(t,i);if(o.ok)return o.value;throw new Ir(o.errors)}}}function jy(u){let t={parse:(i,o)=>i==null?{ok:!0,value:null}:u.parse(i,o),json:(i,o)=>i==null?{ok:!0,value:null}:u.json(i,o),getType:()=>q.NULLABLE};return{...t,...G(t)}}function Co(u){let t={parse:(i,o)=>i==null?{ok:!0,value:void 0}:u.parse(i,o),json:(i,o)=>o?.omitUndefined&&i===void 0?{ok:!0,value:void 0}:i==null?{ok:!0,value:null}:u.json(i,o),getType:()=>q.OPTIONAL};return{...t,...G(t)}}function By(u){let t={parse:(i,o)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:u.parse(i,o),json:(i,o)=>i===void 0?{ok:!0,value:void 0}:i===null?{ok:!0,value:null}:u.json(i,o),getType:()=>q.OPTIONAL_NULLABLE};return{...t,...G(t)}}function Uo(u,t){let i={parse:(o,s)=>{let r=u.parse(o,s);return r.ok?{ok:!0,value:t.transform(r.value)}:r},json:(o,s)=>{let r=t.untransform(o);return u.json(r,s)},getType:()=>u.getType()};return{...i,...G(i)}}function Bn(){let u={parse:(t,{breadcrumbsPrefix:i=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:i,message:L(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:i=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:i,message:L(t,"bigint")}]}:{ok:!0,value:t},getType:()=>q.BIGINT};return{...le(u),...G(u)}}var Vy=/^([+-]?\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 Vn(){let u={parse:(t,{breadcrumbsPrefix:i=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:i,message:L(t,"string")}]}:Vy.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:i,message:L(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:i=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:i,message:L(t,"Date object")}]},getType:()=>q.DATE};return{...le(u),...G(u)}}function pe(u,t){return()=>{let i={parse:t,json:t,getType:()=>u};return{...le(i),...G(i)}}}function ji(u){let t=new Set(u);return pe(q.ENUM,(o,{allowUnrecognizedEnumValues:s,breadcrumbsPrefix:r=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:r,message:L(o,"string")}]}:!t.has(o)&&!s?{ok:!1,errors:[{path:r,message:L(o,"enum")}]}:{ok:!0,value:o})()}function An(u){let t=vo(u);return{...t,...G(t)}}function vo(u){return{parse:(t,i)=>Kr(u).parse(t,i),json:(t,i)=>Kr(u).json(t,i),getType:()=>Kr(u).getType()}}function Kr(u){let t=u;return t.__zurg_memoized==null&&(t.__zurg_memoized=u()),t.__zurg_memoized}function di(u){return Object.entries(u)}function mi(u,t){let i=new Set(t);return Object.entries(u).reduce((o,[s,r])=>(i.has(s)&&(o[s]=r),o),{})}function Qe(u){if(typeof u!="object"||u===null)return!1;if(Object.getPrototypeOf(u)===null)return!0;let t=u;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(u)===t}function hi(u){return Object.keys(u)}function Dn(u,t){let i=[],o=[];for(let s of u)t(s)?i.push(s):o.push(s);return[i,o]}function Ve(u){return{withParsedProperties:t=>To(u,t)}}function To(u,t){let i={parse:(o,s)=>{let r=u.parse(o,s);if(!r.ok)return r;let a=Object.entries(t).reduce((p,[d,m])=>({...p,[d]:typeof m=="function"?m(r.value):m}),{});return{ok:!0,value:{...r.value,...a}}},json:(o,s)=>{if(!Qe(o))return{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:L(o,"object")}]};let r=new Set(Object.keys(t)),a=mi(o,Object.keys(o).filter(p=>!r.has(p)));return u.json(a,s)},getType:()=>u.getType()};return{...i,...G(i),...Ve(i)}}function qn(u,t){return{rawKey:u,valueSchema:t,isProperty:!0}}function nr(u){return u.isProperty}function Bi(u){let t={_getRawProperties:()=>Object.entries(u).map(([i,o])=>nr(o)?o.rawKey:i),_getParsedProperties:()=>hi(u),parse:(i,o)=>{let s={},r=[];for(let[a,p]of di(u)){let d=nr(p)?p.rawKey:a,m=nr(p)?p.valueSchema:p,c={rawKey:d,parsedKey:a,valueSchema:m};s[d]=c,Fn(m)&&r.push(d)}return Mn({value:i,requiredKeys:r,getProperty:a=>{let p=s[a];if(p!=null)return{transformedKey:p.parsedKey,transform:d=>p.valueSchema.parse(d,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:o?.unrecognizedObjectKeys,skipValidation:o?.skipValidation,breadcrumbsPrefix:o?.breadcrumbsPrefix,omitUndefined:o?.omitUndefined})},json:(i,o)=>{let s=[];for(let[r,a]of di(u)){let p=nr(a)?a.valueSchema:a;Fn(p)&&s.push(r)}return Mn({value:i,requiredKeys:s,getProperty:r=>{let a=u[r];if(a!=null)return nr(a)?{transformedKey:a.rawKey,transform:p=>a.valueSchema.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],r]})}:{transformedKey:r,transform:p=>a.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],r]})}},unrecognizedObjectKeys:o?.unrecognizedObjectKeys,skipValidation:o?.skipValidation,breadcrumbsPrefix:o?.breadcrumbsPrefix,omitUndefined:o?.omitUndefined})},getType:()=>q.OBJECT};return{...le(t),...G(t),...Ve(t),...Or(t)}}function Mn({value:u,requiredKeys:t,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:s=!1,breadcrumbsPrefix:r=[]}){if(!Qe(u))return{ok:!1,errors:[{path:r,message:L(u,"object")}]};let a=new Set(t),p=[],d={};for(let[m,c]of Object.entries(u)){let h=i(m);if(h!=null){a.delete(m);let y=h.transform(c);y.ok?d[h.transformedKey]=y.value:(d[m]=c,p.push(...y.errors))}else switch(o){case"fail":p.push({path:[...r,m],message:`Unexpected key "${m}"`});break;case"strip":break;case"passthrough":d[m]=c;break}}return p.push(...t.filter(m=>a.has(m)).map(m=>({path:r,message:`Missing required key "${m}"`}))),p.length===0||s?{ok:!0,value:d}:{ok:!1,errors:p}}function Or(u){return{extend:t=>{let i={_getParsedProperties:()=>[...u._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...u._getRawProperties(),...t._getRawProperties()],parse:(o,s)=>In({extensionKeys:t._getRawProperties(),value:o,transformBase:r=>u.parse(r,s),transformExtension:r=>t.parse(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(o,s)=>In({extensionKeys:t._getParsedProperties(),value:o,transformBase:r=>u.json(r,s),transformExtension:r=>t.json(r,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>q.OBJECT};return{...i,...G(i),...Ve(i),...Or(i)}},passthrough:()=>{let t={_getParsedProperties:()=>u._getParsedProperties(),_getRawProperties:()=>u._getRawProperties(),parse:(i,o)=>{let s=u.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});return s.ok?{ok:!0,value:{...i,...s.value}}:s},json:(i,o)=>{let s=u.json(i,{...o,unrecognizedObjectKeys:"passthrough"});return s.ok?{ok:!0,value:{...i,...s.value}}:s},getType:()=>q.OBJECT};return{...t,...G(t),...Ve(t),...Or(t)}}}}function In({extensionKeys:u,value:t,transformBase:i,transformExtension:o,breadcrumbsPrefix:s=[]}){if(!Qe(t))return{ok:!1,errors:[{path:s,message:L(t,"object")}]};let r=new Set(u),[a,p]=Dn(hi(t),c=>r.has(c)),d=i(mi(t,p)),m=o(mi(t,a));return d.ok&&m.ok?{ok:!0,value:{...d.value,...m.value}}:{ok:!1,errors:[...d.ok?[]:d.errors,...m.ok?[]:m.errors]}}function Fn(u){return!Ay(u)}function Ay(u){switch(u.getType()){case q.ANY:case q.UNKNOWN:case q.OPTIONAL:case q.OPTIONAL_NULLABLE:return!0;default:return!1}}function Kn(u){return Bi(u)}function Ln(u){let t={...vo(u),_getRawProperties:()=>Kr(u)._getRawProperties(),_getParsedProperties:()=>Kr(u)._getParsedProperties()};return{...t,...G(t),...Ve(t),...Or(t)}}function Vi(u){let t={parse:(i,o)=>Gn(i,(s,r)=>u.parse(s,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`[${r}]`]})),json:(i,o)=>Gn(i,(s,r)=>u.json(s,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`[${r}]`]})),getType:()=>q.LIST};return{...le(t),...G(t)}}function Gn(u,t){return Array.isArray(u)?u.map((o,s)=>t(o,s)).reduce((o,s)=>{if(o.ok&&s.ok)return{ok:!0,value:[...o.value,s.value]};let r=[];return o.ok||r.push(...o.errors),s.ok||r.push(...s.errors),{ok:!1,errors:r}},{ok:!0,value:[]}):{ok:!1,errors:[{message:L(u,"list"),path:[]}]}}function Wn(u){return pe(q.BOOLEAN_LITERAL,(i,{breadcrumbsPrefix:o=[]}={})=>i===u?{ok:!0,value:u}:{ok:!1,errors:[{path:o,message:L(i,`${u.toString()}`)}]})()}function Hn(u){return pe(q.STRING_LITERAL,(i,{breadcrumbsPrefix:o=[]}={})=>i===u?{ok:!0,value:u}:{ok:!1,errors:[{path:o,message:L(i,`"${u}"`)}]})()}var Nn=pe(q.ANY,u=>({ok:!0,value:u}));var $n=pe(q.BOOLEAN,(u,{breadcrumbsPrefix:t=[]}={})=>typeof u=="boolean"?{ok:!0,value:u}:{ok:!1,errors:[{path:t,message:L(u,"boolean")}]});var Jn=pe(q.NEVER,(u,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var Zn=pe(q.NUMBER,(u,{breadcrumbsPrefix:t=[]}={})=>typeof u=="number"?{ok:!0,value:u}:{ok:!1,errors:[{path:t,message:L(u,"number")}]});var Yn=pe(q.STRING,(u,{breadcrumbsPrefix:t=[]}={})=>typeof u=="string"?{ok:!0,value:u}:{ok:!1,errors:[{path:t,message:L(u,"string")}]});var Qn=pe(q.UNKNOWN,u=>({ok:!0,value:u}));function es(u,t){let i={parse:(o,s)=>Xn({value:o,isKeyNumeric:u.getType()===q.NUMBER,transformKey:r=>u.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,a)=>t.parse(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(o,s)=>Xn({value:o,isKeyNumeric:u.getType()===q.NUMBER,transformKey:r=>u.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${r} (key)`]}),transformValue:(r,a)=>t.json(r,{...s,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>q.RECORD};return{...le(i),...G(i)}}function Xn({value:u,isKeyNumeric:t,transformKey:i,transformValue:o,breadcrumbsPrefix:s=[]}){return Qe(u)?di(u).reduce((r,[a,p])=>{if(p===void 0)return r;let d=r,m=a;if(t){let b=a.length>0?Number(a):NaN;Number.isNaN(b)||(m=b)}let c=i(m),h=o(p,m);if(d.ok&&c.ok&&h.ok)return{ok:!0,value:{...d.value,[c.value]:h.value}};let y=[];return d.ok||y.push(...d.errors),c.ok||y.push(...c.errors),h.ok||y.push(...h.errors),{ok:!1,errors:y}},{ok:!0,value:{}}):{ok:!1,errors:[{path:s,message:L(u,"object")}]}}function rs(u){let t=Vi(u),i={parse:(o,s)=>{let r=t.parse(o,s);return r.ok?{ok:!0,value:new Set(r.value)}:r},json:(o,s)=>o instanceof Set?t.json([...o],s):{ok:!1,errors:[{path:s?.breadcrumbsPrefix??[],message:L(o,"Set")}]},getType:()=>q.SET};return{...le(i),...G(i)}}function ts(u){let t={parse:(i,o)=>is((s,r)=>s.parse(i,r),u,o),json:(i,o)=>is((s,r)=>s.json(i,r),u,o),getType:()=>q.UNDISCRIMINATED_UNION};return{...le(t),...G(t)}}function is(u,t,i){let o=[];for(let[s,r]of t.entries()){let a=u(r,{...i,skipValidation:!1});if(a.ok)return a;for(let p of a.errors)o.push({path:p.path,message:`[Variant ${s}] ${p.message}`})}return{ok:!1,errors:o}}function os(u,t){return{parsedDiscriminant:u,rawDiscriminant:t}}function ns(u,t){let i=typeof u=="string"?u:u.rawDiscriminant,o=typeof u=="string"?u:u.parsedDiscriminant,s=ji(hi(t)),r={parse:(a,p)=>as({value:a,discriminant:i,transformedDiscriminant:o,transformDiscriminantValue:d=>s.parse(d,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,m)=>m.parse(d,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),json:(a,p)=>as({value:a,discriminant:o,transformedDiscriminant:i,transformDiscriminantValue:d=>s.json(d,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],o]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,m)=>m.json(d,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),getType:()=>q.UNION};return{...le(r),...G(r),...Ve(r)}}function as({value:u,discriminant:t,transformedDiscriminant:i,transformDiscriminantValue:o,getAdditionalPropertiesSchema:s,allowUnrecognizedUnionMembers:r=!1,transformAdditionalProperties:a,breadcrumbsPrefix:p=[]}){if(!Qe(u))return{ok:!1,errors:[{path:p,message:L(u,"object")}]};let{[t]:d,...m}=u;if(d==null)return{ok:!1,errors:[{path:p,message:`Missing discriminant ("${t}")`}]};let c=o(d);if(!c.ok)return{ok:!1,errors:c.errors};let h=s(c.value);if(h==null)return r?{ok:!0,value:{[i]:c.value,...m}}:{ok:!1,errors:[{path:[...p,t],message:"Unexpected discriminant value"}]};let y=a(m,h);return y.ok?{ok:!0,value:{[i]:d,...y.value}}:y}var w={};Ye(w,{encodePathParam:()=>ss,join:()=>ls,toQueryString:()=>Ar});function ss(u){if(u===null)return"null";switch(typeof u){case"undefined":return"undefined";case"string":case"number":case"boolean":break;default:u=String(u);break}return encodeURIComponent(u)}function ls(u,...t){if(!u)return"";if(t.length===0)return u;if(u.includes("://")){let i;try{i=new URL(u)}catch{return cs(u,...t)}let s=t[t.length-1]?.endsWith("/");for(let r of t){let a=us(r);a&&(i.pathname=ps(i.pathname,a))}return s&&!i.pathname.endsWith("/")&&(i.pathname+="/"),i.toString()}return cs(u,...t)}function cs(u,...t){if(t.length===0)return u;let i=u,s=t[t.length-1]?.endsWith("/");for(let r of t){let a=us(r);a&&(i=ps(i,a))}return s&&!i.endsWith("/")&&(i+="/"),i}function ps(u,t){return u.endsWith("/")?u+t:`${u}/${t}`}function us(u){if(!u)return u;let t=0,i=u.length;return u.startsWith("/")&&(t=1),u.endsWith("/")&&(i=u.length-1),t===0&&i===u.length?u:u.slice(t,i)}var Ai=class{constructor(t){this.headerValue=t.apiKey}static canCreate(t){return t.apiKey!=null}async getAuthRequest(t){let i=await g.get(this.headerValue);if(i==null)throw new z({message:"Please specify a apiKey by passing it in to the constructor"});return{headers:{"X-Schematic-Api-Key":i}}}};function _(...u){let t={};for(let[i,o]of u.filter(s=>s!=null).flatMap(s=>Object.entries(s))){let s=i.toLowerCase();o!=null?t[s]=o:s in t&&delete t[s]}return t}function Dy(u){let t=_({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.4.0","User-Agent":"@schematichq/schematic-typescript-node/1.4.0","X-Fern-Runtime":ze.type,"X-Fern-Runtime-Version":ze.version},u?.headers);return{...u,logging:Oi.createLogger(u?.logging),headers:t}}function I(u){let t=Dy(u),i=qy(t);return t.authProvider??=new Ai(i),t}function qy(u){return{...u,authProvider:new li}}var S={Default:"https://api.schematichq.com"};function v(u,t,i,o){switch(u.reason){case"non-json":throw new z({statusCode:u.statusCode,body:u.rawBody,rawResponse:t});case"body-is-null":throw new z({statusCode:u.statusCode,rawResponse:t});case"timeout":throw new Ur(`Timeout exceeded when calling ${i} ${o}.`);case"unknown":throw new z({message:u.errorMessage,rawResponse:t});default:throw new z({message:"Unknown error",rawResponse:t})}}var Oo=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 ko=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string(),readonly:e.boolean().optional()});var sr=e.enum_(["development","production","staging"]);var jo=e.object({environmentType:e.property("environment_type",sr),name:e.string()});var Bo=e.object({description:e.string().optional(),name:e.string().optional()});var Vo=e.object({environmentType:e.property("environment_type",sr.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 V=e.object({count:e.number().optional()});var ys=e.object({data:V,params:gs});var _e=e.enum_(["api_key","app_user","stripe_app","system","temporary_access_token"]);var ws=e.object({actorType:e.property("actor_type",_e.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:V,params:ws});var Di=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(Di),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var Rs=e.object({data:zs,params:e.record(e.string(),e.unknown())});var Ie=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(Di),updatedAt:e.property("updated_at",e.date())});var fs=e.object({apiKeys:e.property("api_keys",e.list(Ie)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",sr),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 F=e.object({deleted:e.boolean().optional()});var Ss=e.object({data:F,params:e.record(e.string(),e.unknown())});var Ps=e.object({data:F,params:e.record(e.string(),e.unknown())});var xs=e.object({data:Ie,params:e.record(e.string(),e.unknown())});var Es=e.object({actorType:e.property("actor_type",_e),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 Cs=e.object({data:Es,params:e.record(e.string(),e.unknown())});var cr=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",sr),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Us=e.object({data:cr,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",e.string()),apiKeyId:e.property("api_key_id",e.string().optional()),environmentId:e.property("environment_id",e.string().optional()),environments:e.list(cr),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(Ie),params:Os});var js=e.object({actorType:e.property("actor_type",_e.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 qi=e.object({actorType:e.property("actor_type",_e),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(qi),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(cr),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:Ie,params:e.record(e.string(),e.unknown())});var Is=e.object({data:cr,params:e.record(e.string(),e.unknown())});var A=e.enum_(["schematic","stripe"]);var Ao=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 Fe=e.enum_(["per_unit","tiered"]);var Y=e.enum_(["licensed","metered"]);var ne=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 Do=e.object({billingScheme:e.property("billing_scheme",Fe),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",ne.optional()),usageType:e.property("usage_type",Y)});var qo=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),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",Y)});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 lr=e.enum_(["cancel","subscribe"]);var Mo=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",lr.optional())});var Io=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 Mi=e.enum_(["draft","open","paid","uncollectible","void"]);var Fo=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:Mi.optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var Ko=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 Lo=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",Y.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:V,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:V,params:Hs});var $s=e.object({data:F,params:e.record(e.string(),e.unknown())});var Js=e.object({data:F,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",ne.optional()),usageType:e.property("usage_type",Y.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Lr=e.enum_(["day","month","one-time","year"]);var Ii=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 X=e.object({billingScheme:e.property("billing_scheme",Fe),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Lr,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(Ii)),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",ne.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Y)});var Ys=e.object({data:e.list(X),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",ne.optional()),usageType:e.property("usage_type",Y.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Xs=e.object({data:e.list(X),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",Y.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 W=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:Lr,price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),providerType:e.property("provider_type",A),scheme:Fe});var Ke=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(W),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(Ke),params:ec});var ic=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Fi=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 tc=e.object({data:e.list(Fi),params:ic});var oc=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:oc});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 Ae=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:Mi.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(Ae),params:cc});var pc=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Ki=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(Ki),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 De=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(De),params:dc});var hc=e.object({data:Fi,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:Ki,params:e.record(e.string(),e.unknown())});var bc=e.object({data:W,params:e.record(e.string(),e.unknown())});var pr=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:pr,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",lr.optional())});var fc=e.object({data:Rc,params:e.record(e.string(),e.unknown())});var _c=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var Sc=e.object({data:De,params:e.record(e.string(),e.unknown())});var Go=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var Wo=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var Ho=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Li=e.object({billingScheme:e.property("billing_scheme",Fe),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(Ii)),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",Y)});var Gi=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 gi=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(Gi),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",Ae.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",De.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(Li),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",lr.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 N=e.enum_(["duration","end_of_billing_period","end_of_next_billing_period","end_of_trial","no_expiry"]);var K=e.enum_(["billing_periods","days"]);var ur=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var dr=e.enum_(["expire","none","rollover"]);var xc=e.object({accountId:e.property("account_id",e.string()),burnStrategy:e.property("burn_strategy",ur),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",K),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",dr),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:X.optional(),pricePerUnit:e.property("price_per_unit",e.number().optional()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),product:pr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Pe=e.enum_(["daily","monthly","weekly","yearly"]);var Le=e.enum_(["billing_period","first_of_month"]);var mr=e.enum_(["no_reset","plan_period"]);var Wi=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Gr=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",N.optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",K.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",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:Wi.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",Pe.optional()),resetStart:e.property("reset_start",Le.optional()),resetType:e.property("reset_type",mr),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var No=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(Gr)),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 J=e.enum_(["company","user"]);var Hi=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",J),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var Ni=e.object({createdAt:e.property("created_at",e.date()),definition:Hi.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",J),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var ie=e.enum_(["boolean","currency","date","number","string","url"]);var se=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",J),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",ie),updatedAt:e.property("updated_at",e.date())});var $i=e.object({createdAt:e.property("created_at",e.date()),definition:se.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 Z=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var Ec=e.enum_(["all_time","current_day","current_month","current_week"]);var Cc=e.enum_(["first_of_month","billing_cycle"]);var Ji=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",Ec.optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",Cc.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),valueType:e.property("value_type",Z)});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 $o=e.object({comparableType:e.property("comparable_type",kc),entityType:e.property("entity_type",J),id:e.string()});var Zi=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",$o.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",$o.optional()),traitValue:e.property("trait_value",e.string())});var jc=e.object({conditions:e.list(Zi)});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(Zi),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 Yi=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 $=e.object({addOns:e.property("add_ons",e.list(No)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",gi.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(gi)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",De.optional()),entitlements:e.list(Ji),entityTraits:e.property("entity_traits",e.list($i)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Ni),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(De)),plan:No.optional(),plans:e.list(Wi),rules:e.list(Vc),scheduledDowngrade:e.property("scheduled_downgrade",Yi.optional()),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Qi=e.object({company:$.optional(),success:e.boolean()});var Ac=e.object({data:Qi,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",lr.optional())});var qc=e.object({data:Dc,params:e.record(e.string(),e.unknown())});var ye=e.enum_(["active","inactive"]);var Se=e.stringLiteral("fixed");var xe=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",Se),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",N),expiryUnit:e.property("expiry_unit",K),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:W.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ye,unitPrice:e.property("unit_price",W.optional()),updatedAt:e.property("updated_at",e.date())});var Wr=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(Gi),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",Ae.optional()),paymentMethod:e.property("payment_method",De.optional()),products:e.list(Li),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:xe.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 hr=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var ce=e.enum_(["boolean","event","trait"]);var Hr=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",ce),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",hr.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 Ee=e.object({company:$.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:Hr.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",se.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Z)});var Nr=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 $r=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 ge=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var gr=e.enum_(["company_override","plan_entitlement","unknown"]);var Xi=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 yr=e.stringLiteral("boolean");var et=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var rt=e.object({comparisonTrait:e.property("comparison_trait",se.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(et),ruleId:e.property("rule_id",e.string()),trait:se.optional(),traitEntityType:e.property("trait_entity_type",J.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(rt),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 it=e.object({conditionGroups:e.property("condition_groups",e.list(Fc)),conditions:e.list(rt),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 Ge=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:Hr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",yr),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(it),updatedAt:e.property("updated_at",e.date())});var Jr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var ee=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",Xi.optional()),featureType:e.property("feature_type",ce),flags:e.list(Ge),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",hr.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(Jr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:se.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",ur),costEditable:e.property("cost_editable",e.boolean()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",K),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",dr),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:W.optional(),product:pr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var te=e.enum_(["plan","add_on"]);var We=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",te),updatedAt:e.property("updated_at",e.date())});var re=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:Hr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",X.optional()),meteredYearlyPrice:e.property("metered_yearly_price",X.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:We.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",ge.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",pr.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",se.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Z)});var wr=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Z),companyOverride:e.property("company_override",Ee.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(Nr).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",$r.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",gr),feature:ee.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",X.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:We.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",ge.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",X.optional())});var Zr=e.object({features:e.list(wr)});var Ue=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",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.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",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),plan:et.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",Pe.optional()),resetStart:e.property("reset_start",Le.optional()),resetType:e.property("reset_type",mr.optional()),updatedAt:e.property("updated_at",e.date())});var ve=e.enum_(["free","one_time","recurring"]);var He=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",te),status:Kc,updatedAt:e.property("updated_at",e.date()),version:e.number()});var we=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ke.optional()),chargeType:e.property("charge_type",ve),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",He),createdAt:e.property("created_at",e.date()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ue).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",W.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",W.optional()),planType:e.property("plan_type",te),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",W.optional())});var yi=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",X.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",X.optional()),priceBehavior:e.property("price_behavior",ge.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",Z),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",X.optional())});var Lc=e.object({activeAddOns:e.property("active_add_ons",e.list(we)),activePlan:e.property("active_plan",we.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(yi)),availableCreditBundles:e.property("available_credit_bundles",e.list(xe)),company:$.optional(),featureUsage:e.property("feature_usage",Zr.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Mc)),selectedPlan:e.property("selected_plan",we.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(yi)),subscription:Wr.optional()});var Gc=e.object({data:Lc,params:e.record(e.string(),e.unknown())});var Wc=e.object({data:Qi,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 tt=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(wr))});var $c=e.object({data:tt,params:e.record(e.string(),e.unknown())});var Jc=e.object({subscriptionChangePreview:e.property("subscription_change_preview",tt.optional())});var Zc=e.object({data:Jc,params:e.record(e.string(),e.unknown())});var Yc=e.object({data:gi,params:e.record(e.string(),e.unknown())});var Jo=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",J),hierarchy:e.list(e.string()),traitType:e.property("trait_type",ie)});var Zo=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Yo=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Qo=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",ie)});var Yr=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Xo=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(Yr)});var ea=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var fe=e.enum_(["asc","desc"]);var Xe=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var er=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(Xe).optional()),subscriptionTypes:e.property("subscription_types",e.list(er).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:V,params:Qc});var el=e.object({entityType:e.property("entity_type",J.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var rl=e.object({data:V,params:el});var il=e.object({entityType:e.property("entity_type",J.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",ie.optional()),traitTypes:e.property("trait_types",e.list(ie).optional())});var tl=e.object({data:V,params:il});var ol=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:V,params:ol});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:V,params:nl});var cl=e.object({data:$,params:e.record(e.string(),e.unknown())});var Te=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:Te,params:e.record(e.string(),e.unknown())});var Qr=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 Xr=e.object({company:Qr.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 Oe=e.object({companyMemberships:e.property("company_memberships",e.list(Xr)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list($i)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Ni),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:Oe,params:e.record(e.string(),e.unknown())});var ul=e.object({data:Qr,params:e.record(e.string(),e.unknown())});var dl=e.object({data:F,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:F,params:ml});var gl=e.object({data:F,params:e.record(e.string(),e.unknown())});var ot=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:ot,params:e.record(e.string(),e.unknown())});var wl=e.object({data:F,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(Wr),params:bl});var Rl=e.object({data:$,params:e.record(e.string(),e.unknown())});var fl=e.object({data:se,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:Xr,params:e.record(e.string(),e.unknown())});var El=e.object({data:se,params:e.record(e.string(),e.unknown())});var Cl=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 wi=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});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",ie),value:e.string()});var at=e.object({action:Cl,actorType:e.property("actor_type",_e),addOnsAdded:e.property("add_ons_added",e.list(wi)),addOnsRemoved:e.property("add_ons_removed",e.list(wi)),apiKey:e.property("api_key",Ie.optional()),auditLog:e.property("audit_log",qi.optional()),basePlan:e.property("base_plan",wi.optional()),basePlanAction:e.property("base_plan_action",Ul.optional()),company:Qr.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",wi.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:at,params:e.record(e.string(),e.unknown())});var kl=e.object({data:Te,params:e.record(e.string(),e.unknown())});var jl=e.object({data:Oe,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(Xe).optional()),subscriptionTypes:e.property("subscription_types",e.list(er).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($),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(Xr),params:Al});var ql=e.object({entityType:e.property("entity_type",J.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(Hi),params:ql});var Il=e.object({entityType:e.property("entity_type",J.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",ie.optional()),traitTypes:e.property("trait_types",e.list(ie).optional())});var Fl=e.object({data:e.list(se),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(at),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(Te),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(Oe),params:Hl});var $l=e.object({keys:e.record(e.string(),e.string()).optional()});var Jl=e.object({data:$,params:$l});var Zl=e.object({keys:e.record(e.string(),e.string()).optional()});var Yl=e.object({data:Oe,params:Zl});var Ql=e.object({data:se,params:e.record(e.string(),e.unknown())});var Xl=e.object({data:Te,params:e.record(e.string(),e.unknown())});var ep=e.object({data:e.list(Te),params:e.record(e.string(),e.unknown())});var rp=e.object({data:$,params:e.record(e.string(),e.unknown())});var ip=e.object({data:$,params:e.record(e.string(),e.unknown())});var tp=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var op=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var ei=e.enum_(["billing","entitlement"]);var ra=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",ei),name:e.string()});var nt=e.enum_(["draft","live"]);var ia=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",ei.optional()),name:e.string().optional(),state:nt.optional()});var ap=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var np=e.object({data:V,params:ap});var Ne=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:nt,type:ei,updatedAt:e.property("updated_at",e.date())});var sp=e.object({data:Ne,params:e.record(e.string(),e.unknown())});var cp=e.object({data:F,params:e.record(e.string(),e.unknown())});var lp=e.object({data:Ne,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(Ne),params:pp});var dp=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var bi=e.object({billingScheme:e.property("billing_scheme",Fe),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Lr,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",ne.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Y)});var mp=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",Se),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",N),expiryUnit:e.property("expiry_unit",K),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:bi.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ye,unitPrice:e.property("unit_price",bi.optional()),updatedAt:e.property("updated_at",e.date())});var hp=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var br=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",Ke.optional()),chargeType:e.property("charge_type",ve),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",He),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",br.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(re),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Gr)),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",W.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",W.optional()),planType:e.property("plan_type",te),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(wr)),valid:e.boolean(),versions:e.list(ue),yearlyPrice:e.property("yearly_price",W.optional())});var zr=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var st=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 ct=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 Rr=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",N.optional()),expiryUnit:e.property("expiry_unit",K.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:bi.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",Pe.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",Rr.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(yi)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(zr)),capabilities:st.optional(),checkoutSettings:e.property("checkout_settings",gp),company:$.optional(),component:Ne.optional(),creditBundles:e.property("credit_bundles",e.list(mp)),creditGrants:e.property("credit_grants",e.list(wp)),defaultPlan:e.property("default_plan",we.optional()),displaySettings:e.property("display_settings",ct),featureUsage:e.property("feature_usage",Zr.optional()),invoices:e.list(Ae),postTrialPlan:e.property("post_trial_plan",we.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",Yi.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:Wr.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Ae.optional())});var Rp=e.object({data:zp,params:dp});var fp=e.object({data:Ne,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",Ke.optional()),chargeType:e.property("charge_type",ve),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",He),createdAt:e.property("created_at",e.date()),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",br.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(re),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Gr)),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",W.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",W.optional()),planType:e.property("plan_type",te),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",W.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(zr)),capabilities:st.optional(),displaySettings:e.property("display_settings",ct),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 aa=e.object({burnStrategy:e.property("burn_strategy",ur.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",K.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",dr.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({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",N.optional()),expiryUnit:e.property("expiry_unit",K.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",Le.optional())});var sa=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",Se.optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.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:ye.optional()});var ca=e.object({burnStrategy:e.property("burn_strategy",ur.optional()),defaultExpiryUnit:e.property("default_expiry_unit",K.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",dr.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({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.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:ye.optional()});var pa=e.object({reason:Rr.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:V,params:Pp});var Ep=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Cp=e.object({data:V,params:Ep});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:V,params:Up});var kr=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:kr.optional()});var Op=e.object({data:V,params:Tp});var kp=e.object({bundleType:e.property("bundle_type",Se.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ye.optional()});var jp=e.object({data:V,params:kp});var rr=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",rr.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:V,params:Bp});var jr=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:jr.optional(),startTime:e.property("start_time",e.string().optional())});var Dp=e.object({data:V,params:Ap});var qp=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var Mp=e.object({data:Ue,params:e.record(e.string(),e.unknown())});var Ip=e.object({data:xe,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:F,params:Fp});var Lp=e.object({data:F,params:e.record(e.string(),e.unknown())});var Gp=e.object({data:xe,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:jr.optional(),startTime:e.property("start_time",e.string().optional())});var lt=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 pt=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var ut=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:pt.optional(),companyId:e.property("company_id",e.string()),credit:lt.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:ut.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 fr=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:W.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",Pe.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",Rr.optional())});var Zp=e.object({data:fr,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(Ue),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:kr.optional()});var iu=e.object({data:e.list(fr),params:ru});var tu=e.object({bundleType:e.property("bundle_type",Se.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ye.optional()});var ou=e.object({data:e.list(xe),params:tu});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",rr.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:pt.optional(),companyId:e.property("company_id",e.string()),credit:lt.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",rr),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),feature:ut.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",Rr.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(fr),params:cu});var pu=e.object({data:F,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:Ue,params:e.record(e.string(),e.unknown())});var mu=e.object({data:xe,params:e.record(e.string(),e.unknown())});var hu=e.object({data:fr,params:e.record(e.string(),e.unknown())});var ua=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 da=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",Z)});var ke=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 ma=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(ke).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",ge.optional()),priceTiers:e.property("price_tiers",e.list(ke).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ne.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",Z),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ke).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var ha=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 ga=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",Z)});var Eu=e.enum_(["all_time","current_month","current_week","current_day"]);var Cu=e.enum_(["first_of_month","billing_cycle"]);var ya=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",Eu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Cu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ke).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",ge.optional()),priceTiers:e.property("price_tiers",e.list(ke).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ne.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",Z),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ke).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:V,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:V,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:V,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:V,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:V,params:Au});var qu=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var Mu=e.object({data:re,params:e.record(e.string(),e.unknown())});var Iu=e.object({data:F,params:e.record(e.string(),e.unknown())});var Fu=e.object({data:F,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(re),skipped:e.list(Lu)});var Wu=e.object({data:Gu,params:e.record(e.string(),e.unknown())});var Hu=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var Nu=e.object({keys:e.record(e.string(),e.string()).optional()});var $u=e.object({data:Zr,params:Nu});var dt=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:dt.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",gr),limitValue:e.property("limit_value",e.number().optional()),planId:e.property("plan_id",e.string().optional()),priceBehavior:e.property("price_behavior",ge.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",ce),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:re,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 id=e.object({data:e.list(Ee),params:rd});var td=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var od=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(Nr).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",$r.optional())});var ad=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Z),company:$.optional(),companyOverride:e.property("company_override",Ee.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(Nr).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",od.optional()),creditUsageAggregation:e.property("credit_usage_aggregation",$r.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",gr),feature:ee.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",X.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:We.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",ge.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",X.optional())});var nd=e.object({data:e.list(ad),params:td});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(wr),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",Z),company:$.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",gr),feature:ee.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:We.optional(),usage:e.number().optional(),user:ot.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(re),params:dd});var hd=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var gd=e.object({data:re,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 ir=e.enum_(["flag_check","identify","track"]);var mt=e.object({body:Rd.optional(),eventType:e.property("event_type",ir),sentAt:e.property("sent_at",e.date().optional())});var wa=e.object({events:e.list(mt)});var ht=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(ht)});var _d=e.object({data:fd,params:e.record(e.string(),e.unknown())});var Sd=e.object({data:ht,params:e.record(e.string(),e.unknown())});var Pd=e.enum_(["enriched","failed","pending","processed","unknown"]);var gt=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:Jr.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(Jr),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:ir,updatedAt:e.property("updated_at",e.date().optional()),user:Jr.optional(),userId:e.property("user_id",e.string().optional())});var xd=e.object({data:gt,params:e.record(e.string(),e.unknown())});var Ed=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 Cd=e.object({data:e.list(Xi),params:Ed});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(ir).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(gt),params:Td});var zi=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var ba=e.object({contexts:e.list(zi)});var yt=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",yr),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var za=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ce),flag:yt.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",hr.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 Ra=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ce.optional()),flag:yt.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",hr.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 wt=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(wt),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(wt),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Dd.optional()),value:e.boolean()});var fa=e.object({rules:e.list(qd)});var bt=e.object({companyId:e.property("company_id",e.string().optional()),entitlement:Ji.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:bt,params:e.record(e.string(),e.unknown())});var zt=e.object({flags:e.list(bt)});var Id=e.object({data:e.list(zt)});var Fd=e.object({data:Id,params:e.record(e.string(),e.unknown())});var Kd=e.object({data:zt,params:e.record(e.string(),e.unknown())});var Ld=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(ce).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 Gd=e.object({data:V,params:Ld});var Wd=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 Hd=e.object({data:V,params:Wd});var Nd=e.object({data:ee,params:e.record(e.string(),e.unknown())});var $d=e.object({data:Ge,params:e.record(e.string(),e.unknown())});var Jd=e.object({data:F,params:e.record(e.string(),e.unknown())});var Zd=e.object({data:F,params:e.record(e.string(),e.unknown())});var Yd=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Qd=e.object({data:Ge,params:e.record(e.string(),e.unknown())});var Xd=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(ce).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 em=e.object({data:e.list(ee),params:Xd});var rm=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 im=e.object({data:e.list(Ge),params:rm});var tm=e.object({data:ee,params:e.record(e.string(),e.unknown())});var om=e.object({data:Ge,params:e.record(e.string(),e.unknown())});var am=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",yr),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 nm=e.object({flag:am.optional(),rules:e.list(it)});var sm=e.object({data:nm,params:e.record(e.string(),e.unknown())});var Rt=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",te)});var ft=e.stringLiteral("credit");var _t=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",ft.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.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",N.optional()),expiryUnit:e.property("expiry_unit",K.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",Pe),resetStart:e.property("reset_start",Le),resetType:e.property("reset_type",mr.optional())});var cm=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var St=e.enum_(["create","update","delete"]);var Pt=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",ft.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.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",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Pe),resetStart:e.property("reset_start",Le),resetType:e.property("reset_type",mr.optional())});var xt=e.object({action:St,createReq:e.property("create_req",_t.optional()),creditGrantId:e.property("credit_grant_id",e.string().optional()),deleteReq:e.property("delete_req",cm.optional()),updateReq:e.property("update_req",Pt.optional())});var lm=e.enum_(["all_time","current_month","current_week","current_day"]);var pm=e.enum_(["first_of_month","billing_cycle"]);var um=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",lm.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",pm.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ke).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",ge.optional()),priceTiers:e.property("price_tiers",e.list(ke).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ne.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",Z),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ke).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Et=e.object({action:St,entitlementId:e.property("entitlement_id",e.string().optional()),req:um.optional()});var ri=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",ve),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 _a=e.object({billingProduct:e.property("billing_product",ri.optional()),creditGrants:e.property("credit_grants",e.list(xt).optional()),entitlements:e.list(Et),plan:Rt.optional(),traits:e.list(Yr).optional()});var Ct=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Sa=e.object({billingProduct:e.property("billing_product",ri.optional()),creditGrants:e.property("credit_grants",e.list(xt).optional()),entitlements:e.list(Et),plan:Ct.optional(),planVersionId:e.property("plan_version_id",e.string().optional()),traits:e.list(Yr).optional()});var Ut=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",ve),controlledBy:e.property("controlled_by",He),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 vt=e.object({billingProduct:e.property("billing_product",Ut.optional()),creditGrants:e.property("credit_grants",e.list(Ue).optional()),entitlements:e.list(re).optional(),plan:We.optional(),traits:e.list(Te).optional()});var dm=e.object({data:vt,params:e.record(e.string(),e.unknown())});var mm=e.object({data:vt,params:e.record(e.string(),e.unknown())});var hm=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var tr=e.object({entitlements:e.list(hm).optional(),planId:e.property("plan_id",e.string())});var ii=e.object({bundleId:e.string()});var Tt=e.enum_(["create_prorations","invoice_immediately"]);var Ot=e.enum_(["end_of_billing_period","none"]);var Pa=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(zr).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",br.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(tr)),orderedBundleList:e.property("ordered_bundle_list",e.list(ii)),orderedPlans:e.property("ordered_plans",e.list(tr)),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",Tt),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",Ot.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 xa=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(zr).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",br.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(tr)),orderedBundleList:e.property("ordered_bundle_list",e.list(ii)),orderedPlans:e.property("ordered_plans",e.list(tr)),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",Tt),scheduledDowngradeBehavior:e.property("scheduled_downgrade_behavior",Ot.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 kt=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var gm=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var jt=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 Bt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(gm)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",kt),componentSettings:e.property("component_settings",jt),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(tr)),planIds:e.property("plan_ids",e.list(tr)),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 ym=e.object({data:Bt,params:e.record(e.string(),e.unknown())});var Vt=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 Br=e.object({activeVersion:e.property("active_version",ue.optional()),audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ke.optional()),chargeType:e.property("charge_type",ve),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",He),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",Vt.optional()),description:e.string(),draftVersion:e.property("draft_version",ue.optional()),entitlements:e.list(re),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ue).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",W.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",W.optional()),planType:e.property("plan_type",te),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(ue),yearlyPrice:e.property("yearly_price",W.optional())});var wm=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Ea=e.object({entitlements:e.list(wm).optional(),planId:e.property("plan_id",e.string())});var bm=e.object({addOns:e.property("add_ons",e.list(Br)),checkoutSettings:e.property("checkout_settings",kt),componentSettings:e.property("component_settings",jt),customPlanConfig:e.property("custom_plan_config",Vt.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",Br.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",Br.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",Br.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",X.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Ea)),orderedBundleList:e.property("ordered_bundle_list",e.list(ii)),orderedPlanList:e.property("ordered_plan_list",e.list(Ea)),plans:e.list(Br),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",Br.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",X.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var zm=e.object({data:bm,params:e.record(e.string(),e.unknown())});var Rm=e.object({data:Bt,params:e.record(e.string(),e.unknown())});var or=e.enum_(["completed","failed","in_progress","pending","skipped"]);var fm=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:or.optional()});var _m=e.object({data:V,params:fm});var ar=e.enum_(["completed","failed","in_progress","pending"]);var Sm=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:ar.optional()});var Pm=e.object({data:V,params:Sm});var At=e.enum_(["immediate","leave"]);var Dt=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:ar,strategy:At,totalCompanies:e.property("total_companies",e.number()),updatedAt:e.property("updated_at",e.date())});var xm=e.object({data:Dt,params:e.record(e.string(),e.unknown())});var Em=e.object({limit:e.number().optional(),migrationId:e.property("migration_id",e.string().optional()),offset:e.number().optional(),q:e.string().optional(),status:or.optional()});var Cm=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:or,updatedAt:e.property("updated_at",e.date())});var Um=e.object({data:e.list(Cm),params:Em});var vm=e.object({limit:e.number().optional(),offset:e.number().optional(),planVersionId:e.property("plan_version_id",e.string().optional()),status:ar.optional()});var Tm=e.object({data:e.list(Dt),params:vm});var Ca=e.object({excludedCompanyIds:e.property("excluded_company_ids",e.list(e.string())),migrationStrategy:e.property("migration_strategy",At)});var Ua=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Om=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(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",te.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 km=e.object({data:V,params:Om});var jm=e.object({data:we,params:e.record(e.string(),e.unknown())});var Bm=e.object({data:F,params:e.record(e.string(),e.unknown())});var Vm=e.object({data:F,params:e.record(e.string(),e.unknown())});var Am=e.object({planVersionId:e.property("plan_version_id",e.string().optional())});var Dm=e.object({data:we,params:Am});var qm=e.object({planId:e.property("plan_id",e.string().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var Mm=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var Im=e.object({data:e.list(Mm),params:qm});var Fm=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(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",te.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 Km=e.object({data:e.list(we),params:Fm});var Lm=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Gm=e.object({data:$,params:e.record(e.string(),e.unknown())});var Wm=e.object({data:we,params:e.record(e.string(),e.unknown())});var Hm=e.object({data:Ut,params:e.record(e.string(),e.unknown())});var va=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 _r=e.enum_(["cancelled","error","executing","pending","success"]);var Ta=e.object({executeAfter:e.property("execute_after",e.date().optional()),status:_r.optional()});var Sr=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:_r,toPlanId:e.property("to_plan_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Nm=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var $m=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var Jm=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),status:_r.optional()});var Zm=e.object({data:e.list(Sr),params:Jm});var Ym=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var ti=e.object({creditId:e.property("credit_id",e.string())});var oi=e.object({featureId:e.property("feature_id",e.string())});var Pr=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.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 Oa=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(ti).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(oi).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(Pr)),url:e.string()});var qt=e.enum_(["active","inactive"]);var ka=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(ti).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(oi).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(Pr).optional()),status:qt.optional(),url:e.string().optional()});var Qm=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 Xm=e.object({data:V,params:Qm});var eh=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var rh=e.object({data:V,params:eh});var $e=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(ti).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(oi).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(Pr)),secret:e.string(),status:qt,updatedAt:e.property("updated_at",e.date()),url:e.string()});var ih=e.object({data:$e,params:e.record(e.string(),e.unknown())});var th=e.object({data:F,params:e.record(e.string(),e.unknown())});var oh=e.enum_(["failure","pending","success"]);var Mt=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",Pr),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:oh,updatedAt:e.property("updated_at",e.date()),webhook:$e.optional(),webhookId:e.property("webhook_id",e.string())});var ah=e.object({data:Mt,params:e.record(e.string(),e.unknown())});var nh=e.object({data:$e,params:e.record(e.string(),e.unknown())});var sh=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 ch=e.object({data:e.list(Mt),params:sh});var lh=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ph=e.object({data:e.list($e),params:lh});var uh=e.object({data:$e,params:e.record(e.string(),e.unknown())});var n=e.object({error:e.string()});var dh=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var It=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var Ft=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var ja=e.object({addOnIds:e.property("add_on_ids",e.list(dh)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(It)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(Ft)),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 Ba=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",yr),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Va=e.object({keys:e.record(e.string(),e.string())});var mh=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var Aa=e.object({addOnSelections:e.property("add_on_selections",e.list(mh)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_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(It)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(Ft)),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 Da=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 qa=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 Ma=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 Kt=class{constructor(t){this._options=I(t)}issueTemporaryAccessToken(t,i){return f.fromPromise(this.__issueTemporaryAccessToken(t,i))}async __issueTemporaryAccessToken(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"temporary-access-tokens"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...Oo.jsonOrThrow(t,{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: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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/temporary-access-tokens")}};var Lt=class{constructor(t){this._options=I(t)}listApiKeys(t,i){return f.fromPromise(this.__listApiKeys(t,i))}async __listApiKeys(t,i){let{environmentId:o,requireEnvironment:s,limit:r,offset:a}=t,p={};o!=null&&(p.environment_id=o),p.require_environment=s.toString(),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"api-keys"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:ks.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/api-keys")}createApiKey(t,i){return f.fromPromise(this.__createApiKey(t,i))}async __createApiKey(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"api-keys"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ko.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/api-keys")}getApiKey(t,i){return f.fromPromise(this.__getApiKey(t,i))}async __getApiKey(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/api-keys/{api_key_id}")}updateApiKey(t,i={},o){return f.fromPromise(this.__updateApiKey(t,i,o))}async __updateApiKey(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Bo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Ms.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/api-keys/{api_key_id}")}deleteApiKey(t,i){return f.fromPromise(this.__deleteApiKey(t,i))}async __deleteApiKey(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`api-keys/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/api-keys/{api_key_id}")}countApiKeys(t,i){return f.fromPromise(this.__countApiKeys(t,i))}async __countApiKeys(t,i){let{environmentId:o,requireEnvironment:s,limit:r,offset:a}=t,p={};o!=null&&(p.environment_id=o),p.require_environment=s.toString(),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"api-keys/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:ys.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/api-keys/count")}listAuditLogs(t={},i){return f.fromPromise(this.__listAuditLogs(t,i))}async __listAuditLogs(t={},i){let{actorType:o,endTime:s,environmentId:r,q:a,startTime:p,limit:d,offset:m}=t,c={};o!=null&&(c.actor_type=_e.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(c.end_time=s.toISOString()),r!=null&&(c.environment_id=r),a!=null&&(c.q=a),p!=null&&(c.start_time=p.toISOString()),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"audit-log"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/audit-log")}getAuditLog(t,i){return f.fromPromise(this.__getAuditLog(t,i))}async __getAuditLog(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`audit-log/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(r.ok)return{data:Cs.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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/audit-log/{audit_log_id}")}countAuditLogs(t={},i){return f.fromPromise(this.__countAuditLogs(t,i))}async __countAuditLogs(t={},i){let{actorType:o,endTime:s,environmentId:r,q:a,startTime:p,limit:d,offset:m}=t,c={};o!=null&&(c.actor_type=_e.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(c.end_time=s.toISOString()),r!=null&&(c.environment_id=r),a!=null&&(c.q=a),p!=null&&(c.start_time=p.toISOString()),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"audit-log/count"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/audit-log/count")}listEnvironments(t={},i){return f.fromPromise(this.__listEnvironments(t,i))}async __listEnvironments(t={},i){let{ids:o,limit:s,offset:r}=t,a={};o!=null&&(Array.isArray(o)?a.ids=o.map(c=>c):a.ids=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"environments"),method:"GET",headers:d,queryParameters:{...a,...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:As.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/environments")}createEnvironment(t,i){return f.fromPromise(this.__createEnvironment(t,i))}async __createEnvironment(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"environments"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:jo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/environments")}getEnvironment(t,i){return f.fromPromise(this.__getEnvironment(t,i))}async __getEnvironment(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/environments/{environment_id}")}updateEnvironment(t,i={},o){return f.fromPromise(this.__updateEnvironment(t,i,o))}async __updateEnvironment(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Vo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Is.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/environments/{environment_id}")}deleteEnvironment(t,i){return f.fromPromise(this.__deleteEnvironment(t,i))}async __deleteEnvironment(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`environments/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/environments/{environment_id}")}quickstart(t){return f.fromPromise(this.__quickstart(t))}async __quickstart(t){let i=await this._options.authProvider.getAuthRequest(),o=_(i.headers,this._options?.headers,t?.headers),s=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"quickstart"),method:"POST",headers:o,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(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(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new U(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(n.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 v(s.error,s.rawResponse,"POST","/quickstart")}getWhoAmI(t){return f.fromPromise(this.__getWhoAmI(t))}async __getWhoAmI(t){let i=await this._options.authProvider.getAuthRequest(),o=_(i.headers,this._options?.headers,t?.headers),s=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"whoami"),method:"GET",headers:o,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(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 U(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(n.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 v(s.error,s.rawResponse,"GET","/whoami")}};var Gt=class{constructor(t){this._options=I(t)}listCoupons(t={},i){return f.fromPromise(this.__listCoupons(t,i))}async __listCoupons(t={},i){let{isActive:o,q:s,limit:r,offset:a}=t,p={};o!=null&&(p.is_active=o.toString()),s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/coupons"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:tc.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/coupons")}upsertBillingCoupon(t,i){return f.fromPromise(this.__upsertBillingCoupon(t,i))}async __upsertBillingCoupon(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/coupons"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Io.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/coupons")}upsertBillingCustomer(t,i){return f.fromPromise(this.__upsertBillingCustomer(t,i))}async __upsertBillingCustomer(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/customer/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ao.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/customer/upsert")}listCustomersWithSubscriptions(t={},i){return f.fromPromise(this.__listCustomersWithSubscriptions(t,i))}async __listCustomersWithSubscriptions(t={},i){let{companyIds:o,name:s,providerType:r,q:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.company_ids=o.map(b=>b):m.company_ids=o),s!=null&&(m.name=s),r!=null&&(m.provider_type=A.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(m.q=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/customers"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:sc.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/billing/customers")}countCustomers(t={},i){return f.fromPromise(this.__countCustomers(t,i))}async __countCustomers(t={},i){let{companyIds:o,name:s,providerType:r,q:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.company_ids=o.map(b=>b):m.company_ids=o),s!=null&&(m.name=s),r!=null&&(m.provider_type=A.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(m.q=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/customers/count"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:Ns.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/billing/customers/count")}listInvoices(t,i){return f.fromPromise(this.__listInvoices(t,i))}async __listInvoices(t,i){let{companyId:o,customerExternalId:s,subscriptionExternalId:r,limit:a,offset:p}=t,d={};o!=null&&(d.company_id=o),d.customer_external_id=s,d.subscription_external_id=r,a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/invoices"),method:"GET",headers:c,queryParameters:{...d,...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:lc.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/billing/invoices")}upsertInvoice(t,i){return f.fromPromise(this.__upsertInvoice(t,i))}async __upsertInvoice(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/invoices"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Fo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/invoices")}listMeters(t={},i){return f.fromPromise(this.__listMeters(t,i))}async __listMeters(t={},i){let{displayName:o,limit:s,offset:r}=t,a={};o!=null&&(a.display_name=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/meter"),method:"GET",headers:d,queryParameters:{...a,...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:uc.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/billing/meter")}upsertBillingMeter(t,i){return f.fromPromise(this.__upsertBillingMeter(t,i))}async __upsertBillingMeter(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/meter/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ko.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/meter/upsert")}listPaymentMethods(t,i){return f.fromPromise(this.__listPaymentMethods(t,i))}async __listPaymentMethods(t,i){let{companyId:o,customerExternalId:s,limit:r,offset:a}=t,p={};o!=null&&(p.company_id=o),p.customer_external_id=s,r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/payment-methods"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:mc.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/payment-methods")}upsertPaymentMethod(t,i){return f.fromPromise(this.__upsertPaymentMethod(t,i))}async __upsertPaymentMethod(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/payment-methods"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Lo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/payment-methods")}listBillingPrices(t={},i){return f.fromPromise(this.__listBillingPrices(t,i))}async __listBillingPrices(t={},i){let{forInitialPlan:o,forTrialExpiryPlan:s,ids:r,interval:a,isActive:p,price:d,productId:m,productIds:c,providerType:h,q:y,tiersMode:b,usageType:R,withMeter:O,limit:D,offset:B}=t,k={};o!=null&&(k.for_initial_plan=o.toString()),s!=null&&(k.for_trial_expiry_plan=s.toString()),r!=null&&(Array.isArray(r)?k.ids=r.map(je=>je):k.ids=r),a!=null&&(k.interval=a),p!=null&&(k.is_active=p.toString()),d!=null&&(k.price=d.toString()),m!=null&&(k.product_id=m),c!=null&&(Array.isArray(c)?k.product_ids=c.map(je=>je):k.product_ids=c),h!=null&&(k.provider_type=A.jsonOrThrow(h,{unrecognizedObjectKeys:"strip"})),y!=null&&(k.q=y),b!=null&&(k.tiers_mode=ne.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),R!=null&&(k.usage_type=Y.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})),O!=null&&(k.with_meter=O.toString()),D!=null&&(k.limit=D.toString()),B!=null&&(k.offset=B.toString());let me=await this._options.authProvider.getAuthRequest(),Ze=_(me.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/price"),method:"GET",headers:Ze,queryParameters:{...k,...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(j.ok)return{data:Ys.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(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new U(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new C(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new E(n.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 v(j.error,j.rawResponse,"GET","/billing/price")}upsertBillingPrice(t,i){return f.fromPromise(this.__upsertBillingPrice(t,i))}async __upsertBillingPrice(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/price/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Do.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/price/upsert")}deleteBillingProduct(t,i){return f.fromPromise(this.__deleteBillingProduct(t,i))}async __deleteBillingProduct(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/product/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/billing/product/{billing_id}")}listBillingProductPrices(t={},i){return f.fromPromise(this.__listBillingProductPrices(t,i))}async __listBillingProductPrices(t={},i){let{forInitialPlan:o,forTrialExpiryPlan:s,ids:r,interval:a,isActive:p,price:d,productId:m,productIds:c,providerType:h,q:y,tiersMode:b,usageType:R,withMeter:O,limit:D,offset:B}=t,k={};o!=null&&(k.for_initial_plan=o.toString()),s!=null&&(k.for_trial_expiry_plan=s.toString()),r!=null&&(Array.isArray(r)?k.ids=r.map(je=>je):k.ids=r),a!=null&&(k.interval=a),p!=null&&(k.is_active=p.toString()),d!=null&&(k.price=d.toString()),m!=null&&(k.product_id=m),c!=null&&(Array.isArray(c)?k.product_ids=c.map(je=>je):k.product_ids=c),h!=null&&(k.provider_type=A.jsonOrThrow(h,{unrecognizedObjectKeys:"strip"})),y!=null&&(k.q=y),b!=null&&(k.tiers_mode=ne.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),R!=null&&(k.usage_type=Y.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})),O!=null&&(k.with_meter=O.toString()),D!=null&&(k.limit=D.toString()),B!=null&&(k.offset=B.toString());let me=await this._options.authProvider.getAuthRequest(),Ze=_(me.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/product/prices"),method:"GET",headers:Ze,queryParameters:{...k,...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(j.ok)return{data:Xs.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(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new U(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new C(n.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new E(n.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 v(j.error,j.rawResponse,"GET","/billing/product/prices")}deleteProductPrice(t,i){return f.fromPromise(this.__deleteProductPrice(t,i))}async __deleteProductPrice(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/product/prices/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/billing/product/prices/{billing_id}")}upsertBillingProduct(t,i){return f.fromPromise(this.__upsertBillingProduct(t,i))}async __upsertBillingProduct(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/product/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/product/upsert")}listBillingProducts(t={},i){return f.fromPromise(this.__listBillingProducts(t,i))}async __listBillingProducts(t={},i){let{ids:o,isActive:s,name:r,priceUsageType:a,providerType:p,q:d,withOneTimeCharges:m,withPricesOnly:c,withZeroPrice:h,withoutLinkedToPlan:y,limit:b,offset:R}=t,O={};o!=null&&(Array.isArray(o)?O.ids=o.map(me=>me):O.ids=o),s!=null&&(O.is_active=s.toString()),r!=null&&(O.name=r),a!=null&&(O.price_usage_type=Y.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.provider_type=A.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(O.q=d),m!=null&&(O.with_one_time_charges=m.toString()),c!=null&&(O.with_prices_only=c.toString()),h!=null&&(O.with_zero_price=h.toString()),y!=null&&(O.without_linked_to_plan=y.toString()),b!=null&&(O.limit=b.toString()),R!=null&&(O.offset=R.toString());let D=await this._options.authProvider.getAuthRequest(),B=_(D.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/products"),method:"GET",headers:B,queryParameters:{...O,...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(k.ok)return{data:rc.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(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(n.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 v(k.error,k.rawResponse,"GET","/billing/products")}countBillingProducts(t={},i){return f.fromPromise(this.__countBillingProducts(t,i))}async __countBillingProducts(t={},i){let{ids:o,isActive:s,name:r,priceUsageType:a,providerType:p,q:d,withOneTimeCharges:m,withPricesOnly:c,withZeroPrice:h,withoutLinkedToPlan:y,limit:b,offset:R}=t,O={};o!=null&&(Array.isArray(o)?O.ids=o.map(me=>me):O.ids=o),s!=null&&(O.is_active=s.toString()),r!=null&&(O.name=r),a!=null&&(O.price_usage_type=Y.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.provider_type=A.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(O.q=d),m!=null&&(O.with_one_time_charges=m.toString()),c!=null&&(O.with_prices_only=c.toString()),h!=null&&(O.with_zero_price=h.toString()),y!=null&&(O.without_linked_to_plan=y.toString()),b!=null&&(O.limit=b.toString()),R!=null&&(O.offset=R.toString());let D=await this._options.authProvider.getAuthRequest(),B=_(D.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/products/count"),method:"GET",headers:B,queryParameters:{...O,...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(k.ok)return{data:Ws.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(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(n.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 v(k.error,k.rawResponse,"GET","/billing/products/count")}upsertBillingSubscription(t,i){return f.fromPromise(this.__upsertBillingSubscription(t,i))}async __upsertBillingSubscription(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/subscription/upsert"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Mo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/subscription/upsert")}};var Wt=class{constructor(t){this._options=I(t)}internal(t,i){return f.fromPromise(this.__internal(t,i))}async __internal(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"checkout-internal"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/checkout-internal")}getCheckoutData(t,i){return f.fromPromise(this.__getCheckoutData(t,i))}async __getCheckoutData(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"checkout-internal/data"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Wo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/checkout-internal/data")}previewCheckoutInternal(t,i){return f.fromPromise(this.__previewCheckoutInternal(t,i))}async __previewCheckoutInternal(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"checkout-internal/preview"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/checkout-internal/preview")}managePlan(t,i){return f.fromPromise(this.__managePlan(t,i))}async __managePlan(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"manage-plan"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Aa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/manage-plan")}previewManagePlan(t,i){return f.fromPromise(this.__previewManagePlan(t,i))}async __previewManagePlan(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"manage-plan/preview"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Aa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/manage-plan/preview")}cancelSubscription(t,i){return f.fromPromise(this.__cancelSubscription(t,i))}async __cancelSubscription(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"manage-plan/subscription/cancel"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Go.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/manage-plan/subscription/cancel")}updateCustomerSubscriptionTrialEnd(t,i={},o){return f.fromPromise(this.__updateCustomerSubscriptionTrialEnd(t,i,o))}async __updateCustomerSubscriptionTrialEnd(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`subscription/${w.encodePathParam(t)}/edit-trial-end`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ho.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Yc.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/subscription/{subscription_id}/edit-trial-end")}};var Ht=class{constructor(t){this._options=I(t)}listCompanies(t={},i){return f.fromPromise(this.__listCompanies(t,i))}async __listCompanies(t={},i){let{creditTypeIds:o,ids:s,monetizedSubscriptions:r,planId:a,planIds:p,planVersionId:d,q:m,sortOrderColumn:c,sortOrderDirection:h,subscriptionStatuses:y,subscriptionTypes:b,withEntitlementFor:R,withoutFeatureOverrideFor:O,withoutPlan:D,withoutSubscription:B,withSubscription:k,limit:me,offset:Ze}=t,j={};o!=null&&(Array.isArray(o)?j.credit_type_ids=o.map(oe=>oe):j.credit_type_ids=o),s!=null&&(Array.isArray(s)?j.ids=s.map(oe=>oe):j.ids=s),r!=null&&(j.monetized_subscriptions=r.toString()),a!=null&&(j.plan_id=a),p!=null&&(Array.isArray(p)?j.plan_ids=p.map(oe=>oe):j.plan_ids=p),d!=null&&(j.plan_version_id=d),m!=null&&(j.q=m),c!=null&&(j.sort_order_column=c),h!=null&&(j.sort_order_direction=fe.jsonOrThrow(h,{unrecognizedObjectKeys:"strip"})),y!=null&&(Array.isArray(y)?j.subscription_statuses=y.map(oe=>Xe.jsonOrThrow(oe,{unrecognizedObjectKeys:"strip"})):j.subscription_statuses=Xe.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),b!=null&&(Array.isArray(b)?j.subscription_types=b.map(oe=>er.jsonOrThrow(oe,{unrecognizedObjectKeys:"strip"})):j.subscription_types=er.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),R!=null&&(j.with_entitlement_for=R),O!=null&&(j.without_feature_override_for=O),D!=null&&(j.without_plan=D.toString()),B!=null&&(j.without_subscription=B.toString()),k!=null&&(j.with_subscription=k.toString()),me!=null&&(j.limit=me.toString()),Ze!=null&&(j.offset=Ze.toString());let je=await this._options.authProvider.getAuthRequest(),yo=_(je.headers,this._options?.headers,i?.headers),M=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies"),method:"GET",headers:yo,queryParameters:{...j,...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: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(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new U(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new x(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new C(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new E(n.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 v(M.error,M.rawResponse,"GET","/companies")}upsertCompany(t,i){return f.fromPromise(this.__upsertCompany(t,i))}async __upsertCompany(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Da.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/companies")}getCompany(t,i){return f.fromPromise(this.__getCompany(t,i))}async __getCompany(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`companies/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/companies/{company_id}")}deleteCompany(t,i={},o){return f.fromPromise(this.__deleteCompany(t,i,o))}async __deleteCompany(t,i={},o){let{cancelSubscription:s,prorate:r}=i,a={};s!=null&&(a.cancel_subscription=s.toString()),r!=null&&(a.prorate=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,o?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`companies/${w.encodePathParam(t)}`),method:"DELETE",headers:d,queryParameters:{...a,...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(m.ok)return{data:hl.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"DELETE","/companies/{company_id}")}countCompanies(t={},i){return f.fromPromise(this.__countCompanies(t,i))}async __countCompanies(t={},i){let{creditTypeIds:o,ids:s,monetizedSubscriptions:r,planId:a,planIds:p,planVersionId:d,q:m,sortOrderColumn:c,sortOrderDirection:h,subscriptionStatuses:y,subscriptionTypes:b,withEntitlementFor:R,withoutFeatureOverrideFor:O,withoutPlan:D,withoutSubscription:B,withSubscription:k,limit:me,offset:Ze}=t,j={};o!=null&&(Array.isArray(o)?j.credit_type_ids=o.map(oe=>oe):j.credit_type_ids=o),s!=null&&(Array.isArray(s)?j.ids=s.map(oe=>oe):j.ids=s),r!=null&&(j.monetized_subscriptions=r.toString()),a!=null&&(j.plan_id=a),p!=null&&(Array.isArray(p)?j.plan_ids=p.map(oe=>oe):j.plan_ids=p),d!=null&&(j.plan_version_id=d),m!=null&&(j.q=m),c!=null&&(j.sort_order_column=c),h!=null&&(j.sort_order_direction=fe.jsonOrThrow(h,{unrecognizedObjectKeys:"strip"})),y!=null&&(Array.isArray(y)?j.subscription_statuses=y.map(oe=>Xe.jsonOrThrow(oe,{unrecognizedObjectKeys:"strip"})):j.subscription_statuses=Xe.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),b!=null&&(Array.isArray(b)?j.subscription_types=b.map(oe=>er.jsonOrThrow(oe,{unrecognizedObjectKeys:"strip"})):j.subscription_types=er.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),R!=null&&(j.with_entitlement_for=R),O!=null&&(j.without_feature_override_for=O),D!=null&&(j.without_plan=D.toString()),B!=null&&(j.without_subscription=B.toString()),k!=null&&(j.with_subscription=k.toString()),me!=null&&(j.limit=me.toString()),Ze!=null&&(j.offset=Ze.toString());let je=await this._options.authProvider.getAuthRequest(),yo=_(je.headers,this._options?.headers,i?.headers),M=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies/count"),method:"GET",headers:yo,queryParameters:{...j,...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: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(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 401:throw new U(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 403:throw new x(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 404:throw new C(n.parseOrThrow(M.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),M.rawResponse);case 500:throw new E(n.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 v(M.error,M.rawResponse,"GET","/companies/count")}createCompany(t,i){return f.fromPromise(this.__createCompany(t,i))}async __createCompany(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies/create"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Da.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/companies/create")}deleteCompanyByKeys(t,i){return f.fromPromise(this.__deleteCompanyByKeys(t,i))}async __deleteCompanyByKeys(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies/delete"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/companies/delete")}lookupCompany(t,i){return f.fromPromise(this.__lookupCompany(t,i))}async __lookupCompany(t,i){let{keys:o}=t,s={};s.keys=be(o);let r=await this._options.authProvider.getAuthRequest(),a=_(r.headers,this._options?.headers,i?.headers),p=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"companies/lookup"),method:"GET",headers:a,queryParameters:{...s,...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(p.ok)return{data:Jl.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 401:throw new U(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new C(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new E(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new z({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}return v(p.error,p.rawResponse,"GET","/companies/lookup")}listCompanyMemberships(t={},i){return f.fromPromise(this.__listCompanyMemberships(t,i))}async __listCompanyMemberships(t={},i){let{companyId:o,userId:s,limit:r,offset:a}=t,p={};o!=null&&(p.company_id=o),s!=null&&(p.user_id=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-memberships"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Dl.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/company-memberships")}getOrCreateCompanyMembership(t,i){return f.fromPromise(this.__getOrCreateCompanyMembership(t,i))}async __getOrCreateCompanyMembership(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-memberships"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Yo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/company-memberships")}deleteCompanyMembership(t,i){return f.fromPromise(this.__deleteCompanyMembership(t,i))}async __deleteCompanyMembership(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`company-memberships/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/company-memberships/{company_membership_id}")}getActiveCompanySubscription(t={},i){return f.fromPromise(this.__getActiveCompanySubscription(t,i))}async __getActiveCompanySubscription(t={},i){let{companyId:o,companyIds:s,limit:r,offset:a}=t,p={};o!=null&&(p.company_id=o),s!=null&&(Array.isArray(s)?p.company_ids=s.map(h=>h):p.company_ids=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-subscriptions"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:zl.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/company-subscriptions")}upsertCompanyTrait(t,i){return f.fromPromise(this.__upsertCompanyTrait(t,i))}async __upsertCompanyTrait(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/company-traits")}listEntityKeyDefinitions(t={},i){return f.fromPromise(this.__listEntityKeyDefinitions(t,i))}async __listEntityKeyDefinitions(t={},i){let{entityType:o,ids:s,q:r,limit:a,offset:p}=t,d={};o!=null&&(d.entity_type=J.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?d.ids=s.map(y=>y):d.ids=s),r!=null&&(d.q=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-key-definitions"),method:"GET",headers:c,queryParameters:{...d,...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:Ml.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/entity-key-definitions")}countEntityKeyDefinitions(t={},i){return f.fromPromise(this.__countEntityKeyDefinitions(t,i))}async __countEntityKeyDefinitions(t={},i){let{entityType:o,ids:s,q:r,limit:a,offset:p}=t,d={};o!=null&&(d.entity_type=J.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?d.ids=s.map(y=>y):d.ids=s),r!=null&&(d.q=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-key-definitions/count"),method:"GET",headers:c,queryParameters:{...d,...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:rl.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/entity-key-definitions/count")}listEntityTraitDefinitions(t={},i){return f.fromPromise(this.__listEntityTraitDefinitions(t,i))}async __listEntityTraitDefinitions(t={},i){let{entityType:o,ids:s,q:r,traitType:a,traitTypes:p,limit:d,offset:m}=t,c={};o!=null&&(c.entity_type=J.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?c.ids=s.map(R=>R):c.ids=s),r!=null&&(c.q=r),a!=null&&(c.trait_type=ie.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(Array.isArray(p)?c.trait_types=p.map(R=>ie.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})):c.trait_types=ie.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-trait-definitions"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/entity-trait-definitions")}getOrCreateEntityTraitDefinition(t,i){return f.fromPromise(this.__getOrCreateEntityTraitDefinition(t,i))}async __getOrCreateEntityTraitDefinition(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-trait-definitions"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Jo.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(r.ok)return{data:El.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/entity-trait-definitions")}getEntityTraitDefinition(t,i){return f.fromPromise(this.__getEntityTraitDefinition(t,i))}async __getEntityTraitDefinition(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`entity-trait-definitions/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/entity-trait-definitions/{entity_trait_definition_id}")}updateEntityTraitDefinition(t,i,o){return f.fromPromise(this.__updateEntityTraitDefinition(t,i,o))}async __updateEntityTraitDefinition(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`entity-trait-definitions/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Qo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Ql.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/entity-trait-definitions/{entity_trait_definition_id}")}countEntityTraitDefinitions(t={},i){return f.fromPromise(this.__countEntityTraitDefinitions(t,i))}async __countEntityTraitDefinitions(t={},i){let{entityType:o,ids:s,q:r,traitType:a,traitTypes:p,limit:d,offset:m}=t,c={};o!=null&&(c.entity_type=J.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?c.ids=s.map(R=>R):c.ids=s),r!=null&&(c.q=r),a!=null&&(c.trait_type=ie.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(Array.isArray(p)?c.trait_types=p.map(R=>ie.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})):c.trait_types=ie.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-trait-definitions/count"),method:"GET",headers:y,queryParameters:{...c,...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(b.ok)return{data:tl.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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/entity-trait-definitions/count")}getEntityTraitValues(t,i){return f.fromPromise(this.__getEntityTraitValues(t,i))}async __getEntityTraitValues(t,i){let{definitionId:o,q:s,limit:r,offset:a}=t,p={};p.definition_id=o,s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"entity-trait-values"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Pl.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/entity-trait-values")}listPlanChanges(t={},i){return f.fromPromise(this.__listPlanChanges(t,i))}async __listPlanChanges(t={},i){let{action:o,basePlanAction:s,companyId:r,companyIds:a,planIds:p,limit:d,offset:m}=t,c={};o!=null&&(c.action=o),s!=null&&(c.base_plan_action=s),r!=null&&(c.company_id=r),a!=null&&(Array.isArray(a)?c.company_ids=a.map(R=>R):c.company_ids=a),p!=null&&(Array.isArray(p)?c.plan_ids=p.map(R=>R):c.plan_ids=p),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-changes"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/plan-changes")}getPlanChange(t,i){return f.fromPromise(this.__getPlanChange(t,i))}async __getPlanChange(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-changes/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/plan-changes/{plan_change_id}")}listPlanTraits(t={},i){return f.fromPromise(this.__listPlanTraits(t,i))}async __listPlanTraits(t={},i){let{ids:o,planId:s,traitId:r,traitIds:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.ids=o.map(b=>b):m.ids=o),s!=null&&(m.plan_id=s),r!=null&&(m.trait_id=r),a!=null&&(Array.isArray(a)?m.trait_ids=a.map(b=>b):m.trait_ids=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-traits"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:Wl.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/plan-traits")}createPlanTrait(t,i){return f.fromPromise(this.__createPlanTrait(t,i))}async __createPlanTrait(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Zo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-traits")}getPlanTrait(t,i){return f.fromPromise(this.__getPlanTrait(t,i))}async __getPlanTrait(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/plan-traits/{plan_trait_id}")}updatePlanTrait(t,i,o){return f.fromPromise(this.__updatePlanTrait(t,i,o))}async __updatePlanTrait(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ea.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Xl.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plan-traits/{plan_trait_id}")}deletePlanTrait(t,i){return f.fromPromise(this.__deletePlanTrait(t,i))}async __deletePlanTrait(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-traits/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/plan-traits/{plan_trait_id}")}updatePlanTraitsBulk(t,i){return f.fromPromise(this.__updatePlanTraitsBulk(t,i))}async __updatePlanTraitsBulk(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-traits/bulk"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Xo.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-traits/bulk")}countPlanTraits(t={},i){return f.fromPromise(this.__countPlanTraits(t,i))}async __countPlanTraits(t={},i){let{ids:o,planId:s,traitId:r,traitIds:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.ids=o.map(b=>b):m.ids=o),s!=null&&(m.plan_id=s),r!=null&&(m.trait_id=r),a!=null&&(Array.isArray(a)?m.trait_ids=a.map(b=>b):m.trait_ids=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-traits/count"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:al.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/plan-traits/count")}upsertUserTrait(t,i){return f.fromPromise(this.__upsertUserTrait(t,i))}async __upsertUserTrait(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"user-traits"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:qa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/user-traits")}listUsers(t={},i){return f.fromPromise(this.__listUsers(t,i))}async __listUsers(t={},i){let{companyId:o,ids:s,planId:r,q:a,limit:p,offset:d}=t,m={};o!=null&&(m.company_id=o),s!=null&&(Array.isArray(s)?m.ids=s.map(b=>b):m.ids=s),r!=null&&(m.plan_id=r),a!=null&&(m.q=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users"),method:"GET",headers:h,queryParameters:{...m,...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(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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/users")}upsertUser(t,i){return f.fromPromise(this.__upsertUser(t,i))}async __upsertUser(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ma.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/users")}getUser(t,i){return f.fromPromise(this.__getUser(t,i))}async __getUser(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`users/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/users/{user_id}")}deleteUser(t,i){return f.fromPromise(this.__deleteUser(t,i))}async __deleteUser(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`users/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/users/{user_id}")}countUsers(t={},i){return f.fromPromise(this.__countUsers(t,i))}async __countUsers(t={},i){let{companyId:o,ids:s,planId:r,q:a,limit:p,offset:d}=t,m={};o!=null&&(m.company_id=o),s!=null&&(Array.isArray(s)?m.ids=s.map(b=>b):m.ids=s),r!=null&&(m.plan_id=r),a!=null&&(m.q=a),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users/count"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:sl.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/users/count")}createUser(t,i){return f.fromPromise(this.__createUser(t,i))}async __createUser(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users/create"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ma.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/users/create")}deleteUserByKeys(t,i){return f.fromPromise(this.__deleteUserByKeys(t,i))}async __deleteUserByKeys(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users/delete"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/users/delete")}lookupUser(t,i){return f.fromPromise(this.__lookupUser(t,i))}async __lookupUser(t,i){let{keys:o}=t,s={};s.keys=be(o);let r=await this._options.authProvider.getAuthRequest(),a=_(r.headers,this._options?.headers,i?.headers),p=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"users/lookup"),method:"GET",headers:a,queryParameters:{...s,...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(p.ok)return{data:Yl.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 401:throw new U(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new C(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new E(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new z({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}return v(p.error,p.rawResponse,"GET","/users/lookup")}};var Nt=class{constructor(t){this._options=I(t)}listComponents(t={},i){return f.fromPromise(this.__listComponents(t,i))}async __listComponents(t={},i){let{q:o,limit:s,offset:r}=t,a={};o!=null&&(a.q=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"components"),method:"GET",headers:d,queryParameters:{...a,...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:up.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/components")}createComponent(t,i){return f.fromPromise(this.__createComponent(t,i))}async __createComponent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"components"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/components")}getComponent(t,i){return f.fromPromise(this.__getComponent(t,i))}async __getComponent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`components/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/components/{component_id}")}updateComponent(t,i={},o){return f.fromPromise(this.__updateComponent(t,i,o))}async __updateComponent(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`components/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ia.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:fp.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/components/{component_id}")}deleteComponent(t,i){return f.fromPromise(this.__deleteComponent(t,i))}async __deleteComponent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`components/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/components/{component_id}")}countComponents(t={},i){return f.fromPromise(this.__countComponents(t,i))}async __countComponents(t={},i){let{q:o,limit:s,offset:r}=t,a={};o!=null&&(a.q=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"components/count"),method:"GET",headers:d,queryParameters:{...a,...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:np.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/components/count")}previewComponentData(t={},i){return f.fromPromise(this.__previewComponentData(t,i))}async __previewComponentData(t={},i){let{companyId:o,componentId:s}=t,r={};o!=null&&(r.company_id=o),s!=null&&(r.component_id=s);let a=await this._options.authProvider.getAuthRequest(),p=_(a.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"components/preview-data"),method:"GET",headers:p,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(d.ok)return{data:Rp.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 U(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return v(d.error,d.rawResponse,"GET","/components/preview-data")}};var $t=class{constructor(t){this._options=I(t)}getPublicPlans(t){return f.fromPromise(this.__getPublicPlans(t))}async __getPublicPlans(t){let i=await this._options.authProvider.getAuthRequest(),o=_(i.headers,this._options?.headers,t?.headers),s=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"public/plans"),method:"GET",headers:o,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(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 U(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(n.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 v(s.error,s.rawResponse,"GET","/public/plans")}};var Jt=class{constructor(t){this._options=I(t)}listBillingCredits(t={},i){return f.fromPromise(this.__listBillingCredits(t,i))}async __listBillingCredits(t={},i){let{ids:o,name:s,limit:r,offset:a}=t,p={};o!=null&&(Array.isArray(o)?p.ids=o.map(h=>h):p.ids=o),s!=null&&(p.name=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Qp.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/credits")}createBillingCredit(t,i){return f.fromPromise(this.__createBillingCredit(t,i))}async __createBillingCredit(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:aa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/credits")}getSingleBillingCredit(t,i){return f.fromPromise(this.__getSingleBillingCredit(t,i))}async __getSingleBillingCredit(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/billing/credits/{credit_id}")}updateBillingCredit(t,i,o){return f.fromPromise(this.__updateBillingCredit(t,i,o))}async __updateBillingCredit(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ca.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:uu.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/billing/credits/{credit_id}")}softDeleteBillingCredit(t,i){return f.fromPromise(this.__softDeleteBillingCredit(t,i))}async __softDeleteBillingCredit(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/billing/credits/{credit_id}")}listCreditBundles(t={},i){return f.fromPromise(this.__listCreditBundles(t,i))}async __listCreditBundles(t={},i){let{ids:o,creditId:s,status:r,bundleType:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.ids=o.map(b=>b):m.ids=o),s!=null&&(m.credit_id=s),r!=null&&(m.status=ye.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(m.bundle_type=Se.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/bundles"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:ou.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/billing/credits/bundles")}createCreditBundle(t,i){return f.fromPromise(this.__createCreditBundle(t,i))}async __createCreditBundle(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/bundles"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/credits/bundles")}getCreditBundle(t,i){return f.fromPromise(this.__getCreditBundle(t,i))}async __getCreditBundle(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/billing/credits/bundles/{bundle_id}")}updateCreditBundleDetails(t,i,o){return f.fromPromise(this.__updateCreditBundleDetails(t,i,o))}async __updateCreditBundleDetails(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:la.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:mu.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/billing/credits/bundles/{bundle_id}")}deleteCreditBundle(t,i){return f.fromPromise(this.__deleteCreditBundle(t,i))}async __deleteCreditBundle(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/bundles/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/billing/credits/bundles/{bundle_id}")}countCreditBundles(t={},i){return f.fromPromise(this.__countCreditBundles(t,i))}async __countCreditBundles(t={},i){let{ids:o,creditId:s,status:r,bundleType:a,limit:p,offset:d}=t,m={};o!=null&&(Array.isArray(o)?m.ids=o.map(b=>b):m.ids=o),s!=null&&(m.credit_id=s),r!=null&&(m.status=ye.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(m.bundle_type=Se.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(m.limit=p.toString()),d!=null&&(m.offset=d.toString());let c=await this._options.authProvider.getAuthRequest(),h=_(c.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/bundles/count"),method:"GET",headers:h,queryParameters:{...m,...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(y.ok)return{data:jp.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(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new U(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new C(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new E(n.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new z({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}return v(y.error,y.rawResponse,"GET","/billing/credits/bundles/count")}countBillingCredits(t={},i){return f.fromPromise(this.__countBillingCredits(t,i))}async __countBillingCredits(t={},i){let{ids:o,name:s,limit:r,offset:a}=t,p={};o!=null&&(Array.isArray(o)?p.ids=o.map(h=>h):p.ids=o),s!=null&&(p.name=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Cp.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/credits/count")}zeroOutGrant(t,i={},o){return f.fromPromise(this.__zeroOutGrant(t,i,o))}async __zeroOutGrant(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/grants/${w.encodePathParam(t)}/zero-out`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:pa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:hu.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/billing/credits/grants/{grant_id}/zero-out")}grantBillingCreditsToCompany(t,i){return f.fromPromise(this.__grantBillingCreditsToCompany(t,i))}async __grantBillingCreditsToCompany(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/grants/company"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:na.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/credits/grants/company")}countCompanyGrants(t={},i){return f.fromPromise(this.__countCompanyGrants(t,i))}async __countCompanyGrants(t={},i){let{companyId:o,order:s,dir:r,limit:a,offset:p}=t,d={};o!=null&&(d.company_id=o),s!=null&&(d.order=kr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),r!=null&&(d.dir=fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/grants/company/count"),method:"GET",headers:c,queryParameters:{...d,...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:Op.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/billing/credits/grants/company/count")}listCompanyGrants(t={},i){return f.fromPromise(this.__listCompanyGrants(t,i))}async __listCompanyGrants(t={},i){let{companyId:o,order:s,dir:r,limit:a,offset:p}=t,d={};o!=null&&(d.company_id=o),s!=null&&(d.order=kr.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),r!=null&&(d.dir=fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/grants/company/list"),method:"GET",headers:c,queryParameters:{...d,...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:iu.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/billing/credits/grants/company/list")}countBillingCreditsGrants(t={},i){return f.fromPromise(this.__countBillingCreditsGrants(t,i))}async __countBillingCreditsGrants(t={},i){let{creditId:o,ids:s,limit:r,offset:a}=t,p={};o!=null&&(p.credit_id=o),s!=null&&(Array.isArray(s)?p.ids=s.map(h=>h):p.ids=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/grants/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:xp.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/credits/grants/count")}listGrantsForCredit(t={},i){return f.fromPromise(this.__listGrantsForCredit(t,i))}async __listGrantsForCredit(t={},i){let{creditId:o,ids:s,limit:r,offset:a}=t,p={};o!=null&&(p.credit_id=o),s!=null&&(Array.isArray(s)?p.ids=s.map(h=>h):p.ids=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/grants/list"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:lu.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/billing/credits/grants/list")}getEnrichedCreditLedger(t,i){return f.fromPromise(this.__getEnrichedCreditLedger(t,i))}async __getEnrichedCreditLedger(t,i){let{companyId:o,billingCreditId:s,featureId:r,period:a,startTime:p,endTime:d,limit:m,offset:c}=t,h={};h.company_id=o,s!=null&&(h.billing_credit_id=s),r!=null&&(h.feature_id=r),h.period=jr.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"}),p!=null&&(h.start_time=p),d!=null&&(h.end_time=d),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/ledger"),method:"GET",headers:b,queryParameters:{...h,...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(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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/billing/credits/ledger")}countCreditLedger(t,i){return f.fromPromise(this.__countCreditLedger(t,i))}async __countCreditLedger(t,i){let{companyId:o,billingCreditId:s,featureId:r,period:a,startTime:p,endTime:d,limit:m,offset:c}=t,h={};h.company_id=o,s!=null&&(h.billing_credit_id=s),r!=null&&(h.feature_id=r),h.period=jr.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"}),p!=null&&(h.start_time=p),d!=null&&(h.end_time=d),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/ledger/count"),method:"GET",headers:b,queryParameters:{...h,...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(R.ok)return{data:Dp.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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/billing/credits/ledger/count")}listBillingPlanCreditGrants(t={},i){return f.fromPromise(this.__listBillingPlanCreditGrants(t,i))}async __listBillingPlanCreditGrants(t={},i){let{creditId:o,ids:s,planId:r,planIds:a,planVersionId:p,limit:d,offset:m}=t,c={};o!=null&&(c.credit_id=o),s!=null&&(Array.isArray(s)?c.ids=s.map(R=>R):c.ids=s),r!=null&&(c.plan_id=r),a!=null&&(Array.isArray(a)?c.plan_ids=a.map(R=>R):c.plan_ids=a),p!=null&&(c.plan_version_id=p),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/plan-grants"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/billing/credits/plan-grants")}createBillingPlanCreditGrant(t,i){return f.fromPromise(this.__createBillingPlanCreditGrant(t,i))}async __createBillingPlanCreditGrant(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/plan-grants"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/billing/credits/plan-grants")}updateBillingPlanCreditGrant(t,i,o){return f.fromPromise(this.__updateBillingPlanCreditGrant(t,i,o))}async __updateBillingPlanCreditGrant(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/plan-grants/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Pt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:du.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/billing/credits/plan-grants/{plan_grant_id}")}deleteBillingPlanCreditGrant(t,i={},o){return f.fromPromise(this.__deleteBillingPlanCreditGrant(t,i,o))}async __deleteBillingPlanCreditGrant(t,i={},o){let{applyToExisting:s}=i,r={};s!=null&&(r.apply_to_existing=s.toString());let a=await this._options.authProvider.getAuthRequest(),p=_(a.headers,this._options?.headers,o?.headers),d=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`billing/credits/plan-grants/${w.encodePathParam(t)}`),method:"DELETE",headers:p,queryParameters:{...r,...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(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 400:throw new T(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return v(d.error,d.rawResponse,"DELETE","/billing/credits/plan-grants/{plan_grant_id}")}countBillingPlanCreditGrants(t={},i){return f.fromPromise(this.__countBillingPlanCreditGrants(t,i))}async __countBillingPlanCreditGrants(t={},i){let{creditId:o,ids:s,planId:r,planIds:a,planVersionId:p,limit:d,offset:m}=t,c={};o!=null&&(c.credit_id=o),s!=null&&(Array.isArray(s)?c.ids=s.map(R=>R):c.ids=s),r!=null&&(c.plan_id=r),a!=null&&(Array.isArray(a)?c.plan_ids=a.map(R=>R):c.plan_ids=a),p!=null&&(c.plan_version_id=p),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"billing/credits/plan-grants/count"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/billing/credits/plan-grants/count")}listCreditEventLedger(t,i){return f.fromPromise(this.__listCreditEventLedger(t,i))}async __listCreditEventLedger(t,i){let{billingCreditId:o,companyId:s,endTime:r,eventType:a,featureId:p,startTime:d,limit:m,offset:c}=t,h={};o!=null&&(h.billing_credit_id=o),h.company_id=s,r!=null&&(h.end_time=r),a!=null&&(h.event_type=rr.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(h.feature_id=p),d!=null&&(h.start_time=d),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"v2/billing/credits/ledger"),method:"GET",headers:b,queryParameters:{...h,...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(R.ok)return{data:su.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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/v2/billing/credits/ledger")}countCreditEventLedger(t,i){return f.fromPromise(this.__countCreditEventLedger(t,i))}async __countCreditEventLedger(t,i){let{billingCreditId:o,companyId:s,endTime:r,eventType:a,featureId:p,startTime:d,limit:m,offset:c}=t,h={};o!=null&&(h.billing_credit_id=o),h.company_id=s,r!=null&&(h.end_time=r),a!=null&&(h.event_type=rr.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),p!=null&&(h.feature_id=p),d!=null&&(h.start_time=d),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"v2/billing/credits/ledger/count"),method:"GET",headers:b,queryParameters:{...h,...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(R.ok)return{data:Vp.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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/v2/billing/credits/ledger/count")}};var Zt=class{constructor(t){this._options=I(t)}createDataExport(t,i){return f.fromPromise(this.__createDataExport(t,i))}async __createDataExport(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"data-exports"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...ua.jsonOrThrow(t,{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: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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/data-exports")}getDataExportArtifact(t,i){return f.fromPromise(this.__getDataExportArtifact(t,i))}async __getDataExportArtifact(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`data-exports/${w.encodePathParam(t)}/artifact`),method:"GET",headers:s,queryParameters:i?.queryParams,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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/data-exports/{data_export_id}/artifact")}};var Yt=class{constructor(t){this._options=I(t)}listCompanyOverrides(t={},i){return f.fromPromise(this.__listCompanyOverrides(t,i))}async __listCompanyOverrides(t={},i){let{companyId:o,companyIds:s,featureId:r,featureIds:a,ids:p,withoutExpired:d,q:m,limit:c,offset:h}=t,y={};o!=null&&(y.company_id=o),s!=null&&(Array.isArray(s)?y.company_ids=s.map(D=>D):y.company_ids=s),r!=null&&(y.feature_id=r),a!=null&&(Array.isArray(a)?y.feature_ids=a.map(D=>D):y.feature_ids=a),p!=null&&(Array.isArray(p)?y.ids=p.map(D=>D):y.ids=p),d!=null&&(y.without_expired=d.toString()),m!=null&&(y.q=m),c!=null&&(y.limit=c.toString()),h!=null&&(y.offset=h.toString());let b=await this._options.authProvider.getAuthRequest(),R=_(b.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-overrides"),method:"GET",headers:R,queryParameters:{...y,...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(O.ok)return{data:id.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(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(n.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 v(O.error,O.rawResponse,"GET","/company-overrides")}createCompanyOverride(t,i){return f.fromPromise(this.__createCompanyOverride(t,i))}async __createCompanyOverride(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-overrides"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:da.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/company-overrides")}getCompanyOverride(t,i){return f.fromPromise(this.__getCompanyOverride(t,i))}async __getCompanyOverride(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/company-overrides/{company_override_id}")}updateCompanyOverride(t,i,o){return f.fromPromise(this.__updateCompanyOverride(t,i,o))}async __updateCompanyOverride(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ga.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:hd.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/company-overrides/{company_override_id}")}deleteCompanyOverride(t,i){return f.fromPromise(this.__deleteCompanyOverride(t,i))}async __deleteCompanyOverride(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`company-overrides/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/company-overrides/{company_override_id}")}countCompanyOverrides(t={},i){return f.fromPromise(this.__countCompanyOverrides(t,i))}async __countCompanyOverrides(t={},i){let{companyId:o,companyIds:s,featureId:r,featureIds:a,ids:p,withoutExpired:d,q:m,limit:c,offset:h}=t,y={};o!=null&&(y.company_id=o),s!=null&&(Array.isArray(s)?y.company_ids=s.map(D=>D):y.company_ids=s),r!=null&&(y.feature_id=r),a!=null&&(Array.isArray(a)?y.feature_ids=a.map(D=>D):y.feature_ids=a),p!=null&&(Array.isArray(p)?y.ids=p.map(D=>D):y.ids=p),d!=null&&(y.without_expired=d.toString()),m!=null&&(y.q=m),c!=null&&(y.limit=c.toString()),h!=null&&(y.offset=h.toString());let b=await this._options.authProvider.getAuthRequest(),R=_(b.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"company-overrides/count"),method:"GET",headers:R,queryParameters:{...y,...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(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(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(n.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 v(O.error,O.rawResponse,"GET","/company-overrides/count")}listFeatureCompanies(t,i){return f.fromPromise(this.__listFeatureCompanies(t,i))}async __listFeatureCompanies(t,i){let{featureId:o,q:s,limit:r,offset:a}=t,p={};p.feature_id=o,s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-companies"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:nd.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/feature-companies")}countFeatureCompanies(t,i){return f.fromPromise(this.__countFeatureCompanies(t,i))}async __countFeatureCompanies(t,i){let{featureId:o,q:s,limit:r,offset:a}=t,p={};p.feature_id=o,s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-companies/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Ou.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/feature-companies/count")}listFeatureUsage(t={},i){return f.fromPromise(this.__listFeatureUsage(t,i))}async __listFeatureUsage(t={},i){let{companyId:o,companyKeys:s,featureIds:r,includeUsageAggregation:a,q:p,withoutNegativeEntitlements:d,limit:m,offset:c}=t,h={};o!=null&&(h.company_id=o),s!=null&&(h.company_keys=be(s)),r!=null&&(Array.isArray(r)?h.feature_ids=r.map(O=>O):h.feature_ids=r),a!=null&&(h.include_usage_aggregation=a.toString()),p!=null&&(h.q=p),d!=null&&(h.without_negative_entitlements=d.toString()),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-usage"),method:"GET",headers:b,queryParameters:{...h,...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(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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/feature-usage")}getFeatureUsageTimeSeries(t,i){return f.fromPromise(this.__getFeatureUsageTimeSeries(t,i))}async __getFeatureUsageTimeSeries(t,i){let{companyId:o,endTime:s,featureId:r,granularity:a,startTime:p}=t,d={};d.company_id=o,d.end_time=s.toISOString(),d.feature_id=r,a!=null&&(d.granularity=dt.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"})),d.start_time=p.toISOString();let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-usage-timeseries"),method:"GET",headers:c,queryParameters:{...d,...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:Xu.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 U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/feature-usage-timeseries")}countFeatureUsage(t={},i){return f.fromPromise(this.__countFeatureUsage(t,i))}async __countFeatureUsage(t={},i){let{companyId:o,companyKeys:s,featureIds:r,includeUsageAggregation:a,q:p,withoutNegativeEntitlements:d,limit:m,offset:c}=t,h={};o!=null&&(h.company_id=o),s!=null&&(h.company_keys=be(s)),r!=null&&(Array.isArray(r)?h.feature_ids=r.map(O=>O):h.feature_ids=r),a!=null&&(h.include_usage_aggregation=a.toString()),p!=null&&(h.q=p),d!=null&&(h.without_negative_entitlements=d.toString()),m!=null&&(h.limit=m.toString()),c!=null&&(h.offset=c.toString());let y=await this._options.authProvider.getAuthRequest(),b=_(y.headers,this._options?.headers,i?.headers),R=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-usage/count"),method:"GET",headers:b,queryParameters:{...h,...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(R.ok)return{data:ju.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(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new U(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new x(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new C(n.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new E(n.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 v(R.error,R.rawResponse,"GET","/feature-usage/count")}listFeatureUsers(t,i){return f.fromPromise(this.__listFeatureUsers(t,i))}async __listFeatureUsers(t,i){let{featureId:o,q:s,limit:r,offset:a}=t,p={};p.feature_id=o,s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-users"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:ud.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/feature-users")}countFeatureUsers(t,i){return f.fromPromise(this.__countFeatureUsers(t,i))}async __countFeatureUsers(t,i){let{featureId:o,q:s,limit:r,offset:a}=t,p={};p.feature_id=o,s!=null&&(p.q=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"feature-users/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Vu.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/feature-users/count")}listPlanEntitlements(t={},i){return f.fromPromise(this.__listPlanEntitlements(t,i))}async __listPlanEntitlements(t={},i){let{featureId:o,featureIds:s,ids:r,planId:a,planIds:p,planVersionId:d,planVersionIds:m,q:c,withMeteredProducts:h,limit:y,offset:b}=t,R={};o!=null&&(R.feature_id=o),s!=null&&(Array.isArray(s)?R.feature_ids=s.map(k=>k):R.feature_ids=s),r!=null&&(Array.isArray(r)?R.ids=r.map(k=>k):R.ids=r),a!=null&&(R.plan_id=a),p!=null&&(Array.isArray(p)?R.plan_ids=p.map(k=>k):R.plan_ids=p),d!=null&&(R.plan_version_id=d),m!=null&&(Array.isArray(m)?R.plan_version_ids=m.map(k=>k):R.plan_version_ids=m),c!=null&&(R.q=c),h!=null&&(R.with_metered_products=h.toString()),y!=null&&(R.limit=y.toString()),b!=null&&(R.offset=b.toString());let O=await this._options.authProvider.getAuthRequest(),D=_(O.headers,this._options?.headers,i?.headers),B=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-entitlements"),method:"GET",headers:D,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(B.ok)return{data:md.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(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new U(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new C(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new E(n.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 v(B.error,B.rawResponse,"GET","/plan-entitlements")}createPlanEntitlement(t,i){return f.fromPromise(this.__createPlanEntitlement(t,i))}async __createPlanEntitlement(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-entitlements"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ma.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-entitlements")}getPlanEntitlement(t,i){return f.fromPromise(this.__getPlanEntitlement(t,i))}async __getPlanEntitlement(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/plan-entitlements/{plan_entitlement_id}")}updatePlanEntitlement(t,i,o){return f.fromPromise(this.__updatePlanEntitlement(t,i,o))}async __updatePlanEntitlement(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ya.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:gd.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plan-entitlements/{plan_entitlement_id}")}deletePlanEntitlement(t,i){return f.fromPromise(this.__deletePlanEntitlement(t,i))}async __deletePlanEntitlement(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-entitlements/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/plan-entitlements/{plan_entitlement_id}")}countPlanEntitlements(t={},i){return f.fromPromise(this.__countPlanEntitlements(t,i))}async __countPlanEntitlements(t={},i){let{featureId:o,featureIds:s,ids:r,planId:a,planIds:p,planVersionId:d,planVersionIds:m,q:c,withMeteredProducts:h,limit:y,offset:b}=t,R={};o!=null&&(R.feature_id=o),s!=null&&(Array.isArray(s)?R.feature_ids=s.map(k=>k):R.feature_ids=s),r!=null&&(Array.isArray(r)?R.ids=r.map(k=>k):R.ids=r),a!=null&&(R.plan_id=a),p!=null&&(Array.isArray(p)?R.plan_ids=p.map(k=>k):R.plan_ids=p),d!=null&&(R.plan_version_id=d),m!=null&&(Array.isArray(m)?R.plan_version_ids=m.map(k=>k):R.plan_version_ids=m),c!=null&&(R.q=c),h!=null&&(R.with_metered_products=h.toString()),y!=null&&(R.limit=y.toString()),b!=null&&(R.offset=b.toString());let O=await this._options.authProvider.getAuthRequest(),D=_(O.headers,this._options?.headers,i?.headers),B=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-entitlements/count"),method:"GET",headers:D,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(B.ok)return{data:Du.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(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new U(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new C(n.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new E(n.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 v(B.error,B.rawResponse,"GET","/plan-entitlements/count")}duplicatePlanEntitlements(t,i){return f.fromPromise(this.__duplicatePlanEntitlements(t,i))}async __duplicatePlanEntitlements(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-entitlements/duplicate"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-entitlements/duplicate")}getFeatureUsageByCompany(t,i){return f.fromPromise(this.__getFeatureUsageByCompany(t,i))}async __getFeatureUsageByCompany(t,i){let{keys:o}=t,s={};s.keys=be(o);let r=await this._options.authProvider.getAuthRequest(),a=_(r.headers,this._options?.headers,i?.headers),p=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"usage-by-company"),method:"GET",headers:a,queryParameters:{...s,...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(p.ok)return{data:$u.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 401:throw new U(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new C(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new E(n.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new z({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}return v(p.error,p.rawResponse,"GET","/usage-by-company")}};var Qt=class{constructor(t){this._options=I(t)}createEventBatch(t,i){return f.fromPromise(this.__createEventBatch(t,i))}async __createEventBatch(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"event-batch"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:wa.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/event-batch")}getEventSummaries(t={},i){return f.fromPromise(this.__getEventSummaries(t,i))}async __getEventSummaries(t={},i){let{q:o,eventSubtypes:s,limit:r,offset:a}=t,p={};o!=null&&(p.q=o),s!=null&&(Array.isArray(s)?p.event_subtypes=s.map(h=>h):p.event_subtypes=s),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"event-types"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Cd.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/event-types")}listEvents(t={},i){return f.fromPromise(this.__listEvents(t,i))}async __listEvents(t={},i){let{companyId:o,eventSubtype:s,eventTypes:r,flagId:a,userId:p,limit:d,offset:m}=t,c={};o!=null&&(c.company_id=o),s!=null&&(c.event_subtype=s),r!=null&&(Array.isArray(r)?c.event_types=r.map(R=>ir.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})):c.event_types=ir.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(c.flag_id=a),p!=null&&(c.user_id=p),d!=null&&(c.limit=d.toString()),m!=null&&(c.offset=m.toString());let h=await this._options.authProvider.getAuthRequest(),y=_(h.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"events"),method:"GET",headers:y,queryParameters:{...c,...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(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(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new U(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new x(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new C(n.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new E(n.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 v(b.error,b.rawResponse,"GET","/events")}createEvent(t,i){return f.fromPromise(this.__createEvent(t,i))}async __createEvent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"events"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:mt.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/events")}getEvent(t,i){return f.fromPromise(this.__getEvent(t,i))}async __getEvent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`events/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/events/{event_id}")}getSegmentIntegrationStatus(t){return f.fromPromise(this.__getSegmentIntegrationStatus(t))}async __getSegmentIntegrationStatus(t){let i=await this._options.authProvider.getAuthRequest(),o=_(i.headers,this._options?.headers,t?.headers),s=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"segment-integration"),method:"GET",headers:o,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(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 U(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(n.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 v(s.error,s.rawResponse,"GET","/segment-integration")}};var Xt=class{constructor(t){this._options=I(t)}listFeatures(t={},i){return f.fromPromise(this.__listFeatures(t,i))}async __listFeatures(t={},i){let{ids:o,q:s,withoutCompanyOverrideFor:r,planVersionId:a,withoutPlanEntitlementFor:p,featureType:d,booleanRequireEvent:m,limit:c,offset:h}=t,y={};o!=null&&(Array.isArray(o)?y.ids=o.map(D=>D):y.ids=o),s!=null&&(y.q=s),r!=null&&(y.without_company_override_for=r),a!=null&&(y.plan_version_id=a),p!=null&&(y.without_plan_entitlement_for=p),d!=null&&(Array.isArray(d)?y.feature_type=d.map(D=>ce.jsonOrThrow(D,{unrecognizedObjectKeys:"strip"})):y.feature_type=ce.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),m!=null&&(y.boolean_require_event=m.toString()),c!=null&&(y.limit=c.toString()),h!=null&&(y.offset=h.toString());let b=await this._options.authProvider.getAuthRequest(),R=_(b.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"features"),method:"GET",headers:R,queryParameters:{...y,...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(O.ok)return{data:em.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(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(n.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 v(O.error,O.rawResponse,"GET","/features")}createFeature(t,i){return f.fromPromise(this.__createFeature(t,i))}async __createFeature(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"features"),method:"POST",headers:s,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(r.ok)return{data:Nd.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/features")}getFeature(t,i){return f.fromPromise(this.__getFeature(t,i))}async __getFeature(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`features/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/features/{feature_id}")}updateFeature(t,i={},o){return f.fromPromise(this.__updateFeature(t,i,o))}async __updateFeature(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`features/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ra.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:tm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/features/{feature_id}")}deleteFeature(t,i){return f.fromPromise(this.__deleteFeature(t,i))}async __deleteFeature(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`features/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/features/{feature_id}")}countFeatures(t={},i){return f.fromPromise(this.__countFeatures(t,i))}async __countFeatures(t={},i){let{ids:o,q:s,withoutCompanyOverrideFor:r,planVersionId:a,withoutPlanEntitlementFor:p,featureType:d,booleanRequireEvent:m,limit:c,offset:h}=t,y={};o!=null&&(Array.isArray(o)?y.ids=o.map(D=>D):y.ids=o),s!=null&&(y.q=s),r!=null&&(y.without_company_override_for=r),a!=null&&(y.plan_version_id=a),p!=null&&(y.without_plan_entitlement_for=p),d!=null&&(Array.isArray(d)?y.feature_type=d.map(D=>ce.jsonOrThrow(D,{unrecognizedObjectKeys:"strip"})):y.feature_type=ce.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),m!=null&&(y.boolean_require_event=m.toString()),c!=null&&(y.limit=c.toString()),h!=null&&(y.offset=h.toString());let b=await this._options.authProvider.getAuthRequest(),R=_(b.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"features/count"),method:"GET",headers:R,queryParameters:{...y,...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(O.ok)return{data:Gd.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(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new U(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new x(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new C(n.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new E(n.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 v(O.error,O.rawResponse,"GET","/features/count")}listFlags(t={},i){return f.fromPromise(this.__listFlags(t,i))}async __listFlags(t={},i){let{featureId:o,ids:s,q:r,limit:a,offset:p}=t,d={};o!=null&&(d.feature_id=o),s!=null&&(Array.isArray(s)?d.ids=s.map(y=>y):d.ids=s),r!=null&&(d.q=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"flags"),method:"GET",headers:c,queryParameters:{...d,...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:im.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/flags")}createFlag(t,i){return f.fromPromise(this.__createFlag(t,i))}async __createFlag(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"flags"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ba.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/flags")}getFlag(t,i){return f.fromPromise(this.__getFlag(t,i))}async __getFlag(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/flags/{flag_id}")}updateFlag(t,i,o){return f.fromPromise(this.__updateFlag(t,i,o))}async __updateFlag(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ba.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:om.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/flags/{flag_id}")}deleteFlag(t,i){return f.fromPromise(this.__deleteFlag(t,i))}async __deleteFlag(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/flags/{flag_id}")}updateFlagRules(t,i,o){return f.fromPromise(this.__updateFlagRules(t,i,o))}async __updateFlagRules(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(t)}/rules`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:fa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:sm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/flags/{flag_id}/rules")}checkFlag(t,i,o){return f.fromPromise(this.__checkFlag(t,i,o))}async __checkFlag(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`flags/${w.encodePathParam(t)}/check`),method:"POST",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:zi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Md.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"POST","/flags/{key}/check")}checkFlags(t,i){return f.fromPromise(this.__checkFlags(t,i))}async __checkFlags(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"flags/check"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/flags/check")}checkFlagsBulk(t,i){return f.fromPromise(this.__checkFlagsBulk(t,i))}async __checkFlagsBulk(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"flags/check-bulk"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ba.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(r.ok)return{data:Fd.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/flags/check-bulk")}countFlags(t={},i){return f.fromPromise(this.__countFlags(t,i))}async __countFlags(t={},i){let{featureId:o,ids:s,q:r,limit:a,offset:p}=t,d={};o!=null&&(d.feature_id=o),s!=null&&(Array.isArray(s)?d.ids=s.map(y=>y):d.ids=s),r!=null&&(d.q=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"flags/count"),method:"GET",headers:c,queryParameters:{...d,...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:Hd.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/flags/count")}};var eo=class{constructor(t){this._options=I(t)}createPlanBundle(t,i){return f.fromPromise(this.__createPlanBundle(t,i))}async __createPlanBundle(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-bundles"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-bundles")}updatePlanBundle(t,i,o){return f.fromPromise(this.__updatePlanBundle(t,i,o))}async __updatePlanBundle(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-bundles/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Sa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:mm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plan-bundles/{plan_bundle_id}")}};var ro=class{constructor(t){this._options=I(t)}getPlanGroup(t){return f.fromPromise(this.__getPlanGroup(t))}async __getPlanGroup(t){let i=await this._options.authProvider.getAuthRequest(),o=_(i.headers,this._options?.headers,t?.headers),s=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-groups"),method:"GET",headers:o,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(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 U(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new C(n.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new E(n.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 v(s.error,s.rawResponse,"GET","/plan-groups")}createPlanGroup(t,i){return f.fromPromise(this.__createPlanGroup(t,i))}async __createPlanGroup(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-groups"),method:"POST",headers:s,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(r.ok)return{data:ym.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plan-groups")}updatePlanGroup(t,i,o){return f.fromPromise(this.__updatePlanGroup(t,i,o))}async __updatePlanGroup(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-groups/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:xa.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Rm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plan-groups/{plan_group_id}")}};var io=class{constructor(t){this._options=I(t)}listCompanyMigrations(t={},i){return f.fromPromise(this.__listCompanyMigrations(t,i))}async __listCompanyMigrations(t={},i){let{migrationId:o,q:s,status:r,limit:a,offset:p}=t,d={};o!=null&&(d.migration_id=o),s!=null&&(d.q=s),r!=null&&(d.status=or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-version-company-migrations"),method:"GET",headers:c,queryParameters:{...d,...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:Um.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/plan-version-company-migrations")}countCompanyMigrations(t={},i){return f.fromPromise(this.__countCompanyMigrations(t,i))}async __countCompanyMigrations(t={},i){let{migrationId:o,q:s,status:r,limit:a,offset:p}=t,d={};o!=null&&(d.migration_id=o),s!=null&&(d.q=s),r!=null&&(d.status=or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-version-company-migrations/count"),method:"GET",headers:c,queryParameters:{...d,...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:_m.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/plan-version-company-migrations/count")}listMigrations(t={},i){return f.fromPromise(this.__listMigrations(t,i))}async __listMigrations(t={},i){let{planVersionId:o,status:s,limit:r,offset:a}=t,p={};o!=null&&(p.plan_version_id=o),s!=null&&(p.status=ar.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-version-migrations"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Tm.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/plan-version-migrations")}getMigration(t,i){return f.fromPromise(this.__getMigration(t,i))}async __getMigration(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-version-migrations/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(r.ok)return{data:xm.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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/plan-version-migrations/{plan_version_migration_id}")}countMigrations(t={},i){return f.fromPromise(this.__countMigrations(t,i))}async __countMigrations(t={},i){let{planVersionId:o,status:s,limit:r,offset:a}=t,p={};o!=null&&(p.plan_version_id=o),s!=null&&(p.status=ar.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plan-version-migrations/count"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Pm.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/plan-version-migrations/count")}};var to=class{constructor(t){this._options=I(t)}updateCompanyPlans(t,i,o){return f.fromPromise(this.__updateCompanyPlans(t,i,o))}async __updateCompanyPlans(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`company-plans/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ua.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Gm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/company-plans/{company_plan_id}")}listPlans(t={},i){return f.fromPromise(this.__listPlans(t,i))}async __listPlans(t={},i){let{companyId:o,forFallbackPlan:s,forInitialPlan:r,forTrialExpiryPlan:a,hasProductId:p,ids:d,planType:m,q:c,withoutEntitlementFor:h,withoutPaidProductId:y,limit:b,offset:R}=t,O={};o!=null&&(O.company_id=o),s!=null&&(O.for_fallback_plan=s.toString()),r!=null&&(O.for_initial_plan=r.toString()),a!=null&&(O.for_trial_expiry_plan=a.toString()),p!=null&&(O.has_product_id=p.toString()),d!=null&&(Array.isArray(d)?O.ids=d.map(me=>me):O.ids=d),m!=null&&(O.plan_type=te.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),c!=null&&(O.q=c),h!=null&&(O.without_entitlement_for=h),y!=null&&(O.without_paid_product_id=y.toString()),b!=null&&(O.limit=b.toString()),R!=null&&(O.offset=R.toString());let D=await this._options.authProvider.getAuthRequest(),B=_(D.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plans"),method:"GET",headers:B,queryParameters:{...O,...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(k.ok)return{data:Km.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(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(n.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 v(k.error,k.rawResponse,"GET","/plans")}createPlan(t,i){return f.fromPromise(this.__createPlan(t,i))}async __createPlan(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plans"),method:"POST",headers:s,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Rt.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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/plans")}getPlan(t,i={},o){return f.fromPromise(this.__getPlan(t,i,o))}async __getPlan(t,i={},o){let{planVersionId:s}=i,r={};s!=null&&(r.plan_version_id=s);let a=await this._options.authProvider.getAuthRequest(),p=_(a.headers,this._options?.headers,o?.headers),d=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(t)}`),method:"GET",headers:p,queryParameters:{...r,...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(d.ok)return{data:Dm.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 U(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return v(d.error,d.rawResponse,"GET","/plans/{plan_id}")}updatePlan(t,i,o){return f.fromPromise(this.__updatePlan(t,i,o))}async __updatePlan(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ct.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Wm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plans/{plan_id}")}deletePlan(t,i){return f.fromPromise(this.__deletePlan(t,i))}async __deletePlan(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(r.ok)return{data:Bm.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/plans/{plan_id}")}upsertBillingProductPlan(t,i,o){return f.fromPromise(this.__upsertBillingProductPlan(t,i,o))}async __upsertBillingProductPlan(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/${w.encodePathParam(t)}/billing_products`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ri.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Hm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plans/{plan_id}/billing_products")}countPlans(t={},i){return f.fromPromise(this.__countPlans(t,i))}async __countPlans(t={},i){let{companyId:o,forFallbackPlan:s,forInitialPlan:r,forTrialExpiryPlan:a,hasProductId:p,ids:d,planType:m,q:c,withoutEntitlementFor:h,withoutPaidProductId:y,limit:b,offset:R}=t,O={};o!=null&&(O.company_id=o),s!=null&&(O.for_fallback_plan=s.toString()),r!=null&&(O.for_initial_plan=r.toString()),a!=null&&(O.for_trial_expiry_plan=a.toString()),p!=null&&(O.has_product_id=p.toString()),d!=null&&(Array.isArray(d)?O.ids=d.map(me=>me):O.ids=d),m!=null&&(O.plan_type=te.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),c!=null&&(O.q=c),h!=null&&(O.without_entitlement_for=h),y!=null&&(O.without_paid_product_id=y.toString()),b!=null&&(O.limit=b.toString()),R!=null&&(O.offset=R.toString());let D=await this._options.authProvider.getAuthRequest(),B=_(D.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plans/count"),method:"GET",headers:B,queryParameters:{...O,...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(k.ok)return{data:km.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(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new U(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new C(n.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new E(n.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 v(k.error,k.rawResponse,"GET","/plans/count")}listPlanIssues(t,i){return f.fromPromise(this.__listPlanIssues(t,i))}async __listPlanIssues(t,i){let{planId:o,planVersionId:s}=t,r={};r.plan_id=o,s!=null&&(r.plan_version_id=s);let a=await this._options.authProvider.getAuthRequest(),p=_(a.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"plans/issues"),method:"GET",headers:p,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(d.ok)return{data:Im.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(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new U(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new x(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new C(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new E(n.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);default:throw new z({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}return v(d.error,d.rawResponse,"GET","/plans/issues")}deletePlanVersion(t,i){return f.fromPromise(this.__deletePlanVersion(t,i))}async __deletePlanVersion(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/version/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/plans/version/{plan_id}")}publishPlanVersion(t,i,o){return f.fromPromise(this.__publishPlanVersion(t,i,o))}async __publishPlanVersion(t,i,o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plans/version/${w.encodePathParam(t)}/publish`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ca.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Lm.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/plans/version/{plan_id}/publish")}};var oo=class{constructor(t){this._options=I(t)}listScheduledCheckouts(t={},i){return f.fromPromise(this.__listScheduledCheckouts(t,i))}async __listScheduledCheckouts(t={},i){let{companyId:o,status:s,limit:r,offset:a}=t,p={};o!=null&&(p.company_id=o),s!=null&&(p.status=_r.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),r!=null&&(p.limit=r.toString()),a!=null&&(p.offset=a.toString());let d=await this._options.authProvider.getAuthRequest(),m=_(d.headers,this._options?.headers,i?.headers),c=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"scheduled-checkout"),method:"GET",headers:m,queryParameters:{...p,...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(c.ok)return{data:Zm.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new T(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 401:throw new U(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 403:throw new x(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 404:throw new C(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);case 500:throw new E(n.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),c.rawResponse);default:throw new z({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return v(c.error,c.rawResponse,"GET","/scheduled-checkout")}createScheduledCheckout(t,i){return f.fromPromise(this.__createScheduledCheckout(t,i))}async __createScheduledCheckout(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"scheduled-checkout"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/scheduled-checkout")}getScheduledCheckout(t,i){return f.fromPromise(this.__getScheduledCheckout(t,i))}async __getScheduledCheckout(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`scheduled-checkout/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(r.ok)return{data:$m.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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/scheduled-checkout/{scheduled_checkout_id}")}updateScheduledCheckout(t,i={},o){return f.fromPromise(this.__updateScheduledCheckout(t,i,o))}async __updateScheduledCheckout(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`scheduled-checkout/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:Ta.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:Ym.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/scheduled-checkout/{scheduled_checkout_id}")}};var ao=class{constructor(t){this._options=I(t)}listWebhookEvents(t={},i){return f.fromPromise(this.__listWebhookEvents(t,i))}async __listWebhookEvents(t={},i){let{ids:o,q:s,webhookId:r,limit:a,offset:p}=t,d={};o!=null&&(Array.isArray(o)?d.ids=o.map(y=>y):d.ids=o),s!=null&&(d.q=s),r!=null&&(d.webhook_id=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"webhook-events"),method:"GET",headers:c,queryParameters:{...d,...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:ch.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/webhook-events")}getWebhookEvent(t,i){return f.fromPromise(this.__getWebhookEvent(t,i))}async __getWebhookEvent(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`webhook-events/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(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 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/webhook-events/{webhook_event_id}")}countWebhookEvents(t={},i){return f.fromPromise(this.__countWebhookEvents(t,i))}async __countWebhookEvents(t={},i){let{ids:o,q:s,webhookId:r,limit:a,offset:p}=t,d={};o!=null&&(Array.isArray(o)?d.ids=o.map(y=>y):d.ids=o),s!=null&&(d.q=s),r!=null&&(d.webhook_id=r),a!=null&&(d.limit=a.toString()),p!=null&&(d.offset=p.toString());let m=await this._options.authProvider.getAuthRequest(),c=_(m.headers,this._options?.headers,i?.headers),h=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"webhook-events/count"),method:"GET",headers:c,queryParameters:{...d,...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:Xm.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(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 401:throw new U(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 403:throw new x(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 404:throw new C(n.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),h.rawResponse);case 500:throw new E(n.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 v(h.error,h.rawResponse,"GET","/webhook-events/count")}listWebhooks(t={},i){return f.fromPromise(this.__listWebhooks(t,i))}async __listWebhooks(t={},i){let{q:o,limit:s,offset:r}=t,a={};o!=null&&(a.q=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"webhooks"),method:"GET",headers:d,queryParameters:{...a,...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:ph.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/webhooks")}createWebhook(t,i){return f.fromPromise(this.__createWebhook(t,i))}async __createWebhook(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"webhooks"),method:"POST",headers:s,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(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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"POST","/webhooks")}getWebhook(t,i){return f.fromPromise(this.__getWebhook(t,i))}async __getWebhook(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(t)}`),method:"GET",headers:s,queryParameters: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(r.ok)return{data:nh.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 U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"GET","/webhooks/{webhook_id}")}updateWebhook(t,i={},o){return f.fromPromise(this.__updateWebhook(t,i,o))}async __updateWebhook(t,i={},o){let s=await this._options.authProvider.getAuthRequest(),r=_(s.headers,this._options?.headers,o?.headers),a=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(t)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:ka.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),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(a.ok)return{data:uh.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(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 401:throw new U(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 403:throw new x(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new C(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);case 500:throw new E(n.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),a.rawResponse);default:throw new z({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return v(a.error,a.rawResponse,"PUT","/webhooks/{webhook_id}")}deleteWebhook(t,i){return f.fromPromise(this.__deleteWebhook(t,i))}async __deleteWebhook(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`webhooks/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(r.ok)return{data:th.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(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new U(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new C(n.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new E(n.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 v(r.error,r.rawResponse,"DELETE","/webhooks/{webhook_id}")}countWebhooks(t={},i){return f.fromPromise(this.__countWebhooks(t,i))}async __countWebhooks(t={},i){let{q:o,limit:s,offset:r}=t,a={};o!=null&&(a.q=o),s!=null&&(a.limit=s.toString()),r!=null&&(a.offset=r.toString());let p=await this._options.authProvider.getAuthRequest(),d=_(p.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,"webhooks/count"),method:"GET",headers:d,queryParameters:{...a,...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:rh.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(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new U(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new C(n.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new E(n.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 v(m.error,m.rawResponse,"GET","/webhooks/count")}};var no=class{constructor(t){this._options=I(t)}get accounts(){return this._accounts??=new Lt(this._options)}get billing(){return this._billing??=new Gt(this._options)}get credits(){return this._credits??=new Jt(this._options)}get checkout(){return this._checkout??=new Wt(this._options)}get companies(){return this._companies??=new Ht(this._options)}get entitlements(){return this._entitlements??=new Yt(this._options)}get plans(){return this._plans??=new to(this._options)}get components(){return this._components??=new Nt(this._options)}get dataexports(){return this._dataexports??=new Zt(this._options)}get events(){return this._events??=new Qt(this._options)}get features(){return this._features??=new Xt(this._options)}get planbundle(){return this._planbundle??=new eo(this._options)}get plangroups(){return this._plangroups??=new ro(this._options)}get planmigrations(){return this._planmigrations??=new io(this._options)}get componentspublic(){return this._componentspublic??=new $t(this._options)}get scheduledcheckout(){return this._scheduledcheckout??=new oo(this._options)}get accesstokens(){return this._accesstokens??=new Kt(this._options)}get webhooks(){return this._webhooks??=new ao(this._options)}putPlanAudiencesPlanAudienceId(t,i){return f.fromPromise(this.__putPlanAudiencesPlanAudienceId(t,i))}async __putPlanAudiencesPlanAudienceId(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-audiences/${w.encodePathParam(t)}`),method:"PUT",headers:s,queryParameters: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(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 v(r.error,r.rawResponse,"PUT","/plan-audiences/{plan_audience_id}")}deletePlanAudiencesPlanAudienceId(t,i){return f.fromPromise(this.__deletePlanAudiencesPlanAudienceId(t,i))}async __deletePlanAudiencesPlanAudienceId(t,i){let o=await this._options.authProvider.getAuthRequest(),s=_(o.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??P)({url:w.join(await g.get(this._options.baseUrl)??await g.get(this._options.environment)??S.Default,`plan-audiences/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters: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(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 v(r.error,r.rawResponse,"DELETE","/plan-audiences/{plan_audience_id}")}};var ai=class{error(t,...i){console.error(t,...i)}warn(t,...i){console.warn(t,...i)}info(t,...i){console.info(t,...i)}debug(t,...i){console.debug(t,...i)}};var My=1e3,Iy=1e3,Fy=3,Ky=1e3,so=class{constructor(t,i){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:o=new ai,maxSize:s=Iy,interval:r=My,offline:a=!1,maxRetries:p=Fy,initialRetryDelay:d=Ky}=i||{};this.eventsApi=t,this.interval=r,this.logger=o,this.maxSize=s,this.offline=a,this.maxRetries=p,this.initialRetryDelay=d,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let t=[...this.events];this.events=[];let i=0,o=!1,s=null;for(;i<=this.maxRetries&&!o;)try{i>0&&this.logger.info(`Retrying event batch submission (attempt ${i} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:t}),o=!0}catch(r){if(s=r,i++,i<=this.maxRetries){let a=this.initialRetryDelay*Math.pow(2,i-1),p=Math.random()*.1*a,d=a+p;this.logger.warn(`Event batch submission failed: ${r}. Retrying in ${(d/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(m=>setTimeout(m,d))}}o?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(t){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(t)}}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))}};function hh(u){return async function(i){let o={};if(u&&Object.assign(o,u),i.body!==void 0&&i.contentType!=null&&(o["Content-Type"]=i.contentType),i.headers!=null)for(let[p,d]of Object.entries(i.headers))d!=null&&typeof d=="string"&&(o[p]=d);let s=Ei(i.url,i.queryParameters),r=await Ui({body:i.body,type:i.requestType==="json"?"json":"other"}),a=await Ci();try{let p=await Ti(async()=>vi(a,s,i.method,o,r,i.timeoutMs,i.abortSignal,i.withCredentials,i.duplex),i.maxRetries),d=await Dr(p,i.responseType),m=ui(p);return p.status>=200&&p.status<400?{ok:!0,body:d,headers:p.headers,rawResponse:m}:{ok:!1,error:{reason:"status-code",statusCode:p.status,body:d},rawResponse:m}}catch(p){return i.abortSignal!=null&&i.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:qr}:p instanceof Error&&p.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:qr}:p instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:p.message},rawResponse:Mr}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(p)},rawResponse:Mr}}}}async function Ly(u){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Me,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var gh=Ly;var Eh=require("events");var yh=require("events"),wh=si(require("ws")),Gy=10*1e3,bh=60*1e3,Wy=bh*9/10,Hy=10,Ny=1*1e3,$y=30*1e3;function Jy(u){let t=new URL(u);switch(t.protocol){case"https:":t.protocol="wss:";break;case"http:":t.protocol="ws:";break;default:throw new Error(`Unsupported scheme: ${t.protocol} (must be http: or https:)`)}if(t.hostname){let i=t.hostname.split(".");i.length>1&&i[0]==="api"&&(i[0]="datastream",t.hostname=i.join("."))}return t.pathname="/datastream",t.toString()}var co=class extends yh.EventEmitter{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=Jy(i.url):this.url=i.url,this.headers={"X-Schematic-Api-Key":i.apiKey},this.logger=i.logger,this.messageHandler=i.messageHandler,this.connectionReadyHandler=i.connectionReadyHandler,this.maxReconnectAttempts=i.maxReconnectAttempts??Hy,this.minReconnectDelay=i.minReconnectDelay??Ny,this.maxReconnectDelay=i.maxReconnectDelay??$y}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((o,s)=>{if(!this.ws){s(new Error("WebSocket connection is not available!"));return}let r=setTimeout(()=>{s(new Error("Write timeout"))},Gy);try{this.ws.send(JSON.stringify(i),a=>{clearTimeout(r),a?s(a):o()})}catch(a){clearTimeout(r),s(a)}})}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(o){this.logger.error(`Connection ready handler failed: ${o}`),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(o=>{let s=()=>{this.logger.info("WebSocket connection closed"),this.cleanup(),o()},r=a=>{this.logger.error(`WebSocket error: ${a.message}`),this.emit("error",a),this.cleanup(),o()};i.on("close",s),i.on("error",r)}),!this.shouldReconnect)break}catch(i){this.reconnectAttempts++,this.setConnected(!1),this.setReady(!1);let o=i instanceof Error?i.message:String(i);if(this.logger.warn(`WebSocket connection failed: ${o}, 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)})}}catch(i){this.emit("error",i)}}connect(){return new Promise((i,o)=>{this.logger.debug(`Connecting to WebSocket: ${this.url}`);let s=new wh.default(this.url,{headers:this.headers,handshakeTimeout:3e4}),r=setTimeout(()=>{s.close(),o(new Error("Connection timeout"))},3e4);s.on("open",()=>{clearTimeout(r),i(s)}),s.on("error",a=>{clearTimeout(r),o(a)})})}setupWebSocketHandlers(i){i.on("message",o=>{this.handleMessage(o)}),i.on("pong",()=>{this.handlePong()}),i.on("close",o=>{this.handleClose(o)}),i.on("error",o=>{this.handleError(o)})}async handleMessage(i){try{let o;Buffer.isBuffer(i)?o=i.toString():Array.isArray(i)?o=Buffer.concat(i).toString():o=String(i);let s;try{s=JSON.parse(o)}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(o){this.emit("error",o)}}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()},Wy)}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()},bh);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 o=Math.floor(Math.random()*this.minReconnectDelay),s=Math.pow(2,i-1)*this.minReconnectDelay+o;return Math.min(s,this.maxReconnectDelay+o)}setConnected(i){let o=this.connected;this.connected=i,i||(this.ready=!1),o!==i&&(this.logger.debug(`Connection state changed: ${i}`),i?this.emit("connected"):this.emit("disconnected"))}setReady(i){let o=this.ready;this.ready=i,o!==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 xh=si(Ph()),ni=class{constructor(){this.wasmInstance=null;this.initialized=!1}async initialize(){if(!this.initialized)try{this.wasmInstance=new xh.RulesEngineJS,this.initialized=!0}catch(t){throw new Error(`Failed to initialize WASM rules engine: ${t}`)}}async checkFlag(t,i,o){this.ensureInitialized();let s=(r,a)=>a===null?void 0:a;try{let r=JSON.stringify(t,s),a=i?JSON.stringify(i,s):void 0,p=o?JSON.stringify(o,s):void 0,d=this.wasmInstance.checkFlag(r,a,p);return JSON.parse(d)}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.")}};var Er="company",Cr="user",rw="flags",Fa=30*1e3,iw=1440*60*1e3,tw=720*60*60*1e3,Si=class extends Eh.EventEmitter{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??iw,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 ni}createCacheProvider(i,o){let s;switch(o){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 ${o} cache`),s;let r=this.calculateCacheTTL(o);return i.redisClient?(this.logger.debug(`Using Redis cache provider for ${o} cache (TTL: ${r}ms)`),new vr({client:i.redisClient,keyPrefix:i.redisKeyPrefix||"schematic:",ttl:r})):(this.logger.debug(`Using memory cache provider for ${o} cache (TTL: ${r}ms)`),new qe({ttl:r}))}createKeyCacheProvider(i){let o=this.cacheTTL;return i.redisClient?new vr({client:i.redisClient,keyPrefix:i.redisKeyPrefix||"schematic:",ttl:o}):new qe({ttl:o})}calculateCacheTTL(i){return i==="flag"?Math.max(tw,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"),this.wsClient=new co({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(i){let o=await this.getCompanyFromCache(i);if(o)return this.logger.debug(`Company found in cache for keys: ${JSON.stringify(i)}`),o;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 a of s)if(this.pendingCompanyRequests.has(a)){r=!0;break}return new Promise((a,p)=>{let d=setTimeout(()=>{this.cleanupPendingCompanyRequests(s,m),p(new Error("Timeout while waiting for company data"))},Fa),m=c=>{clearTimeout(d),c?a(c):p(new Error("Company not found"))};for(let c of s)this.pendingCompanyRequests.has(c)||this.pendingCompanyRequests.set(c,[]),this.pendingCompanyRequests.get(c).push(m);r||this.sendDataStreamRequest({entity_type:"rulesengine.Company",keys:i}).catch(c=>{this.cleanupPendingCompanyRequests(s,m),p(c)})})}async getUser(i){let o=await this.getUserFromCache(i);if(o)return this.logger.debug(`User found in cache for keys: ${JSON.stringify(i)}`),o;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 a of s)if(this.pendingUserRequests.has(a)){r=!0;break}return new Promise((a,p)=>{let d=setTimeout(()=>{this.cleanupPendingUserRequests(s,m),p(new Error("Timeout while waiting for user data"))},Fa),m=c=>{clearTimeout(d),c?a(c):p(new Error("User not found"))};for(let c of s)this.pendingUserRequests.has(c)||this.pendingUserRequests.set(c,[]),this.pendingUserRequests.get(c).push(m);r||this.sendDataStreamRequest({entity_type:"rulesengine.User",keys:i}).catch(c=>{this.cleanupPendingUserRequests(s,m),p(c)})})}async getFlag(i){let o=this.flagCacheKey(i);this.logger.debug(`Retrieving flag from cache: ${i} (cache key: ${o})`);try{return await this.flagsCacheProvider.get(o)||null}catch(s){return this.logger.warn(`Failed to retrieve flag from cache: ${s}`),null}}async getAllFlags(){return this.pendingFlagRequest?new Promise((i,o)=>{let s=this.pendingFlagRequest;this.pendingFlagRequest=r=>{s(r),r?i():o(new Error("Failed to refresh flags"))}}):new Promise((i,o)=>{let s=setTimeout(()=>{this.pendingFlagRequest=void 0,o(new Error("Timeout while waiting for flags data"))},Fa);this.pendingFlagRequest=r=>{clearTimeout(s),this.pendingFlagRequest=void 0,r?i():o(new Error("Failed to refresh flags"))},this.sendDataStreamRequest({entity_type:"rulesengine.Flags"}).catch(r=>{clearTimeout(s),this.pendingFlagRequest=void 0,o(r)})})}async checkFlag(i,o){let s=await this.getFlag(o);if(!s)throw new Error(`Flag not found: ${o}`);let r=i.company&&Object.keys(i.company).length>0,a=i.user&&Object.keys(i.user).length>0,p=null,d=null;if(r&&(p=await this.getCompanyFromCache(i.company),this.logger.debug(`Company ${p?"found in cache":"not found in cache"} for keys: ${JSON.stringify(i.company)}`)),a&&(d=await this.getUserFromCache(i.user),this.logger.debug(`User ${d?"found in cache":"not found in cache"} for keys: ${JSON.stringify(i.user)}`)),this.replicatorMode)return this.evaluateFlag(s,p,d);if((!r||p)&&(!a||d))return this.logger.debug(`All required resources found in cache for flag ${o} evaluation`),this.evaluateFlag(s,p,d);if(!this.isConnected())throw new Error("Datastream not connected and required entities not in cache");let m=r&&!p?this.getCompany(i.company):Promise.resolve(p),c=a&&!d?this.getUser(i.user):Promise.resolve(d),[h,y]=await Promise.all([m,c]);return this.evaluateFlag(s,h,y)}async updateCompanyMetrics(i,o,s){let r=await this.getCompanyFromCache(i);if(!r)return;let a=this.deepCopyCompany(r);if(a.metrics)for(let p of a.metrics)(p.eventSubtype??p.event_subtype)===o&&(p.value=(p.value||0)+s);await this.cacheCompanyForKeys(a)}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 o=new AbortController,s=setTimeout(()=>o.abort(),i),r=await fetch(this.replicatorHealthURL,{method:"GET",signal:o.signal});if(clearTimeout(s),r.ok){let a=await r.json(),p=a.cache_version||a.cacheVersion;if(p)return this.replicatorCacheVersion=p,p}}catch(o){this.logger.debug(`Failed to fetch replicator cache version: ${o}`)}}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(o){this.logger.error(`Error processing datastream message: ${o}`),this.emit("error",o)}}async handleCompanyMessage(i){let o=i.data;if(o){if(i.message_type==="delete"){if(o.keys)for(let[r,a]of Object.entries(o.keys)){let p=this.resourceKeyToCacheKey(Er,r,a);try{await this.companyKeyCacheProvider.delete(p)}catch(d){this.logger.warn(`Failed to delete company key mapping from cache: ${d}`)}}let s=this.resourceIdCacheKey(Er,o.id);try{await this.companyCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete company resource from cache: ${r}`)}return}await this.cacheCompanyForKeys(o),this.notifyPendingCompanyRequests(o.keys||{},o)}}async handleUserMessage(i){let o=i.data;if(o){if(i.message_type==="delete"){if(o.keys)for(let[r,a]of Object.entries(o.keys)){let p=this.resourceKeyToCacheKey(Cr,r,a);try{await this.userKeyCacheProvider.delete(p)}catch(d){this.logger.warn(`Failed to delete user key mapping from cache: ${d}`)}}let s=this.resourceIdCacheKey(Cr,o.id);try{await this.userCacheProvider.delete(s)}catch(r){this.logger.warn(`Failed to delete user resource from cache: ${r}`)}return}await this.cacheUserForKeys(o),this.notifyPendingUserRequests(o.keys||{},o)}}async handleFlagsMessage(i){let o=i.data;if(!Array.isArray(o)){this.logger.warn("Expected flags array in bulk flags message");return}let s=await Promise.allSettled(o.filter(p=>p?.key).map(async p=>{let d=this.flagCacheKey(p.key);return await this.flagsCacheProvider.set(d,p),d})),r=s.filter(p=>p.status==="fulfilled").map(p=>p.value),a=s.filter(p=>p.status==="rejected");if(a.length>0&&this.logger.warn(`Failed to cache ${a.length} flag(s)`),this.flagsCacheProvider.deleteMissing)try{await this.flagsCacheProvider.deleteMissing(r,{scanPattern:"flags:*"})}catch(p){this.logger.warn(`Failed to delete missing flags: ${p}`)}this.pendingFlagRequest&&this.pendingFlagRequest(!0)}async handleFlagMessage(i){let o=i.data;if(!o?.key)return;let s=this.flagCacheKey(o.key);try{switch(i.message_type){case"delete":await this.flagsCacheProvider.delete(s);break;case"full":await this.flagsCacheProvider.set(s,o);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 o=i.data;if(o?.keys&&o?.entity_type)switch(o.entity_type){case"rulesengine.Company":this.notifyPendingCompanyRequests(o.keys,null);break;case"rulesengine.User":this.notifyPendingUserRequests(o.keys,null);break;default:this.logger.warn(`Received error for unsupported entity type: ${o.entity_type}`)}let s=o?.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 o={data:i};await this.wsClient.sendMessage(o)}async getCompanyFromCache(i){for(let[o,s]of Object.entries(i)){let r=this.resourceKeyToCacheKey(Er,o,s);try{let a=await this.companyKeyCacheProvider.get(r);if(a){let p=this.resourceIdCacheKey(Er,a),d=await this.companyCacheProvider.get(p);if(d)return d}}catch(a){this.logger.warn(`Failed to retrieve company from cache: ${a}`)}}return null}async getUserFromCache(i){for(let[o,s]of Object.entries(i)){let r=this.resourceKeyToCacheKey(Cr,o,s);try{let a=await this.userKeyCacheProvider.get(r);if(a){let p=this.resourceIdCacheKey(Cr,a),d=await this.userCacheProvider.get(p);if(d)return d}}catch(a){this.logger.warn(`Failed to retrieve user from cache: ${a}`)}}return null}async cacheCompanyForKeys(i){if(!i.keys||Object.keys(i.keys).length===0)throw new Error("No keys provided for company lookup");let o=this.resourceIdCacheKey(Er,i.id);await this.companyCacheProvider.set(o,i,this.cacheTTL);for(let[s,r]of Object.entries(i.keys)){let a=this.resourceKeyToCacheKey(Er,s,r);try{await this.companyKeyCacheProvider.set(a,i.id,this.cacheTTL)}catch(p){this.logger.warn(`Failed to cache company key mapping '${a}': ${p}`)}}}async cacheUserForKeys(i){if(!i.keys||Object.keys(i.keys).length===0)throw new Error("No keys provided for user lookup");let o=this.resourceIdCacheKey(Cr,i.id);await this.userCacheProvider.set(o,i,this.cacheTTL);for(let[s,r]of Object.entries(i.keys)){let a=this.resourceKeyToCacheKey(Cr,s,r);try{await this.userKeyCacheProvider.set(a,i.id,this.cacheTTL)}catch(p){this.logger.warn(`Failed to cache user key mapping '${a}': ${p}`)}}}generateCacheKeysForCompany(i){return Object.entries(i).map(([o,s])=>this.resourceKeyToCacheKey(Er,o,s))}generateCacheKeysForUser(i){return Object.entries(i).map(([o,s])=>this.resourceKeyToCacheKey(Cr,o,s))}notifyPendingCompanyRequests(i,o){for(let[s,r]of Object.entries(i)){let a=this.resourceKeyToCacheKey(Er,s,r),p=this.pendingCompanyRequests.get(a);p&&(this.pendingCompanyRequests.delete(a),p.forEach(d=>{try{d(o)}catch(m){this.logger.error(`Error in company request handler: ${m}`)}}))}}notifyPendingUserRequests(i,o){for(let[s,r]of Object.entries(i)){let a=this.resourceKeyToCacheKey(Cr,s,r),p=this.pendingUserRequests.get(a);p&&(this.pendingUserRequests.delete(a),p.forEach(d=>{try{d(o)}catch(m){this.logger.error(`Error in user request handler: ${m}`)}}))}}cleanupPendingCompanyRequests(i,o){for(let s of i){let r=this.pendingCompanyRequests.get(s);if(r){let a=r.indexOf(o);a!==-1&&r.splice(a,1),r.length===0&&this.pendingCompanyRequests.delete(s)}}}cleanupPendingUserRequests(i,o){for(let s of i){let r=this.pendingUserRequests.get(s);if(r){let a=r.indexOf(o);a!==-1&&r.splice(a,1),r.length===0&&this.pendingUserRequests.delete(s)}}}clearPendingRequests(){for(let[,i]of this.pendingCompanyRequests)i.forEach(o=>{try{o(null)}catch(s){this.logger.error(`Error clearing company request: ${s}`)}});this.pendingCompanyRequests.clear();for(let[,i]of this.pendingUserRequests)i.forEach(o=>{try{o(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))}async checkReplicatorHealth(){if(this.replicatorHealthURL)try{let i=new AbortController,o=setTimeout(()=>i.abort(),5e3),s=await fetch(this.replicatorHealthURL,{method:"GET",signal:i.signal});if(clearTimeout(o),!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);let r=await s.json(),a=this.replicatorReady;this.replicatorReady=r.ready??!1;let p=r.cache_version||r.cacheVersion;if(p&&p!==this.replicatorCacheVersion){let d=this.replicatorCacheVersion;this.replicatorCacheVersion=p,this.logger.info(`Cache version changed from ${d||"(null)"} to ${p}`)}this.replicatorReady&&!a?(this.logger.info("External replicator is now ready"),this.emit("replicator-health-changed",!0)):!this.replicatorReady&&a&&(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 o=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey(),s=`${rw}:${o}:${i.toLowerCase()}`;return this.logger.debug(`Generated flag cache key - flag: ${i}, mode: ${this.replicatorMode?"replicator":"datastream"}, version: ${o}, cacheKey: ${s}`),s}resourceIdCacheKey(i,o){let s=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${i}:${s}:${o}`}resourceKeyToCacheKey(i,o,s){let r=this.replicatorMode&&this.replicatorCacheVersion?this.replicatorCacheVersion:this.getRulesEngineVersionKey();return`${i}:${r}:${o.toLowerCase()}:${s.toLowerCase()}`}deepCopyCompany(i){return JSON.parse(JSON.stringify(i))}async evaluateFlag(i,o,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:o?.id,userId:s?.id})}`);let a=await this.rulesEngine.checkFlag(i,o,s);return this.logger.debug(`Rules engine evaluation result: ${JSON.stringify(a)}`),{flagKey:i.key,value:a.value??r,reason:a.reason||"RULES_ENGINE_EVALUATION",companyId:o?.id,userId:s?.id,flagId:i.id,ruleId:a.ruleId,ruleType:a.ruleType,entitlement:a.entitlement?{...a.entitlement,metricResetAt:a.entitlement.metricResetAt?new Date(a.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:o?.id,userId:s?.id,flagId:i.id}}catch(a){return this.logger.error(`Rules engine evaluation failed: ${a}`),{flagKey:i.key,value:r,reason:"RULES_ENGINE_ERROR",companyId:o?.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 mo=class extends no{constructor(t){let{apiKey:i="",basePath:o,eventBufferInterval:s,flagDefaults:r={},logger:a=new ai,timeoutMs:p}=t??{},{offline:d=!1}=t??{},m={};if(t?.environmentId&&(m["X-Schematic-Environment-Id"]=t.environmentId),t?.headers&&Object.assign(m,t.headers),d?i!==""&&a.debug("Offline mode enabled, ignoring API key"):i===""&&!d&&(a.warn("No API key was provided, running in offline mode"),d=!0),super({apiKey:i,environment:o,fetcher:d?gh:hh(m),timeoutInSeconds:p!==void 0?p/1e3:void 0}),this.logger=a,this.eventBuffer=new so(this.events,{interval:s,logger:a,offline:d}),this.flagCheckCacheProviders=t?.cacheProviders?.flagChecks??[new qe],this.flagDefaults=r,this.offline=d,t?.useDataStream&&!d){let c={apiKey:i,baseURL:o,logger:a,cacheTTL:t.dataStream?.cacheTTL,redisClient:t.dataStream?.redisClient,redisKeyPrefix:t.dataStream?.redisKeyPrefix,replicatorMode:t.dataStream?.replicatorMode,replicatorHealthURL:t.dataStream?.replicatorHealthURL,replicatorHealthCheck:t.dataStream?.replicatorHealthCheck};this.datastreamClient=new Si(c),this.datastreamClient.start().catch(h=>{a.error(`Failed to start DataStream client: ${h}`),this.datastreamClient=void 0})}}useDataStream(){return this.datastreamClient!==void 0}async checkFlag(t,i,o){return(await this.checkFlagWithEntitlement(t,i,o)).value}async checkFlagWithEntitlement(t,i,o){let s=()=>o?.defaultValue===void 0?this.getFlagDefault(i):typeof o.defaultValue=="function"?o.defaultValue():o.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(t,i);return this.enqueueEvent(zo.FlagCheck,{flagKey:i,value:r?.value??!1,reason:r?.reason??"unknown",ruleId:r?.ruleId,companyId:r?.companyId,userId:r?.userId,flagId:r?.flagId,reqCompany:t.company,reqUser:t.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(t,i,o,s)}return this.checkFlagViaAPI(t,i,o,s)}async checkFlagViaAPI(t,i,o,s){let r=s??(()=>this.getFlagDefault(i));try{let a=JSON.stringify({evalCtx:t,key:i});for(let m of this.flagCheckCacheProviders){let c=await m.get(a);if(c!=null)return this.logger.debug(`${m.constructor.name} cache hit for flag ${i}`),c}let p=await this.features.checkFlag(i,t,{timeoutInSeconds:o?.timeoutMs!==void 0?o.timeoutMs/1e3:void 0});if(p.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(p.data)}`);let d={companyId:p.data.companyId,entitlement:p.data.entitlement,err:p.data.error,flagKey:p.data.flag,flagId:p.data.flagId,reason:p.data.reason,ruleId:p.data.ruleId,ruleType:p.data.ruleType,userId:p.data.userId,value:p.data.value};for(let m of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${i} in ${m.constructor.name}`),await m.set(a,d);return d}catch(a){return this.logger.error(`Error checking flag ${i}: ${a}`),{flagKey:i,reason:"flag default",value:r()}}}async checkFlags(t,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(o=>({flag:o,value:this.getFlagDefault(o),reason:"Offline mode - using default value"})):[];try{if(!i||i.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(t)).data.flags;let o=new Map,s=[];for(let d of i){let m=JSON.stringify({evalCtx:t,key:d}),c=!1;for(let h of this.flagCheckCacheProviders){let y=await h.get(m);if(y!=null){this.logger.debug(`${h.constructor.name} cache hit for flag ${d}`),o.set(d,{flag:d,value:y.value,reason:y.reason}),c=!0;break}}c||s.push(d)}if(s.length===0)return this.logger.debug(`All ${i.length} flags found in cache`),i.map(d=>o.get(d));this.logger.debug(`Cache miss for ${s.length} flags: ${s.join(", ")}, calling API`);let a=(await this.features.checkFlags(t)).data.flags,p=[];for(let d of i){let m=a.find(c=>c.flag===d);if(m){let c=JSON.stringify({evalCtx:t,key:d}),h={companyId:m.companyId,entitlement:m.entitlement,err:m.error,flagKey:m.flag,flagId:m.flagId,reason:m.reason,ruleId:m.ruleId,ruleType:m.ruleType,userId:m.userId,value:m.value};for(let y of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${c} in ${y.constructor.name}`),await y.set(c,h);p.push(m)}else{let c=o.get(d);if(c)p.push(c);else{this.logger.debug(`Flag ${d} not found in API response or cache, using default value`);let h={flag:d,value:this.getFlagDefault(d),reason:"Flag not found - using default value"};p.push(h)}}}return this.logger.debug(`Checked ${i.length} flags: used fresh API values for consistency (${s.length} were cache misses)`),p}catch(o){return this.logger.error(`Error checking flags ${i?i.join(", "):"all"}: ${o}`),i&&i.length>0?i.map(s=>({flag:s,value:this.getFlagDefault(s),reason:`Error occurred - using default value: ${o}`})):[]}}async close(){return this.datastreamClient&&this.datastreamClient.close(),this.eventBuffer.stop()}async identify(t){if(!this.offline)try{await this.enqueueEvent("identify",t)}catch(i){this.logger.error(`Error sending identify event: ${i}`)}}async track(t){if(!this.offline)try{if(await this.enqueueEvent("track",t),t.company&&this.useDataStream()&&this.datastreamClient.isConnected())try{await this.datastreamClient.updateCompanyMetrics(t.company,t.event,t.quantity||1)}catch(i){this.logger.error(`Failed to update company metrics: ${i}`)}}catch(i){this.logger.error(`Error sending track event: ${i}`)}}setFlagDefault(t,i){this.flagDefaults[t]=i}setFlagDefaults(t){Object.assign(this.flagDefaults,t)}getFlagDefault(t){return this.flagDefaults[t]??!1}async enqueueEvent(t,i){try{this.eventBuffer.push({eventType:t,body:i,sentAt:new Date})}catch(o){this.logger.error(`Error enqueueing ${t} event: ${o}`)}}};var ho=si(require("crypto")),Ka="X-Schematic-Webhook-Signature",La="X-Schematic-Webhook-Timestamp",Je=class u extends Error{constructor(t){super(t),Object.setPrototypeOf(this,u.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new u("Missing webhook signature header")}static missingTimestamp(){return new u("Missing webhook timestamp header")}static invalidSignature(){return new u("Invalid webhook signature")}};function go(u,t,i){let o=Buffer.isBuffer(u)?u:Buffer.from(u),s=Buffer.concat([o,Buffer.from(`+${t}`)]),r=ho.createHmac("sha256",i);return r.update(s),r.digest()}function Uh(u,t,i){return go(u,t,i).toString("hex")}function Ga(u,t,i,o){if(!t)throw Je.missingSignature();if(!i)throw Je.missingTimestamp();let s;try{s=Buffer.from(t,"hex")}catch(a){throw new Je(`Invalid signature format: ${a?.message||"Unknown error"}`)}let r=go(u,i,o);if(s.length!==r.length||!ho.timingSafeEqual(s,r))throw Je.invalidSignature()}function vh(u,t,i,o={}){let s=u.headers,r=o.signatureHeader||Ka,a=o.timestampHeader||La,p=Ch(s,r),d=Ch(s,a),m;if(i!==void 0)m=i;else if("rawBody"in u&&u.rawBody)m=u.rawBody;else throw new Je("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");Ga(m,p,d,t)}function Ch(u,t){let i=u[t]||u[t.toLowerCase()];return Array.isArray(i)?i[0]||"":i||""}0&&(module.exports={LocalCache,RedisCacheProvider,RulesEngineClient,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});