@schematichq/schematic-typescript-node 1.2.6 → 1.3.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 (1718) hide show
  1. package/dist/BaseClient.d.ts +40 -0
  2. package/dist/Client.d.ts +52 -74
  3. package/dist/api/errors/BadRequestError.d.ts +2 -5
  4. package/dist/api/errors/ForbiddenError.d.ts +2 -5
  5. package/dist/api/errors/InternalServerError.d.ts +2 -5
  6. package/dist/api/errors/NotFoundError.d.ts +2 -5
  7. package/dist/api/errors/UnauthorizedError.d.ts +2 -5
  8. package/dist/api/errors/index.d.ts +2 -2
  9. package/dist/api/index.d.ts +1 -1
  10. package/dist/api/resources/accesstokens/client/Client.d.ts +10 -29
  11. package/dist/api/resources/accesstokens/client/requests/IssueTemporaryAccessTokenRequestBody.d.ts +1 -7
  12. package/dist/api/resources/accesstokens/client/requests/index.d.ts +1 -1
  13. package/dist/api/resources/accesstokens/index.d.ts +1 -1
  14. package/dist/api/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.d.ts +1 -4
  15. package/dist/api/resources/accounts/client/Client.d.ts +45 -64
  16. package/dist/api/resources/accounts/client/requests/CountApiKeysRequest.d.ts +2 -9
  17. package/dist/api/resources/accounts/client/requests/CountApiRequestsRequest.d.ts +2 -9
  18. package/dist/api/resources/accounts/client/requests/CreateApiKeyRequestBody.d.ts +0 -3
  19. package/dist/api/resources/accounts/client/requests/CreateEnvironmentRequestBody.d.ts +2 -5
  20. package/dist/api/resources/accounts/client/requests/ListApiKeysRequest.d.ts +2 -9
  21. package/dist/api/resources/accounts/client/requests/ListApiRequestsRequest.d.ts +2 -9
  22. package/dist/api/resources/accounts/client/requests/ListEnvironmentsRequest.d.ts +2 -9
  23. package/dist/api/resources/accounts/client/requests/UpdateApiKeyRequestBody.d.ts +0 -3
  24. package/dist/api/resources/accounts/client/requests/UpdateEnvironmentRequestBody.d.ts +2 -5
  25. package/dist/api/resources/accounts/client/requests/index.d.ts +9 -9
  26. package/dist/api/resources/accounts/index.d.ts +1 -1
  27. package/dist/api/resources/accounts/types/CountApiKeysParams.d.ts +0 -3
  28. package/dist/api/resources/accounts/types/CountApiKeysResponse.d.ts +1 -4
  29. package/dist/api/resources/accounts/types/CountApiRequestsParams.d.ts +0 -3
  30. package/dist/api/resources/accounts/types/CountApiRequestsResponse.d.ts +1 -4
  31. package/dist/api/resources/accounts/types/CreateApiKeyResponse.d.ts +1 -4
  32. package/dist/api/resources/accounts/types/CreateEnvironmentResponse.d.ts +1 -4
  33. package/dist/api/resources/accounts/types/DeleteApiKeyResponse.d.ts +1 -4
  34. package/dist/api/resources/accounts/types/DeleteEnvironmentResponse.d.ts +1 -4
  35. package/dist/api/resources/accounts/types/GetApiKeyResponse.d.ts +1 -4
  36. package/dist/api/resources/accounts/types/GetApiRequestResponse.d.ts +1 -4
  37. package/dist/api/resources/accounts/types/GetEnvironmentResponse.d.ts +1 -4
  38. package/dist/api/resources/accounts/types/ListApiKeysParams.d.ts +0 -3
  39. package/dist/api/resources/accounts/types/ListApiKeysResponse.d.ts +1 -4
  40. package/dist/api/resources/accounts/types/ListApiRequestsParams.d.ts +0 -3
  41. package/dist/api/resources/accounts/types/ListApiRequestsResponse.d.ts +1 -4
  42. package/dist/api/resources/accounts/types/ListEnvironmentsParams.d.ts +0 -3
  43. package/dist/api/resources/accounts/types/ListEnvironmentsResponse.d.ts +1 -4
  44. package/dist/api/resources/accounts/types/QuickstartResponse.d.ts +1 -4
  45. package/dist/api/resources/accounts/types/UpdateApiKeyResponse.d.ts +1 -4
  46. package/dist/api/resources/accounts/types/UpdateEnvironmentResponse.d.ts +1 -4
  47. package/dist/api/resources/accounts/types/index.d.ts +13 -15
  48. package/dist/api/resources/billing/client/Client.d.ts +87 -97
  49. package/dist/api/resources/billing/client/requests/CountBillingProductsRequest.d.ts +18 -33
  50. package/dist/api/resources/billing/client/requests/CountCustomersRequest.d.ts +7 -11
  51. package/dist/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +2 -3
  52. package/dist/api/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +5 -7
  53. package/dist/api/resources/billing/client/requests/CreateBillingProductRequestBody.d.ts +2 -3
  54. package/dist/api/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +5 -7
  55. package/dist/api/resources/billing/client/requests/CreateCouponRequestBody.d.ts +0 -3
  56. package/dist/api/resources/billing/client/requests/CreateInvoiceRequestBody.d.ts +0 -3
  57. package/dist/api/resources/billing/client/requests/CreateMeterRequestBody.d.ts +0 -3
  58. package/dist/api/resources/billing/client/requests/CreatePaymentMethodRequestBody.d.ts +0 -3
  59. package/dist/api/resources/billing/client/requests/ListBillingPricesRequest.d.ts +42 -0
  60. package/dist/api/resources/billing/client/requests/ListBillingProductPricesRequest.d.ts +42 -0
  61. package/dist/api/resources/billing/client/requests/ListBillingProductsRequest.d.ts +18 -33
  62. package/dist/api/resources/billing/client/requests/ListCouponsRequest.d.ts +2 -9
  63. package/dist/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.d.ts +7 -11
  64. package/dist/api/resources/billing/client/requests/ListInvoicesRequest.d.ts +2 -9
  65. package/dist/api/resources/billing/client/requests/ListMetersRequest.d.ts +2 -9
  66. package/dist/api/resources/billing/client/requests/ListPaymentMethodsRequest.d.ts +2 -9
  67. package/dist/api/resources/billing/client/requests/index.d.ts +18 -18
  68. package/dist/api/resources/billing/index.d.ts +1 -1
  69. package/dist/api/resources/billing/types/CountBillingProductsParams.d.ts +3 -5
  70. package/dist/api/resources/billing/types/CountBillingProductsResponse.d.ts +1 -4
  71. package/dist/api/resources/billing/types/CountCustomersParams.d.ts +2 -3
  72. package/dist/api/resources/billing/types/CountCustomersResponse.d.ts +1 -4
  73. package/dist/api/resources/billing/types/DeleteBillingProductResponse.d.ts +1 -4
  74. package/dist/api/resources/billing/types/DeleteProductPriceResponse.d.ts +1 -4
  75. package/dist/api/resources/billing/types/{SearchBillingPricesParams.d.ts → ListBillingPricesParams.d.ts} +10 -9
  76. package/dist/api/resources/billing/types/ListBillingPricesResponse.d.ts +6 -0
  77. package/dist/api/resources/billing/types/ListBillingProductPricesParams.d.ts +27 -0
  78. package/dist/api/resources/billing/types/ListBillingProductPricesResponse.d.ts +6 -0
  79. package/dist/api/resources/billing/types/ListBillingProductsParams.d.ts +3 -5
  80. package/dist/api/resources/billing/types/ListBillingProductsResponse.d.ts +1 -4
  81. package/dist/api/resources/billing/types/ListCouponsParams.d.ts +0 -3
  82. package/dist/api/resources/billing/types/ListCouponsResponse.d.ts +1 -4
  83. package/dist/api/resources/billing/types/ListCustomersWithSubscriptionsParams.d.ts +2 -3
  84. package/dist/api/resources/billing/types/ListCustomersWithSubscriptionsResponse.d.ts +1 -4
  85. package/dist/api/resources/billing/types/ListInvoicesParams.d.ts +0 -3
  86. package/dist/api/resources/billing/types/ListInvoicesResponse.d.ts +1 -4
  87. package/dist/api/resources/billing/types/ListMetersParams.d.ts +0 -3
  88. package/dist/api/resources/billing/types/ListMetersResponse.d.ts +1 -4
  89. package/dist/api/resources/billing/types/ListPaymentMethodsParams.d.ts +0 -3
  90. package/dist/api/resources/billing/types/ListPaymentMethodsResponse.d.ts +1 -4
  91. package/dist/api/resources/billing/types/UpsertBillingCouponResponse.d.ts +1 -4
  92. package/dist/api/resources/billing/types/UpsertBillingCustomerResponse.d.ts +1 -4
  93. package/dist/api/resources/billing/types/UpsertBillingMeterResponse.d.ts +1 -4
  94. package/dist/api/resources/billing/types/UpsertBillingPriceResponse.d.ts +1 -4
  95. package/dist/api/resources/billing/types/UpsertBillingProductResponse.d.ts +1 -4
  96. package/dist/api/resources/billing/types/UpsertBillingSubscriptionResponse.d.ts +1 -4
  97. package/dist/api/resources/billing/types/UpsertInvoiceResponse.d.ts +1 -4
  98. package/dist/api/resources/billing/types/UpsertPaymentMethodResponse.d.ts +1 -4
  99. package/dist/api/resources/billing/types/index.d.ts +17 -31
  100. package/dist/api/resources/checkout/client/Client.d.ts +38 -40
  101. package/dist/api/resources/checkout/client/requests/CancelSubscriptionRequest.d.ts +13 -0
  102. package/dist/api/resources/checkout/client/requests/CheckoutDataRequestBody.d.ts +0 -3
  103. package/dist/api/resources/checkout/client/requests/UpdateTrialEndRequestBody.d.ts +0 -3
  104. package/dist/api/resources/checkout/client/requests/index.d.ts +3 -2
  105. package/dist/api/resources/checkout/index.d.ts +1 -1
  106. package/dist/api/resources/checkout/types/CancelSubscriptionResponse.d.ts +6 -0
  107. package/dist/api/resources/checkout/types/CheckoutInternalResponse.d.ts +1 -4
  108. package/dist/api/resources/checkout/types/GetCheckoutDataResponse.d.ts +1 -4
  109. package/dist/api/resources/checkout/types/ManagePlanResponse.d.ts +1 -4
  110. package/dist/api/resources/checkout/types/PreviewCheckoutInternalResponse.d.ts +1 -4
  111. package/dist/api/resources/checkout/types/PreviewManagePlanResponse.d.ts +1 -4
  112. package/dist/api/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.d.ts +1 -4
  113. package/dist/api/resources/checkout/types/index.d.ts +2 -1
  114. package/dist/api/resources/companies/client/Client.d.ts +102 -140
  115. package/dist/api/resources/companies/client/requests/CountCompaniesForAdvancedFilterRequest.d.ts +19 -52
  116. package/dist/api/resources/companies/client/requests/CountCompaniesRequest.d.ts +8 -27
  117. package/dist/api/resources/companies/client/requests/CountEntityKeyDefinitionsRequest.d.ts +4 -11
  118. package/dist/api/resources/companies/client/requests/CountEntityTraitDefinitionsRequest.d.ts +6 -12
  119. package/dist/api/resources/companies/client/requests/CountPlanTraitsRequest.d.ts +2 -9
  120. package/dist/api/resources/companies/client/requests/CountUsersRequest.d.ts +6 -21
  121. package/dist/api/resources/companies/client/requests/CreateEntityTraitDefinitionRequestBody.d.ts +3 -6
  122. package/dist/api/resources/companies/client/requests/CreatePlanTraitRequestBody.d.ts +0 -3
  123. package/dist/api/resources/companies/client/requests/DeleteCompanyRequest.d.ts +0 -3
  124. package/dist/api/resources/companies/client/requests/GetActiveCompanySubscriptionRequest.d.ts +2 -9
  125. package/dist/api/resources/companies/client/requests/GetEntityTraitValuesRequest.d.ts +2 -9
  126. package/dist/api/resources/companies/client/requests/GetOrCreateCompanyMembershipRequestBody.d.ts +0 -3
  127. package/dist/api/resources/companies/client/requests/ListCompaniesForAdvancedFilterRequest.d.ts +19 -52
  128. package/dist/api/resources/companies/client/requests/ListCompaniesRequest.d.ts +8 -27
  129. package/dist/api/resources/companies/client/requests/ListCompanyMembershipsRequest.d.ts +2 -9
  130. package/dist/api/resources/companies/client/requests/ListEntityKeyDefinitionsRequest.d.ts +4 -11
  131. package/dist/api/resources/companies/client/requests/ListEntityTraitDefinitionsRequest.d.ts +6 -12
  132. package/dist/api/resources/companies/client/requests/ListPlanChangesRequest.d.ts +2 -9
  133. package/dist/api/resources/companies/client/requests/ListPlanTraitsRequest.d.ts +2 -9
  134. package/dist/api/resources/companies/client/requests/ListUsersRequest.d.ts +6 -21
  135. package/dist/api/resources/companies/client/requests/LookupCompanyRequest.d.ts +1 -6
  136. package/dist/api/resources/companies/client/requests/LookupUserRequest.d.ts +1 -6
  137. package/dist/api/resources/companies/client/requests/UpdateEntityTraitDefinitionRequestBody.d.ts +2 -5
  138. package/dist/api/resources/companies/client/requests/UpdatePlanTraitBulkRequestBody.d.ts +3 -4
  139. package/dist/api/resources/companies/client/requests/UpdatePlanTraitRequestBody.d.ts +0 -3
  140. package/dist/api/resources/companies/client/requests/index.d.ts +25 -26
  141. package/dist/api/resources/companies/index.d.ts +1 -1
  142. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.d.ts +4 -8
  143. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterResponse.d.ts +1 -4
  144. package/dist/api/resources/companies/types/CountCompaniesParams.d.ts +0 -3
  145. package/dist/api/resources/companies/types/CountCompaniesResponse.d.ts +1 -4
  146. package/dist/api/resources/companies/types/CountEntityKeyDefinitionsParams.d.ts +2 -5
  147. package/dist/api/resources/companies/types/CountEntityKeyDefinitionsResponse.d.ts +1 -4
  148. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsParams.d.ts +4 -6
  149. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsResponse.d.ts +1 -4
  150. package/dist/api/resources/companies/types/CountPlanTraitsParams.d.ts +0 -3
  151. package/dist/api/resources/companies/types/CountPlanTraitsResponse.d.ts +1 -4
  152. package/dist/api/resources/companies/types/CountUsersParams.d.ts +0 -3
  153. package/dist/api/resources/companies/types/CountUsersResponse.d.ts +1 -4
  154. package/dist/api/resources/companies/types/CreateCompanyResponse.d.ts +1 -4
  155. package/dist/api/resources/companies/types/CreatePlanTraitResponse.d.ts +1 -4
  156. package/dist/api/resources/companies/types/CreateUserResponse.d.ts +1 -4
  157. package/dist/api/resources/companies/types/DeleteCompanyByKeysResponse.d.ts +1 -4
  158. package/dist/api/resources/companies/types/DeleteCompanyMembershipResponse.d.ts +1 -4
  159. package/dist/api/resources/companies/types/DeleteCompanyParams.d.ts +0 -3
  160. package/dist/api/resources/companies/types/DeleteCompanyResponse.d.ts +1 -4
  161. package/dist/api/resources/companies/types/DeletePlanTraitResponse.d.ts +1 -4
  162. package/dist/api/resources/companies/types/DeleteUserByKeysResponse.d.ts +1 -4
  163. package/dist/api/resources/companies/types/DeleteUserResponse.d.ts +1 -4
  164. package/dist/api/resources/companies/types/GetActiveCompanySubscriptionParams.d.ts +0 -3
  165. package/dist/api/resources/companies/types/GetActiveCompanySubscriptionResponse.d.ts +1 -4
  166. package/dist/api/resources/companies/types/GetCompanyResponse.d.ts +1 -4
  167. package/dist/api/resources/companies/types/GetEntityTraitDefinitionResponse.d.ts +1 -4
  168. package/dist/api/resources/companies/types/GetEntityTraitValuesParams.d.ts +0 -3
  169. package/dist/api/resources/companies/types/GetEntityTraitValuesResponse.d.ts +1 -4
  170. package/dist/api/resources/companies/types/GetOrCreateCompanyMembershipResponse.d.ts +1 -4
  171. package/dist/api/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.d.ts +1 -4
  172. package/dist/api/resources/companies/types/GetPlanChangeResponse.d.ts +1 -4
  173. package/dist/api/resources/companies/types/GetPlanTraitResponse.d.ts +1 -4
  174. package/dist/api/resources/companies/types/GetUserResponse.d.ts +1 -4
  175. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.d.ts +4 -8
  176. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterResponse.d.ts +1 -4
  177. package/dist/api/resources/companies/types/ListCompaniesParams.d.ts +0 -3
  178. package/dist/api/resources/companies/types/ListCompaniesResponse.d.ts +1 -4
  179. package/dist/api/resources/companies/types/ListCompanyMembershipsParams.d.ts +0 -3
  180. package/dist/api/resources/companies/types/ListCompanyMembershipsResponse.d.ts +1 -4
  181. package/dist/api/resources/companies/types/ListEntityKeyDefinitionsParams.d.ts +2 -5
  182. package/dist/api/resources/companies/types/ListEntityKeyDefinitionsResponse.d.ts +1 -4
  183. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsParams.d.ts +4 -6
  184. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsResponse.d.ts +1 -4
  185. package/dist/api/resources/companies/types/ListPlanChangesParams.d.ts +0 -3
  186. package/dist/api/resources/companies/types/ListPlanChangesResponse.d.ts +1 -4
  187. package/dist/api/resources/companies/types/ListPlanTraitsParams.d.ts +0 -3
  188. package/dist/api/resources/companies/types/ListPlanTraitsResponse.d.ts +1 -4
  189. package/dist/api/resources/companies/types/ListUsersParams.d.ts +0 -3
  190. package/dist/api/resources/companies/types/ListUsersResponse.d.ts +1 -4
  191. package/dist/api/resources/companies/types/LookupCompanyParams.d.ts +0 -3
  192. package/dist/api/resources/companies/types/LookupCompanyResponse.d.ts +1 -4
  193. package/dist/api/resources/companies/types/LookupUserParams.d.ts +0 -3
  194. package/dist/api/resources/companies/types/LookupUserResponse.d.ts +1 -4
  195. package/dist/api/resources/companies/types/UpdateEntityTraitDefinitionResponse.d.ts +1 -4
  196. package/dist/api/resources/companies/types/UpdatePlanTraitResponse.d.ts +1 -4
  197. package/dist/api/resources/companies/types/UpdatePlanTraitsBulkResponse.d.ts +1 -4
  198. package/dist/api/resources/companies/types/UpsertCompanyResponse.d.ts +1 -4
  199. package/dist/api/resources/companies/types/UpsertCompanyTraitResponse.d.ts +1 -4
  200. package/dist/api/resources/companies/types/UpsertUserResponse.d.ts +1 -4
  201. package/dist/api/resources/companies/types/UpsertUserTraitResponse.d.ts +1 -4
  202. package/dist/api/resources/companies/types/index.d.ts +40 -61
  203. package/dist/api/resources/components/client/Client.d.ts +26 -45
  204. package/dist/api/resources/components/client/requests/CountComponentsRequest.d.ts +2 -9
  205. package/dist/api/resources/components/client/requests/CreateComponentRequestBody.d.ts +3 -6
  206. package/dist/api/resources/components/client/requests/ListComponentsRequest.d.ts +2 -9
  207. package/dist/api/resources/components/client/requests/PreviewComponentDataRequest.d.ts +0 -3
  208. package/dist/api/resources/components/client/requests/UpdateComponentRequestBody.d.ts +3 -6
  209. package/dist/api/resources/components/client/requests/index.d.ts +5 -5
  210. package/dist/api/resources/components/index.d.ts +1 -1
  211. package/dist/api/resources/components/types/CountComponentsParams.d.ts +0 -3
  212. package/dist/api/resources/components/types/CountComponentsResponse.d.ts +1 -4
  213. package/dist/api/resources/components/types/CreateComponentResponse.d.ts +1 -4
  214. package/dist/api/resources/components/types/DeleteComponentResponse.d.ts +1 -4
  215. package/dist/api/resources/components/types/GetComponentResponse.d.ts +1 -4
  216. package/dist/api/resources/components/types/ListComponentsParams.d.ts +0 -3
  217. package/dist/api/resources/components/types/ListComponentsResponse.d.ts +1 -4
  218. package/dist/api/resources/components/types/PreviewComponentDataParams.d.ts +0 -3
  219. package/dist/api/resources/components/types/PreviewComponentDataResponse.d.ts +1 -4
  220. package/dist/api/resources/components/types/UpdateComponentResponse.d.ts +1 -4
  221. package/dist/api/resources/components/types/index.d.ts +6 -9
  222. package/dist/api/resources/credits/client/Client.d.ts +68 -87
  223. package/dist/api/resources/credits/client/requests/CountBillingCreditsGrantsRequest.d.ts +2 -9
  224. package/dist/api/resources/credits/client/requests/CountBillingCreditsRequest.d.ts +2 -9
  225. package/dist/api/resources/credits/client/requests/CountBillingPlanCreditGrantsRequest.d.ts +2 -9
  226. package/dist/api/resources/credits/client/requests/CountCreditBundlesRequest.d.ts +5 -12
  227. package/dist/api/resources/credits/client/requests/CountCreditLedgerRequest.d.ts +4 -11
  228. package/dist/api/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +4 -7
  229. package/dist/api/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.d.ts +10 -13
  230. package/dist/api/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +7 -8
  231. package/dist/api/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +5 -8
  232. package/dist/api/resources/credits/client/requests/DeleteBillingPlanCreditGrantRequest.d.ts +0 -3
  233. package/dist/api/resources/credits/client/requests/GetEnrichedCreditLedgerRequest.d.ts +4 -11
  234. package/dist/api/resources/credits/client/requests/ListBillingCreditsRequest.d.ts +2 -9
  235. package/dist/api/resources/credits/client/requests/ListBillingPlanCreditGrantsRequest.d.ts +2 -9
  236. package/dist/api/resources/credits/client/requests/ListCompanyGrantsRequest.d.ts +5 -12
  237. package/dist/api/resources/credits/client/requests/ListCreditBundlesRequest.d.ts +5 -12
  238. package/dist/api/resources/credits/client/requests/ListGrantsForCreditRequest.d.ts +2 -9
  239. package/dist/api/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +4 -7
  240. package/dist/api/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.d.ts +14 -10
  241. package/dist/api/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +4 -7
  242. package/dist/api/resources/credits/client/requests/ZeroOutGrantRequestBody.d.ts +2 -5
  243. package/dist/api/resources/credits/client/requests/index.d.ts +20 -20
  244. package/dist/api/resources/credits/index.d.ts +1 -1
  245. package/dist/api/resources/credits/types/CountBillingCreditsGrantsParams.d.ts +0 -3
  246. package/dist/api/resources/credits/types/CountBillingCreditsGrantsResponse.d.ts +1 -4
  247. package/dist/api/resources/credits/types/CountBillingCreditsParams.d.ts +0 -3
  248. package/dist/api/resources/credits/types/CountBillingCreditsResponse.d.ts +1 -4
  249. package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +0 -3
  250. package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.d.ts +1 -4
  251. package/dist/api/resources/credits/types/CountCreditBundlesParams.d.ts +3 -6
  252. package/dist/api/resources/credits/types/CountCreditBundlesResponse.d.ts +1 -4
  253. package/dist/api/resources/credits/types/CountCreditLedgerParams.d.ts +2 -5
  254. package/dist/api/resources/credits/types/CountCreditLedgerResponse.d.ts +1 -4
  255. package/dist/api/resources/credits/types/CreateBillingCreditResponse.d.ts +1 -4
  256. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.d.ts +1 -4
  257. package/dist/api/resources/credits/types/CreateCreditBundleResponse.d.ts +1 -4
  258. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +0 -3
  259. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +1 -4
  260. package/dist/api/resources/credits/types/DeleteCreditBundleResponse.d.ts +1 -4
  261. package/dist/api/resources/credits/types/GetCreditBundleResponse.d.ts +1 -4
  262. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +2 -5
  263. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +1 -4
  264. package/dist/api/resources/credits/types/GetSingleBillingCreditResponse.d.ts +1 -4
  265. package/dist/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.d.ts +1 -4
  266. package/dist/api/resources/credits/types/ListBillingCreditsParams.d.ts +0 -3
  267. package/dist/api/resources/credits/types/ListBillingCreditsResponse.d.ts +1 -4
  268. package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +0 -3
  269. package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.d.ts +1 -4
  270. package/dist/api/resources/credits/types/ListCompanyGrantsParams.d.ts +3 -6
  271. package/dist/api/resources/credits/types/ListCompanyGrantsResponse.d.ts +1 -4
  272. package/dist/api/resources/credits/types/ListCreditBundlesParams.d.ts +3 -6
  273. package/dist/api/resources/credits/types/ListCreditBundlesResponse.d.ts +1 -4
  274. package/dist/api/resources/credits/types/ListGrantsForCreditParams.d.ts +0 -3
  275. package/dist/api/resources/credits/types/ListGrantsForCreditResponse.d.ts +1 -4
  276. package/dist/api/resources/credits/types/SoftDeleteBillingCreditResponse.d.ts +1 -4
  277. package/dist/api/resources/credits/types/UpdateBillingCreditResponse.d.ts +1 -4
  278. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.d.ts +1 -4
  279. package/dist/api/resources/credits/types/UpdateCreditBundleDetailsResponse.d.ts +1 -4
  280. package/dist/api/resources/credits/types/ZeroOutGrantResponse.d.ts +1 -4
  281. package/dist/api/resources/credits/types/index.d.ts +27 -64
  282. package/dist/api/resources/dataexports/client/Client.d.ts +12 -31
  283. package/dist/api/resources/dataexports/client/requests/CreateDataExportRequestBody.d.ts +0 -3
  284. package/dist/api/resources/dataexports/client/requests/index.d.ts +1 -1
  285. package/dist/api/resources/dataexports/index.d.ts +1 -1
  286. package/dist/api/resources/dataexports/types/CreateDataExportResponse.d.ts +1 -4
  287. package/dist/api/resources/entitlements/client/Client.d.ts +72 -71
  288. package/dist/api/resources/entitlements/client/requests/CountCompanyOverridesRequest.d.ts +9 -30
  289. package/dist/api/resources/entitlements/client/requests/CountFeatureCompaniesRequest.d.ts +2 -9
  290. package/dist/api/resources/entitlements/client/requests/CountFeatureUsageRequest.d.ts +5 -9
  291. package/dist/api/resources/entitlements/client/requests/CountFeatureUsersRequest.d.ts +2 -9
  292. package/dist/api/resources/entitlements/client/requests/CountPlanEntitlementsRequest.d.ts +9 -30
  293. package/dist/api/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +2 -5
  294. package/dist/api/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +4 -7
  295. package/dist/api/resources/entitlements/client/requests/DuplicatePlanEntitlementsRequestBody.d.ts +11 -0
  296. package/dist/api/resources/entitlements/client/requests/GetFeatureUsageByCompanyRequest.d.ts +1 -6
  297. package/dist/api/resources/entitlements/client/requests/ListCompanyOverridesRequest.d.ts +9 -30
  298. package/dist/api/resources/entitlements/client/requests/ListFeatureCompaniesRequest.d.ts +2 -9
  299. package/dist/api/resources/entitlements/client/requests/ListFeatureUsageRequest.d.ts +5 -9
  300. package/dist/api/resources/entitlements/client/requests/ListFeatureUsersRequest.d.ts +2 -9
  301. package/dist/api/resources/entitlements/client/requests/ListPlanEntitlementsRequest.d.ts +9 -30
  302. package/dist/api/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +2 -5
  303. package/dist/api/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +4 -7
  304. package/dist/api/resources/entitlements/client/requests/index.d.ts +16 -15
  305. package/dist/api/resources/entitlements/index.d.ts +1 -1
  306. package/dist/api/resources/entitlements/types/CountCompanyOverridesParams.d.ts +0 -3
  307. package/dist/api/resources/entitlements/types/CountCompanyOverridesResponse.d.ts +1 -4
  308. package/dist/api/resources/entitlements/types/CountFeatureCompaniesParams.d.ts +0 -3
  309. package/dist/api/resources/entitlements/types/CountFeatureCompaniesResponse.d.ts +1 -4
  310. package/dist/api/resources/entitlements/types/CountFeatureUsageParams.d.ts +2 -3
  311. package/dist/api/resources/entitlements/types/CountFeatureUsageResponse.d.ts +1 -4
  312. package/dist/api/resources/entitlements/types/CountFeatureUsersParams.d.ts +0 -3
  313. package/dist/api/resources/entitlements/types/CountFeatureUsersResponse.d.ts +1 -4
  314. package/dist/api/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +0 -3
  315. package/dist/api/resources/entitlements/types/CountPlanEntitlementsResponse.d.ts +1 -4
  316. package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +1 -4
  317. package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  318. package/dist/api/resources/entitlements/types/CreateCompanyOverrideResponse.d.ts +1 -4
  319. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +1 -4
  320. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  321. package/dist/api/resources/entitlements/types/CreatePlanEntitlementResponse.d.ts +1 -4
  322. package/dist/api/resources/entitlements/types/DeleteCompanyOverrideResponse.d.ts +1 -4
  323. package/dist/api/resources/entitlements/types/DeletePlanEntitlementResponse.d.ts +1 -4
  324. package/dist/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.d.ts +6 -0
  325. package/dist/api/resources/entitlements/types/GetCompanyOverrideResponse.d.ts +1 -4
  326. package/dist/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.d.ts +0 -3
  327. package/dist/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.d.ts +1 -4
  328. package/dist/api/resources/entitlements/types/GetPlanEntitlementResponse.d.ts +1 -4
  329. package/dist/api/resources/entitlements/types/ListCompanyOverridesParams.d.ts +0 -3
  330. package/dist/api/resources/entitlements/types/ListCompanyOverridesResponse.d.ts +1 -4
  331. package/dist/api/resources/entitlements/types/ListFeatureCompaniesParams.d.ts +0 -3
  332. package/dist/api/resources/entitlements/types/ListFeatureCompaniesResponse.d.ts +1 -4
  333. package/dist/api/resources/entitlements/types/ListFeatureUsageParams.d.ts +2 -3
  334. package/dist/api/resources/entitlements/types/ListFeatureUsageResponse.d.ts +1 -4
  335. package/dist/api/resources/entitlements/types/ListFeatureUsersParams.d.ts +0 -3
  336. package/dist/api/resources/entitlements/types/ListFeatureUsersResponse.d.ts +1 -4
  337. package/dist/api/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +0 -3
  338. package/dist/api/resources/entitlements/types/ListPlanEntitlementsResponse.d.ts +1 -4
  339. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +1 -4
  340. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  341. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideResponse.d.ts +1 -4
  342. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +1 -4
  343. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  344. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementResponse.d.ts +1 -4
  345. package/dist/api/resources/entitlements/types/index.d.ts +24 -29
  346. package/dist/api/resources/events/client/Client.d.ts +23 -42
  347. package/dist/api/resources/events/client/requests/CreateEventBatchRequestBody.d.ts +2 -5
  348. package/dist/api/resources/events/client/requests/GetEventSummariesRequest.d.ts +2 -9
  349. package/dist/api/resources/events/client/requests/ListEventsRequest.d.ts +4 -11
  350. package/dist/api/resources/events/client/requests/index.d.ts +3 -3
  351. package/dist/api/resources/events/index.d.ts +1 -1
  352. package/dist/api/resources/events/types/CreateEventBatchResponse.d.ts +1 -4
  353. package/dist/api/resources/events/types/CreateEventResponse.d.ts +1 -4
  354. package/dist/api/resources/events/types/GetEventResponse.d.ts +1 -4
  355. package/dist/api/resources/events/types/GetEventSummariesParams.d.ts +0 -3
  356. package/dist/api/resources/events/types/GetEventSummariesResponse.d.ts +1 -4
  357. package/dist/api/resources/events/types/GetSegmentIntegrationStatusResponse.d.ts +1 -4
  358. package/dist/api/resources/events/types/ListEventsParams.d.ts +2 -5
  359. package/dist/api/resources/events/types/ListEventsResponse.d.ts +1 -4
  360. package/dist/api/resources/events/types/index.d.ts +3 -5
  361. package/dist/api/resources/features/client/Client.d.ts +62 -64
  362. package/dist/api/resources/features/client/requests/CheckFlagsBulkRequestBody.d.ts +10 -0
  363. package/dist/api/resources/features/client/requests/CountFeaturesRequest.d.ts +9 -25
  364. package/dist/api/resources/features/client/requests/CountFlagsRequest.d.ts +3 -12
  365. package/dist/api/resources/features/client/requests/CreateFeatureRequestBody.d.ts +3 -6
  366. package/dist/api/resources/features/client/requests/ListFeaturesRequest.d.ts +9 -25
  367. package/dist/api/resources/features/client/requests/ListFlagsRequest.d.ts +3 -12
  368. package/dist/api/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +3 -6
  369. package/dist/api/resources/features/client/requests/UpdateFlagRulesRequestBody.d.ts +1 -4
  370. package/dist/api/resources/features/client/requests/index.d.ts +8 -7
  371. package/dist/api/resources/features/index.d.ts +1 -1
  372. package/dist/api/resources/features/types/CheckFlagResponse.d.ts +1 -4
  373. package/dist/api/resources/features/types/CheckFlagsBulkResponse.d.ts +6 -0
  374. package/dist/api/resources/features/types/CheckFlagsResponse.d.ts +1 -4
  375. package/dist/api/resources/features/types/CountFeaturesParams.d.ts +2 -4
  376. package/dist/api/resources/features/types/CountFeaturesResponse.d.ts +1 -4
  377. package/dist/api/resources/features/types/CountFlagsParams.d.ts +0 -3
  378. package/dist/api/resources/features/types/CountFlagsResponse.d.ts +1 -4
  379. package/dist/api/resources/features/types/CreateFeatureResponse.d.ts +1 -4
  380. package/dist/api/resources/features/types/CreateFlagResponse.d.ts +1 -4
  381. package/dist/api/resources/features/types/DeleteFeatureResponse.d.ts +1 -4
  382. package/dist/api/resources/features/types/DeleteFlagResponse.d.ts +1 -4
  383. package/dist/api/resources/features/types/GetFeatureResponse.d.ts +1 -4
  384. package/dist/api/resources/features/types/GetFlagResponse.d.ts +1 -4
  385. package/dist/api/resources/features/types/ListFeaturesParams.d.ts +2 -4
  386. package/dist/api/resources/features/types/ListFeaturesResponse.d.ts +1 -4
  387. package/dist/api/resources/features/types/ListFlagsParams.d.ts +0 -3
  388. package/dist/api/resources/features/types/ListFlagsResponse.d.ts +1 -4
  389. package/dist/api/resources/features/types/UpdateFeatureResponse.d.ts +1 -4
  390. package/dist/api/resources/features/types/UpdateFlagResponse.d.ts +1 -4
  391. package/dist/api/resources/features/types/UpdateFlagRulesResponse.d.ts +1 -4
  392. package/dist/api/resources/features/types/index.d.ts +14 -17
  393. package/dist/api/resources/index.d.ts +22 -25
  394. package/dist/api/resources/plangroups/client/Client.d.ts +23 -36
  395. package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +11 -6
  396. package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +11 -6
  397. package/dist/api/resources/plangroups/client/requests/index.d.ts +2 -2
  398. package/dist/api/resources/plangroups/index.d.ts +1 -1
  399. package/dist/api/resources/plangroups/types/CreatePlanGroupResponse.d.ts +1 -4
  400. package/dist/api/resources/plangroups/types/GetPlanGroupResponse.d.ts +1 -4
  401. package/dist/api/resources/plangroups/types/UpdatePlanGroupResponse.d.ts +1 -4
  402. package/dist/api/resources/plangroups/types/index.d.ts +1 -1
  403. package/dist/api/resources/plans/client/Client.d.ts +32 -55
  404. package/dist/api/resources/plans/client/requests/CountPlansRequest.d.ts +11 -42
  405. package/dist/api/resources/plans/client/requests/CreatePlanRequestBody.d.ts +2 -5
  406. package/dist/api/resources/plans/client/requests/ListPlanIssuesRequest.d.ts +0 -3
  407. package/dist/api/resources/plans/client/requests/ListPlansRequest.d.ts +11 -42
  408. package/dist/api/resources/plans/client/requests/UpdateCompanyPlansRequestBody.d.ts +0 -3
  409. package/dist/api/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -3
  410. package/dist/api/resources/plans/client/requests/UpsertBillingProductRequestBody.d.ts +3 -6
  411. package/dist/api/resources/plans/client/requests/index.d.ts +7 -7
  412. package/dist/api/resources/plans/index.d.ts +1 -1
  413. package/dist/api/resources/plans/types/CountPlansParams.d.ts +2 -10
  414. package/dist/api/resources/plans/types/CountPlansResponse.d.ts +1 -4
  415. package/dist/api/resources/plans/types/CreatePlanResponse.d.ts +1 -4
  416. package/dist/api/resources/plans/types/DeletePlanResponse.d.ts +1 -4
  417. package/dist/api/resources/plans/types/GetPlanResponse.d.ts +1 -4
  418. package/dist/api/resources/plans/types/ListPlanIssuesParams.d.ts +0 -3
  419. package/dist/api/resources/plans/types/ListPlanIssuesResponse.d.ts +1 -4
  420. package/dist/api/resources/plans/types/ListPlansParams.d.ts +2 -10
  421. package/dist/api/resources/plans/types/ListPlansResponse.d.ts +1 -4
  422. package/dist/api/resources/plans/types/UpdateCompanyPlansResponse.d.ts +1 -4
  423. package/dist/api/resources/plans/types/UpdatePlanResponse.d.ts +1 -4
  424. package/dist/api/resources/plans/types/UpsertBillingProductPlanResponse.d.ts +1 -4
  425. package/dist/api/resources/plans/types/index.d.ts +8 -14
  426. package/dist/api/resources/webhooks/client/Client.d.ts +31 -50
  427. package/dist/api/resources/webhooks/client/requests/CountWebhookEventsRequest.d.ts +2 -9
  428. package/dist/api/resources/webhooks/client/requests/CountWebhooksRequest.d.ts +2 -9
  429. package/dist/api/resources/webhooks/client/requests/CreateWebhookRequestBody.d.ts +3 -6
  430. package/dist/api/resources/webhooks/client/requests/ListWebhookEventsRequest.d.ts +2 -9
  431. package/dist/api/resources/webhooks/client/requests/ListWebhooksRequest.d.ts +2 -9
  432. package/dist/api/resources/webhooks/client/requests/UpdateWebhookRequestBody.d.ts +3 -6
  433. package/dist/api/resources/webhooks/client/requests/index.d.ts +6 -6
  434. package/dist/api/resources/webhooks/index.d.ts +1 -1
  435. package/dist/api/resources/webhooks/types/CountWebhookEventsParams.d.ts +0 -3
  436. package/dist/api/resources/webhooks/types/CountWebhookEventsResponse.d.ts +1 -4
  437. package/dist/api/resources/webhooks/types/CountWebhooksParams.d.ts +0 -3
  438. package/dist/api/resources/webhooks/types/CountWebhooksResponse.d.ts +1 -4
  439. package/dist/api/resources/webhooks/types/CreateWebhookResponse.d.ts +1 -4
  440. package/dist/api/resources/webhooks/types/DeleteWebhookResponse.d.ts +1 -4
  441. package/dist/api/resources/webhooks/types/GetWebhookEventResponse.d.ts +1 -4
  442. package/dist/api/resources/webhooks/types/GetWebhookResponse.d.ts +1 -4
  443. package/dist/api/resources/webhooks/types/ListWebhookEventsParams.d.ts +0 -3
  444. package/dist/api/resources/webhooks/types/ListWebhookEventsResponse.d.ts +1 -4
  445. package/dist/api/resources/webhooks/types/ListWebhooksParams.d.ts +0 -3
  446. package/dist/api/resources/webhooks/types/ListWebhooksResponse.d.ts +1 -4
  447. package/dist/api/resources/webhooks/types/UpdateWebhookResponse.d.ts +1 -4
  448. package/dist/api/resources/webhooks/types/index.d.ts +8 -11
  449. package/dist/api/types/ApiError.d.ts +0 -3
  450. package/dist/api/types/ApiKeyCreateResponseData.d.ts +2 -4
  451. package/dist/api/types/ApiKeyRequestListResponseData.d.ts +0 -3
  452. package/dist/api/types/ApiKeyRequestResponseData.d.ts +1 -4
  453. package/dist/api/types/ApiKeyResponseData.d.ts +2 -4
  454. package/dist/api/types/ApiKeyScope.d.ts +7 -0
  455. package/dist/api/types/BillingCouponResponseData.d.ts +2 -3
  456. package/dist/api/types/BillingCreditBundleResponseData.d.ts +5 -8
  457. package/dist/api/types/BillingCreditBundleStatus.d.ts +5 -0
  458. package/dist/api/types/BillingCreditBundleType.d.ts +1 -0
  459. package/dist/api/types/BillingCreditBundleView.d.ts +5 -8
  460. package/dist/api/types/BillingCreditBurnStrategy.d.ts +7 -0
  461. package/dist/api/types/BillingCreditExpiryType.d.ts +8 -0
  462. package/dist/api/types/BillingCreditExpiryUnit.d.ts +5 -0
  463. package/dist/api/types/BillingCreditGrantReason.d.ts +7 -0
  464. package/dist/api/types/BillingCreditGrantResponseData.d.ts +4 -6
  465. package/dist/api/types/BillingCreditGrantZeroedOutReason.d.ts +7 -0
  466. package/dist/api/types/BillingCreditLedgerResponseData.d.ts +0 -3
  467. package/dist/api/types/BillingCreditResponseData.d.ts +4 -7
  468. package/dist/api/types/BillingCreditRolloverPolicy.d.ts +6 -0
  469. package/dist/api/types/BillingCustomerResponseData.d.ts +2 -3
  470. package/dist/api/types/BillingCustomerSubscription.d.ts +0 -3
  471. package/dist/api/types/BillingCustomerWithSubscriptionsResponseData.d.ts +2 -4
  472. package/dist/api/types/BillingMeterResponseData.d.ts +2 -3
  473. package/dist/api/types/BillingPlanCreditGrantResetCadence.d.ts +7 -0
  474. package/dist/api/types/BillingPlanCreditGrantResetStart.d.ts +5 -0
  475. package/dist/api/types/BillingPlanCreditGrantResetType.d.ts +5 -0
  476. package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +8 -10
  477. package/dist/api/types/BillingPriceResponseData.d.ts +4 -5
  478. package/dist/api/types/BillingPriceScheme.d.ts +5 -0
  479. package/dist/api/types/BillingPriceUsageType.d.ts +5 -0
  480. package/dist/api/types/BillingPriceView.d.ts +6 -8
  481. package/dist/api/types/BillingProductDetailResponseData.d.ts +2 -4
  482. package/dist/api/types/BillingProductForSubscriptionResponseData.d.ts +4 -6
  483. package/dist/api/types/BillingProductPlanResponseData.d.ts +3 -5
  484. package/dist/api/types/BillingProductPriceInterval.d.ts +7 -0
  485. package/dist/api/types/BillingProductPriceResponseData.d.ts +6 -7
  486. package/dist/api/types/BillingProductPriceTierResponseData.d.ts +0 -3
  487. package/dist/api/types/BillingProductPricing.d.ts +2 -5
  488. package/dist/api/types/BillingProductResponseData.d.ts +2 -3
  489. package/dist/api/types/BillingProviderType.d.ts +5 -0
  490. package/dist/api/types/BillingSubscriptionDiscount.d.ts +0 -3
  491. package/dist/api/types/BillingSubscriptionDiscountView.d.ts +0 -3
  492. package/dist/api/types/BillingSubscriptionResponseData.d.ts +4 -4
  493. package/dist/api/types/BillingSubscriptionTrialEndSetting.d.ts +5 -0
  494. package/dist/api/types/BillingSubscriptionView.d.ts +4 -5
  495. package/dist/api/types/BillingTiersMode.d.ts +5 -0
  496. package/dist/api/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -4
  497. package/dist/api/types/ChangeSubscriptionRequestBody.d.ts +1 -4
  498. package/dist/api/types/ChargeType.d.ts +6 -0
  499. package/dist/api/types/CheckFlagRequestBody.d.ts +0 -3
  500. package/dist/api/types/CheckFlagResponseData.d.ts +0 -3
  501. package/dist/api/types/CheckFlagsBulkResponseData.d.ts +4 -0
  502. package/dist/api/types/CheckFlagsResponseData.d.ts +1 -4
  503. package/dist/api/types/CheckoutDataResponseData.d.ts +1 -4
  504. package/dist/api/types/CheckoutSettingsResponseData.d.ts +0 -3
  505. package/dist/api/types/CheckoutSubscription.d.ts +4 -4
  506. package/dist/api/types/CompanyDetailResponseData.d.ts +1 -4
  507. package/dist/api/types/CompanyEventPeriodMetricsResponseData.d.ts +0 -3
  508. package/dist/api/types/CompanyLedgerResponseData.d.ts +0 -3
  509. package/dist/api/types/CompanyMembershipDetailResponseData.d.ts +1 -4
  510. package/dist/api/types/CompanyMembershipResponseData.d.ts +0 -3
  511. package/dist/api/types/CompanyOverrideNoteResponseData.d.ts +0 -3
  512. package/dist/api/types/CompanyOverrideResponseData.d.ts +2 -5
  513. package/dist/api/types/CompanyPlanDetailResponseData.d.ts +5 -7
  514. package/dist/api/types/CompanyPlanInvalidReason.d.ts +5 -0
  515. package/dist/api/types/CompanyPlanWithBillingSubView.d.ts +2 -3
  516. package/dist/api/types/CompanyResponseData.d.ts +0 -3
  517. package/dist/api/types/CompanySubscriptionResponseData.d.ts +1 -4
  518. package/dist/api/types/CompanyViewWithFeatureUsageResponseData.d.ts +1 -4
  519. package/dist/api/types/CompatiblePlans.d.ts +0 -3
  520. package/dist/api/types/CompatiblePlansResponseData.d.ts +0 -3
  521. package/dist/api/types/ComponentCapabilities.d.ts +0 -3
  522. package/dist/api/types/ComponentCheckoutSettings.d.ts +0 -3
  523. package/dist/api/types/ComponentDisplaySettings.d.ts +6 -0
  524. package/dist/api/types/ComponentEntityType.d.ts +5 -0
  525. package/dist/api/types/ComponentHydrateResponseData.d.ts +6 -4
  526. package/dist/api/types/ComponentPreviewResponseData.d.ts +6 -4
  527. package/dist/api/types/ComponentResponseData.d.ts +3 -5
  528. package/dist/api/types/ComponentSettingsResponseData.d.ts +6 -0
  529. package/dist/api/types/ComponentState.d.ts +5 -0
  530. package/dist/api/types/Condition.d.ts +1 -4
  531. package/dist/api/types/ConditionConditionType.d.ts +1 -4
  532. package/dist/api/types/ConditionGroup.d.ts +1 -4
  533. package/dist/api/types/ConditionMetricPeriod.d.ts +1 -4
  534. package/dist/api/types/ConditionMetricPeriodMonthReset.d.ts +1 -4
  535. package/dist/api/types/ConditionOperator.d.ts +1 -4
  536. package/dist/api/types/CountResponse.d.ts +0 -3
  537. package/dist/api/types/CouponRequestBody.d.ts +0 -3
  538. package/dist/api/types/CreateBillingPriceTierRequestBody.d.ts +2 -3
  539. package/dist/api/types/CreateEntitlementReqCommon.d.ts +2 -5
  540. package/dist/api/types/CreateEntitlementReqCommonMetricPeriod.d.ts +1 -4
  541. package/dist/api/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +1 -4
  542. package/dist/api/types/CreateEventRequestBody.d.ts +2 -6
  543. package/dist/api/types/CreateFlagRequestBody.d.ts +2 -4
  544. package/dist/api/types/CreateOrUpdateConditionGroupRequestBody.d.ts +1 -4
  545. package/dist/api/types/CreateOrUpdateConditionRequestBody.d.ts +1 -4
  546. package/dist/api/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +1 -5
  547. package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +2 -7
  548. package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +2 -7
  549. package/dist/api/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +1 -4
  550. package/dist/api/types/CreateOrUpdateFlagRequestBody.d.ts +2 -4
  551. package/dist/api/types/CreateOrUpdateRuleRequestBody.d.ts +1 -4
  552. package/dist/api/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -4
  553. package/dist/api/types/CreatePriceTierRequestBody.d.ts +0 -3
  554. package/dist/api/types/CreditAutoTopupAmountType.d.ts +1 -0
  555. package/dist/api/types/CreditBundlePurchaseResponseData.d.ts +1 -4
  556. package/dist/api/types/CreditCompanyGrantView.d.ts +7 -8
  557. package/dist/api/types/CreditGrantDetail.d.ts +2 -5
  558. package/dist/api/types/CreditGrantExpiryRequestBody.d.ts +6 -9
  559. package/dist/api/types/CreditGrantSortOrder.d.ts +7 -0
  560. package/dist/api/types/CreditLedgerEnrichedEntryResponseData.d.ts +1 -4
  561. package/dist/api/types/CreditLedgerPeriod.d.ts +7 -0
  562. package/dist/api/types/CreditTransferResponseData.d.ts +8 -0
  563. package/dist/api/types/CreditTransferView.d.ts +8 -0
  564. package/dist/api/types/CreditTriggerConfig.d.ts +0 -3
  565. package/dist/api/types/CreditUsage.d.ts +2 -4
  566. package/dist/api/types/CreditUsageAggregation.d.ts +10 -0
  567. package/dist/api/types/CreditUsageResponseData.d.ts +2 -4
  568. package/dist/api/types/CustomPlanConfig.d.ts +0 -3
  569. package/dist/api/types/CustomPlanViewConfigResponseData.d.ts +0 -3
  570. package/dist/api/types/DataExportOutputFileType.d.ts +1 -0
  571. package/dist/api/types/DataExportResponseData.d.ts +4 -6
  572. package/dist/api/types/DataExportStatus.d.ts +6 -0
  573. package/dist/api/types/DataExportType.d.ts +1 -0
  574. package/dist/api/types/DeleteResponse.d.ts +0 -3
  575. package/dist/api/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +5 -0
  576. package/dist/api/types/EntitlementPriceBehavior.d.ts +8 -0
  577. package/dist/api/types/EntitlementTriggerConfig.d.ts +0 -3
  578. package/dist/api/types/EntitlementType.d.ts +6 -0
  579. package/dist/api/types/EntitlementValueType.d.ts +9 -0
  580. package/dist/api/types/EntitlementsInPlan.d.ts +0 -3
  581. package/dist/api/types/EntityKeyDefinitionResponseData.d.ts +2 -4
  582. package/dist/api/types/EntityKeyDetailResponseData.d.ts +2 -5
  583. package/dist/api/types/EntityKeyResponseData.d.ts +2 -4
  584. package/dist/api/types/EntityTraitDefinitionResponseData.d.ts +3 -5
  585. package/dist/api/types/EntityTraitDetailResponseData.d.ts +1 -4
  586. package/dist/api/types/EntityTraitResponseData.d.ts +0 -3
  587. package/dist/api/types/EntityTraitValue.d.ts +0 -3
  588. package/dist/api/types/EntityType.d.ts +5 -0
  589. package/dist/api/types/EnvironmentDetailResponseData.d.ts +2 -5
  590. package/dist/api/types/EnvironmentResponseData.d.ts +2 -4
  591. package/dist/api/types/EnvironmentType.d.ts +6 -0
  592. package/dist/api/types/EventBody.d.ts +1 -4
  593. package/dist/api/types/EventBodyFlagCheck.d.ts +0 -3
  594. package/dist/api/types/EventBodyIdentify.d.ts +1 -4
  595. package/dist/api/types/EventBodyIdentifyCompany.d.ts +0 -3
  596. package/dist/api/types/EventBodyTrack.d.ts +0 -3
  597. package/dist/api/types/EventDetailResponseData.d.ts +3 -6
  598. package/dist/api/types/EventResponseData.d.ts +3 -5
  599. package/dist/api/types/EventStatus.d.ts +8 -0
  600. package/dist/api/types/EventSummaryResponseData.d.ts +0 -3
  601. package/dist/api/types/EventType.d.ts +6 -0
  602. package/dist/api/types/FeatureCompanyResponseData.d.ts +9 -12
  603. package/dist/api/types/FeatureCompanyUserResponseData.d.ts +3 -7
  604. package/dist/api/types/FeatureDetailResponseData.d.ts +3 -6
  605. package/dist/api/types/FeatureLedgerResponseData.d.ts +0 -3
  606. package/dist/api/{resources/features/types/CreateFeatureRequestBodyLifecyclePhase.d.ts → types/FeatureLifecyclePhase.d.ts} +3 -6
  607. package/dist/api/types/FeatureResponseData.d.ts +3 -5
  608. package/dist/api/types/FeatureType.d.ts +6 -0
  609. package/dist/api/types/FeatureUsageDataResponseData.d.ts +2 -5
  610. package/dist/api/types/FeatureUsageDetailResponseData.d.ts +1 -4
  611. package/dist/api/types/FeatureUsageResponseData.d.ts +9 -12
  612. package/dist/api/types/FlagDetailResponseData.d.ts +2 -5
  613. package/dist/api/types/FlagResponseData.d.ts +2 -4
  614. package/dist/api/types/FlagType.d.ts +1 -0
  615. package/dist/api/types/GenericPreviewObject.d.ts +0 -3
  616. package/dist/api/types/InvoiceRequestBody.d.ts +0 -3
  617. package/dist/api/types/InvoiceResponseData.d.ts +2 -3
  618. package/dist/api/types/IssueTemporaryAccessTokenResponseData.d.ts +2 -4
  619. package/dist/api/types/KeysRequestBody.d.ts +0 -3
  620. package/dist/api/types/ManagePlanPreviewResponseResponseData.d.ts +1 -4
  621. package/dist/api/types/ManagePlanRequest.d.ts +6 -4
  622. package/dist/api/types/ManagePlanResponseResponseData.d.ts +1 -4
  623. package/dist/api/types/MeterRequestBody.d.ts +0 -3
  624. package/dist/api/types/OrderedPlansInGroup.d.ts +1 -4
  625. package/dist/api/types/PaymentMethodRequestBody.d.ts +0 -3
  626. package/dist/api/types/PaymentMethodResponseData.d.ts +2 -3
  627. package/dist/api/types/{PlanChangeResponseDataAction.d.ts → PlanChangeAction.d.ts} +3 -5
  628. package/dist/api/types/PlanChangeActorType.d.ts +7 -0
  629. package/dist/api/types/PlanChangeBasePlanAction.d.ts +7 -0
  630. package/dist/api/types/PlanChangeResponseData.d.ts +5 -10
  631. package/dist/api/types/PlanChangeSubscriptionAction.d.ts +9 -0
  632. package/dist/api/types/PlanControlledByType.d.ts +5 -0
  633. package/dist/api/types/PlanCreditGrantView.d.ts +8 -10
  634. package/dist/api/types/PlanDetailResponseData.d.ts +4 -7
  635. package/dist/api/types/PlanEntitlementResponseData.d.ts +3 -6
  636. package/dist/api/types/PlanEntitlementsOrder.d.ts +0 -3
  637. package/dist/api/types/PlanGroupBundleOrder.d.ts +0 -3
  638. package/dist/api/types/PlanGroupDetailResponseData.d.ts +10 -7
  639. package/dist/api/types/PlanGroupPlanDetailResponseData.d.ts +4 -7
  640. package/dist/api/types/PlanGroupPlanEntitlementsOrder.d.ts +1 -4
  641. package/dist/api/types/PlanGroupResponseData.d.ts +8 -5
  642. package/dist/api/types/PlanIssueResponseData.d.ts +0 -3
  643. package/dist/api/types/PlanResponseData.d.ts +2 -4
  644. package/dist/api/types/PlanSelection.d.ts +0 -3
  645. package/dist/api/types/PlanSnapshotView.d.ts +0 -3
  646. package/dist/api/types/PlanTraitResponseData.d.ts +0 -3
  647. package/dist/api/types/PlanType.d.ts +5 -0
  648. package/dist/api/types/PreviewObject.d.ts +0 -3
  649. package/dist/api/types/PreviewObjectResponseData.d.ts +0 -3
  650. package/dist/api/types/PreviewSubscriptionChangeResponseData.d.ts +1 -4
  651. package/dist/api/types/PreviewSubscriptionFinanceResponseData.d.ts +2 -4
  652. package/dist/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.d.ts +0 -3
  653. package/dist/api/types/ProrationBehavior.d.ts +5 -0
  654. package/dist/api/types/QuickstartResp.d.ts +0 -3
  655. package/dist/api/types/RawEventBatchResponseData.d.ts +1 -4
  656. package/dist/api/types/RawEventResponseData.d.ts +0 -3
  657. package/dist/api/types/Rule.d.ts +1 -4
  658. package/dist/api/types/RuleConditionDetailResponseData.d.ts +2 -5
  659. package/dist/api/types/RuleConditionGroupDetailResponseData.d.ts +1 -4
  660. package/dist/api/types/RuleConditionGroupResponseData.d.ts +0 -3
  661. package/dist/api/types/RuleConditionResponseData.d.ts +2 -4
  662. package/dist/api/types/RuleDetailResponseData.d.ts +1 -4
  663. package/dist/api/types/RuleResponseData.d.ts +0 -3
  664. package/dist/api/types/RuleRuleType.d.ts +1 -4
  665. package/dist/api/types/RulesDetailResponseData.d.ts +1 -4
  666. package/dist/api/types/RulesEngineSchemaVersion.d.ts +6 -0
  667. package/dist/api/types/RulesengineCheckFlagResult.d.ts +17 -0
  668. package/dist/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +7 -0
  669. package/dist/api/types/RulesengineCheckFlagResultRuleType.d.ts +10 -0
  670. package/dist/api/types/RulesengineCompany.d.ts +16 -0
  671. package/dist/api/types/RulesengineCompanyMetric.d.ts +12 -0
  672. package/dist/api/types/RulesengineCompanyMetricMonthReset.d.ts +5 -0
  673. package/dist/api/types/RulesengineCompanyMetricPeriod.d.ts +7 -0
  674. package/dist/api/types/RulesengineCondition.d.ts +18 -0
  675. package/dist/api/types/RulesengineConditionConditionType.d.ts +12 -0
  676. package/dist/api/types/RulesengineConditionGroup.d.ts +4 -0
  677. package/dist/api/types/RulesengineConditionMetricPeriod.d.ts +7 -0
  678. package/dist/api/types/RulesengineConditionMetricPeriodMonthReset.d.ts +5 -0
  679. package/dist/api/types/RulesengineConditionOperator.d.ts +11 -0
  680. package/dist/api/types/RulesengineEntityType.d.ts +5 -0
  681. package/dist/api/types/RulesengineFlag.d.ts +9 -0
  682. package/dist/api/types/RulesengineRule.d.ts +13 -0
  683. package/dist/api/types/RulesengineRuleRuleType.d.ts +10 -0
  684. package/dist/api/types/RulesengineSubscription.d.ts +5 -0
  685. package/dist/api/types/RulesengineTrait.d.ts +5 -0
  686. package/dist/api/types/RulesengineTraitDefinition.d.ts +6 -0
  687. package/dist/api/types/RulesengineTraitDefinitionComparableType.d.ts +7 -0
  688. package/dist/api/types/RulesengineUser.d.ts +9 -0
  689. package/dist/api/types/SegmentStatusResp.d.ts +0 -3
  690. package/dist/api/types/SkippedEntitlementErrorResponseData.d.ts +3 -0
  691. package/dist/api/types/SkippedEntitlementResponseData.d.ts +7 -0
  692. package/dist/api/types/SortDirection.d.ts +5 -0
  693. package/dist/api/types/StripeEmbedInfo.d.ts +0 -3
  694. package/dist/api/types/SubscriptionStatus.d.ts +12 -0
  695. package/dist/api/types/SubscriptionTraitUpdate.d.ts +2 -4
  696. package/dist/api/types/SubscriptionType.d.ts +7 -0
  697. package/dist/api/types/TemporaryAccessTokenResourceType.d.ts +1 -0
  698. package/dist/api/types/TemporaryAccessTokenResponseData.d.ts +2 -4
  699. package/dist/api/types/TraitDefinition.d.ts +2 -5
  700. package/dist/api/types/TraitDefinitionComparableType.d.ts +1 -4
  701. package/dist/api/types/TraitType.d.ts +9 -0
  702. package/dist/api/types/UpdateAddOnRequestBody.d.ts +0 -3
  703. package/dist/api/types/UpdateCreditBundleRequestBody.d.ts +0 -3
  704. package/dist/api/types/UpdateEntitlementReqCommon.d.ts +2 -5
  705. package/dist/api/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +1 -4
  706. package/dist/api/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +1 -4
  707. package/dist/api/types/UpdatePayInAdvanceRequestBody.d.ts +0 -3
  708. package/dist/api/types/UpdatePlanTraitTraitRequestBody.d.ts +0 -3
  709. package/dist/api/types/UpdateRuleRequestBody.d.ts +1 -4
  710. package/dist/api/types/UpsertCompanyRequestBody.d.ts +0 -3
  711. package/dist/api/types/UpsertTraitRequestBody.d.ts +0 -3
  712. package/dist/api/types/UpsertUserRequestBody.d.ts +0 -3
  713. package/dist/api/types/UpsertUserSubRequestBody.d.ts +0 -3
  714. package/dist/api/types/UsageBasedEntitlementRequestBody.d.ts +3 -6
  715. package/dist/api/types/UsageBasedEntitlementResponseData.d.ts +3 -6
  716. package/dist/api/types/UserDetailResponseData.d.ts +1 -4
  717. package/dist/api/types/UserResponseData.d.ts +0 -3
  718. package/dist/api/types/WebhookEventDetailResponseData.d.ts +3 -6
  719. package/dist/api/types/WebhookEventResponseData.d.ts +3 -5
  720. package/dist/api/types/WebhookEventStatus.d.ts +6 -0
  721. package/dist/api/{resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts → types/WebhookRequestType.d.ts} +30 -31
  722. package/dist/api/types/WebhookResponseData.d.ts +3 -6
  723. package/dist/api/types/WebhookStatus.d.ts +5 -0
  724. package/dist/api/types/index.d.ts +99 -41
  725. package/dist/auth/HeaderAuthProvider.d.ts +16 -0
  726. package/dist/auth/index.d.ts +1 -0
  727. package/dist/cache.d.ts +1 -1
  728. package/dist/core/auth/AuthProvider.d.ts +7 -0
  729. package/dist/core/auth/AuthRequest.d.ts +9 -0
  730. package/dist/core/auth/BasicAuth.d.ts +8 -0
  731. package/dist/core/auth/BearerToken.d.ts +7 -0
  732. package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
  733. package/dist/core/auth/index.d.ts +5 -0
  734. package/dist/core/base64.d.ts +2 -0
  735. package/dist/core/exports.d.ts +1 -0
  736. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  737. package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
  738. package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
  739. package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
  740. package/dist/core/fetcher/Fetcher.d.ts +16 -6
  741. package/dist/core/fetcher/HttpResponsePromise.d.ts +1 -1
  742. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  743. package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
  744. package/dist/core/fetcher/getRequestBody.d.ts +1 -1
  745. package/dist/core/fetcher/index.d.ts +7 -4
  746. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  747. package/dist/core/fetcher/signals.d.ts +1 -7
  748. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +1 -1
  749. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +1 -1
  750. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  751. package/dist/core/headers.d.ts +2 -0
  752. package/dist/core/index.d.ts +4 -0
  753. package/dist/core/logging/exports.d.ts +18 -0
  754. package/dist/core/logging/index.d.ts +1 -0
  755. package/dist/core/logging/logger.d.ts +126 -0
  756. package/dist/core/schemas/Schema.d.ts +2 -1
  757. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  758. package/dist/core/schemas/builders/date/date.d.ts +1 -1
  759. package/dist/core/schemas/builders/enum/enum.d.ts +1 -1
  760. package/dist/core/schemas/builders/index.d.ts +14 -14
  761. package/dist/core/schemas/builders/lazy/index.d.ts +1 -1
  762. package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
  763. package/dist/core/schemas/builders/lazy/lazyObject.d.ts +2 -2
  764. package/dist/core/schemas/builders/list/list.d.ts +1 -1
  765. package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +1 -1
  766. package/dist/core/schemas/builders/literals/index.d.ts +1 -1
  767. package/dist/core/schemas/builders/literals/stringLiteral.d.ts +1 -1
  768. package/dist/core/schemas/builders/object/index.d.ts +2 -2
  769. package/dist/core/schemas/builders/object/object.d.ts +1 -1
  770. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +1 -1
  771. package/dist/core/schemas/builders/object/property.d.ts +1 -1
  772. package/dist/core/schemas/builders/object/types.d.ts +5 -5
  773. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +2 -2
  774. package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
  775. package/dist/core/schemas/builders/primitives/any.d.ts +2 -1
  776. package/dist/core/schemas/builders/primitives/boolean.d.ts +2 -1
  777. package/dist/core/schemas/builders/primitives/index.d.ts +1 -0
  778. package/dist/core/schemas/builders/primitives/never.d.ts +2 -0
  779. package/dist/core/schemas/builders/primitives/number.d.ts +2 -1
  780. package/dist/core/schemas/builders/primitives/string.d.ts +2 -1
  781. package/dist/core/schemas/builders/primitives/unknown.d.ts +2 -1
  782. package/dist/core/schemas/builders/record/record.d.ts +2 -2
  783. package/dist/core/schemas/builders/record/types.d.ts +2 -2
  784. package/dist/core/schemas/builders/schema-utils/JsonError.d.ts +1 -1
  785. package/dist/core/schemas/builders/schema-utils/ParseError.d.ts +1 -1
  786. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +1 -1
  787. package/dist/core/schemas/builders/schema-utils/index.d.ts +1 -1
  788. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +1 -1
  789. package/dist/core/schemas/builders/set/set.d.ts +1 -1
  790. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +1 -1
  791. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +2 -2
  792. package/dist/core/schemas/builders/union/index.d.ts +1 -1
  793. package/dist/core/schemas/builders/union/types.d.ts +2 -2
  794. package/dist/core/schemas/builders/union/union.d.ts +3 -3
  795. package/dist/core/schemas/index.d.ts +1 -1
  796. package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +1 -1
  797. package/dist/core/schemas/utils/maybeSkipValidation.d.ts +1 -1
  798. package/dist/core/url/encodePathParam.d.ts +1 -0
  799. package/dist/core/url/index.d.ts +3 -0
  800. package/dist/core/url/join.d.ts +1 -0
  801. package/dist/core/url/qs.d.ts +6 -0
  802. package/dist/environments.d.ts +0 -3
  803. package/dist/errors/SchematicError.d.ts +1 -4
  804. package/dist/errors/SchematicTimeoutError.d.ts +0 -3
  805. package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
  806. package/dist/events.d.ts +2 -2
  807. package/dist/exports.d.ts +1 -0
  808. package/dist/index.js +3 -3
  809. package/dist/serialization/resources/accesstokens/client/requests/IssueTemporaryAccessTokenRequestBody.d.ts +2 -6
  810. package/dist/serialization/resources/accesstokens/index.d.ts +1 -1
  811. package/dist/serialization/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.d.ts +2 -5
  812. package/dist/serialization/resources/accounts/client/requests/CreateApiKeyRequestBody.d.ts +2 -5
  813. package/dist/serialization/resources/accounts/client/requests/CreateEnvironmentRequestBody.d.ts +4 -7
  814. package/dist/serialization/resources/accounts/client/requests/UpdateApiKeyRequestBody.d.ts +2 -5
  815. package/dist/serialization/resources/accounts/client/requests/UpdateEnvironmentRequestBody.d.ts +4 -7
  816. package/dist/serialization/resources/accounts/client/requests/index.d.ts +1 -1
  817. package/dist/serialization/resources/accounts/index.d.ts +1 -1
  818. package/dist/serialization/resources/accounts/types/CountApiKeysParams.d.ts +2 -5
  819. package/dist/serialization/resources/accounts/types/CountApiKeysResponse.d.ts +2 -5
  820. package/dist/serialization/resources/accounts/types/CountApiRequestsParams.d.ts +2 -5
  821. package/dist/serialization/resources/accounts/types/CountApiRequestsResponse.d.ts +2 -5
  822. package/dist/serialization/resources/accounts/types/CreateApiKeyResponse.d.ts +2 -5
  823. package/dist/serialization/resources/accounts/types/CreateEnvironmentResponse.d.ts +2 -5
  824. package/dist/serialization/resources/accounts/types/DeleteApiKeyResponse.d.ts +2 -5
  825. package/dist/serialization/resources/accounts/types/DeleteEnvironmentResponse.d.ts +2 -5
  826. package/dist/serialization/resources/accounts/types/GetApiKeyResponse.d.ts +2 -5
  827. package/dist/serialization/resources/accounts/types/GetApiRequestResponse.d.ts +2 -5
  828. package/dist/serialization/resources/accounts/types/GetEnvironmentResponse.d.ts +2 -5
  829. package/dist/serialization/resources/accounts/types/ListApiKeysParams.d.ts +2 -5
  830. package/dist/serialization/resources/accounts/types/ListApiKeysResponse.d.ts +2 -5
  831. package/dist/serialization/resources/accounts/types/ListApiRequestsParams.d.ts +2 -5
  832. package/dist/serialization/resources/accounts/types/ListApiRequestsResponse.d.ts +2 -5
  833. package/dist/serialization/resources/accounts/types/ListEnvironmentsParams.d.ts +2 -5
  834. package/dist/serialization/resources/accounts/types/ListEnvironmentsResponse.d.ts +2 -5
  835. package/dist/serialization/resources/accounts/types/QuickstartResponse.d.ts +2 -5
  836. package/dist/serialization/resources/accounts/types/UpdateApiKeyResponse.d.ts +2 -5
  837. package/dist/serialization/resources/accounts/types/UpdateEnvironmentResponse.d.ts +2 -5
  838. package/dist/serialization/resources/accounts/types/index.d.ts +13 -15
  839. package/dist/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +4 -5
  840. package/dist/serialization/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +10 -11
  841. package/dist/serialization/resources/billing/client/requests/CreateBillingProductRequestBody.d.ts +4 -5
  842. package/dist/serialization/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +6 -8
  843. package/dist/serialization/resources/billing/client/requests/CreateCouponRequestBody.d.ts +2 -5
  844. package/dist/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.d.ts +2 -5
  845. package/dist/serialization/resources/billing/client/requests/CreateMeterRequestBody.d.ts +2 -5
  846. package/dist/serialization/resources/billing/client/requests/CreatePaymentMethodRequestBody.d.ts +2 -5
  847. package/dist/serialization/resources/billing/client/requests/index.d.ts +4 -4
  848. package/dist/serialization/resources/billing/index.d.ts +1 -1
  849. package/dist/serialization/resources/billing/types/CountBillingProductsParams.d.ts +6 -7
  850. package/dist/serialization/resources/billing/types/CountBillingProductsResponse.d.ts +2 -5
  851. package/dist/serialization/resources/billing/types/CountCustomersParams.d.ts +4 -5
  852. package/dist/serialization/resources/billing/types/CountCustomersResponse.d.ts +2 -5
  853. package/dist/serialization/resources/billing/types/DeleteBillingProductResponse.d.ts +2 -5
  854. package/dist/serialization/resources/billing/types/DeleteProductPriceResponse.d.ts +2 -5
  855. package/dist/serialization/resources/billing/types/ListBillingPricesParams.d.ts +26 -0
  856. package/dist/serialization/resources/billing/types/ListBillingPricesResponse.d.ts +12 -0
  857. package/dist/serialization/resources/billing/types/ListBillingProductPricesParams.d.ts +26 -0
  858. package/dist/serialization/resources/billing/types/ListBillingProductPricesResponse.d.ts +12 -0
  859. package/dist/serialization/resources/billing/types/ListBillingProductsParams.d.ts +6 -7
  860. package/dist/serialization/resources/billing/types/ListBillingProductsResponse.d.ts +2 -5
  861. package/dist/serialization/resources/billing/types/ListCouponsParams.d.ts +2 -5
  862. package/dist/serialization/resources/billing/types/ListCouponsResponse.d.ts +2 -5
  863. package/dist/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.d.ts +4 -5
  864. package/dist/serialization/resources/billing/types/ListCustomersWithSubscriptionsResponse.d.ts +2 -5
  865. package/dist/serialization/resources/billing/types/ListInvoicesParams.d.ts +2 -5
  866. package/dist/serialization/resources/billing/types/ListInvoicesResponse.d.ts +2 -5
  867. package/dist/serialization/resources/billing/types/ListMetersParams.d.ts +2 -5
  868. package/dist/serialization/resources/billing/types/ListMetersResponse.d.ts +2 -5
  869. package/dist/serialization/resources/billing/types/ListPaymentMethodsParams.d.ts +2 -5
  870. package/dist/serialization/resources/billing/types/ListPaymentMethodsResponse.d.ts +2 -5
  871. package/dist/serialization/resources/billing/types/UpsertBillingCouponResponse.d.ts +2 -5
  872. package/dist/serialization/resources/billing/types/UpsertBillingCustomerResponse.d.ts +2 -5
  873. package/dist/serialization/resources/billing/types/UpsertBillingMeterResponse.d.ts +2 -5
  874. package/dist/serialization/resources/billing/types/UpsertBillingPriceResponse.d.ts +2 -5
  875. package/dist/serialization/resources/billing/types/UpsertBillingProductResponse.d.ts +2 -5
  876. package/dist/serialization/resources/billing/types/UpsertBillingSubscriptionResponse.d.ts +2 -5
  877. package/dist/serialization/resources/billing/types/UpsertInvoiceResponse.d.ts +2 -5
  878. package/dist/serialization/resources/billing/types/UpsertPaymentMethodResponse.d.ts +2 -5
  879. package/dist/serialization/resources/billing/types/index.d.ts +17 -31
  880. package/dist/serialization/resources/checkout/client/requests/CancelSubscriptionRequest.d.ts +11 -0
  881. package/dist/serialization/resources/checkout/client/requests/CheckoutDataRequestBody.d.ts +2 -5
  882. package/dist/serialization/resources/checkout/client/requests/UpdateTrialEndRequestBody.d.ts +2 -5
  883. package/dist/serialization/resources/checkout/client/requests/index.d.ts +1 -0
  884. package/dist/serialization/resources/checkout/index.d.ts +1 -1
  885. package/dist/serialization/resources/checkout/types/CancelSubscriptionResponse.d.ts +11 -0
  886. package/dist/serialization/resources/checkout/types/CheckoutInternalResponse.d.ts +2 -5
  887. package/dist/serialization/resources/checkout/types/GetCheckoutDataResponse.d.ts +2 -5
  888. package/dist/serialization/resources/checkout/types/ManagePlanResponse.d.ts +2 -5
  889. package/dist/serialization/resources/checkout/types/PreviewCheckoutInternalResponse.d.ts +2 -5
  890. package/dist/serialization/resources/checkout/types/PreviewManagePlanResponse.d.ts +2 -5
  891. package/dist/serialization/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.d.ts +2 -5
  892. package/dist/serialization/resources/checkout/types/index.d.ts +2 -1
  893. package/dist/serialization/resources/companies/client/requests/CreateEntityTraitDefinitionRequestBody.d.ts +6 -9
  894. package/dist/serialization/resources/companies/client/requests/CreatePlanTraitRequestBody.d.ts +2 -5
  895. package/dist/serialization/resources/companies/client/requests/GetOrCreateCompanyMembershipRequestBody.d.ts +2 -5
  896. package/dist/serialization/resources/companies/client/requests/UpdateEntityTraitDefinitionRequestBody.d.ts +4 -7
  897. package/dist/serialization/resources/companies/client/requests/UpdatePlanTraitBulkRequestBody.d.ts +3 -5
  898. package/dist/serialization/resources/companies/client/requests/UpdatePlanTraitRequestBody.d.ts +2 -5
  899. package/dist/serialization/resources/companies/client/requests/index.d.ts +3 -3
  900. package/dist/serialization/resources/companies/index.d.ts +1 -1
  901. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterParams.d.ts +8 -9
  902. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterResponse.d.ts +2 -5
  903. package/dist/serialization/resources/companies/types/CountCompaniesParams.d.ts +2 -5
  904. package/dist/serialization/resources/companies/types/CountCompaniesResponse.d.ts +2 -5
  905. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsParams.d.ts +4 -7
  906. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsResponse.d.ts +2 -5
  907. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsParams.d.ts +7 -9
  908. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsResponse.d.ts +2 -5
  909. package/dist/serialization/resources/companies/types/CountPlanTraitsParams.d.ts +2 -5
  910. package/dist/serialization/resources/companies/types/CountPlanTraitsResponse.d.ts +2 -5
  911. package/dist/serialization/resources/companies/types/CountUsersParams.d.ts +2 -5
  912. package/dist/serialization/resources/companies/types/CountUsersResponse.d.ts +2 -5
  913. package/dist/serialization/resources/companies/types/CreateCompanyResponse.d.ts +2 -5
  914. package/dist/serialization/resources/companies/types/CreatePlanTraitResponse.d.ts +2 -5
  915. package/dist/serialization/resources/companies/types/CreateUserResponse.d.ts +2 -5
  916. package/dist/serialization/resources/companies/types/DeleteCompanyByKeysResponse.d.ts +2 -5
  917. package/dist/serialization/resources/companies/types/DeleteCompanyMembershipResponse.d.ts +2 -5
  918. package/dist/serialization/resources/companies/types/DeleteCompanyParams.d.ts +2 -5
  919. package/dist/serialization/resources/companies/types/DeleteCompanyResponse.d.ts +2 -5
  920. package/dist/serialization/resources/companies/types/DeletePlanTraitResponse.d.ts +2 -5
  921. package/dist/serialization/resources/companies/types/DeleteUserByKeysResponse.d.ts +2 -5
  922. package/dist/serialization/resources/companies/types/DeleteUserResponse.d.ts +2 -5
  923. package/dist/serialization/resources/companies/types/GetActiveCompanySubscriptionParams.d.ts +2 -5
  924. package/dist/serialization/resources/companies/types/GetActiveCompanySubscriptionResponse.d.ts +2 -5
  925. package/dist/serialization/resources/companies/types/GetCompanyResponse.d.ts +2 -5
  926. package/dist/serialization/resources/companies/types/GetEntityTraitDefinitionResponse.d.ts +2 -5
  927. package/dist/serialization/resources/companies/types/GetEntityTraitValuesParams.d.ts +2 -5
  928. package/dist/serialization/resources/companies/types/GetEntityTraitValuesResponse.d.ts +2 -5
  929. package/dist/serialization/resources/companies/types/GetOrCreateCompanyMembershipResponse.d.ts +2 -5
  930. package/dist/serialization/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.d.ts +2 -5
  931. package/dist/serialization/resources/companies/types/GetPlanChangeResponse.d.ts +2 -5
  932. package/dist/serialization/resources/companies/types/GetPlanTraitResponse.d.ts +2 -5
  933. package/dist/serialization/resources/companies/types/GetUserResponse.d.ts +2 -5
  934. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterParams.d.ts +8 -9
  935. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterResponse.d.ts +2 -5
  936. package/dist/serialization/resources/companies/types/ListCompaniesParams.d.ts +2 -5
  937. package/dist/serialization/resources/companies/types/ListCompaniesResponse.d.ts +2 -5
  938. package/dist/serialization/resources/companies/types/ListCompanyMembershipsParams.d.ts +2 -5
  939. package/dist/serialization/resources/companies/types/ListCompanyMembershipsResponse.d.ts +2 -5
  940. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsParams.d.ts +4 -7
  941. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsResponse.d.ts +2 -5
  942. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsParams.d.ts +7 -9
  943. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsResponse.d.ts +2 -5
  944. package/dist/serialization/resources/companies/types/ListPlanChangesParams.d.ts +2 -5
  945. package/dist/serialization/resources/companies/types/ListPlanChangesResponse.d.ts +2 -5
  946. package/dist/serialization/resources/companies/types/ListPlanTraitsParams.d.ts +2 -5
  947. package/dist/serialization/resources/companies/types/ListPlanTraitsResponse.d.ts +2 -5
  948. package/dist/serialization/resources/companies/types/ListUsersParams.d.ts +2 -5
  949. package/dist/serialization/resources/companies/types/ListUsersResponse.d.ts +2 -5
  950. package/dist/serialization/resources/companies/types/LookupCompanyParams.d.ts +2 -5
  951. package/dist/serialization/resources/companies/types/LookupCompanyResponse.d.ts +2 -5
  952. package/dist/serialization/resources/companies/types/LookupUserParams.d.ts +2 -5
  953. package/dist/serialization/resources/companies/types/LookupUserResponse.d.ts +2 -5
  954. package/dist/serialization/resources/companies/types/UpdateEntityTraitDefinitionResponse.d.ts +2 -5
  955. package/dist/serialization/resources/companies/types/UpdatePlanTraitResponse.d.ts +2 -5
  956. package/dist/serialization/resources/companies/types/UpdatePlanTraitsBulkResponse.d.ts +2 -5
  957. package/dist/serialization/resources/companies/types/UpsertCompanyResponse.d.ts +2 -5
  958. package/dist/serialization/resources/companies/types/UpsertCompanyTraitResponse.d.ts +2 -5
  959. package/dist/serialization/resources/companies/types/UpsertUserResponse.d.ts +2 -5
  960. package/dist/serialization/resources/companies/types/UpsertUserTraitResponse.d.ts +2 -5
  961. package/dist/serialization/resources/companies/types/index.d.ts +40 -61
  962. package/dist/serialization/resources/components/client/requests/CreateComponentRequestBody.d.ts +4 -7
  963. package/dist/serialization/resources/components/client/requests/UpdateComponentRequestBody.d.ts +6 -9
  964. package/dist/serialization/resources/components/index.d.ts +1 -1
  965. package/dist/serialization/resources/components/types/CountComponentsParams.d.ts +2 -5
  966. package/dist/serialization/resources/components/types/CountComponentsResponse.d.ts +2 -5
  967. package/dist/serialization/resources/components/types/CreateComponentResponse.d.ts +2 -5
  968. package/dist/serialization/resources/components/types/DeleteComponentResponse.d.ts +2 -5
  969. package/dist/serialization/resources/components/types/GetComponentResponse.d.ts +2 -5
  970. package/dist/serialization/resources/components/types/ListComponentsParams.d.ts +2 -5
  971. package/dist/serialization/resources/components/types/ListComponentsResponse.d.ts +2 -5
  972. package/dist/serialization/resources/components/types/PreviewComponentDataParams.d.ts +2 -5
  973. package/dist/serialization/resources/components/types/PreviewComponentDataResponse.d.ts +2 -5
  974. package/dist/serialization/resources/components/types/UpdateComponentResponse.d.ts +2 -5
  975. package/dist/serialization/resources/components/types/index.d.ts +6 -9
  976. package/dist/serialization/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +8 -10
  977. package/dist/serialization/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.d.ts +16 -20
  978. package/dist/serialization/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +11 -10
  979. package/dist/serialization/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +10 -12
  980. package/dist/serialization/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +8 -10
  981. package/dist/serialization/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.d.ts +20 -15
  982. package/dist/serialization/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +8 -11
  983. package/dist/serialization/resources/credits/client/requests/ZeroOutGrantRequestBody.d.ts +4 -7
  984. package/dist/serialization/resources/credits/client/requests/index.d.ts +4 -4
  985. package/dist/serialization/resources/credits/index.d.ts +1 -1
  986. package/dist/serialization/resources/credits/types/CountBillingCreditsGrantsParams.d.ts +2 -5
  987. package/dist/serialization/resources/credits/types/CountBillingCreditsGrantsResponse.d.ts +2 -5
  988. package/dist/serialization/resources/credits/types/CountBillingCreditsParams.d.ts +2 -5
  989. package/dist/serialization/resources/credits/types/CountBillingCreditsResponse.d.ts +2 -5
  990. package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +2 -5
  991. package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsResponse.d.ts +2 -5
  992. package/dist/serialization/resources/credits/types/CountCreditBundlesParams.d.ts +6 -8
  993. package/dist/serialization/resources/credits/types/CountCreditBundlesResponse.d.ts +2 -5
  994. package/dist/serialization/resources/credits/types/CountCreditLedgerParams.d.ts +4 -7
  995. package/dist/serialization/resources/credits/types/CountCreditLedgerResponse.d.ts +2 -5
  996. package/dist/serialization/resources/credits/types/CreateBillingCreditResponse.d.ts +2 -5
  997. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantResponse.d.ts +2 -5
  998. package/dist/serialization/resources/credits/types/CreateCreditBundleResponse.d.ts +2 -5
  999. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +2 -5
  1000. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +2 -5
  1001. package/dist/serialization/resources/credits/types/DeleteCreditBundleResponse.d.ts +2 -5
  1002. package/dist/serialization/resources/credits/types/GetCreditBundleResponse.d.ts +2 -5
  1003. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +4 -7
  1004. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +2 -5
  1005. package/dist/serialization/resources/credits/types/GetSingleBillingCreditResponse.d.ts +2 -5
  1006. package/dist/serialization/resources/credits/types/GrantBillingCreditsToCompanyResponse.d.ts +2 -5
  1007. package/dist/serialization/resources/credits/types/ListBillingCreditsParams.d.ts +2 -5
  1008. package/dist/serialization/resources/credits/types/ListBillingCreditsResponse.d.ts +2 -5
  1009. package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +2 -5
  1010. package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsResponse.d.ts +2 -5
  1011. package/dist/serialization/resources/credits/types/ListCompanyGrantsParams.d.ts +6 -9
  1012. package/dist/serialization/resources/credits/types/ListCompanyGrantsResponse.d.ts +2 -5
  1013. package/dist/serialization/resources/credits/types/ListCreditBundlesParams.d.ts +6 -8
  1014. package/dist/serialization/resources/credits/types/ListCreditBundlesResponse.d.ts +2 -5
  1015. package/dist/serialization/resources/credits/types/ListGrantsForCreditParams.d.ts +2 -5
  1016. package/dist/serialization/resources/credits/types/ListGrantsForCreditResponse.d.ts +2 -5
  1017. package/dist/serialization/resources/credits/types/SoftDeleteBillingCreditResponse.d.ts +2 -5
  1018. package/dist/serialization/resources/credits/types/UpdateBillingCreditResponse.d.ts +2 -5
  1019. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantResponse.d.ts +2 -5
  1020. package/dist/serialization/resources/credits/types/UpdateCreditBundleDetailsResponse.d.ts +2 -5
  1021. package/dist/serialization/resources/credits/types/ZeroOutGrantResponse.d.ts +2 -5
  1022. package/dist/serialization/resources/credits/types/index.d.ts +27 -64
  1023. package/dist/serialization/resources/dataexports/client/requests/CreateDataExportRequestBody.d.ts +2 -5
  1024. package/dist/serialization/resources/dataexports/index.d.ts +1 -1
  1025. package/dist/serialization/resources/dataexports/types/CreateDataExportResponse.d.ts +2 -5
  1026. package/dist/serialization/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +4 -7
  1027. package/dist/serialization/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +9 -11
  1028. package/dist/serialization/resources/entitlements/client/requests/DuplicatePlanEntitlementsRequestBody.d.ts +10 -0
  1029. package/dist/serialization/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +4 -7
  1030. package/dist/serialization/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +9 -11
  1031. package/dist/serialization/resources/entitlements/client/requests/index.d.ts +2 -1
  1032. package/dist/serialization/resources/entitlements/index.d.ts +1 -1
  1033. package/dist/serialization/resources/entitlements/types/CountCompanyOverridesParams.d.ts +2 -5
  1034. package/dist/serialization/resources/entitlements/types/CountCompanyOverridesResponse.d.ts +2 -5
  1035. package/dist/serialization/resources/entitlements/types/CountFeatureCompaniesParams.d.ts +2 -5
  1036. package/dist/serialization/resources/entitlements/types/CountFeatureCompaniesResponse.d.ts +2 -5
  1037. package/dist/serialization/resources/entitlements/types/CountFeatureUsageParams.d.ts +3 -5
  1038. package/dist/serialization/resources/entitlements/types/CountFeatureUsageResponse.d.ts +2 -5
  1039. package/dist/serialization/resources/entitlements/types/CountFeatureUsersParams.d.ts +2 -5
  1040. package/dist/serialization/resources/entitlements/types/CountFeatureUsersResponse.d.ts +2 -5
  1041. package/dist/serialization/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +2 -5
  1042. package/dist/serialization/resources/entitlements/types/CountPlanEntitlementsResponse.d.ts +2 -5
  1043. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +2 -5
  1044. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1045. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideResponse.d.ts +2 -5
  1046. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +2 -5
  1047. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1048. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementResponse.d.ts +2 -5
  1049. package/dist/serialization/resources/entitlements/types/DeleteCompanyOverrideResponse.d.ts +2 -5
  1050. package/dist/serialization/resources/entitlements/types/DeletePlanEntitlementResponse.d.ts +2 -5
  1051. package/dist/serialization/resources/entitlements/types/DuplicatePlanEntitlementsResponse.d.ts +11 -0
  1052. package/dist/serialization/resources/entitlements/types/GetCompanyOverrideResponse.d.ts +2 -5
  1053. package/dist/serialization/resources/entitlements/types/GetFeatureUsageByCompanyParams.d.ts +2 -5
  1054. package/dist/serialization/resources/entitlements/types/GetFeatureUsageByCompanyResponse.d.ts +2 -5
  1055. package/dist/serialization/resources/entitlements/types/GetPlanEntitlementResponse.d.ts +2 -5
  1056. package/dist/serialization/resources/entitlements/types/ListCompanyOverridesParams.d.ts +2 -5
  1057. package/dist/serialization/resources/entitlements/types/ListCompanyOverridesResponse.d.ts +2 -5
  1058. package/dist/serialization/resources/entitlements/types/ListFeatureCompaniesParams.d.ts +2 -5
  1059. package/dist/serialization/resources/entitlements/types/ListFeatureCompaniesResponse.d.ts +2 -5
  1060. package/dist/serialization/resources/entitlements/types/ListFeatureUsageParams.d.ts +3 -5
  1061. package/dist/serialization/resources/entitlements/types/ListFeatureUsageResponse.d.ts +2 -5
  1062. package/dist/serialization/resources/entitlements/types/ListFeatureUsersParams.d.ts +2 -5
  1063. package/dist/serialization/resources/entitlements/types/ListFeatureUsersResponse.d.ts +2 -5
  1064. package/dist/serialization/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +2 -5
  1065. package/dist/serialization/resources/entitlements/types/ListPlanEntitlementsResponse.d.ts +2 -5
  1066. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +2 -5
  1067. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1068. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideResponse.d.ts +2 -5
  1069. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +2 -5
  1070. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1071. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementResponse.d.ts +2 -5
  1072. package/dist/serialization/resources/entitlements/types/index.d.ts +24 -29
  1073. package/dist/serialization/resources/events/client/requests/CreateEventBatchRequestBody.d.ts +2 -5
  1074. package/dist/serialization/resources/events/index.d.ts +1 -1
  1075. package/dist/serialization/resources/events/types/CreateEventBatchResponse.d.ts +2 -5
  1076. package/dist/serialization/resources/events/types/CreateEventResponse.d.ts +2 -5
  1077. package/dist/serialization/resources/events/types/GetEventResponse.d.ts +2 -5
  1078. package/dist/serialization/resources/events/types/GetEventSummariesParams.d.ts +2 -5
  1079. package/dist/serialization/resources/events/types/GetEventSummariesResponse.d.ts +2 -5
  1080. package/dist/serialization/resources/events/types/GetSegmentIntegrationStatusResponse.d.ts +2 -5
  1081. package/dist/serialization/resources/events/types/ListEventsParams.d.ts +4 -7
  1082. package/dist/serialization/resources/events/types/ListEventsResponse.d.ts +2 -5
  1083. package/dist/serialization/resources/events/types/index.d.ts +3 -5
  1084. package/dist/serialization/resources/features/client/requests/CheckFlagsBulkRequestBody.d.ts +10 -0
  1085. package/dist/serialization/resources/features/client/requests/CreateFeatureRequestBody.d.ts +6 -9
  1086. package/dist/serialization/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +6 -9
  1087. package/dist/serialization/resources/features/client/requests/UpdateFlagRulesRequestBody.d.ts +2 -5
  1088. package/dist/serialization/resources/features/client/requests/index.d.ts +1 -0
  1089. package/dist/serialization/resources/features/index.d.ts +1 -1
  1090. package/dist/serialization/resources/features/types/CheckFlagResponse.d.ts +2 -5
  1091. package/dist/serialization/resources/features/types/CheckFlagsBulkResponse.d.ts +11 -0
  1092. package/dist/serialization/resources/features/types/CheckFlagsResponse.d.ts +2 -5
  1093. package/dist/serialization/resources/features/types/CountFeaturesParams.d.ts +4 -6
  1094. package/dist/serialization/resources/features/types/CountFeaturesResponse.d.ts +2 -5
  1095. package/dist/serialization/resources/features/types/CountFlagsParams.d.ts +2 -5
  1096. package/dist/serialization/resources/features/types/CountFlagsResponse.d.ts +2 -5
  1097. package/dist/serialization/resources/features/types/CreateFeatureResponse.d.ts +2 -5
  1098. package/dist/serialization/resources/features/types/CreateFlagResponse.d.ts +2 -5
  1099. package/dist/serialization/resources/features/types/DeleteFeatureResponse.d.ts +2 -5
  1100. package/dist/serialization/resources/features/types/DeleteFlagResponse.d.ts +2 -5
  1101. package/dist/serialization/resources/features/types/GetFeatureResponse.d.ts +2 -5
  1102. package/dist/serialization/resources/features/types/GetFlagResponse.d.ts +2 -5
  1103. package/dist/serialization/resources/features/types/ListFeaturesParams.d.ts +4 -6
  1104. package/dist/serialization/resources/features/types/ListFeaturesResponse.d.ts +2 -5
  1105. package/dist/serialization/resources/features/types/ListFlagsParams.d.ts +2 -5
  1106. package/dist/serialization/resources/features/types/ListFlagsResponse.d.ts +2 -5
  1107. package/dist/serialization/resources/features/types/UpdateFeatureResponse.d.ts +2 -5
  1108. package/dist/serialization/resources/features/types/UpdateFlagResponse.d.ts +2 -5
  1109. package/dist/serialization/resources/features/types/UpdateFlagRulesResponse.d.ts +2 -5
  1110. package/dist/serialization/resources/features/types/index.d.ts +14 -17
  1111. package/dist/serialization/resources/index.d.ts +22 -25
  1112. package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +9 -6
  1113. package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +9 -6
  1114. package/dist/serialization/resources/plangroups/index.d.ts +1 -1
  1115. package/dist/serialization/resources/plangroups/types/CreatePlanGroupResponse.d.ts +2 -5
  1116. package/dist/serialization/resources/plangroups/types/GetPlanGroupResponse.d.ts +2 -5
  1117. package/dist/serialization/resources/plangroups/types/UpdatePlanGroupResponse.d.ts +2 -5
  1118. package/dist/serialization/resources/plangroups/types/index.d.ts +1 -1
  1119. package/dist/serialization/resources/plans/client/requests/CreatePlanRequestBody.d.ts +4 -7
  1120. package/dist/serialization/resources/plans/client/requests/UpdateCompanyPlansRequestBody.d.ts +2 -5
  1121. package/dist/serialization/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +2 -5
  1122. package/dist/serialization/resources/plans/client/requests/UpsertBillingProductRequestBody.d.ts +4 -7
  1123. package/dist/serialization/resources/plans/client/requests/index.d.ts +1 -1
  1124. package/dist/serialization/resources/plans/index.d.ts +1 -1
  1125. package/dist/serialization/resources/plans/types/CountPlansParams.d.ts +4 -9
  1126. package/dist/serialization/resources/plans/types/CountPlansResponse.d.ts +2 -5
  1127. package/dist/serialization/resources/plans/types/CreatePlanResponse.d.ts +2 -5
  1128. package/dist/serialization/resources/plans/types/DeletePlanResponse.d.ts +2 -5
  1129. package/dist/serialization/resources/plans/types/GetPlanResponse.d.ts +2 -5
  1130. package/dist/serialization/resources/plans/types/ListPlanIssuesParams.d.ts +2 -5
  1131. package/dist/serialization/resources/plans/types/ListPlanIssuesResponse.d.ts +2 -5
  1132. package/dist/serialization/resources/plans/types/ListPlansParams.d.ts +4 -9
  1133. package/dist/serialization/resources/plans/types/ListPlansResponse.d.ts +2 -5
  1134. package/dist/serialization/resources/plans/types/UpdateCompanyPlansResponse.d.ts +2 -5
  1135. package/dist/serialization/resources/plans/types/UpdatePlanResponse.d.ts +2 -5
  1136. package/dist/serialization/resources/plans/types/UpsertBillingProductPlanResponse.d.ts +2 -5
  1137. package/dist/serialization/resources/plans/types/index.d.ts +8 -14
  1138. package/dist/serialization/resources/webhooks/client/requests/CreateWebhookRequestBody.d.ts +4 -7
  1139. package/dist/serialization/resources/webhooks/client/requests/UpdateWebhookRequestBody.d.ts +6 -9
  1140. package/dist/serialization/resources/webhooks/index.d.ts +1 -1
  1141. package/dist/serialization/resources/webhooks/types/CountWebhookEventsParams.d.ts +2 -5
  1142. package/dist/serialization/resources/webhooks/types/CountWebhookEventsResponse.d.ts +2 -5
  1143. package/dist/serialization/resources/webhooks/types/CountWebhooksParams.d.ts +2 -5
  1144. package/dist/serialization/resources/webhooks/types/CountWebhooksResponse.d.ts +2 -5
  1145. package/dist/serialization/resources/webhooks/types/CreateWebhookResponse.d.ts +2 -5
  1146. package/dist/serialization/resources/webhooks/types/DeleteWebhookResponse.d.ts +2 -5
  1147. package/dist/serialization/resources/webhooks/types/GetWebhookEventResponse.d.ts +2 -5
  1148. package/dist/serialization/resources/webhooks/types/GetWebhookResponse.d.ts +2 -5
  1149. package/dist/serialization/resources/webhooks/types/ListWebhookEventsParams.d.ts +2 -5
  1150. package/dist/serialization/resources/webhooks/types/ListWebhookEventsResponse.d.ts +2 -5
  1151. package/dist/serialization/resources/webhooks/types/ListWebhooksParams.d.ts +2 -5
  1152. package/dist/serialization/resources/webhooks/types/ListWebhooksResponse.d.ts +2 -5
  1153. package/dist/serialization/resources/webhooks/types/UpdateWebhookResponse.d.ts +2 -5
  1154. package/dist/serialization/resources/webhooks/types/index.d.ts +8 -11
  1155. package/dist/serialization/types/ApiError.d.ts +2 -5
  1156. package/dist/serialization/types/ApiKeyCreateResponseData.d.ts +4 -6
  1157. package/dist/serialization/types/ApiKeyRequestListResponseData.d.ts +2 -5
  1158. package/dist/serialization/types/ApiKeyRequestResponseData.d.ts +2 -5
  1159. package/dist/serialization/types/ApiKeyResponseData.d.ts +4 -6
  1160. package/dist/serialization/types/ApiKeyScope.d.ts +7 -0
  1161. package/dist/serialization/types/BillingCouponResponseData.d.ts +4 -5
  1162. package/dist/serialization/types/BillingCreditBundleResponseData.d.ts +10 -9
  1163. package/dist/serialization/types/BillingCreditBundleStatus.d.ts +7 -0
  1164. package/dist/serialization/types/BillingCreditBundleType.d.ts +7 -0
  1165. package/dist/serialization/types/BillingCreditBundleView.d.ts +10 -9
  1166. package/dist/serialization/types/BillingCreditBurnStrategy.d.ts +7 -0
  1167. package/dist/serialization/types/BillingCreditExpiryType.d.ts +7 -0
  1168. package/dist/serialization/types/BillingCreditExpiryUnit.d.ts +7 -0
  1169. package/dist/serialization/types/BillingCreditGrantReason.d.ts +7 -0
  1170. package/dist/serialization/types/BillingCreditGrantResponseData.d.ts +8 -7
  1171. package/dist/serialization/types/BillingCreditGrantZeroedOutReason.d.ts +7 -0
  1172. package/dist/serialization/types/BillingCreditLedgerResponseData.d.ts +2 -5
  1173. package/dist/serialization/types/BillingCreditResponseData.d.ts +8 -8
  1174. package/dist/serialization/types/BillingCreditRolloverPolicy.d.ts +7 -0
  1175. package/dist/serialization/types/BillingCustomerResponseData.d.ts +4 -5
  1176. package/dist/serialization/types/BillingCustomerSubscription.d.ts +2 -5
  1177. package/dist/serialization/types/BillingCustomerWithSubscriptionsResponseData.d.ts +4 -5
  1178. package/dist/serialization/types/BillingMeterResponseData.d.ts +4 -5
  1179. package/dist/serialization/types/BillingPlanCreditGrantResetCadence.d.ts +7 -0
  1180. package/dist/serialization/types/BillingPlanCreditGrantResetStart.d.ts +7 -0
  1181. package/dist/serialization/types/BillingPlanCreditGrantResetType.d.ts +7 -0
  1182. package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +14 -12
  1183. package/dist/serialization/types/BillingPriceResponseData.d.ts +8 -7
  1184. package/dist/serialization/types/BillingPriceScheme.d.ts +7 -0
  1185. package/dist/serialization/types/BillingPriceUsageType.d.ts +7 -0
  1186. package/dist/serialization/types/BillingPriceView.d.ts +12 -9
  1187. package/dist/serialization/types/BillingProductDetailResponseData.d.ts +4 -5
  1188. package/dist/serialization/types/BillingProductForSubscriptionResponseData.d.ts +8 -7
  1189. package/dist/serialization/types/BillingProductPlanResponseData.d.ts +6 -7
  1190. package/dist/serialization/types/BillingProductPriceInterval.d.ts +7 -0
  1191. package/dist/serialization/types/BillingProductPriceResponseData.d.ts +12 -9
  1192. package/dist/serialization/types/BillingProductPriceTierResponseData.d.ts +2 -5
  1193. package/dist/serialization/types/BillingProductPricing.d.ts +4 -7
  1194. package/dist/serialization/types/BillingProductResponseData.d.ts +4 -5
  1195. package/dist/serialization/types/BillingProviderType.d.ts +7 -0
  1196. package/dist/serialization/types/BillingSubscriptionDiscount.d.ts +2 -5
  1197. package/dist/serialization/types/BillingSubscriptionDiscountView.d.ts +2 -5
  1198. package/dist/serialization/types/BillingSubscriptionResponseData.d.ts +7 -6
  1199. package/dist/serialization/types/BillingSubscriptionTrialEndSetting.d.ts +7 -0
  1200. package/dist/serialization/types/BillingSubscriptionView.d.ts +8 -7
  1201. package/dist/serialization/types/BillingTiersMode.d.ts +7 -0
  1202. package/dist/serialization/types/ChangeSubscriptionInternalRequestBody.d.ts +2 -5
  1203. package/dist/serialization/types/ChangeSubscriptionRequestBody.d.ts +2 -5
  1204. package/dist/serialization/types/ChargeType.d.ts +7 -0
  1205. package/dist/serialization/types/CheckFlagRequestBody.d.ts +2 -5
  1206. package/dist/serialization/types/CheckFlagResponseData.d.ts +2 -5
  1207. package/dist/serialization/types/CheckFlagsBulkResponseData.d.ts +10 -0
  1208. package/dist/serialization/types/CheckFlagsResponseData.d.ts +2 -5
  1209. package/dist/serialization/types/CheckoutDataResponseData.d.ts +6 -9
  1210. package/dist/serialization/types/CheckoutSettingsResponseData.d.ts +2 -5
  1211. package/dist/serialization/types/CheckoutSubscription.d.ts +7 -6
  1212. package/dist/serialization/types/CompanyDetailResponseData.d.ts +6 -9
  1213. package/dist/serialization/types/CompanyEventPeriodMetricsResponseData.d.ts +2 -5
  1214. package/dist/serialization/types/CompanyLedgerResponseData.d.ts +2 -5
  1215. package/dist/serialization/types/CompanyMembershipDetailResponseData.d.ts +2 -5
  1216. package/dist/serialization/types/CompanyMembershipResponseData.d.ts +2 -5
  1217. package/dist/serialization/types/CompanyOverrideNoteResponseData.d.ts +2 -5
  1218. package/dist/serialization/types/CompanyOverrideResponseData.d.ts +5 -7
  1219. package/dist/serialization/types/CompanyPlanDetailResponseData.d.ts +13 -11
  1220. package/dist/serialization/types/CompanyPlanInvalidReason.d.ts +7 -0
  1221. package/dist/serialization/types/CompanyPlanWithBillingSubView.d.ts +4 -5
  1222. package/dist/serialization/types/CompanyResponseData.d.ts +2 -5
  1223. package/dist/serialization/types/CompanySubscriptionResponseData.d.ts +3 -6
  1224. package/dist/serialization/types/CompanyViewWithFeatureUsageResponseData.d.ts +6 -9
  1225. package/dist/serialization/types/CompatiblePlans.d.ts +2 -5
  1226. package/dist/serialization/types/CompatiblePlansResponseData.d.ts +2 -5
  1227. package/dist/serialization/types/ComponentCapabilities.d.ts +2 -5
  1228. package/dist/serialization/types/ComponentCheckoutSettings.d.ts +2 -5
  1229. package/dist/serialization/types/ComponentDisplaySettings.d.ts +12 -0
  1230. package/dist/serialization/types/ComponentEntityType.d.ts +7 -0
  1231. package/dist/serialization/types/ComponentHydrateResponseData.d.ts +14 -11
  1232. package/dist/serialization/types/ComponentPreviewResponseData.d.ts +13 -10
  1233. package/dist/serialization/types/ComponentResponseData.d.ts +6 -7
  1234. package/dist/serialization/types/ComponentSettingsResponseData.d.ts +12 -0
  1235. package/dist/serialization/types/ComponentState.d.ts +7 -0
  1236. package/dist/serialization/types/Condition.d.ts +3 -6
  1237. package/dist/serialization/types/ConditionConditionType.d.ts +2 -5
  1238. package/dist/serialization/types/ConditionGroup.d.ts +2 -5
  1239. package/dist/serialization/types/ConditionMetricPeriod.d.ts +2 -5
  1240. package/dist/serialization/types/ConditionMetricPeriodMonthReset.d.ts +2 -5
  1241. package/dist/serialization/types/ConditionOperator.d.ts +2 -5
  1242. package/dist/serialization/types/CountResponse.d.ts +2 -5
  1243. package/dist/serialization/types/CouponRequestBody.d.ts +2 -5
  1244. package/dist/serialization/types/CreateBillingPriceTierRequestBody.d.ts +4 -5
  1245. package/dist/serialization/types/CreateEntitlementReqCommon.d.ts +4 -7
  1246. package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriod.d.ts +2 -5
  1247. package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +2 -5
  1248. package/dist/serialization/types/CreateEventRequestBody.d.ts +4 -7
  1249. package/dist/serialization/types/CreateFlagRequestBody.d.ts +4 -6
  1250. package/dist/serialization/types/CreateOrUpdateConditionGroupRequestBody.d.ts +2 -5
  1251. package/dist/serialization/types/CreateOrUpdateConditionRequestBody.d.ts +2 -5
  1252. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +3 -6
  1253. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +2 -5
  1254. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1255. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +2 -5
  1256. package/dist/serialization/types/CreateOrUpdateFlagRequestBody.d.ts +4 -6
  1257. package/dist/serialization/types/CreateOrUpdateRuleRequestBody.d.ts +2 -5
  1258. package/dist/serialization/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +2 -5
  1259. package/dist/serialization/types/CreatePriceTierRequestBody.d.ts +2 -5
  1260. package/dist/serialization/types/CreditAutoTopupAmountType.d.ts +7 -0
  1261. package/dist/serialization/types/CreditBundlePurchaseResponseData.d.ts +2 -5
  1262. package/dist/serialization/types/CreditCompanyGrantView.d.ts +13 -9
  1263. package/dist/serialization/types/CreditGrantDetail.d.ts +4 -7
  1264. package/dist/serialization/types/CreditGrantExpiryRequestBody.d.ts +12 -15
  1265. package/dist/serialization/types/CreditGrantSortOrder.d.ts +7 -0
  1266. package/dist/serialization/types/CreditLedgerEnrichedEntryResponseData.d.ts +3 -6
  1267. package/dist/serialization/types/CreditLedgerPeriod.d.ts +7 -0
  1268. package/dist/serialization/types/CreditTransferResponseData.d.ts +14 -0
  1269. package/dist/serialization/types/CreditTransferView.d.ts +14 -0
  1270. package/dist/serialization/types/CreditTriggerConfig.d.ts +2 -5
  1271. package/dist/serialization/types/CreditUsage.d.ts +4 -5
  1272. package/dist/serialization/types/CreditUsageAggregation.d.ts +12 -0
  1273. package/dist/serialization/types/CreditUsageResponseData.d.ts +2 -5
  1274. package/dist/serialization/types/CustomPlanConfig.d.ts +2 -5
  1275. package/dist/serialization/types/CustomPlanViewConfigResponseData.d.ts +2 -5
  1276. package/dist/serialization/types/DataExportOutputFileType.d.ts +7 -0
  1277. package/dist/serialization/types/DataExportResponseData.d.ts +8 -8
  1278. package/dist/serialization/types/DataExportStatus.d.ts +7 -0
  1279. package/dist/serialization/types/DataExportType.d.ts +7 -0
  1280. package/dist/serialization/types/DeleteResponse.d.ts +2 -5
  1281. package/dist/serialization/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +12 -0
  1282. package/dist/serialization/types/EntitlementPriceBehavior.d.ts +7 -0
  1283. package/dist/serialization/types/EntitlementTriggerConfig.d.ts +2 -5
  1284. package/dist/serialization/types/EntitlementType.d.ts +7 -0
  1285. package/dist/serialization/types/EntitlementValueType.d.ts +7 -0
  1286. package/dist/serialization/types/EntitlementsInPlan.d.ts +2 -5
  1287. package/dist/serialization/types/EntityKeyDefinitionResponseData.d.ts +4 -6
  1288. package/dist/serialization/types/EntityKeyDetailResponseData.d.ts +4 -6
  1289. package/dist/serialization/types/EntityKeyResponseData.d.ts +4 -6
  1290. package/dist/serialization/types/EntityTraitDefinitionResponseData.d.ts +6 -7
  1291. package/dist/serialization/types/EntityTraitDetailResponseData.d.ts +2 -5
  1292. package/dist/serialization/types/EntityTraitResponseData.d.ts +2 -5
  1293. package/dist/serialization/types/EntityTraitValue.d.ts +2 -5
  1294. package/dist/serialization/types/EntityType.d.ts +7 -0
  1295. package/dist/serialization/types/EnvironmentDetailResponseData.d.ts +4 -6
  1296. package/dist/serialization/types/EnvironmentResponseData.d.ts +4 -6
  1297. package/dist/serialization/types/EnvironmentType.d.ts +7 -0
  1298. package/dist/serialization/types/EventBody.d.ts +3 -6
  1299. package/dist/serialization/types/EventBodyFlagCheck.d.ts +2 -5
  1300. package/dist/serialization/types/EventBodyIdentify.d.ts +2 -5
  1301. package/dist/serialization/types/EventBodyIdentifyCompany.d.ts +2 -5
  1302. package/dist/serialization/types/EventBodyTrack.d.ts +2 -5
  1303. package/dist/serialization/types/EventDetailResponseData.d.ts +6 -7
  1304. package/dist/serialization/types/EventResponseData.d.ts +6 -7
  1305. package/dist/serialization/types/EventStatus.d.ts +7 -0
  1306. package/dist/serialization/types/EventSummaryResponseData.d.ts +2 -5
  1307. package/dist/serialization/types/EventType.d.ts +7 -0
  1308. package/dist/serialization/types/FeatureCompanyResponseData.d.ts +14 -13
  1309. package/dist/serialization/types/FeatureCompanyUserResponseData.d.ts +6 -8
  1310. package/dist/serialization/types/FeatureDetailResponseData.d.ts +7 -8
  1311. package/dist/serialization/types/FeatureLedgerResponseData.d.ts +2 -5
  1312. package/dist/serialization/types/FeatureLifecyclePhase.d.ts +7 -0
  1313. package/dist/serialization/types/FeatureResponseData.d.ts +6 -7
  1314. package/dist/serialization/types/FeatureType.d.ts +7 -0
  1315. package/dist/serialization/types/FeatureUsageDataResponseData.d.ts +5 -7
  1316. package/dist/serialization/types/FeatureUsageDetailResponseData.d.ts +2 -5
  1317. package/dist/serialization/types/FeatureUsageResponseData.d.ts +14 -13
  1318. package/dist/serialization/types/FlagDetailResponseData.d.ts +4 -6
  1319. package/dist/serialization/types/FlagResponseData.d.ts +4 -6
  1320. package/dist/serialization/types/FlagType.d.ts +7 -0
  1321. package/dist/serialization/types/GenericPreviewObject.d.ts +2 -5
  1322. package/dist/serialization/types/InvoiceRequestBody.d.ts +2 -5
  1323. package/dist/serialization/types/InvoiceResponseData.d.ts +4 -5
  1324. package/dist/serialization/types/IssueTemporaryAccessTokenResponseData.d.ts +4 -6
  1325. package/dist/serialization/types/KeysRequestBody.d.ts +2 -5
  1326. package/dist/serialization/types/ManagePlanPreviewResponseResponseData.d.ts +2 -5
  1327. package/dist/serialization/types/ManagePlanRequest.d.ts +5 -5
  1328. package/dist/serialization/types/ManagePlanResponseResponseData.d.ts +2 -5
  1329. package/dist/serialization/types/MeterRequestBody.d.ts +2 -5
  1330. package/dist/serialization/types/OrderedPlansInGroup.d.ts +2 -5
  1331. package/dist/serialization/types/PaymentMethodRequestBody.d.ts +2 -5
  1332. package/dist/serialization/types/PaymentMethodResponseData.d.ts +4 -5
  1333. package/dist/serialization/types/PlanChangeAction.d.ts +7 -0
  1334. package/dist/serialization/types/PlanChangeActorType.d.ts +7 -0
  1335. package/dist/serialization/types/PlanChangeBasePlanAction.d.ts +7 -0
  1336. package/dist/serialization/types/PlanChangeResponseData.d.ts +12 -15
  1337. package/dist/serialization/types/PlanChangeSubscriptionAction.d.ts +7 -0
  1338. package/dist/serialization/types/PlanControlledByType.d.ts +7 -0
  1339. package/dist/serialization/types/PlanCreditGrantView.d.ts +14 -12
  1340. package/dist/serialization/types/PlanDetailResponseData.d.ts +10 -10
  1341. package/dist/serialization/types/PlanEntitlementResponseData.d.ts +9 -10
  1342. package/dist/serialization/types/PlanEntitlementsOrder.d.ts +2 -5
  1343. package/dist/serialization/types/PlanGroupBundleOrder.d.ts +2 -5
  1344. package/dist/serialization/types/PlanGroupDetailResponseData.d.ts +15 -11
  1345. package/dist/serialization/types/PlanGroupPlanDetailResponseData.d.ts +11 -11
  1346. package/dist/serialization/types/PlanGroupPlanEntitlementsOrder.d.ts +2 -5
  1347. package/dist/serialization/types/PlanGroupResponseData.d.ts +11 -7
  1348. package/dist/serialization/types/PlanIssueResponseData.d.ts +2 -5
  1349. package/dist/serialization/types/PlanResponseData.d.ts +4 -6
  1350. package/dist/serialization/types/PlanSelection.d.ts +2 -5
  1351. package/dist/serialization/types/PlanSnapshotView.d.ts +2 -5
  1352. package/dist/serialization/types/PlanTraitResponseData.d.ts +2 -5
  1353. package/dist/serialization/types/PlanType.d.ts +7 -0
  1354. package/dist/serialization/types/PreviewObject.d.ts +2 -5
  1355. package/dist/serialization/types/PreviewObjectResponseData.d.ts +2 -5
  1356. package/dist/serialization/types/PreviewSubscriptionChangeResponseData.d.ts +3 -6
  1357. package/dist/serialization/types/PreviewSubscriptionFinanceResponseData.d.ts +3 -5
  1358. package/dist/serialization/types/PreviewSubscriptionUpcomingInvoiceLineItems.d.ts +2 -5
  1359. package/dist/serialization/types/ProrationBehavior.d.ts +7 -0
  1360. package/dist/serialization/types/QuickstartResp.d.ts +2 -5
  1361. package/dist/serialization/types/RawEventBatchResponseData.d.ts +2 -5
  1362. package/dist/serialization/types/RawEventResponseData.d.ts +2 -5
  1363. package/dist/serialization/types/Rule.d.ts +3 -6
  1364. package/dist/serialization/types/RuleConditionDetailResponseData.d.ts +4 -6
  1365. package/dist/serialization/types/RuleConditionGroupDetailResponseData.d.ts +2 -5
  1366. package/dist/serialization/types/RuleConditionGroupResponseData.d.ts +2 -5
  1367. package/dist/serialization/types/RuleConditionResponseData.d.ts +4 -6
  1368. package/dist/serialization/types/RuleDetailResponseData.d.ts +3 -6
  1369. package/dist/serialization/types/RuleResponseData.d.ts +2 -5
  1370. package/dist/serialization/types/RuleRuleType.d.ts +2 -5
  1371. package/dist/serialization/types/RulesDetailResponseData.d.ts +2 -5
  1372. package/dist/serialization/types/RulesEngineSchemaVersion.d.ts +7 -0
  1373. package/dist/serialization/types/RulesengineCheckFlagResult.d.ts +24 -0
  1374. package/dist/serialization/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +7 -0
  1375. package/dist/serialization/types/RulesengineCheckFlagResultRuleType.d.ts +7 -0
  1376. package/dist/serialization/types/RulesengineCompany.d.ts +25 -0
  1377. package/dist/serialization/types/RulesengineCompanyMetric.d.ts +19 -0
  1378. package/dist/serialization/types/RulesengineCompanyMetricMonthReset.d.ts +7 -0
  1379. package/dist/serialization/types/RulesengineCompanyMetricPeriod.d.ts +7 -0
  1380. package/dist/serialization/types/RulesengineCondition.d.ts +28 -0
  1381. package/dist/serialization/types/RulesengineConditionConditionType.d.ts +7 -0
  1382. package/dist/serialization/types/RulesengineConditionGroup.d.ts +10 -0
  1383. package/dist/serialization/types/RulesengineConditionMetricPeriod.d.ts +7 -0
  1384. package/dist/serialization/types/RulesengineConditionMetricPeriodMonthReset.d.ts +7 -0
  1385. package/dist/serialization/types/RulesengineConditionOperator.d.ts +7 -0
  1386. package/dist/serialization/types/RulesengineEntityType.d.ts +7 -0
  1387. package/dist/serialization/types/RulesengineFlag.d.ts +15 -0
  1388. package/dist/serialization/types/RulesengineRule.d.ts +21 -0
  1389. package/dist/serialization/types/RulesengineRuleRuleType.d.ts +7 -0
  1390. package/dist/serialization/types/RulesengineSubscription.d.ts +11 -0
  1391. package/dist/serialization/types/RulesengineTrait.d.ts +11 -0
  1392. package/dist/serialization/types/RulesengineTraitDefinition.d.ts +13 -0
  1393. package/dist/serialization/types/RulesengineTraitDefinitionComparableType.d.ts +7 -0
  1394. package/dist/serialization/types/RulesengineUser.d.ts +16 -0
  1395. package/dist/serialization/types/SegmentStatusResp.d.ts +2 -5
  1396. package/dist/serialization/types/SkippedEntitlementErrorResponseData.d.ts +9 -0
  1397. package/dist/serialization/types/SkippedEntitlementResponseData.d.ts +13 -0
  1398. package/dist/serialization/types/SortDirection.d.ts +7 -0
  1399. package/dist/serialization/types/StripeEmbedInfo.d.ts +2 -5
  1400. package/dist/serialization/types/SubscriptionStatus.d.ts +7 -0
  1401. package/dist/serialization/types/SubscriptionTraitUpdate.d.ts +4 -6
  1402. package/dist/serialization/types/SubscriptionType.d.ts +7 -0
  1403. package/dist/serialization/types/TemporaryAccessTokenResourceType.d.ts +7 -0
  1404. package/dist/serialization/types/TemporaryAccessTokenResponseData.d.ts +4 -6
  1405. package/dist/serialization/types/TraitDefinition.d.ts +4 -7
  1406. package/dist/serialization/types/TraitDefinitionComparableType.d.ts +2 -5
  1407. package/dist/serialization/types/TraitType.d.ts +7 -0
  1408. package/dist/serialization/types/UpdateAddOnRequestBody.d.ts +2 -5
  1409. package/dist/serialization/types/UpdateCreditBundleRequestBody.d.ts +2 -5
  1410. package/dist/serialization/types/UpdateEntitlementReqCommon.d.ts +4 -7
  1411. package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +2 -5
  1412. package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +2 -5
  1413. package/dist/serialization/types/UpdatePayInAdvanceRequestBody.d.ts +2 -5
  1414. package/dist/serialization/types/UpdatePlanTraitTraitRequestBody.d.ts +2 -5
  1415. package/dist/serialization/types/UpdateRuleRequestBody.d.ts +2 -5
  1416. package/dist/serialization/types/UpsertCompanyRequestBody.d.ts +2 -5
  1417. package/dist/serialization/types/UpsertTraitRequestBody.d.ts +2 -5
  1418. package/dist/serialization/types/UpsertUserRequestBody.d.ts +2 -5
  1419. package/dist/serialization/types/UpsertUserSubRequestBody.d.ts +2 -5
  1420. package/dist/serialization/types/UsageBasedEntitlementRequestBody.d.ts +6 -8
  1421. package/dist/serialization/types/UsageBasedEntitlementResponseData.d.ts +6 -7
  1422. package/dist/serialization/types/UserDetailResponseData.d.ts +3 -6
  1423. package/dist/serialization/types/UserResponseData.d.ts +2 -5
  1424. package/dist/serialization/types/WebhookEventDetailResponseData.d.ts +6 -7
  1425. package/dist/serialization/types/WebhookEventResponseData.d.ts +6 -7
  1426. package/dist/serialization/types/WebhookEventStatus.d.ts +7 -0
  1427. package/dist/serialization/types/WebhookRequestType.d.ts +7 -0
  1428. package/dist/serialization/types/WebhookResponseData.d.ts +6 -7
  1429. package/dist/serialization/types/WebhookStatus.d.ts +7 -0
  1430. package/dist/serialization/types/index.d.ts +99 -41
  1431. package/package.json +23 -10
  1432. package/dist/api/resources/accounts/types/CreateEnvironmentRequestBodyEnvironmentType.d.ts +0 -9
  1433. package/dist/api/resources/accounts/types/UpdateEnvironmentRequestBodyEnvironmentType.d.ts +0 -9
  1434. package/dist/api/resources/billing/client/requests/ListProductPricesRequest.d.ts +0 -53
  1435. package/dist/api/resources/billing/client/requests/SearchBillingPricesRequest.d.ts +0 -49
  1436. package/dist/api/resources/billing/types/CountBillingProductsRequestPriceUsageType.d.ts +0 -8
  1437. package/dist/api/resources/billing/types/CountBillingProductsResponseParamsPriceUsageType.d.ts +0 -8
  1438. package/dist/api/resources/billing/types/CreateBillingPriceRequestBodyBillingScheme.d.ts +0 -8
  1439. package/dist/api/resources/billing/types/CreateBillingPriceRequestBodyTiersMode.d.ts +0 -8
  1440. package/dist/api/resources/billing/types/CreateBillingPriceRequestBodyUsageType.d.ts +0 -8
  1441. package/dist/api/resources/billing/types/CreateBillingSubscriptionRequestBodyTrialEndSetting.d.ts +0 -8
  1442. package/dist/api/resources/billing/types/ListBillingProductsRequestPriceUsageType.d.ts +0 -8
  1443. package/dist/api/resources/billing/types/ListBillingProductsResponseParamsPriceUsageType.d.ts +0 -8
  1444. package/dist/api/resources/billing/types/ListProductPricesParams.d.ts +0 -27
  1445. package/dist/api/resources/billing/types/ListProductPricesRequestPriceUsageType.d.ts +0 -8
  1446. package/dist/api/resources/billing/types/ListProductPricesResponse.d.ts +0 -9
  1447. package/dist/api/resources/billing/types/ListProductPricesResponseParamsPriceUsageType.d.ts +0 -8
  1448. package/dist/api/resources/billing/types/SearchBillingPricesRequestTiersMode.d.ts +0 -8
  1449. package/dist/api/resources/billing/types/SearchBillingPricesRequestUsageType.d.ts +0 -8
  1450. package/dist/api/resources/billing/types/SearchBillingPricesResponse.d.ts +0 -9
  1451. package/dist/api/resources/billing/types/SearchBillingPricesResponseParamsTiersMode.d.ts +0 -8
  1452. package/dist/api/resources/billing/types/SearchBillingPricesResponseParamsUsageType.d.ts +0 -8
  1453. package/dist/api/resources/companies/client/requests/GetActiveDealsRequest.d.ts +0 -24
  1454. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterRequestSortOrderDirection.d.ts +0 -11
  1455. package/dist/api/resources/companies/types/CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection.d.ts +0 -11
  1456. package/dist/api/resources/companies/types/CountEntityKeyDefinitionsRequestEntityType.d.ts +0 -8
  1457. package/dist/api/resources/companies/types/CountEntityKeyDefinitionsResponseParamsEntityType.d.ts +0 -8
  1458. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsRequestEntityType.d.ts +0 -8
  1459. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsRequestTraitType.d.ts +0 -12
  1460. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsEntityType.d.ts +0 -8
  1461. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsTraitType.d.ts +0 -12
  1462. package/dist/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyEntityType.d.ts +0 -8
  1463. package/dist/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyTraitType.d.ts +0 -12
  1464. package/dist/api/resources/companies/types/GetActiveDealsParams.d.ts +0 -14
  1465. package/dist/api/resources/companies/types/GetActiveDealsResponse.d.ts +0 -9
  1466. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterRequestSortOrderDirection.d.ts +0 -11
  1467. package/dist/api/resources/companies/types/ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection.d.ts +0 -11
  1468. package/dist/api/resources/companies/types/ListEntityKeyDefinitionsRequestEntityType.d.ts +0 -8
  1469. package/dist/api/resources/companies/types/ListEntityKeyDefinitionsResponseParamsEntityType.d.ts +0 -8
  1470. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsRequestEntityType.d.ts +0 -8
  1471. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsRequestTraitType.d.ts +0 -12
  1472. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsEntityType.d.ts +0 -8
  1473. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsTraitType.d.ts +0 -12
  1474. package/dist/api/resources/companies/types/UpdateEntityTraitDefinitionRequestBodyTraitType.d.ts +0 -12
  1475. package/dist/api/resources/components/types/CreateComponentRequestBodyEntityType.d.ts +0 -8
  1476. package/dist/api/resources/components/types/UpdateComponentRequestBodyEntityType.d.ts +0 -8
  1477. package/dist/api/resources/components/types/UpdateComponentRequestBodyState.d.ts +0 -8
  1478. package/dist/api/resources/credits/types/CountCreditBundlesRequestStatus.d.ts +0 -8
  1479. package/dist/api/resources/credits/types/CountCreditBundlesResponseParamsStatus.d.ts +0 -8
  1480. package/dist/api/resources/credits/types/CountCreditLedgerRequestPeriod.d.ts +0 -10
  1481. package/dist/api/resources/credits/types/CountCreditLedgerResponseParamsPeriod.d.ts +0 -10
  1482. package/dist/api/resources/credits/types/CreateBillingCreditRequestBodyBurnStrategy.d.ts +0 -10
  1483. package/dist/api/resources/credits/types/CreateBillingCreditRequestBodyDefaultRolloverPolicy.d.ts +0 -9
  1484. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType.d.ts +0 -11
  1485. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit.d.ts +0 -8
  1486. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +0 -11
  1487. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +0 -8
  1488. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +0 -10
  1489. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetStart.d.ts +0 -8
  1490. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetType.d.ts +0 -8
  1491. package/dist/api/resources/credits/types/CreateCompanyCreditGrantExpiryType.d.ts +0 -11
  1492. package/dist/api/resources/credits/types/CreateCompanyCreditGrantExpiryUnit.d.ts +0 -8
  1493. package/dist/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryType.d.ts +0 -11
  1494. package/dist/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryUnit.d.ts +0 -8
  1495. package/dist/api/resources/credits/types/CreateCreditBundleRequestBodyStatus.d.ts +0 -8
  1496. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerRequestPeriod.d.ts +0 -10
  1497. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerResponseParamsPeriod.d.ts +0 -10
  1498. package/dist/api/resources/credits/types/ListCompanyGrantsRequestDir.d.ts +0 -8
  1499. package/dist/api/resources/credits/types/ListCompanyGrantsRequestOrder.d.ts +0 -10
  1500. package/dist/api/resources/credits/types/ListCompanyGrantsResponseParamsDir.d.ts +0 -8
  1501. package/dist/api/resources/credits/types/ListCompanyGrantsResponseParamsOrder.d.ts +0 -10
  1502. package/dist/api/resources/credits/types/ListCreditBundlesRequestStatus.d.ts +0 -8
  1503. package/dist/api/resources/credits/types/ListCreditBundlesResponseParamsStatus.d.ts +0 -8
  1504. package/dist/api/resources/credits/types/UpdateBillingCreditRequestBodyBurnStrategy.d.ts +0 -10
  1505. package/dist/api/resources/credits/types/UpdateBillingCreditRequestBodyDefaultRolloverPolicy.d.ts +0 -9
  1506. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +0 -11
  1507. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +0 -8
  1508. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +0 -10
  1509. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.d.ts +0 -8
  1510. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.d.ts +0 -8
  1511. package/dist/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryType.d.ts +0 -11
  1512. package/dist/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryUnit.d.ts +0 -8
  1513. package/dist/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyStatus.d.ts +0 -8
  1514. package/dist/api/resources/credits/types/ZeroOutGrantRequestBodyReason.d.ts +0 -10
  1515. package/dist/api/resources/crm/client/Client.d.ts +0 -133
  1516. package/dist/api/resources/crm/client/index.d.ts +0 -1
  1517. package/dist/api/resources/crm/client/requests/CreateCrmDealLineItemAssociationRequestBody.d.ts +0 -14
  1518. package/dist/api/resources/crm/client/requests/CreateCrmDealRequestBody.d.ts +0 -22
  1519. package/dist/api/resources/crm/client/requests/CreateCrmLineItemRequestBody.d.ts +0 -23
  1520. package/dist/api/resources/crm/client/requests/CreateCrmProductRequestBody.d.ts +0 -26
  1521. package/dist/api/resources/crm/client/requests/ListCrmProductsRequest.d.ts +0 -23
  1522. package/dist/api/resources/crm/client/requests/index.d.ts +0 -5
  1523. package/dist/api/resources/crm/index.d.ts +0 -2
  1524. package/dist/api/resources/crm/types/ListCrmProductsParams.d.ts +0 -14
  1525. package/dist/api/resources/crm/types/ListCrmProductsResponse.d.ts +0 -9
  1526. package/dist/api/resources/crm/types/UpsertCrmDealResponse.d.ts +0 -9
  1527. package/dist/api/resources/crm/types/UpsertCrmProductResponse.d.ts +0 -9
  1528. package/dist/api/resources/crm/types/UpsertDealLineItemAssociationResponse.d.ts +0 -9
  1529. package/dist/api/resources/crm/types/UpsertLineItemResponse.d.ts +0 -9
  1530. package/dist/api/resources/crm/types/index.d.ts +0 -6
  1531. package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyValueType.d.ts +0 -11
  1532. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyPriceBehavior.d.ts +0 -11
  1533. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyValueType.d.ts +0 -11
  1534. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyValueType.d.ts +0 -11
  1535. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyPriceBehavior.d.ts +0 -11
  1536. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyValueType.d.ts +0 -11
  1537. package/dist/api/resources/events/types/ListEventsRequestEventTypesItem.d.ts +0 -9
  1538. package/dist/api/resources/events/types/ListEventsResponseParamsEventTypesItem.d.ts +0 -9
  1539. package/dist/api/resources/features/types/CreateFeatureRequestBodyFeatureType.d.ts +0 -9
  1540. package/dist/api/resources/features/types/UpdateFeatureRequestBodyFeatureType.d.ts +0 -9
  1541. package/dist/api/resources/features/types/UpdateFeatureRequestBodyLifecyclePhase.d.ts +0 -15
  1542. package/dist/api/resources/plans/types/CountPlansRequestPlanType.d.ts +0 -11
  1543. package/dist/api/resources/plans/types/CountPlansResponseParamsPlanType.d.ts +0 -11
  1544. package/dist/api/resources/plans/types/CreatePlanRequestBodyPlanType.d.ts +0 -8
  1545. package/dist/api/resources/plans/types/ListPlansRequestPlanType.d.ts +0 -11
  1546. package/dist/api/resources/plans/types/ListPlansResponseParamsPlanType.d.ts +0 -11
  1547. package/dist/api/resources/plans/types/UpsertBillingProductRequestBodyChargeType.d.ts +0 -9
  1548. package/dist/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +0 -39
  1549. package/dist/api/resources/webhooks/types/UpdateWebhookRequestBodyStatus.d.ts +0 -8
  1550. package/dist/api/types/BillingProductPricingUsageType.d.ts +0 -8
  1551. package/dist/api/types/CompanyCrmDealsResponseData.d.ts +0 -11
  1552. package/dist/api/types/CreateEntitlementReqCommonValueType.d.ts +0 -11
  1553. package/dist/api/types/CreateEventRequestBodyEventType.d.ts +0 -12
  1554. package/dist/api/types/CreditGrantDetailGrantReason.d.ts +0 -9
  1555. package/dist/api/types/CreditGrantExpiryRequestBodyExpiryType.d.ts +0 -11
  1556. package/dist/api/types/CreditGrantExpiryRequestBodyExpiryUnit.d.ts +0 -8
  1557. package/dist/api/types/CreditGrantExpiryRequestBodyResetCadence.d.ts +0 -10
  1558. package/dist/api/types/CreditGrantExpiryRequestBodyResetStart.d.ts +0 -8
  1559. package/dist/api/types/CreditGrantExpiryRequestBodyResetType.d.ts +0 -8
  1560. package/dist/api/types/CrmDealLineItem.d.ts +0 -18
  1561. package/dist/api/types/CrmDealResponseData.d.ts +0 -16
  1562. package/dist/api/types/CrmLineItemResponseData.d.ts +0 -11
  1563. package/dist/api/types/CrmProductResponseData.d.ts +0 -15
  1564. package/dist/api/types/Decimal.d.ts +0 -4
  1565. package/dist/api/types/FeatureCompanyResponseDataAllocationType.d.ts +0 -13
  1566. package/dist/api/types/FeatureCompanyResponseDataCreditGrantReason.d.ts +0 -12
  1567. package/dist/api/types/FeatureCompanyUserResponseDataAllocationType.d.ts +0 -14
  1568. package/dist/api/types/FeatureUsageResponseDataAllocationType.d.ts +0 -13
  1569. package/dist/api/types/FeatureUsageResponseDataCreditGrantReason.d.ts +0 -12
  1570. package/dist/api/types/PlanChangeResponseDataActorType.d.ts +0 -10
  1571. package/dist/api/types/PlanChangeResponseDataBasePlanAction.d.ts +0 -13
  1572. package/dist/api/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +0 -15
  1573. package/dist/api/types/TraitDefinitionEntityType.d.ts +0 -8
  1574. package/dist/api/types/UpdateEntitlementReqCommonValueType.d.ts +0 -11
  1575. package/dist/api/types/UsageBasedEntitlementRequestBodyPriceBehavior.d.ts +0 -11
  1576. package/dist/serialization/resources/accounts/types/CreateEnvironmentRequestBodyEnvironmentType.d.ts +0 -10
  1577. package/dist/serialization/resources/accounts/types/UpdateEnvironmentRequestBodyEnvironmentType.d.ts +0 -10
  1578. package/dist/serialization/resources/billing/types/CountBillingProductsRequestPriceUsageType.d.ts +0 -10
  1579. package/dist/serialization/resources/billing/types/CountBillingProductsResponseParamsPriceUsageType.d.ts +0 -10
  1580. package/dist/serialization/resources/billing/types/CreateBillingPriceRequestBodyBillingScheme.d.ts +0 -10
  1581. package/dist/serialization/resources/billing/types/CreateBillingPriceRequestBodyTiersMode.d.ts +0 -10
  1582. package/dist/serialization/resources/billing/types/CreateBillingPriceRequestBodyUsageType.d.ts +0 -10
  1583. package/dist/serialization/resources/billing/types/CreateBillingSubscriptionRequestBodyTrialEndSetting.d.ts +0 -10
  1584. package/dist/serialization/resources/billing/types/ListBillingProductsRequestPriceUsageType.d.ts +0 -10
  1585. package/dist/serialization/resources/billing/types/ListBillingProductsResponseParamsPriceUsageType.d.ts +0 -10
  1586. package/dist/serialization/resources/billing/types/ListProductPricesParams.d.ts +0 -23
  1587. package/dist/serialization/resources/billing/types/ListProductPricesRequestPriceUsageType.d.ts +0 -10
  1588. package/dist/serialization/resources/billing/types/ListProductPricesResponse.d.ts +0 -15
  1589. package/dist/serialization/resources/billing/types/ListProductPricesResponseParamsPriceUsageType.d.ts +0 -10
  1590. package/dist/serialization/resources/billing/types/SearchBillingPricesParams.d.ts +0 -25
  1591. package/dist/serialization/resources/billing/types/SearchBillingPricesRequestTiersMode.d.ts +0 -10
  1592. package/dist/serialization/resources/billing/types/SearchBillingPricesRequestUsageType.d.ts +0 -10
  1593. package/dist/serialization/resources/billing/types/SearchBillingPricesResponse.d.ts +0 -15
  1594. package/dist/serialization/resources/billing/types/SearchBillingPricesResponseParamsTiersMode.d.ts +0 -10
  1595. package/dist/serialization/resources/billing/types/SearchBillingPricesResponseParamsUsageType.d.ts +0 -10
  1596. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterRequestSortOrderDirection.d.ts +0 -10
  1597. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection.d.ts +0 -10
  1598. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsRequestEntityType.d.ts +0 -10
  1599. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsResponseParamsEntityType.d.ts +0 -10
  1600. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsRequestEntityType.d.ts +0 -10
  1601. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsRequestTraitType.d.ts +0 -10
  1602. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsResponseParamsEntityType.d.ts +0 -10
  1603. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsResponseParamsTraitType.d.ts +0 -10
  1604. package/dist/serialization/resources/companies/types/CreateEntityTraitDefinitionRequestBodyEntityType.d.ts +0 -10
  1605. package/dist/serialization/resources/companies/types/CreateEntityTraitDefinitionRequestBodyTraitType.d.ts +0 -10
  1606. package/dist/serialization/resources/companies/types/GetActiveDealsParams.d.ts +0 -15
  1607. package/dist/serialization/resources/companies/types/GetActiveDealsResponse.d.ts +0 -15
  1608. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterRequestSortOrderDirection.d.ts +0 -10
  1609. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection.d.ts +0 -10
  1610. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsRequestEntityType.d.ts +0 -10
  1611. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsResponseParamsEntityType.d.ts +0 -10
  1612. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsRequestEntityType.d.ts +0 -10
  1613. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsRequestTraitType.d.ts +0 -10
  1614. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsResponseParamsEntityType.d.ts +0 -10
  1615. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsResponseParamsTraitType.d.ts +0 -10
  1616. package/dist/serialization/resources/companies/types/UpdateEntityTraitDefinitionRequestBodyTraitType.d.ts +0 -10
  1617. package/dist/serialization/resources/components/types/CreateComponentRequestBodyEntityType.d.ts +0 -10
  1618. package/dist/serialization/resources/components/types/UpdateComponentRequestBodyEntityType.d.ts +0 -10
  1619. package/dist/serialization/resources/components/types/UpdateComponentRequestBodyState.d.ts +0 -10
  1620. package/dist/serialization/resources/credits/types/CountCreditBundlesRequestStatus.d.ts +0 -10
  1621. package/dist/serialization/resources/credits/types/CountCreditBundlesResponseParamsStatus.d.ts +0 -10
  1622. package/dist/serialization/resources/credits/types/CountCreditLedgerRequestPeriod.d.ts +0 -10
  1623. package/dist/serialization/resources/credits/types/CountCreditLedgerResponseParamsPeriod.d.ts +0 -10
  1624. package/dist/serialization/resources/credits/types/CreateBillingCreditRequestBodyBurnStrategy.d.ts +0 -10
  1625. package/dist/serialization/resources/credits/types/CreateBillingCreditRequestBodyDefaultRolloverPolicy.d.ts +0 -10
  1626. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType.d.ts +0 -10
  1627. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit.d.ts +0 -10
  1628. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +0 -10
  1629. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +0 -10
  1630. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +0 -10
  1631. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetStart.d.ts +0 -10
  1632. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetType.d.ts +0 -10
  1633. package/dist/serialization/resources/credits/types/CreateCompanyCreditGrantExpiryType.d.ts +0 -10
  1634. package/dist/serialization/resources/credits/types/CreateCompanyCreditGrantExpiryUnit.d.ts +0 -10
  1635. package/dist/serialization/resources/credits/types/CreateCreditBundleRequestBodyExpiryType.d.ts +0 -10
  1636. package/dist/serialization/resources/credits/types/CreateCreditBundleRequestBodyExpiryUnit.d.ts +0 -10
  1637. package/dist/serialization/resources/credits/types/CreateCreditBundleRequestBodyStatus.d.ts +0 -10
  1638. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerRequestPeriod.d.ts +0 -10
  1639. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerResponseParamsPeriod.d.ts +0 -10
  1640. package/dist/serialization/resources/credits/types/ListCompanyGrantsRequestDir.d.ts +0 -10
  1641. package/dist/serialization/resources/credits/types/ListCompanyGrantsRequestOrder.d.ts +0 -10
  1642. package/dist/serialization/resources/credits/types/ListCompanyGrantsResponseParamsDir.d.ts +0 -10
  1643. package/dist/serialization/resources/credits/types/ListCompanyGrantsResponseParamsOrder.d.ts +0 -10
  1644. package/dist/serialization/resources/credits/types/ListCreditBundlesRequestStatus.d.ts +0 -10
  1645. package/dist/serialization/resources/credits/types/ListCreditBundlesResponseParamsStatus.d.ts +0 -10
  1646. package/dist/serialization/resources/credits/types/UpdateBillingCreditRequestBodyBurnStrategy.d.ts +0 -10
  1647. package/dist/serialization/resources/credits/types/UpdateBillingCreditRequestBodyDefaultRolloverPolicy.d.ts +0 -10
  1648. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +0 -10
  1649. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +0 -10
  1650. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +0 -10
  1651. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.d.ts +0 -10
  1652. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.d.ts +0 -10
  1653. package/dist/serialization/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryType.d.ts +0 -10
  1654. package/dist/serialization/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryUnit.d.ts +0 -10
  1655. package/dist/serialization/resources/credits/types/UpdateCreditBundleDetailsRequestBodyStatus.d.ts +0 -10
  1656. package/dist/serialization/resources/credits/types/ZeroOutGrantRequestBodyReason.d.ts +0 -10
  1657. package/dist/serialization/resources/crm/client/index.d.ts +0 -1
  1658. package/dist/serialization/resources/crm/client/requests/CreateCrmDealLineItemAssociationRequestBody.d.ts +0 -13
  1659. package/dist/serialization/resources/crm/client/requests/CreateCrmDealRequestBody.d.ts +0 -20
  1660. package/dist/serialization/resources/crm/client/requests/CreateCrmLineItemRequestBody.d.ts +0 -19
  1661. package/dist/serialization/resources/crm/client/requests/CreateCrmProductRequestBody.d.ts +0 -19
  1662. package/dist/serialization/resources/crm/client/requests/index.d.ts +0 -4
  1663. package/dist/serialization/resources/crm/index.d.ts +0 -2
  1664. package/dist/serialization/resources/crm/types/ListCrmProductsParams.d.ts +0 -15
  1665. package/dist/serialization/resources/crm/types/ListCrmProductsResponse.d.ts +0 -15
  1666. package/dist/serialization/resources/crm/types/UpsertCrmDealResponse.d.ts +0 -14
  1667. package/dist/serialization/resources/crm/types/UpsertCrmProductResponse.d.ts +0 -14
  1668. package/dist/serialization/resources/crm/types/UpsertDealLineItemAssociationResponse.d.ts +0 -14
  1669. package/dist/serialization/resources/crm/types/UpsertLineItemResponse.d.ts +0 -14
  1670. package/dist/serialization/resources/crm/types/index.d.ts +0 -6
  1671. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyValueType.d.ts +0 -10
  1672. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyPriceBehavior.d.ts +0 -10
  1673. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyValueType.d.ts +0 -10
  1674. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyValueType.d.ts +0 -10
  1675. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyPriceBehavior.d.ts +0 -10
  1676. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyValueType.d.ts +0 -10
  1677. package/dist/serialization/resources/events/types/ListEventsRequestEventTypesItem.d.ts +0 -10
  1678. package/dist/serialization/resources/events/types/ListEventsResponseParamsEventTypesItem.d.ts +0 -10
  1679. package/dist/serialization/resources/features/types/CreateFeatureRequestBodyFeatureType.d.ts +0 -10
  1680. package/dist/serialization/resources/features/types/CreateFeatureRequestBodyLifecyclePhase.d.ts +0 -10
  1681. package/dist/serialization/resources/features/types/UpdateFeatureRequestBodyFeatureType.d.ts +0 -10
  1682. package/dist/serialization/resources/features/types/UpdateFeatureRequestBodyLifecyclePhase.d.ts +0 -10
  1683. package/dist/serialization/resources/plans/types/CountPlansRequestPlanType.d.ts +0 -10
  1684. package/dist/serialization/resources/plans/types/CountPlansResponseParamsPlanType.d.ts +0 -10
  1685. package/dist/serialization/resources/plans/types/CreatePlanRequestBodyPlanType.d.ts +0 -10
  1686. package/dist/serialization/resources/plans/types/ListPlansRequestPlanType.d.ts +0 -10
  1687. package/dist/serialization/resources/plans/types/ListPlansResponseParamsPlanType.d.ts +0 -10
  1688. package/dist/serialization/resources/plans/types/UpsertBillingProductRequestBodyChargeType.d.ts +0 -10
  1689. package/dist/serialization/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts +0 -10
  1690. package/dist/serialization/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +0 -10
  1691. package/dist/serialization/resources/webhooks/types/UpdateWebhookRequestBodyStatus.d.ts +0 -10
  1692. package/dist/serialization/types/BillingProductPricingUsageType.d.ts +0 -10
  1693. package/dist/serialization/types/CompanyCrmDealsResponseData.d.ts +0 -17
  1694. package/dist/serialization/types/CreateEntitlementReqCommonValueType.d.ts +0 -10
  1695. package/dist/serialization/types/CreateEventRequestBodyEventType.d.ts +0 -10
  1696. package/dist/serialization/types/CreditGrantDetailGrantReason.d.ts +0 -10
  1697. package/dist/serialization/types/CreditGrantExpiryRequestBodyExpiryType.d.ts +0 -10
  1698. package/dist/serialization/types/CreditGrantExpiryRequestBodyExpiryUnit.d.ts +0 -10
  1699. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetCadence.d.ts +0 -10
  1700. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetStart.d.ts +0 -10
  1701. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetType.d.ts +0 -10
  1702. package/dist/serialization/types/CrmDealLineItem.d.ts +0 -24
  1703. package/dist/serialization/types/CrmDealResponseData.d.ts +0 -22
  1704. package/dist/serialization/types/CrmLineItemResponseData.d.ts +0 -17
  1705. package/dist/serialization/types/CrmProductResponseData.d.ts +0 -21
  1706. package/dist/serialization/types/Decimal.d.ts +0 -10
  1707. package/dist/serialization/types/FeatureCompanyResponseDataAllocationType.d.ts +0 -10
  1708. package/dist/serialization/types/FeatureCompanyResponseDataCreditGrantReason.d.ts +0 -10
  1709. package/dist/serialization/types/FeatureCompanyUserResponseDataAllocationType.d.ts +0 -10
  1710. package/dist/serialization/types/FeatureUsageResponseDataAllocationType.d.ts +0 -10
  1711. package/dist/serialization/types/FeatureUsageResponseDataCreditGrantReason.d.ts +0 -10
  1712. package/dist/serialization/types/PlanChangeResponseDataAction.d.ts +0 -10
  1713. package/dist/serialization/types/PlanChangeResponseDataActorType.d.ts +0 -10
  1714. package/dist/serialization/types/PlanChangeResponseDataBasePlanAction.d.ts +0 -10
  1715. package/dist/serialization/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +0 -10
  1716. package/dist/serialization/types/TraitDefinitionEntityType.d.ts +0 -10
  1717. package/dist/serialization/types/UpdateEntitlementReqCommonValueType.d.ts +0 -10
  1718. package/dist/serialization/types/UsageBasedEntitlementRequestBodyPriceBehavior.d.ts +0 -10
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var jg=Object.create;var Sr=Object.defineProperty;var kg=Object.getOwnPropertyDescriptor;var Dg=Object.getOwnPropertyNames;var Vg=Object.getPrototypeOf,qg=Object.prototype.hasOwnProperty;var qo=(w,t)=>()=>(w&&(t=w(w=0)),t);var re=(w,t)=>{for(var o in t)Sr(w,o,{get:t[o],enumerable:!0})},wi=(w,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dg(t))!qg.call(w,i)&&i!==o&&Sr(w,i,{get:()=>t[i],enumerable:!(r=kg(t,i))||r.enumerable});return w};var H=(w,t,o)=>(o=w!=null?jg(Vg(w)):{},wi(t||!w||!w.__esModule?Sr(o,"default",{value:w,enumerable:!0}):o,w)),Mg=w=>wi(Sr({},"__esModule",{value:!0}),w);var bs={};re(bs,{Node18UniversalStreamWrapper:()=>Wo});var Wo,fs=qo(()=>{"use strict";Wo=class w{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,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.on("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.on("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.off("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.off("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}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(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}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,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var _s={};re(_s,{UndiciStreamWrapper:()=>Jo});var Jo,Ss=qo(()=>{"use strict";Jo=class w{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,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.on("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.on("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.off("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.off("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}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(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}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,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var xs={};re(xs,{NodePre18StreamWrapper:()=>$o});var $o,Es=qo(()=>{"use strict";$o=class{constructor(t){this.readableStream=t}on(t,o){this.readableStream.on(t,o)}off(t,o){this.readableStream.off(t,o)}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,o)=>{let r=this.readableStream.read();r?t(r):(this.readableStream.once("readable",()=>{let i=this.readableStream.read();t(i)}),this.readableStream.once("error",o))})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t}async text(){let t=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let i of this.readableStream)t.push(o.encode(i));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 o=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:r,done:i}=await o.next();return{value:r,done:i}},[Symbol.asyncIterator](){return this}}}}});var Zw={};re(Zw,{LocalCache:()=>He,Schematic:()=>Z,SchematicClient:()=>ko,SchematicEnvironment:()=>f,SchematicError:()=>c,SchematicTimeoutError:()=>R,WEBHOOK_SIGNATURE_HEADER:()=>di,WEBHOOK_TIMESTAMP_HEADER:()=>hi,WebhookSignatureError:()=>Ee,computeHexSignature:()=>Og,computeSignature:()=>Vo,verifySignature:()=>gi,verifyWebhookSignature:()=>Bg});module.exports=Mg(Zw);var Z={};re(Z,{BadRequestError:()=>P,BillingProductPricingUsageType:()=>Ag,ConditionConditionType:()=>Fg,ConditionMetricPeriod:()=>Ig,ConditionMetricPeriodMonthReset:()=>Kg,ConditionOperator:()=>Lg,CountBillingProductsRequestPriceUsageType:()=>vi,CountBillingProductsResponseParamsPriceUsageType:()=>Oi,CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ya,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>za,CountCreditBundlesRequestStatus:()=>Ni,CountCreditBundlesResponseParamsStatus:()=>Xi,CountCreditLedgerRequestPeriod:()=>oa,CountCreditLedgerResponseParamsPeriod:()=>ta,CountEntityKeyDefinitionsRequestEntityType:()=>Sa,CountEntityKeyDefinitionsResponseParamsEntityType:()=>xa,CountEntityTraitDefinitionsRequestEntityType:()=>Ba,CountEntityTraitDefinitionsRequestTraitType:()=>ja,CountEntityTraitDefinitionsResponseParamsEntityType:()=>ka,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Da,CountPlansRequestPlanType:()=>es,CountPlansResponseParamsPlanType:()=>rs,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>ki,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType:()=>ia,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit:()=>aa,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>sa,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>na,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>ca,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>la,CreateBillingPriceRequestBodyBillingScheme:()=>Si,CreateBillingPriceRequestBodyTiersMode:()=>xi,CreateBillingPriceRequestBodyUsageType:()=>Ei,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Bi,CreateCompanyCreditGrantExpiryType:()=>Wi,CreateCompanyCreditGrantExpiryUnit:()=>Ji,CreateCompanyOverrideRequestBodyMetricPeriod:()=>Va,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>qa,CreateCompanyOverrideRequestBodyValueType:()=>Ma,CreateComponentRequestBodyEntityType:()=>os,CreateCreditBundleRequestBodyExpiryType:()=>Ai,CreateCreditBundleRequestBodyExpiryUnit:()=>Fi,CreateCreditBundleRequestBodyStatus:()=>Ii,CreateEntitlementReqCommonMetricPeriod:()=>Gg,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>Ng,CreateEntitlementReqCommonValueType:()=>Xg,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ta,CreateEntityTraitDefinitionRequestBodyTraitType:()=>va,CreateEnvironmentRequestBodyEnvironmentType:()=>yi,CreateEventRequestBodyEventType:()=>Hg,CreateFeatureRequestBodyFeatureType:()=>ps,CreateFeatureRequestBodyLifecyclePhase:()=>ls,CreateOrUpdateConditionRequestBodyConditionType:()=>Wg,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>Jg,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>$g,CreateOrUpdateConditionRequestBodyOperator:()=>Zg,CreateOrUpdateRuleRequestBodyRuleType:()=>Yg,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>La,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ga,CreatePlanEntitlementRequestBodyValueType:()=>Na,CreatePlanRequestBodyPlanType:()=>Ya,CreateWebhookRequestBodyRequestTypesItem:()=>gs,CreditGrantDetailGrantReason:()=>Qg,CreditGrantExpiryRequestBodyExpiryType:()=>ew,CreditGrantExpiryRequestBodyExpiryUnit:()=>rw,CreditGrantExpiryRequestBodyResetCadence:()=>ow,CreditGrantExpiryRequestBodyResetStart:()=>tw,CreditGrantExpiryRequestBodyResetType:()=>iw,FeatureCompanyResponseDataAllocationType:()=>aw,FeatureCompanyResponseDataCreditGrantReason:()=>sw,FeatureCompanyUserResponseDataAllocationType:()=>nw,FeatureUsageResponseDataAllocationType:()=>cw,FeatureUsageResponseDataCreditGrantReason:()=>pw,ForbiddenError:()=>x,GetEnrichedCreditLedgerRequestPeriod:()=>ea,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ra,InternalServerError:()=>U,ListBillingProductsRequestPriceUsageType:()=>Ci,ListBillingProductsResponseParamsPriceUsageType:()=>Ti,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>Ra,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ba,ListCompanyGrantsRequestDir:()=>Zi,ListCompanyGrantsRequestOrder:()=>$i,ListCompanyGrantsResponseParamsDir:()=>Yi,ListCompanyGrantsResponseParamsOrder:()=>Qi,ListCreditBundlesRequestStatus:()=>qi,ListCreditBundlesResponseParamsStatus:()=>Mi,ListEntityKeyDefinitionsRequestEntityType:()=>fa,ListEntityKeyDefinitionsResponseParamsEntityType:()=>_a,ListEntityTraitDefinitionsRequestEntityType:()=>Ea,ListEntityTraitDefinitionsRequestTraitType:()=>Ua,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Pa,ListEntityTraitDefinitionsResponseParamsTraitType:()=>Ca,ListEventsRequestEventTypesItem:()=>ns,ListEventsResponseParamsEventTypesItem:()=>cs,ListPlansRequestPlanType:()=>$a,ListPlansResponseParamsPlanType:()=>Za,ListProductPricesRequestPriceUsageType:()=>Ui,ListProductPricesResponseParamsPriceUsageType:()=>Pi,NotFoundError:()=>E,PlanChangeResponseDataAction:()=>lw,PlanChangeResponseDataActorType:()=>mw,PlanChangeResponseDataBasePlanAction:()=>uw,PlanChangeResponseDataSubscriptionChangeAction:()=>dw,RuleRuleType:()=>hw,SearchBillingPricesRequestTiersMode:()=>Ri,SearchBillingPricesRequestUsageType:()=>bi,SearchBillingPricesResponseParamsTiersMode:()=>fi,SearchBillingPricesResponseParamsUsageType:()=>_i,TraitDefinitionComparableType:()=>gw,TraitDefinitionEntityType:()=>ww,UnauthorizedError:()=>S,UpdateBillingCreditRequestBodyBurnStrategy:()=>Di,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateBillingPlanCreditGrantRequestBodyExpiryType:()=>ma,UpdateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ua,UpdateBillingPlanCreditGrantRequestBodyResetCadence:()=>da,UpdateBillingPlanCreditGrantRequestBodyResetStart:()=>ha,UpdateBillingPlanCreditGrantRequestBodyResetType:()=>ga,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Aa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Fa,UpdateCompanyOverrideRequestBodyValueType:()=>Ia,UpdateComponentRequestBodyEntityType:()=>ts,UpdateComponentRequestBodyState:()=>is,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ki,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Li,UpdateCreditBundleDetailsRequestBodyStatus:()=>Gi,UpdateEntitlementReqCommonMetricPeriod:()=>yw,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>zw,UpdateEntitlementReqCommonValueType:()=>Rw,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Oa,UpdateEnvironmentRequestBodyEnvironmentType:()=>zi,UpdateFeatureRequestBodyFeatureType:()=>ms,UpdateFeatureRequestBodyLifecyclePhase:()=>us,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Xa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ha,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Wa,UpdatePlanEntitlementRequestBodyValueType:()=>Ja,UpdateWebhookRequestBodyRequestTypesItem:()=>ws,UpdateWebhookRequestBodyStatus:()=>ys,UpsertBillingProductRequestBodyChargeType:()=>Qa,UsageBasedEntitlementRequestBodyPriceBehavior:()=>bw,ZeroOutGrantRequestBodyReason:()=>Hi,accesstokens:()=>hs,accounts:()=>Mo,billing:()=>Ao,checkout:()=>wa,companies:()=>Io,components:()=>Go,credits:()=>Fo,crm:()=>as,dataexports:()=>ss,entitlements:()=>Ko,events:()=>No,features:()=>Xo,plangroups:()=>ds,plans:()=>Lo,webhooks:()=>Ho});var Mo={};re(Mo,{CreateEnvironmentRequestBodyEnvironmentType:()=>yi,UpdateEnvironmentRequestBodyEnvironmentType:()=>zi});var yi={Development:"development",Staging:"staging",Production:"production"};var zi={Development:"development",Staging:"staging",Production:"production"};var Ao={};re(Ao,{CountBillingProductsRequestPriceUsageType:()=>vi,CountBillingProductsResponseParamsPriceUsageType:()=>Oi,CreateBillingPriceRequestBodyBillingScheme:()=>Si,CreateBillingPriceRequestBodyTiersMode:()=>xi,CreateBillingPriceRequestBodyUsageType:()=>Ei,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Bi,ListBillingProductsRequestPriceUsageType:()=>Ci,ListBillingProductsResponseParamsPriceUsageType:()=>Ti,ListProductPricesRequestPriceUsageType:()=>Ui,ListProductPricesResponseParamsPriceUsageType:()=>Pi,SearchBillingPricesRequestTiersMode:()=>Ri,SearchBillingPricesRequestUsageType:()=>bi,SearchBillingPricesResponseParamsTiersMode:()=>fi,SearchBillingPricesResponseParamsUsageType:()=>_i});var Ri={Volume:"volume",Graduated:"graduated"};var bi={Licensed:"licensed",Metered:"metered"};var fi={Volume:"volume",Graduated:"graduated"};var _i={Licensed:"licensed",Metered:"metered"};var Si={PerUnit:"per_unit",Tiered:"tiered"};var xi={Volume:"volume",Graduated:"graduated"};var Ei={Licensed:"licensed",Metered:"metered"};var Ui={Licensed:"licensed",Metered:"metered"};var Pi={Licensed:"licensed",Metered:"metered"};var Ci={Licensed:"licensed",Metered:"metered"};var Ti={Licensed:"licensed",Metered:"metered"};var vi={Licensed:"licensed",Metered:"metered"};var Oi={Licensed:"licensed",Metered:"metered"};var Bi={Subscribe:"subscribe",Cancel:"cancel"};var Fo={};re(Fo,{CountCreditBundlesRequestStatus:()=>Ni,CountCreditBundlesResponseParamsStatus:()=>Xi,CountCreditLedgerRequestPeriod:()=>oa,CountCreditLedgerResponseParamsPeriod:()=>ta,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>ki,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType:()=>ia,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit:()=>aa,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>sa,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>na,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>ca,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>la,CreateCompanyCreditGrantExpiryType:()=>Wi,CreateCompanyCreditGrantExpiryUnit:()=>Ji,CreateCreditBundleRequestBodyExpiryType:()=>Ai,CreateCreditBundleRequestBodyExpiryUnit:()=>Fi,CreateCreditBundleRequestBodyStatus:()=>Ii,GetEnrichedCreditLedgerRequestPeriod:()=>ea,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ra,ListCompanyGrantsRequestDir:()=>Zi,ListCompanyGrantsRequestOrder:()=>$i,ListCompanyGrantsResponseParamsDir:()=>Yi,ListCompanyGrantsResponseParamsOrder:()=>Qi,ListCreditBundlesRequestStatus:()=>qi,ListCreditBundlesResponseParamsStatus:()=>Mi,UpdateBillingCreditRequestBodyBurnStrategy:()=>Di,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateBillingPlanCreditGrantRequestBodyExpiryType:()=>ma,UpdateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ua,UpdateBillingPlanCreditGrantRequestBodyResetCadence:()=>da,UpdateBillingPlanCreditGrantRequestBodyResetStart:()=>ha,UpdateBillingPlanCreditGrantRequestBodyResetType:()=>ga,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ki,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Li,UpdateCreditBundleDetailsRequestBodyStatus:()=>Gi,ZeroOutGrantRequestBodyReason:()=>Hi});var ji={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var ki={None:"none",Rollover:"rollover",Expire:"expire"};var Di={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var Vi={None:"none",Rollover:"rollover",Expire:"expire"};var qi={Active:"active",Inactive:"inactive"};var Mi={Active:"active",Inactive:"inactive"};var Ai={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Fi={Days:"days",BillingPeriods:"billing_periods"};var Ii={Active:"active",Inactive:"inactive"};var Ki={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Li={Days:"days",BillingPeriods:"billing_periods"};var Gi={Active:"active",Inactive:"inactive"};var Ni={Active:"active",Inactive:"inactive"};var Xi={Active:"active",Inactive:"inactive"};var Hi={PlanChange:"plan_change",Manual:"manual",PlanPeriodReset:"plan_period_reset",Expired:"expired"};var Wi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Ji={Days:"days",BillingPeriods:"billing_periods"};var $i={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var Zi={Asc:"asc",Desc:"desc"};var Yi={Asc:"asc",Desc:"desc"};var Qi={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var ea={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ra={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var oa={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ta={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ia={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var aa={Days:"days",BillingPeriods:"billing_periods"};var sa={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var na={Days:"days",BillingPeriods:"billing_periods"};var ca={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var pa={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var la={PlanPeriod:"plan_period",NoReset:"no_reset"};var ma={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var ua={Days:"days",BillingPeriods:"billing_periods"};var da={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var ha={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var ga={PlanPeriod:"plan_period",NoReset:"no_reset"};var wa={};var Io={};re(Io,{CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ya,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>za,CountEntityKeyDefinitionsRequestEntityType:()=>Sa,CountEntityKeyDefinitionsResponseParamsEntityType:()=>xa,CountEntityTraitDefinitionsRequestEntityType:()=>Ba,CountEntityTraitDefinitionsRequestTraitType:()=>ja,CountEntityTraitDefinitionsResponseParamsEntityType:()=>ka,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Da,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ta,CreateEntityTraitDefinitionRequestBodyTraitType:()=>va,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>Ra,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ba,ListEntityKeyDefinitionsRequestEntityType:()=>fa,ListEntityKeyDefinitionsResponseParamsEntityType:()=>_a,ListEntityTraitDefinitionsRequestEntityType:()=>Ea,ListEntityTraitDefinitionsRequestTraitType:()=>Ua,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Pa,ListEntityTraitDefinitionsResponseParamsTraitType:()=>Ca,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Oa});var ya={Asc:"asc",Desc:"desc"};var za={Asc:"asc",Desc:"desc"};var Ra={Asc:"asc",Desc:"desc"};var ba={Asc:"asc",Desc:"desc"};var fa={Company:"company",User:"user"};var _a={Company:"company",User:"user"};var Sa={Company:"company",User:"user"};var xa={Company:"company",User:"user"};var Ea={Company:"company",User:"user"};var Ua={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Pa={Company:"company",User:"user"};var Ca={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ta={Company:"company",User:"user"};var va={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Oa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ba={Company:"company",User:"user"};var ja={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var ka={Company:"company",User:"user"};var Da={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ko={};re(Ko,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>Va,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>qa,CreateCompanyOverrideRequestBodyValueType:()=>Ma,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>La,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ga,CreatePlanEntitlementRequestBodyValueType:()=>Na,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Aa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Fa,UpdateCompanyOverrideRequestBodyValueType:()=>Ia,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Xa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ha,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Wa,UpdatePlanEntitlementRequestBodyValueType:()=>Ja});var Va={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var qa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ma={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Aa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Fa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ia={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Ka={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var La={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ga={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Na={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Xa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ha={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Wa={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Ja={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Lo={};re(Lo,{CountPlansRequestPlanType:()=>es,CountPlansResponseParamsPlanType:()=>rs,CreatePlanRequestBodyPlanType:()=>Ya,ListPlansRequestPlanType:()=>$a,ListPlansResponseParamsPlanType:()=>Za,UpsertBillingProductRequestBodyChargeType:()=>Qa});var $a={Plan:"plan",AddOn:"add_on"};var Za={Plan:"plan",AddOn:"add_on"};var Ya={Plan:"plan",AddOn:"add_on"};var Qa={OneTime:"one_time",Recurring:"recurring",Free:"free"};var es={Plan:"plan",AddOn:"add_on"};var rs={Plan:"plan",AddOn:"add_on"};var Go={};re(Go,{CreateComponentRequestBodyEntityType:()=>os,UpdateComponentRequestBodyEntityType:()=>ts,UpdateComponentRequestBodyState:()=>is});var os={Entitlement:"entitlement",Billing:"billing"};var ts={Entitlement:"entitlement",Billing:"billing"};var is={Draft:"draft",Live:"live"};var as={};var ss={};var No={};re(No,{ListEventsRequestEventTypesItem:()=>ns,ListEventsResponseParamsEventTypesItem:()=>cs});var ns={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var cs={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var Xo={};re(Xo,{CreateFeatureRequestBodyFeatureType:()=>ps,CreateFeatureRequestBodyLifecyclePhase:()=>ls,UpdateFeatureRequestBodyFeatureType:()=>ms,UpdateFeatureRequestBodyLifecyclePhase:()=>us});var ps={Boolean:"boolean",Event:"event",Trait:"trait"};var ls={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var ms={Boolean:"boolean",Event:"event",Trait:"trait"};var us={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var ds={};var hs={};var Ho={};re(Ho,{CreateWebhookRequestBodyRequestTypesItem:()=>gs,UpdateWebhookRequestBodyRequestTypesItem:()=>ws,UpdateWebhookRequestBodyStatus:()=>ys});var gs={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached",CompanyPlanChange:"company.plan_change"};var ws={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached",CompanyPlanChange:"company.plan_change"};var ys={Active:"active",Inactive:"inactive"};var Ag={Licensed:"licensed",Metered:"metered"};var Fg={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var Ig={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Kg={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 Gg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ng={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Xg={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Hg={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var Wg={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",CrmProduct:"crm_product",BasePlan:"base_plan"};var Jg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var $g={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Zg={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Yg={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Qg={Free:"free",Plan:"plan",Purchased:"purchased"};var ew={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var rw={Days:"days",BillingPeriods:"billing_periods"};var ow={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var tw={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var iw={PlanPeriod:"plan_period",NoReset:"no_reset"};var aw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var sw={Free:"free",Plan:"plan",Purchased:"purchased"};var nw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited",Unknown:"unknown"};var cw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var pw={Free:"free",Plan:"plan",Purchased:"purchased"};var lw={Checkout:"checkout",CompanyUpsert:"company_upsert",FallbackPlan:"fallback_plan",ManagePlan:"manage_plan",Migration:"migration",PlanBillingProductChanged:"plan_billing_product_changed",PlanDeleted:"plan_deleted",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var mw={AppUser:"app_user",ApiKey:"api_key",System:"system",TemporaryAccessToken:"temporary_access_token"};var uw={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var dw={Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var hw={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var gw={Bool:"bool",Date:"date",Int:"int",String:"string"};var ww={User:"user",Company:"company"};var yw={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var zw={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Rw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var bw={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var pe=(w,t,o)=>JSON.stringify(w,t,o);var c=class w extends Error{constructor({message:t,statusCode:o,body:r,rawResponse:i}){super(fw({message:t,statusCode:o,body:r})),Object.setPrototypeOf(this,w.prototype),this.statusCode=o,this.body=r,this.rawResponse=i}};function fw({message:w,statusCode:t,body:o}){let r=[];return w!=null&&r.push(w),t!=null&&r.push(`Status code: ${t.toString()}`),o!=null&&r.push(`Body: ${pe(o,void 0,2)}`),r.join(`
2
- `)}var R=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype)}};var P=class w extends c{constructor(t,o){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var S=class w extends c{constructor(t,o){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var x=class w extends c{constructor(t,o){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var E=class w extends c{constructor(t,o){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var U=class w extends c{constructor(t,o){super({message:"InternalServerError",statusCode:500,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var yr=require("timers"),He=class{constructor({maxItems:t=1e3,ttl:o=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=t,this.defaultTTL=o}async get(t){let o=this.cache.get(t);if(o){if(o.expiration<=Date.now()){this.evictItem(t,o);return}return this.accessCounter++,o.accessCounter=this.accessCounter,this.cache.set(t,o),o.value}}async set(t,o,r){if(this.maxItems===0)return;let i=r??this.defaultTTL,m=this.cache.get(t);m&&this.evictItem(t,m),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let g={value:o,accessCounter:this.accessCounter,expiration:Date.now()+i,timeoutId:(0,yr.setTimeout)(()=>this.evictItem(t,g),i)};this.cache.set(t,g)}resetCache(){this.cache.forEach(t=>{t.timeoutId&&(0,yr.clearTimeout)(t.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(t,o){o.timeoutId&&(0,yr.clearTimeout)(o.timeoutId),this.cache.delete(t)}evictExpiredItems(){this.cache.forEach((t,o)=>{t.expiration<=Date.now()&&this.evictItem(o,t)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let t,o=Number.MAX_SAFE_INTEGER;this.cache.forEach((r,i)=>{r.accessCounter<o&&(t=i,o=r.accessCounter)}),t&&this.evictItem(t,this.cache.get(t))}}};var f={Default:"https://api.schematichq.com"};var Ae;typeof globalThis.Headers<"u"?Ae=globalThis.Headers:Ae=class zs{constructor(t){if(this.headers=new Map,t)if(t instanceof zs)t.forEach((o,r)=>this.append(r,o));else if(Array.isArray(t))for(let[o,r]of t)if(typeof o=="string"&&typeof r=="string")this.append(o,r);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[o,r]of Object.entries(t))if(typeof r=="string")this.append(o,r);else throw new TypeError("Header values must be strings")}append(t,o){let r=t.toLowerCase(),i=this.headers.get(r)||[];this.headers.set(r,[...i,o])}delete(t){let o=t.toLowerCase();this.headers.delete(o)}get(t){let o=t.toLowerCase(),r=this.headers.get(o);return r?r.join(", "):null}has(t){let o=t.toLowerCase();return this.headers.has(o)}set(t,o){let r=t.toLowerCase();this.headers.set(r,[o])}forEach(t,o){let r=o?t.bind(o):t;this.headers.forEach((i,m)=>r(i.join(", "),m,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,o]of this.headers.entries())yield[t,o.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var Fe={headers:new Ae,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},Ie={headers:new Ae,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function We(w){return{headers:w.headers,redirected:w.redirected,status:w.status,statusText:w.statusText,type:w.type,url:w.url}}var Rs=H(require("qs"));function xr(w,t){return Object.keys(t??{}).length>0?`${w}?${Rs.default.stringify(t,{arrayFormat:"repeat"})}`:w}var h=_w();function _w(){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 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])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Er(){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?fetch:h.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function Ur({body:w,type:t}){return t.includes("json")?pe(w):w}async function Us(w){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?new(await Promise.resolve().then(()=>(fs(),bs))).Node18UniversalStreamWrapper(w):h.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Ss(),_s))).UndiciStreamWrapper(w):new(await Promise.resolve().then(()=>(Es(),xs))).NodePre18StreamWrapper(w)}async function Pr(w,t){if(w.body!=null&&t==="blob")return await w.blob();if(w.body!=null&&t==="arrayBuffer")return await w.arrayBuffer();if(w.body!=null&&t==="sse")return w.body;if(w.body!=null&&t==="streaming")return Us(w.body);if(w.body!=null&&t==="text")return await w.text();{let o=await w.text();if(o.length>0)try{return JSON.parse(o)}catch{return{ok:!1,error:{reason:"non-json",statusCode:w.status,rawBody:o}}}else return}}var Sw="timeout";function Ps(w){let t=new AbortController,o=setTimeout(()=>t.abort(Sw),w);return{signal:t.signal,abortId:o}}function Cs(...w){let t=w.length===1&&Array.isArray(w[0])?w[0]:w,o=new AbortController;for(let r of t){if(r.aborted){o.abort(r?.reason);break}r.addEventListener("abort",()=>o.abort(r?.reason),{signal:o.signal})}return o.signal}var Cr=async(w,t,o,r,i,m,g,p,s)=>{let l=[],u;if(m!=null){let{signal:C,abortId:O}=Ps(m);u=O,l.push(C)}g!=null&&l.push(g);let z=Cs(l),y=await w(t,{method:o,headers:r,body:i,signal:z,credentials:p?"include":void 0,duplex:s});return u!=null&&clearTimeout(u),y};function xw(w){let t=1+(Math.random()*2-1)*.2;return w*t}async function Tr(w,t=2){let o=await w();for(let r=0;r<t&&([408,429].includes(o.status)||o.status>=500);++r){let i=Math.min(1e3*Math.pow(2,r),6e4),m=xw(i);await new Promise(g=>setTimeout(g,m)),o=await w()}return o}async function Ew(w){let t={};if(w.body!==void 0&&w.contentType!=null&&(t["Content-Type"]=w.contentType),w.headers!=null)for(let[m,g]of Object.entries(w.headers))g!=null&&(t[m]=g);let o=xr(w.url,w.queryParameters),r=await Ur({body:w.body,type:w.requestType==="json"?"json":"other"}),i=await Er();try{let m=await Tr(async()=>Cr(i,o,w.method,t,r,w.timeoutMs,w.abortSignal,w.withCredentials,w.duplex),w.maxRetries),g=await Pr(m,w.responseType);return m.status>=200&&m.status<400?{ok:!0,body:g,headers:m.headers,rawResponse:We(m)}:{ok:!1,error:{reason:"status-code",statusCode:m.status,body:g},rawResponse:We(m)}}catch(m){return w.abortSignal!=null&&w.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Fe}:m instanceof Error&&m.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Fe}:m instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:m.message},rawResponse:Ie}:{ok:!1,error:{reason:"unknown",errorMessage:pe(m)},rawResponse:Ie}}}var _=Ew;var d={get:async w=>typeof w=="function"?w():w};var b=class w extends Promise{constructor(t){super(o=>{o(void 0)}),this.innerPromise=t}static fromFunction(t,...o){return new w(t(...o))}static interceptFunction(t){return(...o)=>w.fromPromise(t(...o))}static fromPromise(t){return new w(t)}static fromExecutor(t){let o=new Promise(t);return new w(o)}static fromResult(t){let o=Promise.resolve(t);return new w(o)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,o){return this.unwrap().then(t,o)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var e={};re(e,{JsonError:()=>Je,ParseError:()=>$e,any:()=>Ls,bigint:()=>vs,boolean:()=>Gs,booleanLiteral:()=>Ks,date:()=>Os,discriminant:()=>Qs,enum_:()=>Or,getObjectLikeUtils:()=>ye,getObjectUtils:()=>Ke,getSchemaUtils:()=>F,isProperty:()=>Ce,lazy:()=>Bs,lazyObject:()=>As,list:()=>jr,number:()=>Ns,object:()=>Br,objectWithoutOptionalProperties:()=>Ms,optional:()=>Zo,property:()=>ks,record:()=>Js,set:()=>$s,string:()=>Xs,stringLiteral:()=>Is,transform:()=>Yo,undiscriminatedUnion:()=>Ys,union:()=>rn,unknown:()=>Hs,withParsedProperties:()=>et});var k={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function A(w,t){return`Expected ${t}. Received ${Uw(w)}.`}function Uw(w){if(Array.isArray(w))return"list";if(w===null)return"null";if(w instanceof BigInt)return"BigInt";switch(typeof w){case"string":return`"${w}"`;case"bigint":case"number":case"boolean":case"undefined":return`${w}`}return typeof w}function Y(w){return{...w,json:Ts(w.json),parse:Ts(w.parse)}}function Ts(w){return(t,o)=>{let r=w(t,o),{skipValidation:i=!1}=o??{};return!r.ok&&i?(console.warn(["Failed to validate.",...r.errors.map(m=>" - "+(m.path.length>0?`${m.path.join(".")}: ${m.message}`:m.message))].join(`
3
- `)),{ok:!0,value:t}):r}}function vr(w){return w.path.length===0?w.message:`${w.path.join(" -> ")}: ${w.message}`}var Je=class w extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};var $e=class w extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};function F(w){return{nullable:()=>Pw(w),optional:()=>Zo(w),optionalNullable:()=>Cw(w),transform:t=>Yo(w,t),parseOrThrow:(t,o)=>{let r=w.parse(t,o);if(r.ok)return r.value;throw new $e(r.errors)},jsonOrThrow:(t,o)=>{let r=w.json(t,o);if(r.ok)return r.value;throw new Je(r.errors)}}}function Pw(w){let t={parse:(o,r)=>o==null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.NULLABLE};return{...t,...F(t)}}function Zo(w){let t={parse:(o,r)=>o==null?{ok:!0,value:void 0}:w.parse(o,r),json:(o,r)=>r?.omitUndefined&&o===void 0?{ok:!0,value:void 0}:o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.OPTIONAL};return{...t,...F(t)}}function Cw(w){let t={parse:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.OPTIONAL_NULLABLE};return{...t,...F(t)}}function Yo(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);return m.ok?{ok:!0,value:t.transform(m.value)}:m},json:(r,i)=>{let m=t.untransform(r);return w.json(m,i)},getType:()=>w.getType()};return{...o,...F(o)}}function vs(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:o,message:A(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:o,message:A(t,"bigint")}]}:{ok:!0,value:t},getType:()=>k.BIGINT};return{...Y(w),...F(w)}}var Tw=/^([+-]?\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 Os(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:o,message:A(t,"string")}]}:Tw.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:o,message:A(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:o,message:A(t,"Date object")}]},getType:()=>k.DATE};return{...Y(w),...F(w)}}function te(w,t){return()=>{let o={parse:t,json:t,getType:()=>w};return{...Y(o),...F(o)}}}function Or(w){let t=new Set(w);return te(k.ENUM,(r,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:m=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:m,message:A(r,"string")}]}:!t.has(r)&&!i?{ok:!1,errors:[{path:m,message:A(r,"enum")}]}:{ok:!0,value:r})()}function Bs(w){let t=Qo(w);return{...t,...F(t)}}function Qo(w){return{parse:(t,o)=>Ze(w).parse(t,o),json:(t,o)=>Ze(w).json(t,o),getType:()=>Ze(w).getType()}}function Ze(w){let t=w;return t.__zurg_memoized==null&&(t.__zurg_memoized=w()),t.__zurg_memoized}function zr(w){return Object.entries(w)}function Rr(w,t){let o=new Set(t);return Object.entries(w).reduce((r,[i,m])=>(o.has(i)&&(r[i]=m),r),{})}function Pe(w){if(typeof w!="object"||w===null)return!1;if(Object.getPrototypeOf(w)===null)return!0;let t=w;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(w)===t}function br(w){return Object.keys(w)}function js(w,t){let o=[],r=[];for(let i of w)t(i)?o.push(i):r.push(i);return[o,r]}function ye(w){return{withParsedProperties:t=>et(w,t)}}function et(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);if(!m.ok)return m;let g=Object.entries(t).reduce((p,[s,l])=>({...p,[s]:typeof l=="function"?l(m.value):l}),{});return{ok:!0,value:{...m.value,...g}}},json:(r,i)=>{if(!Pe(r))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"object")}]};let m=new Set(Object.keys(t)),g=Rr(r,Object.keys(r).filter(p=>!m.has(p)));return w.json(g,i)},getType:()=>w.getType()};return{...o,...F(o),...ye(o)}}function ks(w,t){return{rawKey:w,valueSchema:t,isProperty:!0}}function Ce(w){return w.isProperty}function Br(w){let t={_getRawProperties:()=>Object.entries(w).map(([o,r])=>Ce(r)?r.rawKey:o),_getParsedProperties:()=>br(w),parse:(o,r)=>{let i={},m=[];for(let[g,p]of zr(w)){let s=Ce(p)?p.rawKey:g,l=Ce(p)?p.valueSchema:p,u={rawKey:s,parsedKey:g,valueSchema:l};i[s]=u,qs(l)&&m.push(s)}return Ds({value:o,requiredKeys:m,getProperty:g=>{let p=i[g];if(p!=null)return{transformedKey:p.parsedKey,transform:s=>p.valueSchema.parse(s,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],g]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},json:(o,r)=>{let i=[];for(let[m,g]of zr(w)){let p=Ce(g)?g.valueSchema:g;qs(p)&&i.push(m)}return Ds({value:o,requiredKeys:i,getProperty:m=>{let g=w[m];if(g!=null)return Ce(g)?{transformedKey:g.rawKey,transform:p=>g.valueSchema.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}:{transformedKey:m,transform:p=>g.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},getType:()=>k.OBJECT};return{...Y(t),...F(t),...ye(t),...Ke(t)}}function Ds({value:w,requiredKeys:t,getProperty:o,unrecognizedObjectKeys:r="fail",skipValidation:i=!1,breadcrumbsPrefix:m=[]}){if(!Pe(w))return{ok:!1,errors:[{path:m,message:A(w,"object")}]};let g=new Set(t),p=[],s={};for(let[l,u]of Object.entries(w)){let z=o(l);if(z!=null){g.delete(l);let y=z.transform(u);y.ok?s[z.transformedKey]=y.value:(s[l]=u,p.push(...y.errors))}else switch(r){case"fail":p.push({path:[...m,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":s[l]=u;break}}return p.push(...t.filter(l=>g.has(l)).map(l=>({path:m,message:`Missing required key "${l}"`}))),p.length===0||i?{ok:!0,value:s}:{ok:!1,errors:p}}function Ke(w){return{extend:t=>{let o={_getParsedProperties:()=>[...w._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...w._getRawProperties(),...t._getRawProperties()],parse:(r,i)=>Vs({extensionKeys:t._getRawProperties(),value:r,transformBase:m=>w.parse(m,i),transformExtension:m=>t.parse(m,i)}),json:(r,i)=>Vs({extensionKeys:t._getParsedProperties(),value:r,transformBase:m=>w.json(m,i),transformExtension:m=>t.json(m,i)}),getType:()=>k.OBJECT};return{...o,...F(o),...ye(o),...Ke(o)}},passthrough:()=>{let t={_getParsedProperties:()=>w._getParsedProperties(),_getRawProperties:()=>w._getRawProperties(),parse:(o,r)=>{let i=w.parse(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},json:(o,r)=>{let i=w.json(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},getType:()=>k.OBJECT};return{...t,...F(t),...ye(t),...Ke(t)}}}}function Vs({extensionKeys:w,value:t,transformBase:o,transformExtension:r}){let i=new Set(w),[m,g]=js(br(t),l=>i.has(l)),p=o(Rr(t,g)),s=r(Rr(t,m));return p.ok&&s.ok?{ok:!0,value:{...p.value,...s.value}}:{ok:!1,errors:[...p.ok?[]:p.errors,...s.ok?[]:s.errors]}}function qs(w){return!vw(w)}function vw(w){switch(w.getType()){case k.ANY:case k.UNKNOWN:case k.OPTIONAL:case k.OPTIONAL_NULLABLE:return!0;default:return!1}}function Ms(w){return Br(w)}function As(w){let t={...Qo(w),_getRawProperties:()=>Ze(w)._getRawProperties(),_getParsedProperties:()=>Ze(w)._getParsedProperties()};return{...t,...F(t),...ye(t),...Ke(t)}}function jr(w){let t={parse:(o,r)=>Fs(o,(i,m)=>w.parse(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),json:(o,r)=>Fs(o,(i,m)=>w.json(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),getType:()=>k.LIST};return{...Y(t),...F(t)}}function Fs(w,t){return Array.isArray(w)?w.map((r,i)=>t(r,i)).reduce((r,i)=>{if(r.ok&&i.ok)return{ok:!0,value:[...r.value,i.value]};let m=[];return r.ok||m.push(...r.errors),i.ok||m.push(...i.errors),{ok:!1,errors:m}},{ok:!0,value:[]}):{ok:!1,errors:[{message:A(w,"list"),path:[]}]}}function Is(w){return te(k.STRING_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`"${w}"`)}]})()}function Ks(w){return te(k.BOOLEAN_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`${w.toString()}`)}]})()}var Ls=te(k.ANY,w=>({ok:!0,value:w}));var Gs=te(k.BOOLEAN,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="boolean"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"boolean")}]});var Ns=te(k.NUMBER,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="number"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"number")}]});var Xs=te(k.STRING,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="string"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"string")}]});var Hs=te(k.UNKNOWN,w=>({ok:!0,value:w}));function Js(w,t){let o={parse:(r,i)=>Ws({value:r,isKeyNumeric:w.getType()===k.NUMBER,transformKey:m=>w.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(r,i)=>Ws({value:r,isKeyNumeric:w.getType()===k.NUMBER,transformKey:m=>w.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>k.RECORD};return{...Y(o),...F(o)}}function Ws({value:w,isKeyNumeric:t,transformKey:o,transformValue:r,breadcrumbsPrefix:i=[]}){return Pe(w)?zr(w).reduce((m,[g,p])=>{if(p===void 0)return m;let s=m,l=g;if(t){let C=g.length>0?Number(g):NaN;isNaN(C)||(l=C)}let u=o(l),z=r(p,l);if(s.ok&&u.ok&&z.ok)return{ok:!0,value:{...s.value,[u.value]:z.value}};let y=[];return s.ok||y.push(...s.errors),u.ok||y.push(...u.errors),z.ok||y.push(...z.errors),{ok:!1,errors:y}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:A(w,"object")}]}}function $s(w){let t=jr(w),o={parse:(r,i)=>{let m=t.parse(r,i);return m.ok?{ok:!0,value:new Set(m.value)}:m},json:(r,i)=>r instanceof Set?t.json([...r],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"Set")}]},getType:()=>k.SET};return{...Y(o),...F(o)}}function Ys(w){let t={parse:(o,r)=>Zs((i,m)=>i.parse(o,m),w,r),json:(o,r)=>Zs((i,m)=>i.json(o,m),w,r),getType:()=>k.UNDISCRIMINATED_UNION};return{...Y(t),...F(t)}}function Zs(w,t,o){let r=[];for(let[i,m]of t.entries()){let g=w(m,{...o,skipValidation:!1});if(g.ok)return g;for(let p of g.errors)r.push({path:p.path,message:`[Variant ${i}] ${p.message}`})}return{ok:!1,errors:r}}function Qs(w,t){return{parsedDiscriminant:w,rawDiscriminant:t}}function rn(w,t){let o=typeof w=="string"?w:w.rawDiscriminant,r=typeof w=="string"?w:w.parsedDiscriminant,i=Or(br(t)),m={parse:(g,p)=>en({value:g,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:s=>i.parse(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],o]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.parse(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),json:(g,p)=>en({value:g,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:s=>i.json(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.json(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),getType:()=>k.UNION};return{...Y(m),...F(m),...ye(m)}}function en({value:w,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:r,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:m=!1,transformAdditionalProperties:g,breadcrumbsPrefix:p=[]}){if(!Pe(w))return{ok:!1,errors:[{path:p,message:A(w,"object")}]};let{[t]:s,...l}=w;if(s==null)return{ok:!1,errors:[{path:p,message:`Missing discriminant ("${t}")`}]};let u=r(s);if(!u.ok)return{ok:!1,errors:u.errors};let z=i(u.value);if(z==null)return m?{ok:!0,value:{[o]:u.value,...l}}:{ok:!1,errors:[{path:[...p,t],message:"Unexpected discriminant value"}]};let y=g(l,z);return y.ok?{ok:!0,value:{[o]:s,...y.value}}:y}var ui=H(require("url-join"));var ae=H(require("url-join"));var on=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 me=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),scopes:e.list(e.string()),updatedAt:e.property("updated_at",e.date())});var tn=e.object({data:e.list(me),params:on});var an=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(e.string()),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var sn=e.object({data:an,params:e.record(e.string(),e.unknown())});var nn=e.object({data:me,params:e.record(e.string(),e.unknown())});var cn=e.object({data:me,params:e.record(e.string(),e.unknown())});var M=e.object({deleted:e.boolean().optional()});var pn=e.object({data:M,params:e.record(e.string(),e.unknown())});var ln=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 j=e.object({count:e.number().optional()});var mn=e.object({data:j,params:ln});var un=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 kr=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 dn=e.object({data:e.list(kr),params:un});var hn=e.object({apiKey:e.property("api_key",me.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 gn=e.object({data:hn,params:e.record(e.string(),e.unknown())});var wn=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 yn=e.object({data:j,params:wn});var zn=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Ye=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Rn=e.object({data:e.list(Ye),params:zn});var bn=e.enum_(["development","staging","production"]);var fn=e.object({apiKeys:e.property("api_keys",e.list(me)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var _n=e.object({data:fn,params:e.record(e.string(),e.unknown())});var Sn=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var xn=e.enum_(["development","staging","production"]);var En=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var Un=e.object({data:M,params:e.record(e.string(),e.unknown())});var Pn=e.object({ok:e.boolean()});var Cn=e.object({data:Pn,params:e.record(e.string(),e.unknown())});var rt=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var ot=e.object({description:e.string().optional(),name:e.string().optional()});var tt=e.object({environmentType:e.property("environment_type",bn),name:e.string()});var it=e.object({environmentType:e.property("environment_type",xn.optional()),name:e.string().optional()});var Tn=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Dr=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()),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var vn=e.object({data:e.list(Dr),params:Tn});var On=e.object({data:Dr,params:e.record(e.string(),e.unknown())});var Bn=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(),updatedAt:e.property("updated_at",e.date())});var jn=e.object({data:Bn,params:e.record(e.string(),e.unknown())});var kn=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(),q:e.string().optional()});var Dn=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 Vn=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(),subscriptions:e.list(Dn),updatedAt:e.property("updated_at",e.date())});var qn=e.object({data:e.list(Vn),params:kn});var Mn=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(),q:e.string().optional()});var An=e.object({data:j,params:Mn});var Fn=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 le=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()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var In=e.object({data:e.list(le),params:Fn});var Kn=e.object({data:le,params:e.record(e.string(),e.unknown())});var Ln=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Vr=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()});var Gn=e.object({data:e.list(Vr),params:Ln});var Nn=e.object({data:Vr,params:e.record(e.string(),e.unknown())});var Xn=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 ce=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()),updatedAt:e.property("updated_at",e.date())});var Hn=e.object({data:e.list(ce),params:Xn});var Wn=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Jn=e.enum_(["volume","graduated"]);var $n=e.enum_(["licensed","metered"]);var Zn=e.enum_(["volume","graduated"]);var Yn=e.enum_(["licensed","metered"]);var Qn=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(),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),tiersMode:e.property("tiers_mode",Zn.optional()),usageType:e.property("usage_type",Yn.optional())});var qr=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 Q=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:e.string(),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(qr)),productExternalId:e.property("product_external_id",e.string()),productId:e.property("product_id",e.string()),productName:e.property("product_name",e.string()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var ec=e.object({data:e.list(Q),params:Qn});var rc=e.enum_(["per_unit","tiered"]);var oc=e.enum_(["volume","graduated"]);var tc=e.enum_(["licensed","metered"]);var I=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),scheme:e.string()});var ic=e.object({data:I,params:e.record(e.string(),e.unknown())});var ac=e.object({data:M,params:e.record(e.string(),e.unknown())});var sc=e.enum_(["licensed","metered"]);var nc=e.enum_(["licensed","metered"]);var cc=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",nc.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 pc=e.object({data:e.list(I),params:cc});var lc=e.object({data:M,params:e.record(e.string(),e.unknown())});var Qe=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()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var mc=e.object({data:Qe,params:e.record(e.string(),e.unknown())});var uc=e.enum_(["licensed","metered"]);var dc=e.enum_(["licensed","metered"]);var hc=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",dc.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 Te=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(I),productId:e.property("product_id",e.string()),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var gc=e.object({data:e.list(Te),params:hc});var wc=e.enum_(["licensed","metered"]);var yc=e.enum_(["licensed","metered"]);var zc=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",yc.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 Rc=e.object({data:j,params:zc});var bc=e.enum_(["subscribe","cancel"]);var fc=e.object({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()),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",e.string().optional())});var _c=e.object({data:fc,params:e.record(e.string(),e.unknown())});var at=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 st=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()});var nt=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 ct=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 pt=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 Sc=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()),upTo:e.property("up_to",e.number().optional())});var lt=e.object({billingScheme:e.property("billing_scheme",rc),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(Sc)),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",oc.optional()),usageType:e.property("usage_type",tc)});var mt=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),price:e.number()});var xc=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 Ec=e.enum_(["licensed","metered"]);var Uc=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",Ec)});var ut=e.object({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(xc),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(Uc)),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",bc.optional())});var Pc=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var ze=e.object({burnStrategy:e.property("burn_strategy",e.string()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",e.string()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",e.string()),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:I.optional(),product:Qe.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Cc=e.object({data:e.list(ze),params:Pc});var Tc=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var vc=e.enum_(["none","rollover","expire"]);var Oc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Bc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var jc=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var kc=e.enum_(["none","rollover","expire"]);var Dc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Vc=e.object({data:M,params:e.record(e.string(),e.unknown())});var qc=e.enum_(["active","inactive"]);var Mc=e.enum_(["active","inactive"]);var Ac=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Mc.optional()});var ue=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),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",e.string()),expiryUnit:e.property("expiry_unit",e.string()),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:I.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",I.optional()),updatedAt:e.property("updated_at",e.date())});var Fc=e.object({data:e.list(ue),params:Ac});var Ic=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Kc=e.enum_(["days","billing_periods"]);var Lc=e.enum_(["active","inactive"]);var Gc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Nc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Xc=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Hc=e.enum_(["days","billing_periods"]);var Wc=e.enum_(["active","inactive"]);var Jc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var $c=e.object({data:M,params:e.record(e.string(),e.unknown())});var Zc=e.enum_(["active","inactive"]);var Yc=e.enum_(["active","inactive"]);var Qc=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Yc.optional()});var ep=e.object({data:j,params:Qc});var rp=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var op=e.object({data:j,params:rp});var tp=e.enum_(["plan_change","manual","plan_period_reset","expired"]);var ve=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",e.string()),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:I.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()),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",e.string().optional())});var ip=e.object({data:ve,params:e.record(e.string(),e.unknown())});var ap=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var sp=e.enum_(["days","billing_periods"]);var np=e.object({data:ve,params:e.record(e.string(),e.unknown())});var cp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var pp=e.enum_(["asc","desc"]);var lp=e.enum_(["asc","desc"]);var mp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var up=e.object({companyId:e.property("company_id",e.string().optional()),dir:lp.optional(),limit:e.number().optional(),offset:e.number().optional(),order:mp.optional()});var dp=e.object({data:e.list(ve),params:up});var hp=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 gp=e.object({data:j,params:hp});var wp=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 yp=e.object({data:e.list(ve),params:wp});var zp=e.enum_(["daily","weekly","monthly","raw"]);var Rp=e.enum_(["daily","weekly","monthly","raw"]);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()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Rp.optional(),startTime:e.property("start_time",e.string().optional())});var fp=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var _p=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 Sp=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var xp=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:fp.optional(),companyId:e.property("company_id",e.string()),credit:_p.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:Sp.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 Ep=e.object({data:e.list(xp),params:bp});var Up=e.enum_(["daily","weekly","monthly","raw"]);var Pp=e.enum_(["daily","weekly","monthly","raw"]);var Cp=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:Pp.optional(),startTime:e.property("start_time",e.string().optional())});var Tp=e.object({data:j,params:Cp});var vp=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 Re=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",e.string().optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",e.string().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",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().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",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Op=e.object({data:e.list(Re),params:vp});var Bp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var jp=e.enum_(["days","billing_periods"]);var kp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Dp=e.enum_(["days","billing_periods"]);var Vp=e.enum_(["monthly","yearly","daily","weekly"]);var qp=e.enum_(["billing_period","first_of_month"]);var Mp=e.enum_(["plan_period","no_reset"]);var Ap=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Fp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Ip=e.enum_(["days","billing_periods"]);var Kp=e.enum_(["monthly","yearly","daily","weekly"]);var Lp=e.enum_(["billing_period","first_of_month"]);var Gp=e.enum_(["plan_period","no_reset"]);var Np=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Xp=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Hp=e.object({data:M,params:Xp});var Wp=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 Jp=e.object({data:j,params:Wp});var dt=e.object({burnStrategy:e.property("burn_strategy",Tc.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",e.string().optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",vc.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 ht=e.object({burnStrategy:e.property("burn_strategy",jc.optional()),defaultExpiryUnit:e.property("default_expiry_unit",e.stringLiteral("days").optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",kc.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 gt=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",Ic.optional()),expiryUnit:e.property("expiry_unit",Kc.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:Lc.optional()});var wt=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",Xc.optional()),expiryUnit:e.property("expiry_unit",Hc.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:Wc.optional()});var yt=e.object({reason:tp.optional()});var zt=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",ap.optional()),expiryUnit:e.property("expiry_unit",sp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:e.string()});var Rt=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",e.stringLiteral("credit").optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",Bp.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",jp.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",kp.optional()),expiryUnit:e.property("expiry_unit",Dp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",Vp),resetStart:e.property("reset_start",qp),resetType:e.property("reset_type",Mp.optional())});var bt=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),creditAmount:e.property("credit_amount",e.number().optional()),expiryType:e.property("expiry_type",Fp.optional()),expiryUnit:e.property("expiry_unit",Ip.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Kp),resetStart:e.property("reset_start",Lp),resetType:e.property("reset_type",Gp.optional())});var $p=e.object({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()),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",e.string().optional())});var Zp=e.object({data:$p,params:e.record(e.string(),e.unknown())});var Mr=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.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",e.string()),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().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 $=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",e.string()),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Yp=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Ar=e.object({comparisonTrait:e.property("comparison_trait",$.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(Yp),ruleId:e.property("rule_id",e.string()),trait:$.optional(),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Qp=e.object({conditions:e.list(Ar),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 Fr=e.object({conditionGroups:e.property("condition_groups",e.list(Qp)),conditions:e.list(Ar),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 be=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:er.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.string()),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(Fr),updatedAt:e.property("updated_at",e.date())});var rr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var W=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",Mr.optional()),featureType:e.property("feature_type",e.string()),flags:e.list(be),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(rr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:$.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ee=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),description:e.string(),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Re).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",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",I.optional())});var Le=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",Q.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",Q.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",e.string()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var or=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()),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional())});var Ir=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 Kr=e.object({billingScheme:e.property("billing_scheme",e.string()),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(qr)),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",e.string())});var Oe=e.object({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(Ir),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",le.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",ce.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(Kr),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",e.string().optional())});var tr=e.object({createdAt:e.property("created_at",e.date()),definition:$.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 Lr=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var ir=e.object({createdAt:e.property("created_at",e.date()),definition:Lr.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Gr=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 Nr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var el=e.enum_(["bool","date","int","string"]);var rl=e.enum_(["user","company"]);var ft=e.object({comparableType:e.property("comparable_type",el),entityType:e.property("entity_type",rl),id:e.string()});var ol=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var tl=e.enum_(["all_time","current_day","current_month","current_week"]);var il=e.enum_(["first_of_month","billing_cycle"]);var al=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var Xr=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",ft.optional()),conditionType:e.property("condition_type",ol),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",tl.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",il.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:al,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",ft.optional()),traitValue:e.property("trait_value",e.string())});var sl=e.object({conditions:e.list(Xr)});var nl=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Hr=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(sl)),conditions:e.list(Xr),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",nl),value:e.boolean()});var K=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Oe.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Oe)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Gr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Nr),rules:e.list(Hr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var cl=e.enum_(["boolean","numeric","trait","unlimited"]);var pl=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 de=e.object({company:K.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:er.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(pl),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",$.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var ll=e.enum_(["free","plan","purchased"]);var Be=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",ll),quantity:e.number()});var ml=e.enum_(["free","plan","purchased"]);var je=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",e.string()),updatedAt:e.property("updated_at",e.date())});var ie=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:er.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",Q.optional()),meteredYearlyPrice:e.property("metered_yearly_price",Q.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:je.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",e.string().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",Qe.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",ze.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",$.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var ke=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",cl),companyOverride:e.property("company_override",de.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(Be).optional()),creditGrantReason:e.property("credit_grant_reason",ml.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()),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",e.string()),feature:W.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",Q.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:je.optional(),planEntitlement:e.property("plan_entitlement",ie.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var De=e.object({features:e.list(ke)});var ul=e.object({bundle:ue.optional(),quantity:e.number(),total:e.number()});var Ve=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(Ir),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",le.optional()),paymentMethod:e.property("payment_method",ce.optional()),products:e.list(Kr),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 dl=e.object({activeAddOns:e.property("active_add_ons",e.list(ee)),activePlan:e.property("active_plan",ee.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),availableCreditBundles:e.property("available_credit_bundles",e.list(ue)),company:K.optional(),featureUsage:e.property("feature_usage",De.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(ul)),selectedPlan:e.property("selected_plan",ee.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(Le)),subscription:Ve.optional()});var hl=e.object({data:dl,params:e.record(e.string(),e.unknown())});var gl=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var wl=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()),trialEnd:e.property("trial_end",e.date().optional()),upcomingInvoiceLineItems:e.property("upcoming_invoice_line_items",e.list(gl))});var Wr=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:wl.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(ke))});var yl=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var zl=e.object({company:K.optional(),success:e.boolean()});var Rl=e.object({data:zl,params:e.record(e.string(),e.unknown())});var bl=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Wr.optional())});var fl=e.object({data:bl,params:e.record(e.string(),e.unknown())});var _l=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var _t=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var St=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Sl=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 xl=e.object({data:e.list(K),params:Sl});var El=e.object({data:K,params:e.record(e.string(),e.unknown())});var Ul=e.object({data:K,params:e.record(e.string(),e.unknown())});var Pl=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var Cl=e.object({data:M,params:Pl});var Tl=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 vl=e.object({data:j,params:Tl});var Ol=e.enum_(["asc","desc"]);var Bl=e.enum_(["asc","desc"]);var jl=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",Bl.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var kl=e.object({data:j,params:jl});var Dl=e.object({data:K,params:e.record(e.string(),e.unknown())});var ar=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 Vl=e.object({data:ar,params:e.record(e.string(),e.unknown())});var ql=e.enum_(["asc","desc"]);var Ml=e.enum_(["asc","desc"]);var Al=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",Ml.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Fl=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(Be)),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 Il=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Fl.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",e.string()),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",Q.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",Q.optional())});var Kl=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Oe.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Oe)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Il)),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Gr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Nr),rules:e.list(Hr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Ll=e.object({data:e.list(Kl),params:Al});var Gl=e.object({keys:e.record(e.string(),e.string()).optional()});var Nl=e.object({data:K,params:Gl});var Xl=e.object({companyId:e.property("company_id",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var xt=e.record(e.string(),e.unknown());var Hl=e.object({billingFrequency:e.property("billing_frequency",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),description:e.string(),discountPercentage:e.property("discount_percentage",xt.optional()),id:e.string(),name:e.string(),price:e.number(),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",xt.optional()),updatedAt:e.property("updated_at",e.date())});var Wl=e.object({dealArr:e.property("deal_arr",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealMrr:e.property("deal_mrr",e.string()),dealName:e.property("deal_name",e.string().optional()),lineItems:e.property("line_items",e.list(Hl))});var Jl=e.object({data:e.list(Wl),params:Xl});var $l=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 sr=e.object({company:ar.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 Zl=e.object({data:e.list(sr),params:$l});var Yl=e.object({data:sr,params:e.record(e.string(),e.unknown())});var Ql=e.object({data:M,params:e.record(e.string(),e.unknown())});var em=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 rm=e.object({data:e.list(Ve),params:em});var om=e.object({data:K,params:e.record(e.string(),e.unknown())});var tm=e.enum_(["company","user"]);var im=e.enum_(["company","user"]);var am=e.object({entityType:e.property("entity_type",im.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var sm=e.object({data:e.list(Lr),params:am});var nm=e.enum_(["company","user"]);var cm=e.enum_(["company","user"]);var pm=e.object({entityType:e.property("entity_type",cm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var lm=e.object({data:j,params:pm});var mm=e.enum_(["company","user"]);var um=e.enum_(["boolean","currency","date","number","string","url"]);var dm=e.enum_(["company","user"]);var hm=e.enum_(["boolean","currency","date","number","string","url"]);var gm=e.object({entityType:e.property("entity_type",dm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",hm.optional())});var wm=e.object({data:e.list($),params:gm});var ym=e.enum_(["company","user"]);var zm=e.enum_(["boolean","currency","date","number","string","url"]);var Rm=e.object({data:$,params:e.record(e.string(),e.unknown())});var bm=e.object({data:$,params:e.record(e.string(),e.unknown())});var fm=e.enum_(["boolean","currency","date","number","string","url"]);var _m=e.object({data:$,params:e.record(e.string(),e.unknown())});var Sm=e.enum_(["company","user"]);var xm=e.enum_(["boolean","currency","date","number","string","url"]);var Em=e.enum_(["company","user"]);var Um=e.enum_(["boolean","currency","date","number","string","url"]);var Pm=e.object({entityType:e.property("entity_type",Em.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Um.optional())});var Cm=e.object({data:j,params:Pm});var Tm=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var vm=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var Om=e.object({data:e.list(vm),params:Tm});var Bm=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 jm=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","quickstart","subscription_change"]);var km=e.enum_(["app_user","api_key","system","temporary_access_token"]);var fr=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Dm=e.enum_(["fallback","initial","trait","trial_expiry"]);var Vm=e.enum_(["downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var qm=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",e.string()),value:e.string()});var Jr=e.object({action:jm,actorType:e.property("actor_type",km),addOnsAdded:e.property("add_ons_added",e.list(fr)),addOnsRemoved:e.property("add_ons_removed",e.list(fr)),apiKey:e.property("api_key",me.optional()),apiKeyRequest:e.property("api_key_request",kr.optional()),basePlan:e.property("base_plan",fr.optional()),basePlanAction:e.property("base_plan_action",Dm.optional()),company:ar.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",fr.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",Vm.optional()),traitsUpdated:e.property("traits_updated",e.list(qm)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Mm=e.object({data:e.list(Jr),params:Bm});var Am=e.object({data:Jr,params:e.record(e.string(),e.unknown())});var Fm=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 fe=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 Im=e.object({data:e.list(fe),params:Fm});var Km=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Lm=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Gm=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Nm=e.object({data:M,params:e.record(e.string(),e.unknown())});var Xm=e.object({data:e.list(fe),params:e.record(e.string(),e.unknown())});var Hm=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 Wm=e.object({data:j,params:Hm});var he=e.object({companyMemberships:e.property("company_memberships",e.list(sr)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),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 Jm=e.object({data:he,params:e.record(e.string(),e.unknown())});var $m=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 Zm=e.object({data:e.list(he),params:$m});var Ym=e.object({data:he,params:e.record(e.string(),e.unknown())});var Qm=e.object({data:he,params:e.record(e.string(),e.unknown())});var eu=e.object({data:M,params:e.record(e.string(),e.unknown())});var ru=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 ou=e.object({data:j,params:ru});var tu=e.object({data:he,params:e.record(e.string(),e.unknown())});var $r=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 iu=e.object({data:$r,params:e.record(e.string(),e.unknown())});var au=e.object({keys:e.record(e.string(),e.string()).optional()});var su=e.object({data:he,params:au});var Et=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Ut=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",ym),hierarchy:e.list(e.string()),traitType:e.property("trait_type",zm)});var Pt=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",fm)});var Ct=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Tt=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var nu=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var vt=e.object({planId:e.property("plan_id",e.string()),traits:e.list(nu)});var cu=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 pu=e.object({data:e.list(de),params:cu});var lu=e.enum_(["all_time","current_month","current_week","current_day"]);var mu=e.enum_(["first_of_month","billing_cycle"]);var uu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var du=e.object({data:de,params:e.record(e.string(),e.unknown())});var hu=e.object({data:de,params:e.record(e.string(),e.unknown())});var gu=e.enum_(["all_time","current_month","current_week","current_day"]);var wu=e.enum_(["first_of_month","billing_cycle"]);var yu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var zu=e.object({data:de,params:e.record(e.string(),e.unknown())});var Ru=e.object({data:M,params:e.record(e.string(),e.unknown())});var bu=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 fu=e.object({data:j,params:bu});var _u=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Su=e.enum_(["boolean","numeric","trait","unlimited"]);var xu=e.enum_(["free","plan","purchased"]);var Eu=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(Be).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())});var Uu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Su),company:K.optional(),companyOverride:e.property("company_override",de.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(Be).optional()),creditGrantReason:e.property("credit_grant_reason",xu.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",Eu.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",e.string()),feature:W.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",Q.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:je.optional(),planEntitlement:e.property("plan_entitlement",ie.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var Pu=e.object({data:e.list(Uu),params:_u});var Cu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Tu=e.object({data:j,params:Cu});var vu=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()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var Ou=e.object({data:e.list(ke),params:vu});var Bu=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()),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:j,params:Bu});var ku=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Du=e.enum_(["boolean","numeric","trait","unlimited","unknown"]);var Vu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Du),company:K.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:je.optional(),usage:e.number().optional(),user:$r.optional()});var qu=e.object({data:e.list(Vu),params:ku});var Mu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Au=e.object({data:j,params:Mu});var Fu=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(ie),params:Fu});var Ku=e.enum_(["all_time","current_month","current_week","current_day"]);var Lu=e.enum_(["first_of_month","billing_cycle"]);var Gu=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Nu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Xu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Hu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Wu=e.enum_(["all_time","current_month","current_week","current_day"]);var Ju=e.enum_(["first_of_month","billing_cycle"]);var $u=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Zu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Yu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Qu=e.object({data:M,params:e.record(e.string(),e.unknown())});var ed=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var rd=e.object({data:j,params:ed});var od=e.object({keys:e.record(e.string(),e.string()).optional()});var td=e.object({data:De,params:od});var Ot=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",lu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",mu.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",uu)});var Bt=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",gu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",wu.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",yu)});var ge=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 jt=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",Ku.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Lu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).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",Gu.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",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",Nu),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var kt=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",Wu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Ju.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).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",$u.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",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",Zu),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var id=e.object({data:K,params:e.record(e.string(),e.unknown())});var ad=e.enum_(["plan","add_on"]);var sd=e.enum_(["plan","add_on"]);var nd=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",sd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var cd=e.object({data:e.list(ee),params:nd});var pd=e.enum_(["plan","add_on"]);var ld=e.object({data:ee,params:e.record(e.string(),e.unknown())});var md=e.object({data:ee,params:e.record(e.string(),e.unknown())});var ud=e.object({data:ee,params:e.record(e.string(),e.unknown())});var dd=e.object({data:M,params:e.record(e.string(),e.unknown())});var hd=e.enum_(["one_time","recurring","free"]);var gd=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",e.string()),controlledBy:e.property("controlled_by",e.string()),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:gd,params:e.record(e.string(),e.unknown())});var yd=e.enum_(["plan","add_on"]);var zd=e.enum_(["plan","add_on"]);var Rd=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",zd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var bd=e.object({data:j,params:Rd});var fd=e.object({planId:e.property("plan_id",e.string().optional())});var _d=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var Sd=e.object({data:e.list(_d),params:fd});var Dt=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Vt=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",pd)});var qt=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Mt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",hd),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 xd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var we=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:e.string(),type:e.string(),updatedAt:e.property("updated_at",e.date())});var Ed=e.object({data:e.list(we),params:xd});var Ud=e.enum_(["entitlement","billing"]);var Pd=e.object({data:we,params:e.record(e.string(),e.unknown())});var Cd=e.object({data:we,params:e.record(e.string(),e.unknown())});var Td=e.enum_(["entitlement","billing"]);var vd=e.enum_(["draft","live"]);var Od=e.object({data:we,params:e.record(e.string(),e.unknown())});var Bd=e.object({data:M,params:e.record(e.string(),e.unknown())});var jd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var kd=e.object({data:j,params:jd});var Dd=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var nr=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 Vd=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",e.string().optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",e.string().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",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().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",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string()),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var cr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),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",e.string()),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",nr.optional()),description:e.string(),entitlements:e.list(ie),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Vd)),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",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(ke)),valid:e.boolean(),yearlyPrice:e.property("yearly_price",I.optional())});var qe=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Zr=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var Yr=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 _r=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),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()),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()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var Qr=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),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",e.string()),expiryUnit:e.property("expiry_unit",e.string()),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:_r.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",_r.optional()),updatedAt:e.property("updated_at",e.date())});var eo=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()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",e.string()),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:_r.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()),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",e.string().optional())});var ro=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 qd=e.object({activeAddOns:e.property("active_add_ons",e.list(cr)),activePlans:e.property("active_plans",e.list(cr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe)),capabilities:Zr.optional(),checkoutSettings:e.property("checkout_settings",Yr),company:K.optional(),component:we.optional(),creditBundles:e.property("credit_bundles",e.list(Qr)),creditGrants:e.property("credit_grants",e.list(eo)),defaultPlan:e.property("default_plan",ee.optional()),featureUsage:e.property("feature_usage",De.optional()),invoices:e.list(le),postTrialPlan:e.property("post_trial_plan",ee.optional()),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",ro.optional()),subscription:Ve.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var Md=e.object({data:qd,params:Dd});var At=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Ud),name:e.string()});var Ft=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Td.optional()),name:e.string().optional(),state:vd.optional()});var oo=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),dealId:e.property("deal_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ad=e.object({data:oo,params:e.record(e.string(),e.unknown())});var Fd=e.object({data:oo,params:e.record(e.string(),e.unknown())});var Id=e.object({accountId:e.property("account_id",e.string()),arr:e.string(),companyExternalId:e.property("company_external_id",e.string().optional()),createdAt:e.property("created_at",e.date()),dealExternalId:e.property("deal_external_id",e.string()),dealId:e.property("deal_id",e.string()),environmentId:e.property("environment_id",e.string()),mrr:e.string(),name:e.string().optional(),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Kd=e.object({data:Id,params:e.record(e.string(),e.unknown())});var Ld=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var to=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),name:e.string(),price:e.string(),productId:e.property("product_id",e.string()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var Gd=e.object({data:e.list(to),params:Ld});var Nd=e.object({data:to,params:e.record(e.string(),e.unknown())});var It=e.object({dealExternalId:e.property("deal_external_id",e.string()),lineItemExternalId:e.property("line_item_external_id",e.string())});var Kt=e.object({amount:e.string(),discountPercentage:e.property("discount_percentage",e.string().optional()),interval:e.string(),lineItemExternalId:e.property("line_item_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",e.string().optional())});var Lt=e.object({arr:e.string().optional(),crmCompanyId:e.property("crm_company_id",e.string().optional()),crmCompanyKey:e.property("crm_company_key",e.string()),crmProductId:e.property("crm_product_id",e.string().optional()),crmType:e.property("crm_type",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealName:e.property("deal_name",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),mrr:e.string().optional()});var Gt=e.object({currency:e.string(),description:e.string(),externalId:e.property("external_id",e.string()),interval:e.string(),name:e.string(),price:e.string(),quantity:e.number(),sku:e.string()});var Xd=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",e.string()),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",e.string()),status:e.string(),updatedAt:e.property("updated_at",e.date())});var Hd=e.object({data:Xd,params:e.record(e.string(),e.unknown())});var Nt=e.object({metadata:e.string()});var io=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 Wd=e.object({events:e.list(io)});var Jd=e.object({data:Wd,params:e.record(e.string(),e.unknown())});var $d=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 Zd=e.object({data:e.list(Mr),params:$d});var Xt=e.enum_(["identify","track","flag_check"]);var Yd=e.enum_(["identify","track","flag_check"]);var Qd=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(Yd).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 ao=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:rr.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(rr),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:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),user:rr.optional(),userId:e.property("user_id",e.string().optional())});var eh=e.object({data:e.list(ao),params:Qd});var rh=e.object({data:io,params:e.record(e.string(),e.unknown())});var oh=e.object({data:ao,params:e.record(e.string(),e.unknown())});var th=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var ih=e.object({data:th,params:e.record(e.string(),e.unknown())});var ah=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 sh=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 nh=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var ch=e.object({company:nh.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var ph=e.undiscriminatedUnion([ah,sh,ch]);var lh=e.enum_(["identify","track","flag_check"]);var so=e.object({body:ph.optional(),eventType:e.property("event_type",lh),sentAt:e.property("sent_at",e.date().optional())});var Ht=e.object({events:e.list(so)});var mh=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).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 uh=e.object({data:e.list(W),params:mh});var dh=e.enum_(["boolean","event","trait"]);var hh=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var gh=e.object({data:W,params:e.record(e.string(),e.unknown())});var wh=e.object({data:W,params:e.record(e.string(),e.unknown())});var yh=e.enum_(["boolean","event","trait"]);var zh=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Rh=e.object({data:W,params:e.record(e.string(),e.unknown())});var bh=e.object({data:M,params:e.record(e.string(),e.unknown())});var fh=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).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 _h=e.object({data:j,params:fh});var Sh=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 xh=e.object({data:e.list(be),params:Sh});var Eh=e.object({data:be,params:e.record(e.string(),e.unknown())});var Uh=e.object({data:be,params:e.record(e.string(),e.unknown())});var Ph=e.object({data:be,params:e.record(e.string(),e.unknown())});var Ch=e.object({data:M,params:e.record(e.string(),e.unknown())});var Th=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",e.string()),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 vh=e.object({flag:Th.optional(),rules:e.list(Fr)});var Oh=e.object({data:vh,params:e.record(e.string(),e.unknown())});var no=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 Bh=e.object({data:no,params:e.record(e.string(),e.unknown())});var jh=e.object({flags:e.list(no)});var kh=e.object({data:jh,params:e.record(e.string(),e.unknown())});var Dh=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 Vh=e.object({data:j,params:Dh});var co=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",e.stringLiteral("boolean")),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Wt=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",dh),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",hh.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 Jt=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",yh.optional()),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",zh.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 qh=e.enum_(["company","metric","trait","user","plan","billing_product","crm_product","base_plan"]);var Mh=e.enum_(["all_time","current_month","current_week","current_day"]);var Ah=e.enum_(["first_of_month","billing_cycle"]);var Fh=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var pr=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",qh),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",Mh.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Ah.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Fh,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 po=e.object({conditions:e.list(pr),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Ih=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var Kh=e.object({conditionGroups:e.property("condition_groups",e.list(po)),conditions:e.list(pr),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Ih.optional()),value:e.boolean()});var $t=e.object({rules:e.list(Kh)});var lo=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 Ge=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",lo.optional()),description:e.string(),entitlements:e.list(ie),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Re).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",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",I.optional())});var mo=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var Lh=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Zt=e.object({entitlements:e.list(Lh).optional(),planId:e.property("plan_id",e.string())});var lr=e.object({bundleId:e.string()});var Gh=e.object({addOns:e.property("add_ons",e.list(Ge)),checkoutSettings:e.property("checkout_settings",mo),customPlanConfig:e.property("custom_plan_config",lo.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",Ge.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",Ge.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",Ge.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",I.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Zt)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlanList:e.property("ordered_plan_list",e.list(Zt)),plans:e.list(Ge),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",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()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlan:e.property("trial_expiry_plan",Ge.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",I.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Nh=e.object({data:Gh,params:e.record(e.string(),e.unknown())});var Xh=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Hh=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var Ue=e.object({entitlements:e.list(Hh).optional(),planId:e.property("plan_id",e.string())});var uo=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Xh)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",mo),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(Ue)),planIds:e.property("plan_ids",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",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()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",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 Wh=e.object({data:uo,params:e.record(e.string(),e.unknown())});var Jh=e.object({data:uo,params:e.record(e.string(),e.unknown())});var Yt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe).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",nr.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(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",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()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",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 Qt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe).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",nr.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(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",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()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",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 $h=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",e.string()),token:e.string(),updatedAt:e.property("updated_at",e.date())});var Zh=e.object({data:$h,params:e.record(e.string(),e.unknown())});var ei=e.object({lookup:e.record(e.string(),e.string()),resource_type:e.string()});var Yh=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 mr=e.object({creditId:e.property("credit_id",e.string())});var ur=e.object({featureId:e.property("feature_id",e.string())});var _e=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(e.string())),secret:e.string(),status:e.string(),updatedAt:e.property("updated_at",e.date()),url:e.string()});var ho=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhook:_e.optional(),webhookId:e.property("webhook_id",e.string())});var Qh=e.object({data:e.list(ho),params:Yh});var eg=e.object({data:ho,params:e.record(e.string(),e.unknown())});var rg=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 og=e.object({data:j,params:rg});var tg=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ig=e.object({data:e.list(_e),params:tg});var ag=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached","company.plan_change"]);var sg=e.object({data:_e,params:e.record(e.string(),e.unknown())});var ng=e.object({data:_e,params:e.record(e.string(),e.unknown())});var cg=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached","company.plan_change"]);var pg=e.enum_(["active","inactive"]);var lg=e.object({data:_e,params:e.record(e.string(),e.unknown())});var mg=e.object({data:M,params:e.record(e.string(),e.unknown())});var ug=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var dg=e.object({data:j,params:ug});var ri=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(ag)),url:e.string()});var oi=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(cg).optional()),status:pg.optional(),url:e.string().optional()});var a=e.object({error:e.string()});var go=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var dr=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var hr=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var ti=e.object({addOnIds:e.property("add_on_ids",e.list(go)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(hr)),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 iie=e.object({addOnIds:e.property("add_on_ids",e.list(go)),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(hr)),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 ii=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var nie=e.object({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 Sie=e.object({activeAddOns:e.property("active_add_ons",e.list(cr)),activePlans:e.property("active_plans",e.list(cr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe)),capabilities:Zr.optional(),checkoutSettings:e.property("checkout_settings",Yr),company:K.optional(),component:we.optional(),creditBundles:e.property("credit_bundles",e.list(Qr)),creditGrants:e.property("credit_grants",e.list(eo)),defaultPlan:e.property("default_plan",ee.optional()),featureUsage:e.property("feature_usage",De.optional()),postTrialPlan:e.property("post_trial_plan",ee.optional()),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",ro.optional()),subscription:Ve.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var Eie=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),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 hg=e.enum_(["all_time","current_month","current_week","current_day"]);var gg=e.enum_(["first_of_month","billing_cycle"]);var wg=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var jie=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",hg.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",gg.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",wg)});var ai=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",e.stringLiteral("boolean")),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var yg=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var zg=e.enum_(["days","billing_periods"]);var Rg=e.enum_(["monthly","yearly","daily","weekly"]);var bg=e.enum_(["billing_period","first_of_month"]);var fg=e.enum_(["plan_period","no_reset"]);var Xie=e.object({expiryType:e.property("expiry_type",yg.optional()),expiryUnit:e.property("expiry_unit",zg.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Rg),resetStart:e.property("reset_start",bg),resetType:e.property("reset_type",fg.optional())});var Wie=e.object({createdAt:e.property("created_at",e.date()),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),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.object({createdAt:e.property("created_at",e.date()),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 Yie=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()),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())),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:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional())});var eae=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()),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 si=e.object({keys:e.record(e.string(),e.string())});var _g=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var ni=e.object({addOnSelections:e.property("add_on_selections",e.list(_g)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_id",e.string().optional()),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(hr)),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional())});var cae=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string())});var lae=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()),paymentMethodType:e.property("payment_method_type",e.string())});var uae=e.object({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 hae=e.object({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())),ruleId:e.property("rule_id",e.string()),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var wae=e.object({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 zae=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",e.string()),updatedAt:e.property("updated_at",e.date())});var Sg=e.enum_(["all_time","current_month","current_week","current_day"]);var xg=e.enum_(["first_of_month","billing_cycle"]);var Eg=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Uae=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),metricPeriod:e.property("metric_period",Sg.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",xg.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",Eg)});var vae=e.object({conditionGroups:e.property("condition_groups",e.list(po)),conditions:e.list(pr),name:e.string(),priority:e.number(),value:e.boolean()});var ci=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 pi=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 li=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 Dae=e.object({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 Ug=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Fae=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string().optional(),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).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",Ug.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Kae=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhookId:e.property("webhook_id",e.string())});var wo=class{constructor(t={}){this._options=t}listApiKeys(t,o){return b.fromPromise(this.__listApiKeys(t,o))}async __listApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:tn.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createApiKey(t,o){return b.fromPromise(this.__createApiKey(t,o))}async __createApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:rt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:sn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /api-keys.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getApiKey(t,o){return b.fromPromise(this.__getApiKey(t,o))}async __getApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:nn.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateApiKey(t,o={},r){return b.fromPromise(this.__updateApiKey(t,o,r))}async __updateApiKey(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ot.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:cn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /api-keys/{api_key_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteApiKey(t,o){return b.fromPromise(this.__deleteApiKey(t,o))}async __deleteApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiKeys(t,o){return b.fromPromise(this.__countApiKeys(t,o))}async __countApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:mn.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listApiRequests(t={},o){return b.fromPromise(this.__listApiRequests(t,o))}async __listApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:dn.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getApiRequest(t,o){return b.fromPromise(this.__getApiRequest(t,o))}async __getApiRequest(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-requests/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests/{api_request_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiRequests(t={},o){return b.fromPromise(this.__countApiRequests(t,o))}async __countApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:yn.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEnvironments(t={},o){return b.fromPromise(this.__listEnvironments(t,o))}async __listEnvironments(t={},o){let{ids:r,limit:i,offset:m}=t,g={};r!=null&&(Array.isArray(r)?g.ids=r.map(s=>s):g.ids=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Rn.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /environments.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createEnvironment(t,o){return b.fromPromise(this.__createEnvironment(t,o))}async __createEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:_n.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /environments.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEnvironment(t,o){return b.fromPromise(this.__getEnvironment(t,o))}async __getEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sn.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEnvironment(t,o={},r){return b.fromPromise(this.__updateEnvironment(t,o,r))}async __updateEnvironment(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:it.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:En.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /environments/{environment_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteEnvironment(t,o){return b.fromPromise(this.__deleteEnvironment(t,o))}async __deleteEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}quickstart(t){return b.fromPromise(this.__quickstart(t))}async __quickstart(t){let o=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"quickstart"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:Cn.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 P(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /quickstart.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var X=H(require("url-join"));var yo=class{constructor(t={}){this._options=t}listCoupons(t={},o){return b.fromPromise(this.__listCoupons(t,o))}async __listCoupons(t={},o){let{isActive:r,q:i,limit:m,offset:g}=t,p={};r!=null&&(p.is_active=r.toString()),i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:vn.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/coupons.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertBillingCoupon(t,o){return b.fromPromise(this.__upsertBillingCoupon(t,o))}async __upsertBillingCoupon(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:at.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:On.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/coupons.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingCustomer(t,o){return b.fromPromise(this.__upsertBillingCustomer(t,o))}async __upsertBillingCustomer(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customer/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:st.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:jn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/customer/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCustomersWithSubscriptions(t={},o){return b.fromPromise(this.__listCustomersWithSubscriptions(t,o))}async __listCustomersWithSubscriptions(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(z=>z):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:qn.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/customers.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countCustomers(t={},o){return b.fromPromise(this.__countCustomers(t,o))}async __countCustomers(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(z=>z):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:An.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/customers/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}listInvoices(t,o){return b.fromPromise(this.__listInvoices(t,o))}async __listInvoices(t,o){let{companyId:r,customerExternalId:i,subscriptionExternalId:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),s.customer_external_id=i,s.subscription_external_id=m,g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:In.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/invoices.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}upsertInvoice(t,o){return b.fromPromise(this.__upsertInvoice(t,o))}async __upsertInvoice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/invoices.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMeters(t={},o){return b.fromPromise(this.__listMeters(t,o))}async __listMeters(t={},o){let{displayName:r,limit:i,offset:m}=t,g={};r!=null&&(g.display_name=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Gn.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/meter.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}upsertBillingMeter(t,o){return b.fromPromise(this.__upsertBillingMeter(t,o))}async __upsertBillingMeter(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Nn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/meter/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaymentMethods(t,o){return b.fromPromise(this.__listPaymentMethods(t,o))}async __listPaymentMethods(t,o){let{companyId:r,customerExternalId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),p.customer_external_id=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Hn.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/payment-methods.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertPaymentMethod(t,o){return b.fromPromise(this.__upsertPaymentMethod(t,o))}async __upsertPaymentMethod(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/payment-methods.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchBillingPrices(t={},o){return b.fromPromise(this.__searchBillingPrices(t,o))}async __searchBillingPrices(t={},o){let{forInitialPlan:r,forTrialExpiryPlan:i,ids:m,productId:g,interval:p,price:s,q:l,requiresPaymentMethod:u,tiersMode:z,usageType:y,limit:C,offset:O}=t,T={};r!=null&&(T.for_initial_plan=r.toString()),i!=null&&(T.for_trial_expiry_plan=i.toString()),m!=null&&(Array.isArray(m)?T.ids=m.map(q=>q):T.ids=m),g!=null&&(T.product_id=g),p!=null&&(T.interval=p),s!=null&&(T.price=s.toString()),l!=null&&(T.q=l),u!=null&&(T.requires_payment_method=u.toString()),z!=null&&(T.tiers_mode=Jn.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})),y!=null&&(T.usage_type=$n.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),C!=null&&(T.limit=C.toString()),O!=null&&(T.offset=O.toString());let V=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(V.ok)return{data:ec.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 P(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 401:throw new S(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 403:throw new x(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 404:throw new E(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 500:throw new U(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);default:throw new c({statusCode:V.error.statusCode,body:V.error.body,rawResponse:V.rawResponse})}switch(V.error.reason){case"non-json":throw new c({statusCode:V.error.statusCode,body:V.error.rawBody,rawResponse:V.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/price.");case"unknown":throw new c({message:V.error.errorMessage,rawResponse:V.rawResponse})}}upsertBillingPrice(t,o){return b.fromPromise(this.__upsertBillingPrice(t,o))}async __upsertBillingPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/price/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBillingProduct(t,o){return b.fromPromise(this.__deleteBillingProduct(t,o))}async __deleteBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/product/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listProductPrices(t={},o){return b.fromPromise(this.__listProductPrices(t,o))}async __listProductPrices(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=sc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/prices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:pc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/product/prices.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}deleteProductPrice(t,o){return b.fromPromise(this.__deleteProductPrice(t,o))}async __deleteProductPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/prices/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/product/prices/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProduct(t,o){return b.fromPromise(this.__upsertBillingProduct(t,o))}async __upsertBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:mt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/product/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingProducts(t={},o){return b.fromPromise(this.__listBillingProducts(t,o))}async __listBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=uc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:gc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/products.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}countBillingProducts(t={},o){return b.fromPromise(this.__countBillingProducts(t,o))}async __countBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=wc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:Rc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/products/count.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}upsertBillingSubscription(t,o){return b.fromPromise(this.__upsertBillingSubscription(t,o))}async __upsertBillingSubscription(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/subscription/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ut.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/subscription/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var G=H(require("url-join"));var zo=class{constructor(t={}){this._options=t}listBillingCredits(t={},o){return b.fromPromise(this.__listBillingCredits(t,o))}async __listBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Cc.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createBillingCredit(t,o){return b.fromPromise(this.__createBillingCredit(t,o))}async __createBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:dt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSingleBillingCredit(t,o){return b.fromPromise(this.__getSingleBillingCredit(t,o))}async __getSingleBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Bc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/{credit_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateBillingCredit(t,o,r){return b.fromPromise(this.__updateBillingCredit(t,o,r))}async __updateBillingCredit(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ht.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Dc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/{credit_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}softDeleteBillingCredit(t,o){return b.fromPromise(this.__softDeleteBillingCredit(t,o))}async __softDeleteBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/{credit_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCreditBundles(t={},o){return b.fromPromise(this.__listCreditBundles(t,o))}async __listCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=qc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Fc.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createCreditBundle(t,o){return b.fromPromise(this.__createCreditBundle(t,o))}async __createCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:gt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/bundles.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCreditBundle(t,o){return b.fromPromise(this.__getCreditBundle(t,o))}async __getCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCreditBundleDetails(t,o,r){return b.fromPromise(this.__updateCreditBundleDetails(t,o,r))}async __updateCreditBundleDetails(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:wt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Jc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCreditBundle(t,o){return b.fromPromise(this.__deleteCreditBundle(t,o))}async __deleteCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCreditBundles(t={},o){return b.fromPromise(this.__countCreditBundles(t,o))}async __countCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=Zc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:ep.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countBillingCredits(t={},o){return b.fromPromise(this.__countBillingCredits(t,o))}async __countBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:op.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}zeroOutGrant(t,o={},r){return b.fromPromise(this.__zeroOutGrant(t,o,r))}async __zeroOutGrant(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/grants/${encodeURIComponent(t)}/zero-out`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:yt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ip.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/grants/{grant_id}/zero-out.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}grantBillingCreditsToCompany(t,o){return b.fromPromise(this.__grantBillingCreditsToCompany(t,o))}async __grantBillingCreditsToCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/grants/company.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompanyGrants(t={},o){return b.fromPromise(this.__listCompanyGrants(t,o))}async __listCompanyGrants(t={},o){let{companyId:r,order:i,dir:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),i!=null&&(s.order=cp.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"})),m!=null&&(s.dir=pp.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:dp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/company/list.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countBillingCreditsGrants(t={},o){return b.fromPromise(this.__countBillingCreditsGrants(t,o))}async __countBillingCreditsGrants(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:gp.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listGrantsForCredit(t={},o){return b.fromPromise(this.__listGrantsForCredit(t,o))}async __listGrantsForCredit(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:yp.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/list.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getEnrichedCreditLedger(t,o){return b.fromPromise(this.__getEnrichedCreditLedger(t,o))}async __getEnrichedCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,z={};z.company_id=r,i!=null&&(z.billing_credit_id=i),m!=null&&(z.feature_id=m),z.period=zp.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(z.start_time=p),s!=null&&(z.end_time=s),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Ep.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 P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/ledger.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCreditLedger(t,o){return b.fromPromise(this.__countCreditLedger(t,o))}async __countCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,z={};z.company_id=r,i!=null&&(z.billing_credit_id=i),m!=null&&(z.feature_id=m),z.period=Up.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(z.start_time=p),s!=null&&(z.end_time=s),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Tp.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/ledger/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__listBillingPlanCreditGrants(t,o))}async __listBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(z=>z):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(z=>z):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Op.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/plan-grants.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createBillingPlanCreditGrant(t,o){return b.fromPromise(this.__createBillingPlanCreditGrant(t,o))}async __createBillingPlanCreditGrant(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Rt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/plan-grants.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateBillingPlanCreditGrant(t,o,r){return b.fromPromise(this.__updateBillingPlanCreditGrant(t,o,r))}async __updateBillingPlanCreditGrant(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/plan-grants/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:bt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Np.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/plan-grants/{plan_grant_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteBillingPlanCreditGrant(t,o={},r){return b.fromPromise(this.__deleteBillingPlanCreditGrant(t,o,r))}async __deleteBillingPlanCreditGrant(t,o={},r){let{applyToExisting:i}=o,m={};i!=null&&(m.apply_to_existing=i.toString());let g=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/plan-grants/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(g.ok)return{data:Hp.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 P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new S(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new U(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new c({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/plan-grants/{plan_grant_id}.");case"unknown":throw new c({message:g.error.errorMessage,rawResponse:g.rawResponse})}}countBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__countBillingPlanCreditGrants(t,o))}async __countBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(z=>z):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(z=>z):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Jp.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/plan-grants/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Ne=H(require("url-join"));var Ro=class{constructor(t={}){this._options=t}internal(t,o){return b.fromPromise(this.__internal(t,o))}async __internal(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCheckoutData(t,o){return b.fromPromise(this.__getCheckoutData(t,o))}async __getCheckoutData(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/data"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal/data.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewCheckoutInternal(t,o){return b.fromPromise(this.__previewCheckoutInternal(t,o))}async __previewCheckoutInternal(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}managePlan(t,o){return b.fromPromise(this.__managePlan(t,o))}async __managePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /manage-plan.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewManagePlan(t,o){return b.fromPromise(this.__previewManagePlan(t,o))}async __previewManagePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /manage-plan/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCustomerSubscriptionTrialEnd(t,o={},r){return b.fromPromise(this.__updateCustomerSubscriptionTrialEnd(t,o,r))}async __updateCustomerSubscriptionTrialEnd(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`subscription/${encodeURIComponent(t)}/edit-trial-end`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:St.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:_l.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /subscription/{subscription_id}/edit-trial-end.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var D=H(require("url-join"));var bo=class{constructor(t={}){this._options=t}listCompanies(t={},o){return b.fromPromise(this.__listCompanies(t,o))}async __listCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.plan_id=i),m!=null&&(z.q=m),g!=null&&(z.without_feature_override_for=g),p!=null&&(z.without_plan=p.toString()),s!=null&&(z.with_subscription=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:xl.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 P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}upsertCompany(t,o){return b.fromPromise(this.__upsertCompany(t,o))}async __upsertCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompany(t,o){return b.fromPromise(this.__getCompany(t,o))}async __getCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/{company_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompany(t,o={},r){return b.fromPromise(this.__deleteCompany(t,o,r))}async __deleteCompany(t,o={},r){let{cancelSubscription:i,prorate:m}=o,g={};i!=null&&(g.cancel_subscription=i.toString()),m!=null&&(g.prorate=m.toString());let p=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(p.ok)return{data:Cl.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /companies/{company_id}.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}countCompanies(t={},o){return b.fromPromise(this.__countCompanies(t,o))}async __countCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.plan_id=i),m!=null&&(z.q=m),g!=null&&(z.without_feature_override_for=g),p!=null&&(z.without_plan=p.toString()),s!=null&&(z.with_subscription=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:vl.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 P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__countCompaniesForAdvancedFilter(t,o))}async __countCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:V,offset:q}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),z!=null&&(v.without_plan=z.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=Ol.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),V!=null&&(v.limit=V.toString()),q!=null&&(v.offset=q.toString());let B=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(B.ok)return{data:kl.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 P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/count2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createCompany(t,o){return b.fromPromise(this.__createCompany(t,o))}async __createCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyByKeys(t,o){return b.fromPromise(this.__deleteCompanyByKeys(t,o))}async __deleteCompanyByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__listCompaniesForAdvancedFilter(t,o))}async __listCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:V,offset:q}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),z!=null&&(v.without_plan=z.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=ql.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),V!=null&&(v.limit=V.toString()),q!=null&&(v.offset=q.toString());let B=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/list2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/list2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}lookupCompany(t,o){return b.fromPromise(this.__lookupCompany(t,o))}async __lookupCompany(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:Nl.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}getActiveDeals(t,o){return b.fromPromise(this.__getActiveDeals(t,o))}async __getActiveDeals(t,o){let{companyId:r,dealStage:i,limit:m,offset:g}=t,p={};p.company_id=r,p.deal_stage=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-crm-deals"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Jl.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-crm-deals.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listCompanyMemberships(t={},o){return b.fromPromise(this.__listCompanyMemberships(t,o))}async __listCompanyMemberships(t={},o){let{companyId:r,userId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(p.user_id=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Zl.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-memberships.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getOrCreateCompanyMembership(t,o){return b.fromPromise(this.__getOrCreateCompanyMembership(t,o))}async __getOrCreateCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-memberships.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyMembership(t,o){return b.fromPromise(this.__deleteCompanyMembership(t,o))}async __deleteCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-memberships/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /company-memberships/{company_membership_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getActiveCompanySubscription(t={},o){return b.fromPromise(this.__getActiveCompanySubscription(t,o))}async __getActiveCompanySubscription(t={},o){let{companyId:r,companyIds:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(Array.isArray(i)?p.company_ids=i.map(l=>l):p.company_ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-subscriptions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:rm.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-subscriptions.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCompanyTrait(t,o){return b.fromPromise(this.__upsertCompanyTrait(t,o))}async __upsertCompanyTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:om.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEntityKeyDefinitions(t={},o){return b.fromPromise(this.__listEntityKeyDefinitions(t,o))}async __listEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=tm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:sm.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-key-definitions.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countEntityKeyDefinitions(t={},o){return b.fromPromise(this.__countEntityKeyDefinitions(t,o))}async __countEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=nm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:lm.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-key-definitions/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEntityTraitDefinitions(t={},o){return b.fromPromise(this.__listEntityTraitDefinitions(t,o))}async __listEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=mm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=um.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:wm.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getOrCreateEntityTraitDefinition(t,o){return b.fromPromise(this.__getOrCreateEntityTraitDefinition(t,o))}async __getOrCreateEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ut.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Rm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /entity-trait-definitions.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEntityTraitDefinition(t,o){return b.fromPromise(this.__getEntityTraitDefinition(t,o))}async __getEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEntityTraitDefinition(t,o,r){return b.fromPromise(this.__updateEntityTraitDefinition(t,o,r))}async __updateEntityTraitDefinition(t,o,r){let i=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Pt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:_m.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countEntityTraitDefinitions(t={},o){return b.fromPromise(this.__countEntityTraitDefinitions(t,o))}async __countEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=Sm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=xm.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Cm.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getEntityTraitValues(t,o){return b.fromPromise(this.__getEntityTraitValues(t,o))}async __getEntityTraitValues(t,o){let{definitionId:r,q:i,limit:m,offset:g}=t,p={};p.definition_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-values"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Om.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-values.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanChanges(t={},o){return b.fromPromise(this.__listPlanChanges(t,o))}async __listPlanChanges(t={},o){let{action:r,basePlanAction:i,companyId:m,companyIds:g,planIds:p,limit:s,offset:l}=t,u={};r!=null&&(u.action=r),i!=null&&(u.base_plan_action=i),m!=null&&(u.company_id=m),g!=null&&(Array.isArray(g)?u.company_ids=g.map(y=>y):u.company_ids=g),p!=null&&(Array.isArray(p)?u.plan_ids=p.map(y=>y):u.plan_ids=p),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-changes"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:Mm.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-changes.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}getPlanChange(t,o){return b.fromPromise(this.__getPlanChange(t,o))}async __getPlanChange(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-changes/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Am.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-changes/{plan_change_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPlanTraits(t={},o){return b.fromPromise(this.__listPlanTraits(t,o))}async __listPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(z=>z):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Im.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createPlanTrait(t,o){return b.fromPromise(this.__createPlanTrait(t,o))}async __createPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Km.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanTrait(t,o){return b.fromPromise(this.__getPlanTrait(t,o))}async __getPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Lm.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTrait(t,o,r){return b.fromPromise(this.__updatePlanTrait(t,o,r))}async __updatePlanTrait(t,o,r){let i=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Gm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanTrait(t,o){return b.fromPromise(this.__deletePlanTrait(t,o))}async __deletePlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTraitsBulk(t,o){return b.fromPromise(this.__updatePlanTraitsBulk(t,o))}async __updatePlanTraitsBulk(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/bulk"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-traits/bulk.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanTraits(t={},o){return b.fromPromise(this.__countPlanTraits(t,o))}async __countPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(z=>z):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Wm.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUserTrait(t,o){return b.fromPromise(this.__upsertUserTrait(t,o))}async __upsertUserTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"user-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /user-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listUsers(t={},o){return b.fromPromise(this.__listUsers(t,o))}async __listUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Zm.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUser(t,o){return b.fromPromise(this.__upsertUser(t,o))}async __upsertUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getUser(t,o){return b.fromPromise(this.__getUser(t,o))}async __getUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Qm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUser(t,o){return b.fromPromise(this.__deleteUser(t,o))}async __deleteUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:eu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countUsers(t={},o){return b.fromPromise(this.__countUsers(t,o))}async __countUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:ou.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 P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createUser(t,o){return b.fromPromise(this.__createUser(t,o))}async __createUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:tu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUserByKeys(t,o){return b.fromPromise(this.__deleteUserByKeys(t,o))}async __deleteUserByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}lookupUser(t,o){return b.fromPromise(this.__lookupUser(t,o))}async __lookupUser(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:su.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var J=H(require("url-join"));var fo=class{constructor(t={}){this._options=t}listCompanyOverrides(t={},o){return b.fromPromise(this.__listCompanyOverrides(t,o))}async __listCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:z}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:pu.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 P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createCompanyOverride(t,o){return b.fromPromise(this.__createCompanyOverride(t,o))}async __createCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ot.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-overrides.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompanyOverride(t,o){return b.fromPromise(this.__getCompanyOverride(t,o))}async __getCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCompanyOverride(t,o,r){return b.fromPromise(this.__updateCompanyOverride(t,o,r))}async __updateCompanyOverride(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Bt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:zu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /company-overrides/{company_override_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCompanyOverride(t,o){return b.fromPromise(this.__deleteCompanyOverride(t,o))}async __deleteCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCompanyOverrides(t={},o){return b.fromPromise(this.__countCompanyOverrides(t,o))}async __countCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:z}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:fu.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 P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}listFeatureCompanies(t,o){return b.fromPromise(this.__listFeatureCompanies(t,o))}async __listFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Pu.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-companies.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureCompanies(t,o){return b.fromPromise(this.__countFeatureCompanies(t,o))}async __countFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-companies/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listFeatureUsage(t={},o){return b.fromPromise(this.__listFeatureUsage(t,o))}async __listFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=pe(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:Ou.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-usage.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}countFeatureUsage(t={},o){return b.fromPromise(this.__countFeatureUsage(t,o))}async __countFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=pe(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:ju.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-usage/count.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}listFeatureUsers(t,o){return b.fromPromise(this.__listFeatureUsers(t,o))}async __listFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:qu.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-users.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureUsers(t,o){return b.fromPromise(this.__countFeatureUsers(t,o))}async __countFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Au.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-users/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanEntitlements(t={},o){return b.fromPromise(this.__listPlanEntitlements(t,o))}async __listPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:z}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:Iu.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 P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createPlanEntitlement(t,o){return b.fromPromise(this.__createPlanEntitlement(t,o))}async __createPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:jt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-entitlements.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanEntitlement(t,o){return b.fromPromise(this.__getPlanEntitlement(t,o))}async __getPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanEntitlement(t,o,r){return b.fromPromise(this.__updatePlanEntitlement(t,o,r))}async __updatePlanEntitlement(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Yu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanEntitlement(t,o){return b.fromPromise(this.__deletePlanEntitlement(t,o))}async __deletePlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanEntitlements(t={},o){return b.fromPromise(this.__countPlanEntitlements(t,o))}async __countPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:z}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:rd.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 P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}getFeatureUsageByCompany(t,o){return b.fromPromise(this.__getFeatureUsageByCompany(t,o))}async __getFeatureUsageByCompany(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"usage-by-company"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:td.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /usage-by-company.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Se=H(require("url-join"));var _o=class{constructor(t={}){this._options=t}updateCompanyPlans(t,o,r){return b.fromPromise(this.__updateCompanyPlans(t,o,r))}async __updateCompanyPlans(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Dt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:id.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /company-plans/{company_plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}listPlans(t={},o){return b.fromPromise(this.__listPlans(t,o))}async __listPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:V}=t,q={};r!=null&&(q.company_id=r),i!=null&&(q.for_fallback_plan=i.toString()),m!=null&&(q.for_initial_plan=m.toString()),g!=null&&(q.for_trial_expiry_plan=g.toString()),p!=null&&(q.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?q.ids=s.map(B=>B):q.ids=s),l!=null&&(q.plan_type=ad.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(q.q=u),z!=null&&(q.requires_payment_method=z.toString()),y!=null&&(q.without_entitlement_for=y),C!=null&&(q.without_product_id=C.toString()),O!=null&&(q.without_paid_product_id=O.toString()),T!=null&&(q.limit=T.toString()),V!=null&&(q.offset=V.toString());let v=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:q,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:cd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}createPlan(t,o){return b.fromPromise(this.__createPlan(t,o))}async __createPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ld.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plans.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlan(t,o){return b.fromPromise(this.__getPlan(t,o))}async __getPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:md.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlan(t,o,r){return b.fromPromise(this.__updatePlan(t,o,r))}async __updatePlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ud.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plans/{plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlan(t,o){return b.fromPromise(this.__deletePlan(t,o))}async __deletePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:dd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProductPlan(t,o,r){return b.fromPromise(this.__upsertBillingProductPlan(t,o,r))}async __upsertBillingProductPlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}/billing_products`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Mt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:wd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plans/{plan_id}/billing_products.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countPlans(t={},o){return b.fromPromise(this.__countPlans(t,o))}async __countPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:V}=t,q={};r!=null&&(q.company_id=r),i!=null&&(q.for_fallback_plan=i.toString()),m!=null&&(q.for_initial_plan=m.toString()),g!=null&&(q.for_trial_expiry_plan=g.toString()),p!=null&&(q.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?q.ids=s.map(B=>B):q.ids=s),l!=null&&(q.plan_type=yd.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(q.q=u),z!=null&&(q.requires_payment_method=z.toString()),y!=null&&(q.without_entitlement_for=y),C!=null&&(q.without_product_id=C.toString()),O!=null&&(q.without_paid_product_id=O.toString()),T!=null&&(q.limit=T.toString()),V!=null&&(q.offset=V.toString());let v=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:q,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:bd.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 P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/count.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}listPlanIssues(t,o){return b.fromPromise(this.__listPlanIssues(t,o))}async __listPlanIssues(t,o){let{planId:r}=t,i={};i.plan_id=r;let m=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/issues"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:Sd.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 P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/issues.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Me=H(require("url-join"));var So=class{constructor(t={}){this._options=t}listComponents(t={},o){return b.fromPromise(this.__listComponents(t,o))}async __listComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Ed.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createComponent(t,o){return b.fromPromise(this.__createComponent(t,o))}async __createComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:At.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Pd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /components.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getComponent(t,o){return b.fromPromise(this.__getComponent(t,o))}async __getComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateComponent(t,o={},r){return b.fromPromise(this.__updateComponent(t,o,r))}async __updateComponent(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ft.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Od.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /components/{component_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteComponent(t,o){return b.fromPromise(this.__deleteComponent(t,o))}async __deleteComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Bd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countComponents(t={},o){return b.fromPromise(this.__countComponents(t,o))}async __countComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:kd.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}previewComponentData(t={},o){return b.fromPromise(this.__previewComponentData(t,o))}async __previewComponentData(t={},o){let{companyId:r,componentId:i}=t,m={};r!=null&&(m.company_id=r),i!=null&&(m.component_id=i);let g=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/preview-data"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(g.ok)return{data:Md.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 S(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new U(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new c({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/preview-data.");case"unknown":throw new c({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var gr=H(require("url-join"));var xo=class{constructor(t={}){this._options=t}upsertDealLineItemAssociation(t,o){return b.fromPromise(this.__upsertDealLineItemAssociation(t,o))}async __upsertDealLineItemAssociation(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/associations/deal-line-item"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:It.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ad.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/associations/deal-line-item.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertLineItem(t,o){return b.fromPromise(this.__upsertLineItem(t,o))}async __upsertLineItem(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deal-line-item/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/deal-line-item/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertCrmDeal(t,o){return b.fromPromise(this.__upsertCrmDeal(t,o))}async __upsertCrmDeal(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deals/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/deals/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCrmProducts(t={},o){return b.fromPromise(this.__listCrmProducts(t,o))}async __listCrmProducts(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /crm/products.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCrmProduct(t,o){return b.fromPromise(this.__upsertCrmProduct(t,o))}async __upsertCrmProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Gt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/products/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var mi=H(require("url-join"));var Eo=class{constructor(t={}){this._options=t}createDataExport(t,o){return b.fromPromise(this.__createDataExport(t,o))}async __createDataExport(t,o){let r=await(this._options.fetcher??_)({url:(0,mi.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"data-exports"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...Nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),export_type:"company-feature-usage",output_file_type:"csv"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /data-exports.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDataExportArtifact(t,o){return b.fromPromise(this.__getDataExportArtifact(t,o))}async __getDataExportArtifact(t,o){let r=await(this._options.fetcher??_)({url:(0,mi.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`data-exports/${encodeURIComponent(t)}/artifact`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",responseType:"streaming",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /data-exports/{data_export_id}/artifact.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Xe=H(require("url-join"));var Uo=class{constructor(t={}){this._options=t}createEventBatch(t,o){return b.fromPromise(this.__createEventBatch(t,o))}async __createEventBatch(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-batch"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ht.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /event-batch.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEventSummaries(t={},o){return b.fromPromise(this.__getEventSummaries(t,o))}async __getEventSummaries(t={},o){let{q:r,eventSubtypes:i,limit:m,offset:g}=t,p={};r!=null&&(p.q=r),i!=null&&(Array.isArray(i)?p.event_subtypes=i.map(l=>l):p.event_subtypes=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-types"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Zd.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 P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /event-types.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listEvents(t={},o){return b.fromPromise(this.__listEvents(t,o))}async __listEvents(t={},o){let{companyId:r,eventSubtype:i,eventTypes:m,flagId:g,userId:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.event_subtype=i),m!=null&&(Array.isArray(m)?u.event_types=m.map(y=>Xt.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})):u.event_types=Xt.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(u.flag_id=g),p!=null&&(u.user_id=p),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:eh.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /events.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}createEvent(t,o){return b.fromPromise(this.__createEvent(t,o))}async __createEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:so.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:rh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /events.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEvent(t,o){return b.fromPromise(this.__getEvent(t,o))}async __getEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:oh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /events/{event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSegmentIntegrationStatus(t){return b.fromPromise(this.__getSegmentIntegrationStatus(t))}async __getSegmentIntegrationStatus(t){let o=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"segment-integration"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:ih.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 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /segment-integration.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var se=H(require("url-join"));var Po=class{constructor(t={}){this._options=t}listFeatures(t={},o){return b.fromPromise(this.__listFeatures(t,o))}async __listFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.q=i),m!=null&&(z.without_company_override_for=m),g!=null&&(z.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?z.feature_type=p.map(C=>C):z.feature_type=p),s!=null&&(z.boolean_require_event=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:uh.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 P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}createFeature(t,o){return b.fromPromise(this.__createFeature(t,o))}async __createFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Wt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /features.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFeature(t,o){return b.fromPromise(this.__getFeature(t,o))}async __getFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:wh.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFeature(t,o={},r){return b.fromPromise(this.__updateFeature(t,o,r))}async __updateFeature(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Rh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /features/{feature_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeature(t,o){return b.fromPromise(this.__deleteFeature(t,o))}async __deleteFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFeatures(t={},o){return b.fromPromise(this.__countFeatures(t,o))}async __countFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.q=i),m!=null&&(z.without_company_override_for=m),g!=null&&(z.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?z.feature_type=p.map(C=>C):z.feature_type=p),s!=null&&(z.boolean_require_event=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:_h.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 P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listFlags(t={},o){return b.fromPromise(this.__listFlags(t,o))}async __listFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:xh.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createFlag(t,o){return b.fromPromise(this.__createFlag(t,o))}async __createFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Eh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFlag(t,o){return b.fromPromise(this.__getFlag(t,o))}async __getFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Uh.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlag(t,o,r){return b.fromPromise(this.__updateFlag(t,o,r))}async __updateFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Ph.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /flags/{flag_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFlag(t,o){return b.fromPromise(this.__deleteFlag(t,o))}async __deleteFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ch.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlagRules(t,o,r){return b.fromPromise(this.__updateFlagRules(t,o,r))}async __updateFlagRules(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/rules`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:$t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Oh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /flags/{flag_id}/rules.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlag(t,o,r){return b.fromPromise(this.__checkFlag(t,o,r))}async __checkFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/check`),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Bh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags/{key}/check.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlags(t,o){return b.fromPromise(this.__checkFlags(t,o))}async __checkFlags(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/check"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:kh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags/check.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFlags(t={},o){return b.fromPromise(this.__countFlags(t,o))}async __countFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Vh.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Co=H(require("url-join"));var To=class{constructor(t={}){this._options=t}getPlanGroup(t){return b.fromPromise(this.__getPlanGroup(t))}async __getPlanGroup(t){let o=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:Nh.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 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-groups.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPlanGroup(t,o){return b.fromPromise(this.__createPlanGroup(t,o))}async __createPlanGroup(t,o){let r=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Yt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Wh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-groups.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanGroup(t,o,r){return b.fromPromise(this.__updatePlanGroup(t,o,r))}async __updatePlanGroup(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-groups/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Jh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-groups/{plan_group_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Pg=H(require("url-join"));var vo=class{constructor(t={}){this._options=t}issueTemporaryAccessToken(t,o){return b.fromPromise(this.__issueTemporaryAccessToken(t,o))}async __issueTemporaryAccessToken(t,o){let r=await(this._options.fetcher??_)({url:(0,Pg.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"temporary-access-tokens"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...ei.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),resource_type:"company"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Zh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /temporary-access-tokens.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var xe=H(require("url-join"));var Oo=class{constructor(t={}){this._options=t}listWebhookEvents(t={},o){return b.fromPromise(this.__listWebhookEvents(t,o))}async __listWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Qh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getWebhookEvent(t,o){return b.fromPromise(this.__getWebhookEvent(t,o))}async __getWebhookEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhook-events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:eg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events/{webhook_event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhookEvents(t={},o){return b.fromPromise(this.__countWebhookEvents(t,o))}async __countWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:og.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 P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listWebhooks(t={},o){return b.fromPromise(this.__listWebhooks(t,o))}async __listWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:ig.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createWebhook(t,o){return b.fromPromise(this.__createWebhook(t,o))}async __createWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ri.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:sg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /webhooks.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWebhook(t,o){return b.fromPromise(this.__getWebhook(t,o))}async __getWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ng.parseOrThrow(r.body,{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 S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWebhook(t,o={},r){return b.fromPromise(this.__updateWebhook(t,o,r))}async __updateWebhook(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:oi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:lg.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /webhooks/{webhook_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteWebhook(t,o){return b.fromPromise(this.__deleteWebhook(t,o))}async __deleteWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:mg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhooks(t={},o){return b.fromPromise(this.__countWebhooks(t,o))}async __countWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:dg.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 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Bo=class{constructor(t={}){this._options=t}get accounts(){return this._accounts??=new wo(this._options)}get billing(){return this._billing??=new yo(this._options)}get credits(){return this._credits??=new zo(this._options)}get checkout(){return this._checkout??=new Ro(this._options)}get companies(){return this._companies??=new bo(this._options)}get entitlements(){return this._entitlements??=new fo(this._options)}get plans(){return this._plans??=new _o(this._options)}get components(){return this._components??=new So(this._options)}get crm(){return this._crm??=new xo(this._options)}get dataexports(){return this._dataexports??=new Eo(this._options)}get events(){return this._events??=new Uo(this._options)}get features(){return this._features??=new Po(this._options)}get plangroups(){return this._plangroups??=new To(this._options)}get accesstokens(){return this._accesstokens??=new vo(this._options)}get webhooks(){return this._webhooks??=new Oo(this._options)}putPlanAudiencesPlanAudienceId(t,o){return b.fromPromise(this.__putPlanAudiencesPlanAudienceId(t,o))}async __putPlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deletePlanAudiencesPlanAudienceId(t,o){return b.fromPromise(this.__deletePlanAudiencesPlanAudienceId(t,o))}async __deletePlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var wr=class{error(t,...o){console.error(t,...o)}warn(t,...o){console.warn(t,...o)}info(t,...o){console.info(t,...o)}debug(t,...o){console.debug(t,...o)}};var Xw=1e3,Hw=1e3,Ww=3,Jw=1e3,jo=class{constructor(t,o){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:r=new wr,maxSize:i=Hw,interval:m=Xw,offline:g=!1,maxRetries:p=Ww,initialRetryDelay:s=Jw}=o||{};this.eventsApi=t,this.interval=m,this.logger=r,this.maxSize=i,this.offline=g,this.maxRetries=p,this.initialRetryDelay=s,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let t=[...this.events];this.events=[];let o=0,r=!1,i=null;for(;o<=this.maxRetries&&!r;)try{o>0&&this.logger.info(`Retrying event batch submission (attempt ${o} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:t}),r=!0}catch(m){if(i=m,o++,o<=this.maxRetries){let g=this.initialRetryDelay*Math.pow(2,o-1),p=Math.random()*.1*g,s=g+p;this.logger.warn(`Event batch submission failed: ${m}. Retrying in ${(s/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(l=>setTimeout(l,s))}}r?o>0&&this.logger.info(`Event batch submission succeeded after ${o} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,i)}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 Cg(w){return async function(o){let r={};if(w&&Object.assign(r,w),o.body!==void 0&&o.contentType!=null&&(r["Content-Type"]=o.contentType),o.headers!=null)for(let[p,s]of Object.entries(o.headers))s!=null&&(r[p]=s);let i=xr(o.url,o.queryParameters),m=await Ur({body:o.body,type:o.requestType==="json"?"json":"other"}),g=await Er();try{let p=await Tr(async()=>Cr(g,i,o.method,r,m,o.timeoutMs,o.abortSignal,o.withCredentials,o.duplex),o.maxRetries),s=await Pr(p,o.responseType),l=We(p);return p.status>=200&&p.status<400?{ok:!0,body:s,headers:p.headers,rawResponse:l}:{ok:!1,error:{reason:"status-code",statusCode:p.status,body:s},rawResponse:l}}catch(p){return o.abortSignal!=null&&o.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Fe}:p instanceof Error&&p.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Fe}:p instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:p.message},rawResponse:Ie}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(p)},rawResponse:Ie}}}}async function $w(w){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ae,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Tg=$w;var ko=class extends Bo{constructor(t){let{apiKey:o="",basePath:r,eventBufferInterval:i,flagDefaults:m={},logger:g=new wr}=t??{},{offline:p=!1}=t??{},s={};t?.environmentId&&(s["X-Schematic-Environment-Id"]=t.environmentId),t?.headers&&Object.assign(s,t.headers),p?o!==""&&g.debug("Offline mode enabled, ignoring API key"):o===""&&!p&&(g.warn("No API key was provided, running in offline mode"),p=!0),super({apiKey:o,environment:r,fetcher:p?Tg:Cg(s)}),this.logger=g,this.eventBuffer=new jo(this.events,{interval:i,logger:g,offline:p}),this.flagCheckCacheProviders=t?.cacheProviders?.flagChecks??[new He],this.flagDefaults=m,this.offline=p}async checkFlag(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${o}`),this.getFlagDefault(o);try{let r=JSON.stringify({evalCtx:t,key:o});for(let m of this.flagCheckCacheProviders){let g=await m.get(r);if(g!==void 0)return this.logger.debug(`${m.constructor.name} cache hit for flag ${o}`),g}let i=await this.features.checkFlag(o,t);if(i.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${o}, falling back to default`),this.getFlagDefault(o);for(let m of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${o} in ${m.constructor.name}`),await m.set(r,i.data.value);return this.logger.debug(`Feature flag API response for ${o}: ${JSON.stringify(i.data)}`),i.data.value}catch(r){return this.logger.error(`Error checking flag ${o}: ${r}`),this.getFlagDefault(o)}}async checkFlags(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag values for flags ${o?o.join(", "):"all"}`),o&&o.length>0?o.map(r=>({flag:r,value:this.getFlagDefault(r),reason:"Offline mode - using default value"})):[];try{if(!o||o.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(t)).data.flags;let r=new Map,i=[];for(let s of o){let l=JSON.stringify({evalCtx:t,key:s}),u=!1;for(let z of this.flagCheckCacheProviders){let y=await z.get(l);if(y!==void 0){this.logger.debug(`${z.constructor.name} cache hit for flag ${s}`),r.set(s,{flag:s,value:y,reason:"Retrieved from cache"}),u=!0;break}}u||i.push(s)}if(i.length===0)return this.logger.debug(`All ${o.length} flags found in cache`),o.map(s=>r.get(s));this.logger.debug(`Cache miss for ${i.length} flags: ${i.join(", ")}, calling API`);let g=(await this.features.checkFlags(t)).data.flags,p=[];for(let s of o){let l=g.find(u=>u.flag===s);if(l){let u=JSON.stringify({evalCtx:t,key:s});for(let z of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${u} in ${z.constructor.name}`),await z.set(u,l.value);p.push(l)}else{let u=r.get(s);if(u)p.push(u);else{this.logger.debug(`Flag ${s} not found in API response or cache, using default value`);let z={flag:s,value:this.getFlagDefault(s),reason:"Flag not found - using default value"};p.push(z)}}}return this.logger.debug(`Checked ${o.length} flags: used fresh API values for consistency (${i.length} were cache misses)`),p}catch(r){return this.logger.error(`Error checking flags ${o?o.join(", "):"all"}: ${r}`),o&&o.length>0?o.map(i=>({flag:i,value:this.getFlagDefault(i),reason:`Error occurred - using default value: ${r}`})):[]}}async close(){return this.eventBuffer.stop()}async identify(t){if(!this.offline)try{await this.enqueueEvent("identify",t)}catch(o){this.logger.error(`Error sending identify event: ${o}`)}}async track(t){if(!this.offline)try{await this.enqueueEvent("track",t)}catch(o){this.logger.error(`Error sending track event: ${o}`)}}setFlagDefault(t,o){this.flagDefaults[t]=o}setFlagDefaults(t){Object.assign(this.flagDefaults,t)}getFlagDefault(t){return this.flagDefaults[t]??!1}async enqueueEvent(t,o){try{this.eventBuffer.push({eventType:t,body:o,sentAt:new Date})}catch(r){this.logger.error(`Error enqueueing ${t} event: ${r}`)}}};var Do=H(require("crypto")),di="X-Schematic-Webhook-Signature",hi="X-Schematic-Webhook-Timestamp",Ee=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new w("Missing webhook signature header")}static missingTimestamp(){return new w("Missing webhook timestamp header")}static invalidSignature(){return new w("Invalid webhook signature")}};function Vo(w,t,o){let r=Buffer.isBuffer(w)?w:Buffer.from(w),i=Buffer.concat([r,Buffer.from(`+${t}`)]),m=Do.createHmac("sha256",o);return m.update(i),m.digest()}function Og(w,t,o){return Vo(w,t,o).toString("hex")}function gi(w,t,o,r){if(!t)throw Ee.missingSignature();if(!o)throw Ee.missingTimestamp();let i;try{i=Buffer.from(t,"hex")}catch(g){throw new Ee(`Invalid signature format: ${g?.message||"Unknown error"}`)}let m=Vo(w,o,r);if(i.length!==m.length||!Do.timingSafeEqual(i,m))throw Ee.invalidSignature()}function Bg(w,t,o,r={}){let i=w.headers,m=r.signatureHeader||di,g=r.timestampHeader||hi,p=vg(i,m),s=vg(i,g),l;if(o!==void 0)l=o;else if("rawBody"in w&&w.rawBody)l=w.rawBody;else throw new Ee("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");gi(l,p,s,t)}function vg(w,t){let o=w[t]||w[t.toLowerCase()];return Array.isArray(o)?o[0]||"":o||""}0&&(module.exports={LocalCache,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});
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});