@schematichq/schematic-typescript-node 1.2.7 → 1.3.1

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 (1521) hide show
  1. package/dist/BaseClient.d.ts +40 -0
  2. package/dist/Client.d.ts +55 -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 +11 -31
  11. package/dist/api/resources/accesstokens/client/requests/IssueTemporaryAccessTokenRequestBody.d.ts +1 -6
  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 +1 -4
  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 +1 -4
  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 -13
  48. package/dist/api/resources/billing/client/Client.d.ts +66 -82
  49. package/dist/api/resources/billing/client/requests/CountBillingProductsRequest.d.ts +18 -33
  50. package/dist/api/resources/billing/client/requests/CountCustomersRequest.d.ts +5 -11
  51. package/dist/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +2 -5
  52. package/dist/api/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +2 -4
  53. package/dist/api/resources/billing/client/requests/CreateBillingProductRequestBody.d.ts +2 -3
  54. package/dist/api/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +3 -6
  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 +9 -22
  60. package/dist/api/resources/billing/client/requests/ListBillingProductPricesRequest.d.ts +9 -22
  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 +5 -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 -4
  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/ListBillingPricesParams.d.ts +2 -4
  76. package/dist/api/resources/billing/types/ListBillingPricesResponse.d.ts +1 -4
  77. package/dist/api/resources/billing/types/ListBillingProductPricesParams.d.ts +2 -4
  78. package/dist/api/resources/billing/types/ListBillingProductPricesResponse.d.ts +1 -4
  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 -4
  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 -17
  100. package/dist/api/resources/checkout/client/Client.d.ts +23 -42
  101. package/dist/api/resources/checkout/client/requests/CancelSubscriptionRequest.d.ts +0 -3
  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 -3
  105. package/dist/api/resources/checkout/index.d.ts +1 -1
  106. package/dist/api/resources/checkout/types/CancelSubscriptionResponse.d.ts +1 -4
  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 -2
  114. package/dist/api/resources/companies/client/Client.d.ts +101 -140
  115. package/dist/api/resources/companies/client/requests/CountCompaniesForAdvancedFilterRequest.d.ts +16 -49
  116. package/dist/api/resources/companies/client/requests/CountCompaniesRequest.d.ts +8 -27
  117. package/dist/api/resources/companies/client/requests/CountEntityKeyDefinitionsRequest.d.ts +3 -10
  118. package/dist/api/resources/companies/client/requests/CountEntityTraitDefinitionsRequest.d.ts +3 -10
  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 +1 -4
  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 +16 -49
  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 +3 -10
  131. package/dist/api/resources/companies/client/requests/ListEntityTraitDefinitionsRequest.d.ts +3 -10
  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 +1 -4
  138. package/dist/api/resources/companies/client/requests/UpdatePlanTraitBulkRequestBody.d.ts +1 -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 +1 -4
  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 +1 -4
  147. package/dist/api/resources/companies/types/CountEntityKeyDefinitionsResponse.d.ts +1 -4
  148. package/dist/api/resources/companies/types/CountEntityTraitDefinitionsParams.d.ts +1 -4
  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 +1 -4
  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 +1 -4
  182. package/dist/api/resources/companies/types/ListEntityKeyDefinitionsResponse.d.ts +1 -4
  183. package/dist/api/resources/companies/types/ListEntityTraitDefinitionsParams.d.ts +1 -4
  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 -42
  203. package/dist/api/resources/components/client/Client.d.ts +25 -44
  204. package/dist/api/resources/components/client/requests/CountComponentsRequest.d.ts +2 -9
  205. package/dist/api/resources/components/client/requests/CreateComponentRequestBody.d.ts +1 -4
  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 +1 -4
  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 -6
  222. package/dist/api/resources/credits/client/Client.d.ts +86 -84
  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/CountCompanyGrantsRequest.d.ts +20 -0
  227. package/dist/api/resources/credits/client/requests/CountCreditBundlesRequest.d.ts +3 -10
  228. package/dist/api/resources/credits/client/requests/CountCreditLedgerRequest.d.ts +3 -10
  229. package/dist/api/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +1 -4
  230. package/dist/api/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +1 -4
  231. package/dist/api/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +1 -4
  232. package/dist/api/resources/credits/client/requests/DeleteBillingPlanCreditGrantRequest.d.ts +0 -3
  233. package/dist/api/resources/credits/client/requests/GetEnrichedCreditLedgerRequest.d.ts +3 -10
  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 +3 -10
  237. package/dist/api/resources/credits/client/requests/ListCreditBundlesRequest.d.ts +3 -10
  238. package/dist/api/resources/credits/client/requests/ListGrantsForCreditRequest.d.ts +2 -9
  239. package/dist/api/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +1 -4
  240. package/dist/api/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +1 -4
  241. package/dist/api/resources/credits/client/requests/ZeroOutGrantRequestBody.d.ts +1 -4
  242. package/dist/api/resources/credits/client/requests/index.d.ts +19 -20
  243. package/dist/api/resources/credits/index.d.ts +1 -1
  244. package/dist/api/resources/credits/types/CountBillingCreditsGrantsParams.d.ts +0 -3
  245. package/dist/api/resources/credits/types/CountBillingCreditsGrantsResponse.d.ts +1 -4
  246. package/dist/api/resources/credits/types/CountBillingCreditsParams.d.ts +0 -3
  247. package/dist/api/resources/credits/types/CountBillingCreditsResponse.d.ts +1 -4
  248. package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +0 -3
  249. package/dist/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.d.ts +1 -4
  250. package/dist/api/resources/credits/types/CountCompanyGrantsParams.d.ts +13 -0
  251. package/dist/api/resources/credits/types/CountCompanyGrantsResponse.d.ts +6 -0
  252. package/dist/api/resources/credits/types/CountCreditBundlesParams.d.ts +1 -4
  253. package/dist/api/resources/credits/types/CountCreditBundlesResponse.d.ts +1 -4
  254. package/dist/api/resources/credits/types/CountCreditLedgerParams.d.ts +1 -4
  255. package/dist/api/resources/credits/types/CountCreditLedgerResponse.d.ts +1 -4
  256. package/dist/api/resources/credits/types/CreateBillingCreditResponse.d.ts +1 -4
  257. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.d.ts +1 -4
  258. package/dist/api/resources/credits/types/CreateCreditBundleResponse.d.ts +1 -4
  259. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +0 -3
  260. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +1 -4
  261. package/dist/api/resources/credits/types/DeleteCreditBundleResponse.d.ts +1 -4
  262. package/dist/api/resources/credits/types/GetCreditBundleResponse.d.ts +1 -4
  263. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +1 -4
  264. package/dist/api/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +1 -4
  265. package/dist/api/resources/credits/types/GetSingleBillingCreditResponse.d.ts +1 -4
  266. package/dist/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.d.ts +1 -4
  267. package/dist/api/resources/credits/types/ListBillingCreditsParams.d.ts +0 -3
  268. package/dist/api/resources/credits/types/ListBillingCreditsResponse.d.ts +1 -4
  269. package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +0 -3
  270. package/dist/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.d.ts +1 -4
  271. package/dist/api/resources/credits/types/ListCompanyGrantsParams.d.ts +1 -4
  272. package/dist/api/resources/credits/types/ListCompanyGrantsResponse.d.ts +1 -4
  273. package/dist/api/resources/credits/types/ListCreditBundlesParams.d.ts +1 -4
  274. package/dist/api/resources/credits/types/ListCreditBundlesResponse.d.ts +1 -4
  275. package/dist/api/resources/credits/types/ListGrantsForCreditParams.d.ts +0 -3
  276. package/dist/api/resources/credits/types/ListGrantsForCreditResponse.d.ts +1 -4
  277. package/dist/api/resources/credits/types/SoftDeleteBillingCreditResponse.d.ts +1 -4
  278. package/dist/api/resources/credits/types/UpdateBillingCreditResponse.d.ts +1 -4
  279. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.d.ts +1 -4
  280. package/dist/api/resources/credits/types/UpdateCreditBundleDetailsResponse.d.ts +1 -4
  281. package/dist/api/resources/credits/types/ZeroOutGrantResponse.d.ts +1 -4
  282. package/dist/api/resources/credits/types/index.d.ts +29 -27
  283. package/dist/api/resources/dataexports/client/Client.d.ts +13 -34
  284. package/dist/api/resources/dataexports/client/requests/CreateDataExportRequestBody.d.ts +1 -6
  285. package/dist/api/resources/dataexports/client/requests/index.d.ts +1 -1
  286. package/dist/api/resources/dataexports/index.d.ts +1 -1
  287. package/dist/api/resources/dataexports/types/CreateDataExportResponse.d.ts +1 -4
  288. package/dist/api/resources/entitlements/client/Client.d.ts +56 -73
  289. package/dist/api/resources/entitlements/client/requests/CountCompanyOverridesRequest.d.ts +9 -30
  290. package/dist/api/resources/entitlements/client/requests/CountFeatureCompaniesRequest.d.ts +2 -9
  291. package/dist/api/resources/entitlements/client/requests/CountFeatureUsageRequest.d.ts +5 -9
  292. package/dist/api/resources/entitlements/client/requests/CountFeatureUsersRequest.d.ts +2 -9
  293. package/dist/api/resources/entitlements/client/requests/CountPlanEntitlementsRequest.d.ts +9 -30
  294. package/dist/api/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +1 -4
  295. package/dist/api/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +1 -4
  296. package/dist/api/resources/entitlements/client/requests/DuplicatePlanEntitlementsRequestBody.d.ts +0 -3
  297. package/dist/api/resources/entitlements/client/requests/GetFeatureUsageByCompanyRequest.d.ts +1 -6
  298. package/dist/api/resources/entitlements/client/requests/ListCompanyOverridesRequest.d.ts +9 -30
  299. package/dist/api/resources/entitlements/client/requests/ListFeatureCompaniesRequest.d.ts +2 -9
  300. package/dist/api/resources/entitlements/client/requests/ListFeatureUsageRequest.d.ts +5 -9
  301. package/dist/api/resources/entitlements/client/requests/ListFeatureUsersRequest.d.ts +2 -9
  302. package/dist/api/resources/entitlements/client/requests/ListPlanEntitlementsRequest.d.ts +9 -30
  303. package/dist/api/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +1 -4
  304. package/dist/api/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +1 -4
  305. package/dist/api/resources/entitlements/client/requests/index.d.ts +16 -16
  306. package/dist/api/resources/entitlements/index.d.ts +1 -1
  307. package/dist/api/resources/entitlements/types/CountCompanyOverridesParams.d.ts +0 -3
  308. package/dist/api/resources/entitlements/types/CountCompanyOverridesResponse.d.ts +1 -4
  309. package/dist/api/resources/entitlements/types/CountFeatureCompaniesParams.d.ts +0 -3
  310. package/dist/api/resources/entitlements/types/CountFeatureCompaniesResponse.d.ts +1 -4
  311. package/dist/api/resources/entitlements/types/CountFeatureUsageParams.d.ts +2 -3
  312. package/dist/api/resources/entitlements/types/CountFeatureUsageResponse.d.ts +1 -4
  313. package/dist/api/resources/entitlements/types/CountFeatureUsersParams.d.ts +0 -3
  314. package/dist/api/resources/entitlements/types/CountFeatureUsersResponse.d.ts +1 -4
  315. package/dist/api/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +0 -3
  316. package/dist/api/resources/entitlements/types/CountPlanEntitlementsResponse.d.ts +1 -4
  317. package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +1 -4
  318. package/dist/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  319. package/dist/api/resources/entitlements/types/CreateCompanyOverrideResponse.d.ts +1 -4
  320. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +1 -4
  321. package/dist/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  322. package/dist/api/resources/entitlements/types/CreatePlanEntitlementResponse.d.ts +1 -4
  323. package/dist/api/resources/entitlements/types/DeleteCompanyOverrideResponse.d.ts +1 -4
  324. package/dist/api/resources/entitlements/types/DeletePlanEntitlementResponse.d.ts +1 -4
  325. package/dist/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.d.ts +1 -4
  326. package/dist/api/resources/entitlements/types/GetCompanyOverrideResponse.d.ts +1 -4
  327. package/dist/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.d.ts +0 -3
  328. package/dist/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.d.ts +1 -4
  329. package/dist/api/resources/entitlements/types/GetPlanEntitlementResponse.d.ts +1 -4
  330. package/dist/api/resources/entitlements/types/ListCompanyOverridesParams.d.ts +0 -3
  331. package/dist/api/resources/entitlements/types/ListCompanyOverridesResponse.d.ts +1 -4
  332. package/dist/api/resources/entitlements/types/ListFeatureCompaniesParams.d.ts +0 -3
  333. package/dist/api/resources/entitlements/types/ListFeatureCompaniesResponse.d.ts +1 -4
  334. package/dist/api/resources/entitlements/types/ListFeatureUsageParams.d.ts +2 -3
  335. package/dist/api/resources/entitlements/types/ListFeatureUsageResponse.d.ts +1 -4
  336. package/dist/api/resources/entitlements/types/ListFeatureUsersParams.d.ts +0 -3
  337. package/dist/api/resources/entitlements/types/ListFeatureUsersResponse.d.ts +1 -4
  338. package/dist/api/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +0 -3
  339. package/dist/api/resources/entitlements/types/ListPlanEntitlementsResponse.d.ts +1 -4
  340. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +1 -4
  341. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  342. package/dist/api/resources/entitlements/types/UpdateCompanyOverrideResponse.d.ts +1 -4
  343. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +1 -4
  344. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +1 -4
  345. package/dist/api/resources/entitlements/types/UpdatePlanEntitlementResponse.d.ts +1 -4
  346. package/dist/api/resources/entitlements/types/index.d.ts +24 -24
  347. package/dist/api/resources/events/client/Client.d.ts +21 -40
  348. package/dist/api/resources/events/client/requests/CreateEventBatchRequestBody.d.ts +1 -4
  349. package/dist/api/resources/events/client/requests/GetEventSummariesRequest.d.ts +2 -9
  350. package/dist/api/resources/events/client/requests/ListEventsRequest.d.ts +3 -10
  351. package/dist/api/resources/events/client/requests/index.d.ts +3 -3
  352. package/dist/api/resources/events/index.d.ts +1 -1
  353. package/dist/api/resources/events/types/CreateEventBatchResponse.d.ts +1 -4
  354. package/dist/api/resources/events/types/CreateEventResponse.d.ts +1 -4
  355. package/dist/api/resources/events/types/GetEventResponse.d.ts +1 -4
  356. package/dist/api/resources/events/types/GetEventSummariesParams.d.ts +0 -3
  357. package/dist/api/resources/events/types/GetEventSummariesResponse.d.ts +1 -4
  358. package/dist/api/resources/events/types/GetSegmentIntegrationStatusResponse.d.ts +1 -4
  359. package/dist/api/resources/events/types/ListEventsParams.d.ts +1 -4
  360. package/dist/api/resources/events/types/ListEventsResponse.d.ts +1 -4
  361. package/dist/api/resources/events/types/index.d.ts +3 -3
  362. package/dist/api/resources/features/client/Client.d.ts +47 -66
  363. package/dist/api/resources/features/client/requests/CheckFlagsBulkRequestBody.d.ts +1 -4
  364. package/dist/api/resources/features/client/requests/CountFeaturesRequest.d.ts +8 -25
  365. package/dist/api/resources/features/client/requests/CountFlagsRequest.d.ts +3 -12
  366. package/dist/api/resources/features/client/requests/CreateFeatureRequestBody.d.ts +1 -4
  367. package/dist/api/resources/features/client/requests/ListFeaturesRequest.d.ts +8 -25
  368. package/dist/api/resources/features/client/requests/ListFlagsRequest.d.ts +3 -12
  369. package/dist/api/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +1 -4
  370. package/dist/api/resources/features/client/requests/UpdateFlagRulesRequestBody.d.ts +1 -4
  371. package/dist/api/resources/features/client/requests/index.d.ts +8 -8
  372. package/dist/api/resources/features/index.d.ts +1 -1
  373. package/dist/api/resources/features/types/CheckFlagResponse.d.ts +1 -4
  374. package/dist/api/resources/features/types/CheckFlagsBulkResponse.d.ts +1 -4
  375. package/dist/api/resources/features/types/CheckFlagsResponse.d.ts +1 -4
  376. package/dist/api/resources/features/types/CountFeaturesParams.d.ts +1 -4
  377. package/dist/api/resources/features/types/CountFeaturesResponse.d.ts +1 -4
  378. package/dist/api/resources/features/types/CountFlagsParams.d.ts +0 -3
  379. package/dist/api/resources/features/types/CountFlagsResponse.d.ts +1 -4
  380. package/dist/api/resources/features/types/CreateFeatureResponse.d.ts +1 -4
  381. package/dist/api/resources/features/types/CreateFlagResponse.d.ts +1 -4
  382. package/dist/api/resources/features/types/DeleteFeatureResponse.d.ts +1 -4
  383. package/dist/api/resources/features/types/DeleteFlagResponse.d.ts +1 -4
  384. package/dist/api/resources/features/types/GetFeatureResponse.d.ts +1 -4
  385. package/dist/api/resources/features/types/GetFlagResponse.d.ts +1 -4
  386. package/dist/api/resources/features/types/ListFeaturesParams.d.ts +1 -4
  387. package/dist/api/resources/features/types/ListFeaturesResponse.d.ts +1 -4
  388. package/dist/api/resources/features/types/ListFlagsParams.d.ts +0 -3
  389. package/dist/api/resources/features/types/ListFlagsResponse.d.ts +1 -4
  390. package/dist/api/resources/features/types/UpdateFeatureResponse.d.ts +1 -4
  391. package/dist/api/resources/features/types/UpdateFlagResponse.d.ts +1 -4
  392. package/dist/api/resources/features/types/UpdateFlagRulesResponse.d.ts +1 -4
  393. package/dist/api/resources/features/types/index.d.ts +14 -14
  394. package/dist/api/resources/index.d.ts +25 -25
  395. package/dist/api/resources/planbundle/client/Client.d.ts +52 -0
  396. package/dist/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.d.ts +16 -0
  397. package/dist/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.d.ts +16 -0
  398. package/dist/api/resources/planbundle/client/requests/index.d.ts +2 -0
  399. package/dist/api/resources/planbundle/types/CreatePlanBundleResponse.d.ts +6 -0
  400. package/dist/api/resources/planbundle/types/UpdatePlanBundleResponse.d.ts +6 -0
  401. package/dist/api/resources/planbundle/types/index.d.ts +2 -0
  402. package/dist/api/resources/plangroups/client/Client.d.ts +15 -34
  403. package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +1 -4
  404. package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +1 -4
  405. package/dist/api/resources/plangroups/client/requests/index.d.ts +2 -2
  406. package/dist/api/resources/plangroups/index.d.ts +1 -1
  407. package/dist/api/resources/plangroups/types/CreatePlanGroupResponse.d.ts +1 -4
  408. package/dist/api/resources/plangroups/types/GetPlanGroupResponse.d.ts +1 -4
  409. package/dist/api/resources/plangroups/types/UpdatePlanGroupResponse.d.ts +1 -4
  410. package/dist/api/resources/plangroups/types/index.d.ts +1 -1
  411. package/dist/api/resources/plans/client/Client.d.ts +31 -50
  412. package/dist/api/resources/plans/client/requests/CountPlansRequest.d.ts +10 -31
  413. package/dist/api/resources/plans/client/requests/ListPlanIssuesRequest.d.ts +0 -3
  414. package/dist/api/resources/plans/client/requests/ListPlansRequest.d.ts +10 -31
  415. package/dist/api/resources/plans/client/requests/UpdateCompanyPlansRequestBody.d.ts +0 -3
  416. package/dist/api/resources/plans/client/requests/index.d.ts +4 -7
  417. package/dist/api/resources/plans/index.d.ts +1 -1
  418. package/dist/api/resources/plans/types/CountPlansParams.d.ts +1 -4
  419. package/dist/api/resources/plans/types/CountPlansResponse.d.ts +1 -4
  420. package/dist/api/resources/plans/types/CreatePlanResponse.d.ts +1 -4
  421. package/dist/api/resources/plans/types/DeletePlanResponse.d.ts +1 -4
  422. package/dist/api/resources/plans/types/GetPlanResponse.d.ts +1 -4
  423. package/dist/api/resources/plans/types/ListPlanIssuesParams.d.ts +0 -3
  424. package/dist/api/resources/plans/types/ListPlanIssuesResponse.d.ts +1 -4
  425. package/dist/api/resources/plans/types/ListPlansParams.d.ts +1 -4
  426. package/dist/api/resources/plans/types/ListPlansResponse.d.ts +1 -4
  427. package/dist/api/resources/plans/types/UpdateCompanyPlansResponse.d.ts +1 -4
  428. package/dist/api/resources/plans/types/UpdatePlanResponse.d.ts +1 -4
  429. package/dist/api/resources/plans/types/UpsertBillingProductPlanResponse.d.ts +1 -4
  430. package/dist/api/resources/plans/types/index.d.ts +8 -8
  431. package/dist/api/resources/webhooks/client/Client.d.ts +30 -49
  432. package/dist/api/resources/webhooks/client/requests/CountWebhookEventsRequest.d.ts +2 -9
  433. package/dist/api/resources/webhooks/client/requests/CountWebhooksRequest.d.ts +2 -9
  434. package/dist/api/resources/webhooks/client/requests/CreateWebhookRequestBody.d.ts +1 -4
  435. package/dist/api/resources/webhooks/client/requests/ListWebhookEventsRequest.d.ts +2 -9
  436. package/dist/api/resources/webhooks/client/requests/ListWebhooksRequest.d.ts +2 -9
  437. package/dist/api/resources/webhooks/client/requests/UpdateWebhookRequestBody.d.ts +1 -4
  438. package/dist/api/resources/webhooks/client/requests/index.d.ts +6 -6
  439. package/dist/api/resources/webhooks/index.d.ts +1 -1
  440. package/dist/api/resources/webhooks/types/CountWebhookEventsParams.d.ts +0 -3
  441. package/dist/api/resources/webhooks/types/CountWebhookEventsResponse.d.ts +1 -4
  442. package/dist/api/resources/webhooks/types/CountWebhooksParams.d.ts +0 -3
  443. package/dist/api/resources/webhooks/types/CountWebhooksResponse.d.ts +1 -4
  444. package/dist/api/resources/webhooks/types/CreateWebhookResponse.d.ts +1 -4
  445. package/dist/api/resources/webhooks/types/DeleteWebhookResponse.d.ts +1 -4
  446. package/dist/api/resources/webhooks/types/GetWebhookEventResponse.d.ts +1 -4
  447. package/dist/api/resources/webhooks/types/GetWebhookResponse.d.ts +1 -4
  448. package/dist/api/resources/webhooks/types/ListWebhookEventsParams.d.ts +0 -3
  449. package/dist/api/resources/webhooks/types/ListWebhookEventsResponse.d.ts +1 -4
  450. package/dist/api/resources/webhooks/types/ListWebhooksParams.d.ts +0 -3
  451. package/dist/api/resources/webhooks/types/ListWebhooksResponse.d.ts +1 -4
  452. package/dist/api/resources/webhooks/types/UpdateWebhookResponse.d.ts +1 -4
  453. package/dist/api/resources/webhooks/types/index.d.ts +8 -8
  454. package/dist/api/types/ApiError.d.ts +0 -3
  455. package/dist/api/types/ApiKeyCreateResponseData.d.ts +1 -4
  456. package/dist/api/types/ApiKeyRequestListResponseData.d.ts +0 -3
  457. package/dist/api/types/ApiKeyRequestResponseData.d.ts +1 -4
  458. package/dist/api/types/ApiKeyResponseData.d.ts +1 -4
  459. package/dist/api/types/ApiKeyScope.d.ts +1 -4
  460. package/dist/api/types/BillingCouponResponseData.d.ts +2 -3
  461. package/dist/api/types/BillingCreditBundleResponseData.d.ts +1 -4
  462. package/dist/api/types/BillingCreditBundleStatus.d.ts +1 -4
  463. package/dist/api/types/BillingCreditBundleType.d.ts +0 -3
  464. package/dist/api/types/BillingCreditBundleView.d.ts +1 -4
  465. package/dist/api/types/BillingCreditBurnStrategy.d.ts +1 -4
  466. package/dist/api/types/BillingCreditExpiryType.d.ts +1 -4
  467. package/dist/api/types/BillingCreditExpiryUnit.d.ts +1 -4
  468. package/dist/api/types/BillingCreditGrantReason.d.ts +1 -4
  469. package/dist/api/types/BillingCreditGrantResponseData.d.ts +4 -4
  470. package/dist/api/types/BillingCreditGrantZeroedOutReason.d.ts +1 -4
  471. package/dist/api/types/BillingCreditLedgerResponseData.d.ts +0 -3
  472. package/dist/api/types/BillingCreditResponseData.d.ts +1 -4
  473. package/dist/api/types/BillingCreditRolloverPolicy.d.ts +1 -4
  474. package/dist/api/types/BillingCustomerResponseData.d.ts +2 -4
  475. package/dist/api/types/BillingCustomerSubscription.d.ts +0 -3
  476. package/dist/api/types/BillingCustomerWithSubscriptionsResponseData.d.ts +2 -5
  477. package/dist/api/types/BillingMeterResponseData.d.ts +2 -3
  478. package/dist/api/types/BillingPlanCreditGrantResetCadence.d.ts +1 -4
  479. package/dist/api/types/BillingPlanCreditGrantResetStart.d.ts +1 -4
  480. package/dist/api/types/BillingPlanCreditGrantResetType.d.ts +1 -4
  481. package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +1 -4
  482. package/dist/api/types/BillingPriceResponseData.d.ts +2 -4
  483. package/dist/api/types/BillingPriceScheme.d.ts +1 -4
  484. package/dist/api/types/BillingPriceUsageType.d.ts +1 -4
  485. package/dist/api/types/BillingPriceView.d.ts +2 -4
  486. package/dist/api/types/BillingProductDetailResponseData.d.ts +2 -4
  487. package/dist/api/types/BillingProductForSubscriptionResponseData.d.ts +2 -4
  488. package/dist/api/types/BillingProductPlanResponseData.d.ts +1 -4
  489. package/dist/api/types/BillingProductPriceInterval.d.ts +1 -4
  490. package/dist/api/types/BillingProductPriceResponseData.d.ts +2 -4
  491. package/dist/api/types/BillingProductPriceTierResponseData.d.ts +0 -3
  492. package/dist/api/types/BillingProductPricing.d.ts +1 -4
  493. package/dist/api/types/BillingProductResponseData.d.ts +2 -3
  494. package/dist/api/types/BillingProviderType.d.ts +5 -0
  495. package/dist/api/types/BillingSubscriptionDiscount.d.ts +0 -3
  496. package/dist/api/types/BillingSubscriptionDiscountView.d.ts +0 -3
  497. package/dist/api/types/BillingSubscriptionResponseData.d.ts +2 -4
  498. package/dist/api/types/BillingSubscriptionTrialEndSetting.d.ts +1 -4
  499. package/dist/api/types/BillingSubscriptionView.d.ts +2 -4
  500. package/dist/api/types/BillingTiersMode.d.ts +1 -4
  501. package/dist/api/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -4
  502. package/dist/api/types/ChangeSubscriptionRequestBody.d.ts +1 -4
  503. package/dist/api/types/ChargeType.d.ts +1 -4
  504. package/dist/api/types/CheckFlagRequestBody.d.ts +0 -3
  505. package/dist/api/types/CheckFlagResponseData.d.ts +0 -3
  506. package/dist/api/types/CheckFlagsBulkResponseData.d.ts +1 -4
  507. package/dist/api/types/CheckFlagsResponseData.d.ts +1 -4
  508. package/dist/api/types/CheckoutDataResponseData.d.ts +1 -4
  509. package/dist/api/types/CheckoutSettingsResponseData.d.ts +0 -3
  510. package/dist/api/types/CheckoutSubscription.d.ts +2 -4
  511. package/dist/api/types/CompanyDetailResponseData.d.ts +1 -4
  512. package/dist/api/types/CompanyEventPeriodMetricsResponseData.d.ts +0 -3
  513. package/dist/api/types/CompanyLedgerResponseData.d.ts +0 -3
  514. package/dist/api/types/CompanyMembershipDetailResponseData.d.ts +1 -4
  515. package/dist/api/types/CompanyMembershipResponseData.d.ts +0 -3
  516. package/dist/api/types/CompanyOverrideNoteResponseData.d.ts +0 -3
  517. package/dist/api/types/CompanyOverrideResponseData.d.ts +1 -4
  518. package/dist/api/types/CompanyPlanDetailResponseData.d.ts +2 -4
  519. package/dist/api/types/CompanyPlanInvalidReason.d.ts +1 -4
  520. package/dist/api/types/CompanyPlanWithBillingSubView.d.ts +2 -4
  521. package/dist/api/types/CompanyResponseData.d.ts +0 -3
  522. package/dist/api/types/CompanySubscriptionResponseData.d.ts +1 -4
  523. package/dist/api/types/CompanyViewWithFeatureUsageResponseData.d.ts +1 -4
  524. package/dist/api/types/CompatiblePlans.d.ts +0 -3
  525. package/dist/api/types/CompatiblePlansResponseData.d.ts +0 -3
  526. package/dist/api/types/ComponentCapabilities.d.ts +0 -3
  527. package/dist/api/types/ComponentCheckoutSettings.d.ts +0 -3
  528. package/dist/api/types/ComponentDisplaySettings.d.ts +0 -3
  529. package/dist/api/types/ComponentEntityType.d.ts +1 -4
  530. package/dist/api/types/ComponentHydrateResponseData.d.ts +1 -4
  531. package/dist/api/types/ComponentPreviewResponseData.d.ts +1 -4
  532. package/dist/api/types/ComponentResponseData.d.ts +1 -4
  533. package/dist/api/types/ComponentSettingsResponseData.d.ts +0 -3
  534. package/dist/api/types/ComponentState.d.ts +1 -4
  535. package/dist/api/types/Condition.d.ts +1 -4
  536. package/dist/api/types/ConditionConditionType.d.ts +1 -4
  537. package/dist/api/types/ConditionGroup.d.ts +1 -4
  538. package/dist/api/types/ConditionMetricPeriod.d.ts +1 -4
  539. package/dist/api/types/ConditionMetricPeriodMonthReset.d.ts +1 -4
  540. package/dist/api/types/ConditionOperator.d.ts +1 -4
  541. package/dist/api/types/CountResponse.d.ts +0 -3
  542. package/dist/api/types/CouponRequestBody.d.ts +0 -3
  543. package/dist/api/{resources/credits/client/requests → types}/CreateBillingPlanCreditGrantRequestBody.d.ts +1 -14
  544. package/dist/api/types/CreateBillingPriceTierRequestBody.d.ts +2 -3
  545. package/dist/api/types/CreateEntitlementInBundleRequestBody.d.ts +29 -0
  546. package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +7 -0
  547. package/dist/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +5 -0
  548. package/dist/api/types/CreateEntitlementReqCommon.d.ts +1 -4
  549. package/dist/api/types/CreateEntitlementReqCommonMetricPeriod.d.ts +1 -4
  550. package/dist/api/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +1 -4
  551. package/dist/api/types/CreateEventRequestBody.d.ts +1 -4
  552. package/dist/api/types/CreateFlagRequestBody.d.ts +1 -4
  553. package/dist/api/types/CreateOrUpdateConditionGroupRequestBody.d.ts +1 -4
  554. package/dist/api/types/CreateOrUpdateConditionRequestBody.d.ts +1 -4
  555. package/dist/api/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +1 -5
  556. package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +2 -7
  557. package/dist/api/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +2 -7
  558. package/dist/api/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +1 -4
  559. package/dist/api/types/CreateOrUpdateFlagRequestBody.d.ts +1 -4
  560. package/dist/api/types/CreateOrUpdateRuleRequestBody.d.ts +1 -4
  561. package/dist/api/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -4
  562. package/dist/api/types/CreatePlanRequestBody.d.ts +7 -0
  563. package/dist/api/types/CreatePriceTierRequestBody.d.ts +0 -3
  564. package/dist/api/types/CreditAutoTopupAmountType.d.ts +0 -3
  565. package/dist/api/types/CreditBundlePurchaseResponseData.d.ts +1 -4
  566. package/dist/api/types/CreditCompanyGrantView.d.ts +5 -4
  567. package/dist/api/types/CreditGrantDetail.d.ts +1 -4
  568. package/dist/api/types/CreditGrantExpiryRequestBody.d.ts +1 -4
  569. package/dist/api/types/CreditGrantSortOrder.d.ts +1 -4
  570. package/dist/api/types/CreditLedgerEnrichedEntryResponseData.d.ts +1 -4
  571. package/dist/api/types/CreditLedgerPeriod.d.ts +1 -4
  572. package/dist/api/types/CreditTransferResponseData.d.ts +8 -0
  573. package/dist/api/types/CreditTransferView.d.ts +8 -0
  574. package/dist/api/types/CreditTriggerConfig.d.ts +0 -3
  575. package/dist/api/types/CreditUsage.d.ts +2 -4
  576. package/dist/api/types/CreditUsageAggregation.d.ts +10 -0
  577. package/dist/api/types/CreditUsageResponseData.d.ts +2 -4
  578. package/dist/api/types/CustomPlanConfig.d.ts +0 -3
  579. package/dist/api/types/CustomPlanViewConfigResponseData.d.ts +0 -3
  580. package/dist/api/types/DataExportOutputFileType.d.ts +0 -3
  581. package/dist/api/types/DataExportResponseData.d.ts +1 -4
  582. package/dist/api/types/DataExportStatus.d.ts +1 -4
  583. package/dist/api/types/DataExportType.d.ts +0 -3
  584. package/dist/api/types/DeleteBillingPlanCreditGrantRequestBody.d.ts +3 -0
  585. package/dist/api/types/DeleteResponse.d.ts +0 -3
  586. package/dist/api/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +1 -4
  587. package/dist/api/types/EntitlementPriceBehavior.d.ts +1 -4
  588. package/dist/api/types/EntitlementTriggerConfig.d.ts +0 -3
  589. package/dist/api/types/EntitlementType.d.ts +1 -4
  590. package/dist/api/types/EntitlementValueType.d.ts +1 -4
  591. package/dist/api/types/EntitlementsInPlan.d.ts +0 -3
  592. package/dist/api/types/EntityKeyDefinitionResponseData.d.ts +1 -4
  593. package/dist/api/types/EntityKeyDetailResponseData.d.ts +1 -4
  594. package/dist/api/types/EntityKeyResponseData.d.ts +1 -4
  595. package/dist/api/types/EntityTraitDefinitionResponseData.d.ts +1 -4
  596. package/dist/api/types/EntityTraitDetailResponseData.d.ts +1 -4
  597. package/dist/api/types/EntityTraitResponseData.d.ts +0 -3
  598. package/dist/api/types/EntityTraitValue.d.ts +0 -3
  599. package/dist/api/types/EntityType.d.ts +1 -4
  600. package/dist/api/types/EnvironmentDetailResponseData.d.ts +1 -4
  601. package/dist/api/types/EnvironmentResponseData.d.ts +1 -4
  602. package/dist/api/types/EnvironmentType.d.ts +1 -4
  603. package/dist/api/types/EventBody.d.ts +1 -4
  604. package/dist/api/types/EventBodyFlagCheck.d.ts +0 -3
  605. package/dist/api/types/EventBodyIdentify.d.ts +1 -4
  606. package/dist/api/types/EventBodyIdentifyCompany.d.ts +0 -3
  607. package/dist/api/types/EventBodyTrack.d.ts +0 -3
  608. package/dist/api/types/EventDetailResponseData.d.ts +2 -5
  609. package/dist/api/types/EventResponseData.d.ts +2 -5
  610. package/dist/api/types/EventStatus.d.ts +1 -4
  611. package/dist/api/types/EventSummaryResponseData.d.ts +0 -3
  612. package/dist/api/types/EventType.d.ts +1 -4
  613. package/dist/api/types/FeatureCompanyResponseData.d.ts +5 -6
  614. package/dist/api/types/FeatureCompanyUserResponseData.d.ts +1 -4
  615. package/dist/api/types/FeatureDetailResponseData.d.ts +1 -4
  616. package/dist/api/types/FeatureLedgerResponseData.d.ts +0 -3
  617. package/dist/api/types/FeatureLifecyclePhase.d.ts +1 -4
  618. package/dist/api/types/FeatureResponseData.d.ts +1 -4
  619. package/dist/api/types/FeatureType.d.ts +1 -4
  620. package/dist/api/types/FeatureUsageDataResponseData.d.ts +1 -4
  621. package/dist/api/types/FeatureUsageDetailResponseData.d.ts +1 -4
  622. package/dist/api/types/FeatureUsageResponseData.d.ts +5 -6
  623. package/dist/api/types/FlagDetailResponseData.d.ts +1 -4
  624. package/dist/api/types/FlagResponseData.d.ts +1 -4
  625. package/dist/api/types/FlagType.d.ts +0 -3
  626. package/dist/api/types/GenericPreviewObject.d.ts +0 -3
  627. package/dist/api/types/InvoiceRequestBody.d.ts +0 -3
  628. package/dist/api/types/InvoiceResponseData.d.ts +2 -3
  629. package/dist/api/types/IssueTemporaryAccessTokenResponseData.d.ts +1 -4
  630. package/dist/api/types/KeysRequestBody.d.ts +0 -3
  631. package/dist/api/types/ManagePlanPreviewResponseResponseData.d.ts +1 -4
  632. package/dist/api/types/ManagePlanRequest.d.ts +1 -4
  633. package/dist/api/types/ManagePlanResponseResponseData.d.ts +1 -4
  634. package/dist/api/types/MeterRequestBody.d.ts +0 -3
  635. package/dist/api/types/OrderedPlansInGroup.d.ts +1 -4
  636. package/dist/api/types/PaymentMethodRequestBody.d.ts +0 -3
  637. package/dist/api/types/PaymentMethodResponseData.d.ts +2 -3
  638. package/dist/api/types/PlanBundleAction.d.ts +6 -0
  639. package/dist/api/types/PlanBundleCreditGrantRequestBody.d.ts +8 -0
  640. package/dist/api/types/PlanBundleEntitlementRequestBody.d.ts +6 -0
  641. package/dist/api/types/PlanBundleResponseData.d.ts +8 -0
  642. package/dist/api/types/PlanChangeAction.d.ts +1 -4
  643. package/dist/api/types/PlanChangeActorType.d.ts +1 -4
  644. package/dist/api/types/PlanChangeBasePlanAction.d.ts +1 -4
  645. package/dist/api/types/PlanChangeResponseData.d.ts +1 -4
  646. package/dist/api/types/PlanChangeSubscriptionAction.d.ts +2 -4
  647. package/dist/api/types/PlanControlledByType.d.ts +1 -4
  648. package/dist/api/types/PlanCreditGrantView.d.ts +1 -4
  649. package/dist/api/types/PlanDetailResponseData.d.ts +2 -4
  650. package/dist/api/types/PlanEntitlementResponseData.d.ts +1 -4
  651. package/dist/api/types/PlanEntitlementsOrder.d.ts +0 -3
  652. package/dist/api/types/PlanGroupBundleOrder.d.ts +0 -3
  653. package/dist/api/types/PlanGroupDetailResponseData.d.ts +1 -4
  654. package/dist/api/types/PlanGroupPlanDetailResponseData.d.ts +2 -4
  655. package/dist/api/types/PlanGroupPlanEntitlementsOrder.d.ts +1 -4
  656. package/dist/api/types/PlanGroupResponseData.d.ts +1 -4
  657. package/dist/api/types/PlanIssueResponseData.d.ts +0 -3
  658. package/dist/api/types/PlanResponseData.d.ts +1 -4
  659. package/dist/api/types/PlanSelection.d.ts +0 -3
  660. package/dist/api/types/PlanSnapshotView.d.ts +0 -3
  661. package/dist/api/types/PlanTraitResponseData.d.ts +0 -3
  662. package/dist/api/types/PlanType.d.ts +1 -4
  663. package/dist/api/types/PlanVersionResponseData.d.ts +14 -0
  664. package/dist/api/types/PlanVersionStatus.d.ts +6 -0
  665. package/dist/api/types/PreviewObject.d.ts +0 -3
  666. package/dist/api/types/PreviewObjectResponseData.d.ts +0 -3
  667. package/dist/api/types/PreviewSubscriptionChangeResponseData.d.ts +1 -4
  668. package/dist/api/types/PreviewSubscriptionFinanceResponseData.d.ts +1 -4
  669. package/dist/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.d.ts +0 -3
  670. package/dist/api/types/ProrationBehavior.d.ts +1 -4
  671. package/dist/api/types/QuickstartResp.d.ts +0 -3
  672. package/dist/api/types/RawEventBatchResponseData.d.ts +1 -4
  673. package/dist/api/types/RawEventResponseData.d.ts +1 -4
  674. package/dist/api/types/Rule.d.ts +1 -4
  675. package/dist/api/types/RuleConditionDetailResponseData.d.ts +1 -4
  676. package/dist/api/types/RuleConditionGroupDetailResponseData.d.ts +1 -4
  677. package/dist/api/types/RuleConditionGroupResponseData.d.ts +0 -3
  678. package/dist/api/types/RuleConditionResponseData.d.ts +1 -4
  679. package/dist/api/types/RuleDetailResponseData.d.ts +1 -4
  680. package/dist/api/types/RuleResponseData.d.ts +0 -3
  681. package/dist/api/types/RuleRuleType.d.ts +1 -4
  682. package/dist/api/types/RulesDetailResponseData.d.ts +1 -4
  683. package/dist/api/types/RulesEngineSchemaVersion.d.ts +2 -7
  684. package/dist/api/types/RulesengineCheckFlagResult.d.ts +1 -4
  685. package/dist/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +1 -4
  686. package/dist/api/types/RulesengineCheckFlagResultRuleType.d.ts +1 -4
  687. package/dist/api/types/RulesengineCompany.d.ts +1 -4
  688. package/dist/api/types/RulesengineCompanyMetric.d.ts +1 -4
  689. package/dist/api/types/RulesengineCompanyMetricMonthReset.d.ts +1 -4
  690. package/dist/api/types/RulesengineCompanyMetricPeriod.d.ts +1 -4
  691. package/dist/api/types/RulesengineCondition.d.ts +1 -4
  692. package/dist/api/types/RulesengineConditionConditionType.d.ts +1 -4
  693. package/dist/api/types/RulesengineConditionGroup.d.ts +1 -4
  694. package/dist/api/types/RulesengineConditionMetricPeriod.d.ts +1 -4
  695. package/dist/api/types/RulesengineConditionMetricPeriodMonthReset.d.ts +1 -4
  696. package/dist/api/types/RulesengineConditionOperator.d.ts +1 -4
  697. package/dist/api/types/RulesengineEntityType.d.ts +1 -4
  698. package/dist/api/types/RulesengineFlag.d.ts +1 -4
  699. package/dist/api/types/RulesengineRule.d.ts +1 -4
  700. package/dist/api/types/RulesengineRuleRuleType.d.ts +1 -4
  701. package/dist/api/types/RulesengineSubscription.d.ts +0 -3
  702. package/dist/api/types/RulesengineTrait.d.ts +1 -4
  703. package/dist/api/types/RulesengineTraitDefinition.d.ts +1 -4
  704. package/dist/api/types/RulesengineTraitDefinitionComparableType.d.ts +1 -4
  705. package/dist/api/types/RulesengineUser.d.ts +1 -4
  706. package/dist/api/types/SegmentStatusResp.d.ts +0 -3
  707. package/dist/api/types/SkippedEntitlementErrorResponseData.d.ts +0 -3
  708. package/dist/api/types/SkippedEntitlementResponseData.d.ts +1 -4
  709. package/dist/api/types/SortDirection.d.ts +1 -4
  710. package/dist/api/types/StripeEmbedInfo.d.ts +0 -3
  711. package/dist/api/types/SubscriptionStatus.d.ts +1 -4
  712. package/dist/api/types/SubscriptionTraitUpdate.d.ts +1 -4
  713. package/dist/api/types/SubscriptionType.d.ts +1 -4
  714. package/dist/api/types/TemporaryAccessTokenResourceType.d.ts +0 -3
  715. package/dist/api/types/TemporaryAccessTokenResponseData.d.ts +1 -4
  716. package/dist/api/types/TraitDefinition.d.ts +1 -4
  717. package/dist/api/types/TraitDefinitionComparableType.d.ts +1 -4
  718. package/dist/api/types/TraitType.d.ts +1 -4
  719. package/dist/api/types/UpdateAddOnRequestBody.d.ts +0 -3
  720. package/dist/api/{resources/credits/client/requests → types}/UpdateBillingPlanCreditGrantRequestBody.d.ts +1 -11
  721. package/dist/api/types/UpdateCreditBundleRequestBody.d.ts +0 -3
  722. package/dist/api/types/UpdateEntitlementReqCommon.d.ts +1 -4
  723. package/dist/api/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +1 -4
  724. package/dist/api/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +1 -4
  725. package/dist/api/types/UpdatePayInAdvanceRequestBody.d.ts +0 -3
  726. package/dist/api/types/UpdatePlanRequestBody.d.ts +5 -0
  727. package/dist/api/types/UpdatePlanTraitTraitRequestBody.d.ts +0 -3
  728. package/dist/api/types/UpdateRuleRequestBody.d.ts +1 -4
  729. package/dist/api/{resources/plans/client/requests → types}/UpsertBillingProductRequestBody.d.ts +1 -11
  730. package/dist/api/types/UpsertCompanyRequestBody.d.ts +0 -3
  731. package/dist/api/types/UpsertTraitRequestBody.d.ts +0 -3
  732. package/dist/api/types/UpsertUserRequestBody.d.ts +0 -3
  733. package/dist/api/types/UpsertUserSubRequestBody.d.ts +0 -3
  734. package/dist/api/types/UsageBasedEntitlementRequestBody.d.ts +1 -4
  735. package/dist/api/types/UsageBasedEntitlementResponseData.d.ts +1 -4
  736. package/dist/api/types/UserDetailResponseData.d.ts +1 -4
  737. package/dist/api/types/UserResponseData.d.ts +0 -3
  738. package/dist/api/types/WebhookEventDetailResponseData.d.ts +1 -4
  739. package/dist/api/types/WebhookEventResponseData.d.ts +1 -4
  740. package/dist/api/types/WebhookEventStatus.d.ts +1 -4
  741. package/dist/api/types/WebhookRequestType.d.ts +3 -4
  742. package/dist/api/types/WebhookResponseData.d.ts +1 -4
  743. package/dist/api/types/WebhookStatus.d.ts +1 -4
  744. package/dist/api/types/index.d.ts +39 -26
  745. package/dist/auth/HeaderAuthProvider.d.ts +16 -0
  746. package/dist/auth/index.d.ts +1 -0
  747. package/dist/cache.d.ts +1 -1
  748. package/dist/core/auth/AuthProvider.d.ts +7 -0
  749. package/dist/core/auth/AuthRequest.d.ts +9 -0
  750. package/dist/core/auth/BasicAuth.d.ts +8 -0
  751. package/dist/core/auth/BearerToken.d.ts +7 -0
  752. package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
  753. package/dist/core/auth/index.d.ts +5 -0
  754. package/dist/core/base64.d.ts +2 -0
  755. package/dist/core/exports.d.ts +1 -0
  756. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  757. package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
  758. package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
  759. package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
  760. package/dist/core/fetcher/Fetcher.d.ts +16 -6
  761. package/dist/core/fetcher/HttpResponsePromise.d.ts +1 -1
  762. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  763. package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
  764. package/dist/core/fetcher/getRequestBody.d.ts +1 -1
  765. package/dist/core/fetcher/index.d.ts +7 -4
  766. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  767. package/dist/core/fetcher/signals.d.ts +1 -7
  768. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +1 -1
  769. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +1 -1
  770. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  771. package/dist/core/headers.d.ts +2 -0
  772. package/dist/core/index.d.ts +4 -0
  773. package/dist/core/logging/exports.d.ts +18 -0
  774. package/dist/core/logging/index.d.ts +1 -0
  775. package/dist/core/logging/logger.d.ts +126 -0
  776. package/dist/core/schemas/Schema.d.ts +2 -1
  777. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  778. package/dist/core/schemas/builders/date/date.d.ts +1 -1
  779. package/dist/core/schemas/builders/enum/enum.d.ts +1 -1
  780. package/dist/core/schemas/builders/index.d.ts +14 -14
  781. package/dist/core/schemas/builders/lazy/index.d.ts +1 -1
  782. package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
  783. package/dist/core/schemas/builders/lazy/lazyObject.d.ts +2 -2
  784. package/dist/core/schemas/builders/list/list.d.ts +1 -1
  785. package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +1 -1
  786. package/dist/core/schemas/builders/literals/index.d.ts +1 -1
  787. package/dist/core/schemas/builders/literals/stringLiteral.d.ts +1 -1
  788. package/dist/core/schemas/builders/object/index.d.ts +2 -2
  789. package/dist/core/schemas/builders/object/object.d.ts +1 -1
  790. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +1 -1
  791. package/dist/core/schemas/builders/object/property.d.ts +1 -1
  792. package/dist/core/schemas/builders/object/types.d.ts +5 -5
  793. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +2 -2
  794. package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
  795. package/dist/core/schemas/builders/primitives/any.d.ts +2 -1
  796. package/dist/core/schemas/builders/primitives/boolean.d.ts +2 -1
  797. package/dist/core/schemas/builders/primitives/index.d.ts +1 -0
  798. package/dist/core/schemas/builders/primitives/never.d.ts +2 -0
  799. package/dist/core/schemas/builders/primitives/number.d.ts +2 -1
  800. package/dist/core/schemas/builders/primitives/string.d.ts +2 -1
  801. package/dist/core/schemas/builders/primitives/unknown.d.ts +2 -1
  802. package/dist/core/schemas/builders/record/record.d.ts +2 -2
  803. package/dist/core/schemas/builders/record/types.d.ts +2 -2
  804. package/dist/core/schemas/builders/schema-utils/JsonError.d.ts +1 -1
  805. package/dist/core/schemas/builders/schema-utils/ParseError.d.ts +1 -1
  806. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +1 -1
  807. package/dist/core/schemas/builders/schema-utils/index.d.ts +1 -1
  808. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +1 -1
  809. package/dist/core/schemas/builders/set/set.d.ts +1 -1
  810. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +1 -1
  811. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +2 -2
  812. package/dist/core/schemas/builders/union/index.d.ts +1 -1
  813. package/dist/core/schemas/builders/union/types.d.ts +2 -2
  814. package/dist/core/schemas/builders/union/union.d.ts +3 -3
  815. package/dist/core/schemas/index.d.ts +1 -1
  816. package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +1 -1
  817. package/dist/core/schemas/utils/maybeSkipValidation.d.ts +1 -1
  818. package/dist/core/url/encodePathParam.d.ts +1 -0
  819. package/dist/core/url/index.d.ts +3 -0
  820. package/dist/core/url/join.d.ts +1 -0
  821. package/dist/core/url/qs.d.ts +6 -0
  822. package/dist/environments.d.ts +0 -3
  823. package/dist/errors/SchematicError.d.ts +1 -4
  824. package/dist/errors/SchematicTimeoutError.d.ts +0 -3
  825. package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
  826. package/dist/events.d.ts +2 -2
  827. package/dist/exports.d.ts +1 -0
  828. package/dist/index.js +3 -3
  829. package/dist/serialization/resources/accesstokens/client/requests/IssueTemporaryAccessTokenRequestBody.d.ts +2 -6
  830. package/dist/serialization/resources/accesstokens/index.d.ts +1 -1
  831. package/dist/serialization/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.d.ts +2 -5
  832. package/dist/serialization/resources/accounts/client/requests/CreateApiKeyRequestBody.d.ts +2 -5
  833. package/dist/serialization/resources/accounts/client/requests/CreateEnvironmentRequestBody.d.ts +2 -5
  834. package/dist/serialization/resources/accounts/client/requests/UpdateApiKeyRequestBody.d.ts +2 -5
  835. package/dist/serialization/resources/accounts/client/requests/UpdateEnvironmentRequestBody.d.ts +2 -5
  836. package/dist/serialization/resources/accounts/client/requests/index.d.ts +1 -1
  837. package/dist/serialization/resources/accounts/index.d.ts +1 -1
  838. package/dist/serialization/resources/accounts/types/CountApiKeysParams.d.ts +2 -5
  839. package/dist/serialization/resources/accounts/types/CountApiKeysResponse.d.ts +2 -5
  840. package/dist/serialization/resources/accounts/types/CountApiRequestsParams.d.ts +2 -5
  841. package/dist/serialization/resources/accounts/types/CountApiRequestsResponse.d.ts +2 -5
  842. package/dist/serialization/resources/accounts/types/CreateApiKeyResponse.d.ts +2 -5
  843. package/dist/serialization/resources/accounts/types/CreateEnvironmentResponse.d.ts +2 -5
  844. package/dist/serialization/resources/accounts/types/DeleteApiKeyResponse.d.ts +2 -5
  845. package/dist/serialization/resources/accounts/types/DeleteEnvironmentResponse.d.ts +2 -5
  846. package/dist/serialization/resources/accounts/types/GetApiKeyResponse.d.ts +2 -5
  847. package/dist/serialization/resources/accounts/types/GetApiRequestResponse.d.ts +2 -5
  848. package/dist/serialization/resources/accounts/types/GetEnvironmentResponse.d.ts +2 -5
  849. package/dist/serialization/resources/accounts/types/ListApiKeysParams.d.ts +2 -5
  850. package/dist/serialization/resources/accounts/types/ListApiKeysResponse.d.ts +2 -5
  851. package/dist/serialization/resources/accounts/types/ListApiRequestsParams.d.ts +2 -5
  852. package/dist/serialization/resources/accounts/types/ListApiRequestsResponse.d.ts +2 -5
  853. package/dist/serialization/resources/accounts/types/ListEnvironmentsParams.d.ts +2 -5
  854. package/dist/serialization/resources/accounts/types/ListEnvironmentsResponse.d.ts +2 -5
  855. package/dist/serialization/resources/accounts/types/QuickstartResponse.d.ts +2 -5
  856. package/dist/serialization/resources/accounts/types/UpdateApiKeyResponse.d.ts +2 -5
  857. package/dist/serialization/resources/accounts/types/UpdateEnvironmentResponse.d.ts +2 -5
  858. package/dist/serialization/resources/accounts/types/index.d.ts +13 -13
  859. package/dist/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.d.ts +4 -6
  860. package/dist/serialization/resources/billing/client/requests/CreateBillingPriceRequestBody.d.ts +6 -7
  861. package/dist/serialization/resources/billing/client/requests/CreateBillingProductRequestBody.d.ts +4 -5
  862. package/dist/serialization/resources/billing/client/requests/CreateBillingSubscriptionRequestBody.d.ts +3 -6
  863. package/dist/serialization/resources/billing/client/requests/CreateCouponRequestBody.d.ts +2 -5
  864. package/dist/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.d.ts +2 -5
  865. package/dist/serialization/resources/billing/client/requests/CreateMeterRequestBody.d.ts +2 -5
  866. package/dist/serialization/resources/billing/client/requests/CreatePaymentMethodRequestBody.d.ts +2 -5
  867. package/dist/serialization/resources/billing/client/requests/index.d.ts +4 -4
  868. package/dist/serialization/resources/billing/index.d.ts +1 -1
  869. package/dist/serialization/resources/billing/types/CountBillingProductsParams.d.ts +4 -5
  870. package/dist/serialization/resources/billing/types/CountBillingProductsResponse.d.ts +2 -5
  871. package/dist/serialization/resources/billing/types/CountCustomersParams.d.ts +4 -6
  872. package/dist/serialization/resources/billing/types/CountCustomersResponse.d.ts +2 -5
  873. package/dist/serialization/resources/billing/types/DeleteBillingProductResponse.d.ts +2 -5
  874. package/dist/serialization/resources/billing/types/DeleteProductPriceResponse.d.ts +2 -5
  875. package/dist/serialization/resources/billing/types/ListBillingPricesParams.d.ts +5 -6
  876. package/dist/serialization/resources/billing/types/ListBillingPricesResponse.d.ts +2 -5
  877. package/dist/serialization/resources/billing/types/ListBillingProductPricesParams.d.ts +5 -6
  878. package/dist/serialization/resources/billing/types/ListBillingProductPricesResponse.d.ts +2 -5
  879. package/dist/serialization/resources/billing/types/ListBillingProductsParams.d.ts +4 -5
  880. package/dist/serialization/resources/billing/types/ListBillingProductsResponse.d.ts +2 -5
  881. package/dist/serialization/resources/billing/types/ListCouponsParams.d.ts +2 -5
  882. package/dist/serialization/resources/billing/types/ListCouponsResponse.d.ts +2 -5
  883. package/dist/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.d.ts +4 -6
  884. package/dist/serialization/resources/billing/types/ListCustomersWithSubscriptionsResponse.d.ts +2 -5
  885. package/dist/serialization/resources/billing/types/ListInvoicesParams.d.ts +2 -5
  886. package/dist/serialization/resources/billing/types/ListInvoicesResponse.d.ts +2 -5
  887. package/dist/serialization/resources/billing/types/ListMetersParams.d.ts +2 -5
  888. package/dist/serialization/resources/billing/types/ListMetersResponse.d.ts +2 -5
  889. package/dist/serialization/resources/billing/types/ListPaymentMethodsParams.d.ts +2 -5
  890. package/dist/serialization/resources/billing/types/ListPaymentMethodsResponse.d.ts +2 -5
  891. package/dist/serialization/resources/billing/types/UpsertBillingCouponResponse.d.ts +2 -5
  892. package/dist/serialization/resources/billing/types/UpsertBillingCustomerResponse.d.ts +2 -5
  893. package/dist/serialization/resources/billing/types/UpsertBillingMeterResponse.d.ts +2 -5
  894. package/dist/serialization/resources/billing/types/UpsertBillingPriceResponse.d.ts +2 -5
  895. package/dist/serialization/resources/billing/types/UpsertBillingProductResponse.d.ts +2 -5
  896. package/dist/serialization/resources/billing/types/UpsertBillingSubscriptionResponse.d.ts +2 -5
  897. package/dist/serialization/resources/billing/types/UpsertInvoiceResponse.d.ts +2 -5
  898. package/dist/serialization/resources/billing/types/UpsertPaymentMethodResponse.d.ts +2 -5
  899. package/dist/serialization/resources/billing/types/index.d.ts +17 -17
  900. package/dist/serialization/resources/checkout/client/requests/CancelSubscriptionRequest.d.ts +2 -5
  901. package/dist/serialization/resources/checkout/client/requests/CheckoutDataRequestBody.d.ts +2 -5
  902. package/dist/serialization/resources/checkout/client/requests/UpdateTrialEndRequestBody.d.ts +2 -5
  903. package/dist/serialization/resources/checkout/client/requests/index.d.ts +1 -1
  904. package/dist/serialization/resources/checkout/index.d.ts +1 -1
  905. package/dist/serialization/resources/checkout/types/CancelSubscriptionResponse.d.ts +2 -5
  906. package/dist/serialization/resources/checkout/types/CheckoutInternalResponse.d.ts +2 -5
  907. package/dist/serialization/resources/checkout/types/GetCheckoutDataResponse.d.ts +2 -5
  908. package/dist/serialization/resources/checkout/types/ManagePlanResponse.d.ts +2 -5
  909. package/dist/serialization/resources/checkout/types/PreviewCheckoutInternalResponse.d.ts +2 -5
  910. package/dist/serialization/resources/checkout/types/PreviewManagePlanResponse.d.ts +2 -5
  911. package/dist/serialization/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.d.ts +2 -5
  912. package/dist/serialization/resources/checkout/types/index.d.ts +2 -2
  913. package/dist/serialization/resources/companies/client/requests/CreateEntityTraitDefinitionRequestBody.d.ts +2 -5
  914. package/dist/serialization/resources/companies/client/requests/CreatePlanTraitRequestBody.d.ts +2 -5
  915. package/dist/serialization/resources/companies/client/requests/GetOrCreateCompanyMembershipRequestBody.d.ts +2 -5
  916. package/dist/serialization/resources/companies/client/requests/UpdateEntityTraitDefinitionRequestBody.d.ts +2 -5
  917. package/dist/serialization/resources/companies/client/requests/UpdatePlanTraitBulkRequestBody.d.ts +2 -5
  918. package/dist/serialization/resources/companies/client/requests/UpdatePlanTraitRequestBody.d.ts +2 -5
  919. package/dist/serialization/resources/companies/client/requests/index.d.ts +3 -3
  920. package/dist/serialization/resources/companies/index.d.ts +1 -1
  921. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterParams.d.ts +2 -5
  922. package/dist/serialization/resources/companies/types/CountCompaniesForAdvancedFilterResponse.d.ts +2 -5
  923. package/dist/serialization/resources/companies/types/CountCompaniesParams.d.ts +2 -5
  924. package/dist/serialization/resources/companies/types/CountCompaniesResponse.d.ts +2 -5
  925. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsParams.d.ts +2 -5
  926. package/dist/serialization/resources/companies/types/CountEntityKeyDefinitionsResponse.d.ts +2 -5
  927. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsParams.d.ts +2 -5
  928. package/dist/serialization/resources/companies/types/CountEntityTraitDefinitionsResponse.d.ts +2 -5
  929. package/dist/serialization/resources/companies/types/CountPlanTraitsParams.d.ts +2 -5
  930. package/dist/serialization/resources/companies/types/CountPlanTraitsResponse.d.ts +2 -5
  931. package/dist/serialization/resources/companies/types/CountUsersParams.d.ts +2 -5
  932. package/dist/serialization/resources/companies/types/CountUsersResponse.d.ts +2 -5
  933. package/dist/serialization/resources/companies/types/CreateCompanyResponse.d.ts +2 -5
  934. package/dist/serialization/resources/companies/types/CreatePlanTraitResponse.d.ts +2 -5
  935. package/dist/serialization/resources/companies/types/CreateUserResponse.d.ts +2 -5
  936. package/dist/serialization/resources/companies/types/DeleteCompanyByKeysResponse.d.ts +2 -5
  937. package/dist/serialization/resources/companies/types/DeleteCompanyMembershipResponse.d.ts +2 -5
  938. package/dist/serialization/resources/companies/types/DeleteCompanyParams.d.ts +2 -5
  939. package/dist/serialization/resources/companies/types/DeleteCompanyResponse.d.ts +2 -5
  940. package/dist/serialization/resources/companies/types/DeletePlanTraitResponse.d.ts +2 -5
  941. package/dist/serialization/resources/companies/types/DeleteUserByKeysResponse.d.ts +2 -5
  942. package/dist/serialization/resources/companies/types/DeleteUserResponse.d.ts +2 -5
  943. package/dist/serialization/resources/companies/types/GetActiveCompanySubscriptionParams.d.ts +2 -5
  944. package/dist/serialization/resources/companies/types/GetActiveCompanySubscriptionResponse.d.ts +2 -5
  945. package/dist/serialization/resources/companies/types/GetCompanyResponse.d.ts +2 -5
  946. package/dist/serialization/resources/companies/types/GetEntityTraitDefinitionResponse.d.ts +2 -5
  947. package/dist/serialization/resources/companies/types/GetEntityTraitValuesParams.d.ts +2 -5
  948. package/dist/serialization/resources/companies/types/GetEntityTraitValuesResponse.d.ts +2 -5
  949. package/dist/serialization/resources/companies/types/GetOrCreateCompanyMembershipResponse.d.ts +2 -5
  950. package/dist/serialization/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.d.ts +2 -5
  951. package/dist/serialization/resources/companies/types/GetPlanChangeResponse.d.ts +2 -5
  952. package/dist/serialization/resources/companies/types/GetPlanTraitResponse.d.ts +2 -5
  953. package/dist/serialization/resources/companies/types/GetUserResponse.d.ts +2 -5
  954. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterParams.d.ts +2 -5
  955. package/dist/serialization/resources/companies/types/ListCompaniesForAdvancedFilterResponse.d.ts +2 -5
  956. package/dist/serialization/resources/companies/types/ListCompaniesParams.d.ts +2 -5
  957. package/dist/serialization/resources/companies/types/ListCompaniesResponse.d.ts +2 -5
  958. package/dist/serialization/resources/companies/types/ListCompanyMembershipsParams.d.ts +2 -5
  959. package/dist/serialization/resources/companies/types/ListCompanyMembershipsResponse.d.ts +2 -5
  960. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsParams.d.ts +2 -5
  961. package/dist/serialization/resources/companies/types/ListEntityKeyDefinitionsResponse.d.ts +2 -5
  962. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsParams.d.ts +2 -5
  963. package/dist/serialization/resources/companies/types/ListEntityTraitDefinitionsResponse.d.ts +2 -5
  964. package/dist/serialization/resources/companies/types/ListPlanChangesParams.d.ts +2 -5
  965. package/dist/serialization/resources/companies/types/ListPlanChangesResponse.d.ts +2 -5
  966. package/dist/serialization/resources/companies/types/ListPlanTraitsParams.d.ts +2 -5
  967. package/dist/serialization/resources/companies/types/ListPlanTraitsResponse.d.ts +2 -5
  968. package/dist/serialization/resources/companies/types/ListUsersParams.d.ts +2 -5
  969. package/dist/serialization/resources/companies/types/ListUsersResponse.d.ts +2 -5
  970. package/dist/serialization/resources/companies/types/LookupCompanyParams.d.ts +2 -5
  971. package/dist/serialization/resources/companies/types/LookupCompanyResponse.d.ts +2 -5
  972. package/dist/serialization/resources/companies/types/LookupUserParams.d.ts +2 -5
  973. package/dist/serialization/resources/companies/types/LookupUserResponse.d.ts +2 -5
  974. package/dist/serialization/resources/companies/types/UpdateEntityTraitDefinitionResponse.d.ts +2 -5
  975. package/dist/serialization/resources/companies/types/UpdatePlanTraitResponse.d.ts +2 -5
  976. package/dist/serialization/resources/companies/types/UpdatePlanTraitsBulkResponse.d.ts +2 -5
  977. package/dist/serialization/resources/companies/types/UpsertCompanyResponse.d.ts +2 -5
  978. package/dist/serialization/resources/companies/types/UpsertCompanyTraitResponse.d.ts +2 -5
  979. package/dist/serialization/resources/companies/types/UpsertUserResponse.d.ts +2 -5
  980. package/dist/serialization/resources/companies/types/UpsertUserTraitResponse.d.ts +2 -5
  981. package/dist/serialization/resources/companies/types/index.d.ts +40 -42
  982. package/dist/serialization/resources/components/client/requests/CreateComponentRequestBody.d.ts +2 -5
  983. package/dist/serialization/resources/components/client/requests/UpdateComponentRequestBody.d.ts +2 -5
  984. package/dist/serialization/resources/components/index.d.ts +1 -1
  985. package/dist/serialization/resources/components/types/CountComponentsParams.d.ts +2 -5
  986. package/dist/serialization/resources/components/types/CountComponentsResponse.d.ts +2 -5
  987. package/dist/serialization/resources/components/types/CreateComponentResponse.d.ts +2 -5
  988. package/dist/serialization/resources/components/types/DeleteComponentResponse.d.ts +2 -5
  989. package/dist/serialization/resources/components/types/GetComponentResponse.d.ts +2 -5
  990. package/dist/serialization/resources/components/types/ListComponentsParams.d.ts +2 -5
  991. package/dist/serialization/resources/components/types/ListComponentsResponse.d.ts +2 -5
  992. package/dist/serialization/resources/components/types/PreviewComponentDataParams.d.ts +2 -5
  993. package/dist/serialization/resources/components/types/PreviewComponentDataResponse.d.ts +2 -5
  994. package/dist/serialization/resources/components/types/UpdateComponentResponse.d.ts +2 -5
  995. package/dist/serialization/resources/components/types/index.d.ts +6 -6
  996. package/dist/serialization/resources/credits/client/requests/CreateBillingCreditRequestBody.d.ts +2 -5
  997. package/dist/serialization/resources/credits/client/requests/CreateCompanyCreditGrant.d.ts +2 -5
  998. package/dist/serialization/resources/credits/client/requests/CreateCreditBundleRequestBody.d.ts +3 -6
  999. package/dist/serialization/resources/credits/client/requests/UpdateBillingCreditRequestBody.d.ts +2 -5
  1000. package/dist/serialization/resources/credits/client/requests/UpdateCreditBundleDetailsRequestBody.d.ts +3 -6
  1001. package/dist/serialization/resources/credits/client/requests/ZeroOutGrantRequestBody.d.ts +2 -5
  1002. package/dist/serialization/resources/credits/client/requests/index.d.ts +2 -4
  1003. package/dist/serialization/resources/credits/index.d.ts +1 -1
  1004. package/dist/serialization/resources/credits/types/CountBillingCreditsGrantsParams.d.ts +2 -5
  1005. package/dist/serialization/resources/credits/types/CountBillingCreditsGrantsResponse.d.ts +2 -5
  1006. package/dist/serialization/resources/credits/types/CountBillingCreditsParams.d.ts +2 -5
  1007. package/dist/serialization/resources/credits/types/CountBillingCreditsResponse.d.ts +2 -5
  1008. package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsParams.d.ts +2 -5
  1009. package/dist/serialization/resources/credits/types/CountBillingPlanCreditGrantsResponse.d.ts +2 -5
  1010. package/dist/serialization/resources/credits/types/CountCompanyGrantsParams.d.ts +15 -0
  1011. package/dist/serialization/resources/credits/types/CountCompanyGrantsResponse.d.ts +12 -0
  1012. package/dist/serialization/resources/credits/types/CountCreditBundlesParams.d.ts +3 -6
  1013. package/dist/serialization/resources/credits/types/CountCreditBundlesResponse.d.ts +2 -5
  1014. package/dist/serialization/resources/credits/types/CountCreditLedgerParams.d.ts +2 -5
  1015. package/dist/serialization/resources/credits/types/CountCreditLedgerResponse.d.ts +2 -5
  1016. package/dist/serialization/resources/credits/types/CreateBillingCreditResponse.d.ts +2 -5
  1017. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantResponse.d.ts +2 -5
  1018. package/dist/serialization/resources/credits/types/CreateCreditBundleResponse.d.ts +2 -5
  1019. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +2 -5
  1020. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +2 -5
  1021. package/dist/serialization/resources/credits/types/DeleteCreditBundleResponse.d.ts +2 -5
  1022. package/dist/serialization/resources/credits/types/GetCreditBundleResponse.d.ts +2 -5
  1023. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +2 -5
  1024. package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +2 -5
  1025. package/dist/serialization/resources/credits/types/GetSingleBillingCreditResponse.d.ts +2 -5
  1026. package/dist/serialization/resources/credits/types/GrantBillingCreditsToCompanyResponse.d.ts +2 -5
  1027. package/dist/serialization/resources/credits/types/ListBillingCreditsParams.d.ts +2 -5
  1028. package/dist/serialization/resources/credits/types/ListBillingCreditsResponse.d.ts +2 -5
  1029. package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsParams.d.ts +2 -5
  1030. package/dist/serialization/resources/credits/types/ListBillingPlanCreditGrantsResponse.d.ts +2 -5
  1031. package/dist/serialization/resources/credits/types/ListCompanyGrantsParams.d.ts +3 -6
  1032. package/dist/serialization/resources/credits/types/ListCompanyGrantsResponse.d.ts +2 -5
  1033. package/dist/serialization/resources/credits/types/ListCreditBundlesParams.d.ts +3 -6
  1034. package/dist/serialization/resources/credits/types/ListCreditBundlesResponse.d.ts +2 -5
  1035. package/dist/serialization/resources/credits/types/ListGrantsForCreditParams.d.ts +2 -5
  1036. package/dist/serialization/resources/credits/types/ListGrantsForCreditResponse.d.ts +2 -5
  1037. package/dist/serialization/resources/credits/types/SoftDeleteBillingCreditResponse.d.ts +2 -5
  1038. package/dist/serialization/resources/credits/types/UpdateBillingCreditResponse.d.ts +2 -5
  1039. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantResponse.d.ts +2 -5
  1040. package/dist/serialization/resources/credits/types/UpdateCreditBundleDetailsResponse.d.ts +2 -5
  1041. package/dist/serialization/resources/credits/types/ZeroOutGrantResponse.d.ts +2 -5
  1042. package/dist/serialization/resources/credits/types/index.d.ts +29 -27
  1043. package/dist/serialization/resources/dataexports/client/requests/CreateDataExportRequestBody.d.ts +2 -5
  1044. package/dist/serialization/resources/dataexports/index.d.ts +1 -1
  1045. package/dist/serialization/resources/dataexports/types/CreateDataExportResponse.d.ts +2 -5
  1046. package/dist/serialization/resources/entitlements/client/requests/CreateCompanyOverrideRequestBody.d.ts +3 -6
  1047. package/dist/serialization/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +5 -8
  1048. package/dist/serialization/resources/entitlements/client/requests/DuplicatePlanEntitlementsRequestBody.d.ts +2 -5
  1049. package/dist/serialization/resources/entitlements/client/requests/UpdateCompanyOverrideRequestBody.d.ts +3 -6
  1050. package/dist/serialization/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +5 -8
  1051. package/dist/serialization/resources/entitlements/client/requests/index.d.ts +2 -2
  1052. package/dist/serialization/resources/entitlements/index.d.ts +1 -1
  1053. package/dist/serialization/resources/entitlements/types/CountCompanyOverridesParams.d.ts +2 -5
  1054. package/dist/serialization/resources/entitlements/types/CountCompanyOverridesResponse.d.ts +2 -5
  1055. package/dist/serialization/resources/entitlements/types/CountFeatureCompaniesParams.d.ts +2 -5
  1056. package/dist/serialization/resources/entitlements/types/CountFeatureCompaniesResponse.d.ts +2 -5
  1057. package/dist/serialization/resources/entitlements/types/CountFeatureUsageParams.d.ts +3 -5
  1058. package/dist/serialization/resources/entitlements/types/CountFeatureUsageResponse.d.ts +2 -5
  1059. package/dist/serialization/resources/entitlements/types/CountFeatureUsersParams.d.ts +2 -5
  1060. package/dist/serialization/resources/entitlements/types/CountFeatureUsersResponse.d.ts +2 -5
  1061. package/dist/serialization/resources/entitlements/types/CountPlanEntitlementsParams.d.ts +2 -5
  1062. package/dist/serialization/resources/entitlements/types/CountPlanEntitlementsResponse.d.ts +2 -5
  1063. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriod.d.ts +2 -5
  1064. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1065. package/dist/serialization/resources/entitlements/types/CreateCompanyOverrideResponse.d.ts +2 -5
  1066. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriod.d.ts +2 -5
  1067. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1068. package/dist/serialization/resources/entitlements/types/CreatePlanEntitlementResponse.d.ts +2 -5
  1069. package/dist/serialization/resources/entitlements/types/DeleteCompanyOverrideResponse.d.ts +2 -5
  1070. package/dist/serialization/resources/entitlements/types/DeletePlanEntitlementResponse.d.ts +2 -5
  1071. package/dist/serialization/resources/entitlements/types/DuplicatePlanEntitlementsResponse.d.ts +2 -5
  1072. package/dist/serialization/resources/entitlements/types/GetCompanyOverrideResponse.d.ts +2 -5
  1073. package/dist/serialization/resources/entitlements/types/GetFeatureUsageByCompanyParams.d.ts +2 -5
  1074. package/dist/serialization/resources/entitlements/types/GetFeatureUsageByCompanyResponse.d.ts +2 -5
  1075. package/dist/serialization/resources/entitlements/types/GetPlanEntitlementResponse.d.ts +2 -5
  1076. package/dist/serialization/resources/entitlements/types/ListCompanyOverridesParams.d.ts +2 -5
  1077. package/dist/serialization/resources/entitlements/types/ListCompanyOverridesResponse.d.ts +2 -5
  1078. package/dist/serialization/resources/entitlements/types/ListFeatureCompaniesParams.d.ts +2 -5
  1079. package/dist/serialization/resources/entitlements/types/ListFeatureCompaniesResponse.d.ts +2 -5
  1080. package/dist/serialization/resources/entitlements/types/ListFeatureUsageParams.d.ts +3 -5
  1081. package/dist/serialization/resources/entitlements/types/ListFeatureUsageResponse.d.ts +2 -5
  1082. package/dist/serialization/resources/entitlements/types/ListFeatureUsersParams.d.ts +2 -5
  1083. package/dist/serialization/resources/entitlements/types/ListFeatureUsersResponse.d.ts +2 -5
  1084. package/dist/serialization/resources/entitlements/types/ListPlanEntitlementsParams.d.ts +2 -5
  1085. package/dist/serialization/resources/entitlements/types/ListPlanEntitlementsResponse.d.ts +2 -5
  1086. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriod.d.ts +2 -5
  1087. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1088. package/dist/serialization/resources/entitlements/types/UpdateCompanyOverrideResponse.d.ts +2 -5
  1089. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriod.d.ts +2 -5
  1090. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1091. package/dist/serialization/resources/entitlements/types/UpdatePlanEntitlementResponse.d.ts +2 -5
  1092. package/dist/serialization/resources/entitlements/types/index.d.ts +24 -24
  1093. package/dist/serialization/resources/events/client/requests/CreateEventBatchRequestBody.d.ts +2 -5
  1094. package/dist/serialization/resources/events/index.d.ts +1 -1
  1095. package/dist/serialization/resources/events/types/CreateEventBatchResponse.d.ts +2 -5
  1096. package/dist/serialization/resources/events/types/CreateEventResponse.d.ts +2 -5
  1097. package/dist/serialization/resources/events/types/GetEventResponse.d.ts +2 -5
  1098. package/dist/serialization/resources/events/types/GetEventSummariesParams.d.ts +2 -5
  1099. package/dist/serialization/resources/events/types/GetEventSummariesResponse.d.ts +2 -5
  1100. package/dist/serialization/resources/events/types/GetSegmentIntegrationStatusResponse.d.ts +2 -5
  1101. package/dist/serialization/resources/events/types/ListEventsParams.d.ts +2 -5
  1102. package/dist/serialization/resources/events/types/ListEventsResponse.d.ts +2 -5
  1103. package/dist/serialization/resources/events/types/index.d.ts +3 -3
  1104. package/dist/serialization/resources/features/client/requests/CheckFlagsBulkRequestBody.d.ts +2 -5
  1105. package/dist/serialization/resources/features/client/requests/CreateFeatureRequestBody.d.ts +3 -6
  1106. package/dist/serialization/resources/features/client/requests/UpdateFeatureRequestBody.d.ts +3 -6
  1107. package/dist/serialization/resources/features/client/requests/UpdateFlagRulesRequestBody.d.ts +2 -5
  1108. package/dist/serialization/resources/features/client/requests/index.d.ts +1 -1
  1109. package/dist/serialization/resources/features/index.d.ts +1 -1
  1110. package/dist/serialization/resources/features/types/CheckFlagResponse.d.ts +2 -5
  1111. package/dist/serialization/resources/features/types/CheckFlagsBulkResponse.d.ts +2 -5
  1112. package/dist/serialization/resources/features/types/CheckFlagsResponse.d.ts +2 -5
  1113. package/dist/serialization/resources/features/types/CountFeaturesParams.d.ts +2 -5
  1114. package/dist/serialization/resources/features/types/CountFeaturesResponse.d.ts +2 -5
  1115. package/dist/serialization/resources/features/types/CountFlagsParams.d.ts +2 -5
  1116. package/dist/serialization/resources/features/types/CountFlagsResponse.d.ts +2 -5
  1117. package/dist/serialization/resources/features/types/CreateFeatureResponse.d.ts +2 -5
  1118. package/dist/serialization/resources/features/types/CreateFlagResponse.d.ts +2 -5
  1119. package/dist/serialization/resources/features/types/DeleteFeatureResponse.d.ts +2 -5
  1120. package/dist/serialization/resources/features/types/DeleteFlagResponse.d.ts +2 -5
  1121. package/dist/serialization/resources/features/types/GetFeatureResponse.d.ts +2 -5
  1122. package/dist/serialization/resources/features/types/GetFlagResponse.d.ts +2 -5
  1123. package/dist/serialization/resources/features/types/ListFeaturesParams.d.ts +2 -5
  1124. package/dist/serialization/resources/features/types/ListFeaturesResponse.d.ts +2 -5
  1125. package/dist/serialization/resources/features/types/ListFlagsParams.d.ts +2 -5
  1126. package/dist/serialization/resources/features/types/ListFlagsResponse.d.ts +2 -5
  1127. package/dist/serialization/resources/features/types/UpdateFeatureResponse.d.ts +2 -5
  1128. package/dist/serialization/resources/features/types/UpdateFlagResponse.d.ts +2 -5
  1129. package/dist/serialization/resources/features/types/UpdateFlagRulesResponse.d.ts +2 -5
  1130. package/dist/serialization/resources/features/types/index.d.ts +14 -14
  1131. package/dist/serialization/resources/index.d.ts +25 -25
  1132. package/dist/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.d.ts +18 -0
  1133. package/dist/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.d.ts +18 -0
  1134. package/dist/serialization/resources/planbundle/client/requests/index.d.ts +2 -0
  1135. package/dist/serialization/resources/planbundle/types/CreatePlanBundleResponse.d.ts +11 -0
  1136. package/dist/serialization/resources/planbundle/types/UpdatePlanBundleResponse.d.ts +11 -0
  1137. package/dist/serialization/resources/planbundle/types/index.d.ts +2 -0
  1138. package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +2 -5
  1139. package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +2 -5
  1140. package/dist/serialization/resources/plangroups/index.d.ts +1 -1
  1141. package/dist/serialization/resources/plangroups/types/CreatePlanGroupResponse.d.ts +2 -5
  1142. package/dist/serialization/resources/plangroups/types/GetPlanGroupResponse.d.ts +2 -5
  1143. package/dist/serialization/resources/plangroups/types/UpdatePlanGroupResponse.d.ts +2 -5
  1144. package/dist/serialization/resources/plangroups/types/index.d.ts +1 -1
  1145. package/dist/serialization/resources/plans/client/requests/UpdateCompanyPlansRequestBody.d.ts +2 -5
  1146. package/dist/serialization/resources/plans/client/requests/index.d.ts +0 -3
  1147. package/dist/serialization/resources/plans/index.d.ts +1 -1
  1148. package/dist/serialization/resources/plans/types/CountPlansParams.d.ts +2 -5
  1149. package/dist/serialization/resources/plans/types/CountPlansResponse.d.ts +2 -5
  1150. package/dist/serialization/resources/plans/types/CreatePlanResponse.d.ts +2 -5
  1151. package/dist/serialization/resources/plans/types/DeletePlanResponse.d.ts +2 -5
  1152. package/dist/serialization/resources/plans/types/GetPlanResponse.d.ts +2 -5
  1153. package/dist/serialization/resources/plans/types/ListPlanIssuesParams.d.ts +2 -5
  1154. package/dist/serialization/resources/plans/types/ListPlanIssuesResponse.d.ts +2 -5
  1155. package/dist/serialization/resources/plans/types/ListPlansParams.d.ts +2 -5
  1156. package/dist/serialization/resources/plans/types/ListPlansResponse.d.ts +2 -5
  1157. package/dist/serialization/resources/plans/types/UpdateCompanyPlansResponse.d.ts +2 -5
  1158. package/dist/serialization/resources/plans/types/UpdatePlanResponse.d.ts +2 -5
  1159. package/dist/serialization/resources/plans/types/UpsertBillingProductPlanResponse.d.ts +2 -5
  1160. package/dist/serialization/resources/plans/types/index.d.ts +8 -8
  1161. package/dist/serialization/resources/webhooks/client/requests/CreateWebhookRequestBody.d.ts +2 -5
  1162. package/dist/serialization/resources/webhooks/client/requests/UpdateWebhookRequestBody.d.ts +2 -5
  1163. package/dist/serialization/resources/webhooks/index.d.ts +1 -1
  1164. package/dist/serialization/resources/webhooks/types/CountWebhookEventsParams.d.ts +2 -5
  1165. package/dist/serialization/resources/webhooks/types/CountWebhookEventsResponse.d.ts +2 -5
  1166. package/dist/serialization/resources/webhooks/types/CountWebhooksParams.d.ts +2 -5
  1167. package/dist/serialization/resources/webhooks/types/CountWebhooksResponse.d.ts +2 -5
  1168. package/dist/serialization/resources/webhooks/types/CreateWebhookResponse.d.ts +2 -5
  1169. package/dist/serialization/resources/webhooks/types/DeleteWebhookResponse.d.ts +2 -5
  1170. package/dist/serialization/resources/webhooks/types/GetWebhookEventResponse.d.ts +2 -5
  1171. package/dist/serialization/resources/webhooks/types/GetWebhookResponse.d.ts +2 -5
  1172. package/dist/serialization/resources/webhooks/types/ListWebhookEventsParams.d.ts +2 -5
  1173. package/dist/serialization/resources/webhooks/types/ListWebhookEventsResponse.d.ts +2 -5
  1174. package/dist/serialization/resources/webhooks/types/ListWebhooksParams.d.ts +2 -5
  1175. package/dist/serialization/resources/webhooks/types/ListWebhooksResponse.d.ts +2 -5
  1176. package/dist/serialization/resources/webhooks/types/UpdateWebhookResponse.d.ts +2 -5
  1177. package/dist/serialization/resources/webhooks/types/index.d.ts +8 -8
  1178. package/dist/serialization/types/ApiError.d.ts +2 -5
  1179. package/dist/serialization/types/ApiKeyCreateResponseData.d.ts +2 -5
  1180. package/dist/serialization/types/ApiKeyRequestListResponseData.d.ts +2 -5
  1181. package/dist/serialization/types/ApiKeyRequestResponseData.d.ts +2 -5
  1182. package/dist/serialization/types/ApiKeyResponseData.d.ts +2 -5
  1183. package/dist/serialization/types/ApiKeyScope.d.ts +2 -5
  1184. package/dist/serialization/types/BillingCouponResponseData.d.ts +4 -5
  1185. package/dist/serialization/types/BillingCreditBundleResponseData.d.ts +3 -6
  1186. package/dist/serialization/types/BillingCreditBundleStatus.d.ts +2 -5
  1187. package/dist/serialization/types/BillingCreditBundleType.d.ts +2 -5
  1188. package/dist/serialization/types/BillingCreditBundleView.d.ts +3 -6
  1189. package/dist/serialization/types/BillingCreditBurnStrategy.d.ts +2 -5
  1190. package/dist/serialization/types/BillingCreditExpiryType.d.ts +2 -5
  1191. package/dist/serialization/types/BillingCreditExpiryUnit.d.ts +2 -5
  1192. package/dist/serialization/types/BillingCreditGrantReason.d.ts +2 -5
  1193. package/dist/serialization/types/BillingCreditGrantResponseData.d.ts +8 -6
  1194. package/dist/serialization/types/BillingCreditGrantZeroedOutReason.d.ts +2 -5
  1195. package/dist/serialization/types/BillingCreditLedgerResponseData.d.ts +2 -5
  1196. package/dist/serialization/types/BillingCreditResponseData.d.ts +2 -5
  1197. package/dist/serialization/types/BillingCreditRolloverPolicy.d.ts +2 -5
  1198. package/dist/serialization/types/BillingCustomerResponseData.d.ts +4 -6
  1199. package/dist/serialization/types/BillingCustomerSubscription.d.ts +2 -5
  1200. package/dist/serialization/types/BillingCustomerWithSubscriptionsResponseData.d.ts +4 -6
  1201. package/dist/serialization/types/BillingMeterResponseData.d.ts +4 -5
  1202. package/dist/serialization/types/BillingPlanCreditGrantResetCadence.d.ts +2 -5
  1203. package/dist/serialization/types/BillingPlanCreditGrantResetStart.d.ts +2 -5
  1204. package/dist/serialization/types/BillingPlanCreditGrantResetType.d.ts +2 -5
  1205. package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +2 -5
  1206. package/dist/serialization/types/BillingPriceResponseData.d.ts +5 -6
  1207. package/dist/serialization/types/BillingPriceScheme.d.ts +2 -5
  1208. package/dist/serialization/types/BillingPriceUsageType.d.ts +2 -5
  1209. package/dist/serialization/types/BillingPriceView.d.ts +5 -6
  1210. package/dist/serialization/types/BillingProductDetailResponseData.d.ts +4 -5
  1211. package/dist/serialization/types/BillingProductForSubscriptionResponseData.d.ts +5 -6
  1212. package/dist/serialization/types/BillingProductPlanResponseData.d.ts +2 -5
  1213. package/dist/serialization/types/BillingProductPriceInterval.d.ts +2 -5
  1214. package/dist/serialization/types/BillingProductPriceResponseData.d.ts +5 -6
  1215. package/dist/serialization/types/BillingProductPriceTierResponseData.d.ts +2 -5
  1216. package/dist/serialization/types/BillingProductPricing.d.ts +2 -5
  1217. package/dist/serialization/types/BillingProductResponseData.d.ts +4 -5
  1218. package/dist/serialization/types/BillingProviderType.d.ts +7 -0
  1219. package/dist/serialization/types/BillingSubscriptionDiscount.d.ts +2 -5
  1220. package/dist/serialization/types/BillingSubscriptionDiscountView.d.ts +2 -5
  1221. package/dist/serialization/types/BillingSubscriptionResponseData.d.ts +4 -5
  1222. package/dist/serialization/types/BillingSubscriptionTrialEndSetting.d.ts +2 -5
  1223. package/dist/serialization/types/BillingSubscriptionView.d.ts +6 -7
  1224. package/dist/serialization/types/BillingTiersMode.d.ts +2 -5
  1225. package/dist/serialization/types/ChangeSubscriptionInternalRequestBody.d.ts +2 -5
  1226. package/dist/serialization/types/ChangeSubscriptionRequestBody.d.ts +2 -5
  1227. package/dist/serialization/types/ChargeType.d.ts +2 -5
  1228. package/dist/serialization/types/CheckFlagRequestBody.d.ts +2 -5
  1229. package/dist/serialization/types/CheckFlagResponseData.d.ts +2 -5
  1230. package/dist/serialization/types/CheckFlagsBulkResponseData.d.ts +2 -5
  1231. package/dist/serialization/types/CheckFlagsResponseData.d.ts +2 -5
  1232. package/dist/serialization/types/CheckoutDataResponseData.d.ts +6 -9
  1233. package/dist/serialization/types/CheckoutSettingsResponseData.d.ts +2 -5
  1234. package/dist/serialization/types/CheckoutSubscription.d.ts +4 -5
  1235. package/dist/serialization/types/CompanyDetailResponseData.d.ts +6 -9
  1236. package/dist/serialization/types/CompanyEventPeriodMetricsResponseData.d.ts +2 -5
  1237. package/dist/serialization/types/CompanyLedgerResponseData.d.ts +2 -5
  1238. package/dist/serialization/types/CompanyMembershipDetailResponseData.d.ts +2 -5
  1239. package/dist/serialization/types/CompanyMembershipResponseData.d.ts +2 -5
  1240. package/dist/serialization/types/CompanyOverrideNoteResponseData.d.ts +2 -5
  1241. package/dist/serialization/types/CompanyOverrideResponseData.d.ts +4 -7
  1242. package/dist/serialization/types/CompanyPlanDetailResponseData.d.ts +9 -10
  1243. package/dist/serialization/types/CompanyPlanInvalidReason.d.ts +2 -5
  1244. package/dist/serialization/types/CompanyPlanWithBillingSubView.d.ts +3 -5
  1245. package/dist/serialization/types/CompanyResponseData.d.ts +2 -5
  1246. package/dist/serialization/types/CompanySubscriptionResponseData.d.ts +3 -6
  1247. package/dist/serialization/types/CompanyViewWithFeatureUsageResponseData.d.ts +6 -9
  1248. package/dist/serialization/types/CompatiblePlans.d.ts +2 -5
  1249. package/dist/serialization/types/CompatiblePlansResponseData.d.ts +2 -5
  1250. package/dist/serialization/types/ComponentCapabilities.d.ts +2 -5
  1251. package/dist/serialization/types/ComponentCheckoutSettings.d.ts +2 -5
  1252. package/dist/serialization/types/ComponentDisplaySettings.d.ts +2 -5
  1253. package/dist/serialization/types/ComponentEntityType.d.ts +2 -5
  1254. package/dist/serialization/types/ComponentHydrateResponseData.d.ts +9 -12
  1255. package/dist/serialization/types/ComponentPreviewResponseData.d.ts +8 -11
  1256. package/dist/serialization/types/ComponentResponseData.d.ts +3 -6
  1257. package/dist/serialization/types/ComponentSettingsResponseData.d.ts +2 -5
  1258. package/dist/serialization/types/ComponentState.d.ts +2 -5
  1259. package/dist/serialization/types/Condition.d.ts +3 -6
  1260. package/dist/serialization/types/ConditionConditionType.d.ts +2 -5
  1261. package/dist/serialization/types/ConditionGroup.d.ts +2 -5
  1262. package/dist/serialization/types/ConditionMetricPeriod.d.ts +2 -5
  1263. package/dist/serialization/types/ConditionMetricPeriodMonthReset.d.ts +2 -5
  1264. package/dist/serialization/types/ConditionOperator.d.ts +2 -5
  1265. package/dist/serialization/types/CountResponse.d.ts +2 -5
  1266. package/dist/serialization/types/CouponRequestBody.d.ts +2 -5
  1267. package/dist/serialization/{resources/credits/client/requests → types}/CreateBillingPlanCreditGrantRequestBody.d.ts +10 -13
  1268. package/dist/serialization/types/CreateBillingPriceTierRequestBody.d.ts +4 -5
  1269. package/dist/serialization/types/CreateEntitlementInBundleRequestBody.d.ts +39 -0
  1270. package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.d.ts +7 -0
  1271. package/dist/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.d.ts +7 -0
  1272. package/dist/serialization/types/CreateEntitlementReqCommon.d.ts +2 -5
  1273. package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriod.d.ts +2 -5
  1274. package/dist/serialization/types/CreateEntitlementReqCommonMetricPeriodMonthReset.d.ts +2 -5
  1275. package/dist/serialization/types/CreateEventRequestBody.d.ts +2 -5
  1276. package/dist/serialization/types/CreateFlagRequestBody.d.ts +2 -5
  1277. package/dist/serialization/types/CreateOrUpdateConditionGroupRequestBody.d.ts +2 -5
  1278. package/dist/serialization/types/CreateOrUpdateConditionRequestBody.d.ts +2 -5
  1279. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyConditionType.d.ts +3 -6
  1280. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriod.d.ts +2 -5
  1281. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset.d.ts +2 -5
  1282. package/dist/serialization/types/CreateOrUpdateConditionRequestBodyOperator.d.ts +2 -5
  1283. package/dist/serialization/types/CreateOrUpdateFlagRequestBody.d.ts +2 -5
  1284. package/dist/serialization/types/CreateOrUpdateRuleRequestBody.d.ts +2 -5
  1285. package/dist/serialization/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +2 -5
  1286. package/dist/serialization/types/CreatePlanRequestBody.d.ts +13 -0
  1287. package/dist/serialization/types/CreatePriceTierRequestBody.d.ts +2 -5
  1288. package/dist/serialization/types/CreditAutoTopupAmountType.d.ts +2 -5
  1289. package/dist/serialization/types/CreditBundlePurchaseResponseData.d.ts +2 -5
  1290. package/dist/serialization/types/CreditCompanyGrantView.d.ts +9 -6
  1291. package/dist/serialization/types/CreditGrantDetail.d.ts +2 -5
  1292. package/dist/serialization/types/CreditGrantExpiryRequestBody.d.ts +2 -5
  1293. package/dist/serialization/types/CreditGrantSortOrder.d.ts +2 -5
  1294. package/dist/serialization/types/CreditLedgerEnrichedEntryResponseData.d.ts +3 -6
  1295. package/dist/serialization/types/CreditLedgerPeriod.d.ts +2 -5
  1296. package/dist/serialization/types/CreditTransferResponseData.d.ts +14 -0
  1297. package/dist/serialization/types/CreditTransferView.d.ts +14 -0
  1298. package/dist/serialization/types/CreditTriggerConfig.d.ts +2 -5
  1299. package/dist/serialization/types/CreditUsage.d.ts +4 -5
  1300. package/dist/serialization/types/CreditUsageAggregation.d.ts +12 -0
  1301. package/dist/serialization/types/CreditUsageResponseData.d.ts +2 -5
  1302. package/dist/serialization/types/CustomPlanConfig.d.ts +2 -5
  1303. package/dist/serialization/types/CustomPlanViewConfigResponseData.d.ts +2 -5
  1304. package/dist/serialization/types/DataExportOutputFileType.d.ts +2 -5
  1305. package/dist/serialization/types/DataExportResponseData.d.ts +3 -6
  1306. package/dist/serialization/types/DataExportStatus.d.ts +2 -5
  1307. package/dist/serialization/types/DataExportType.d.ts +2 -5
  1308. package/dist/serialization/types/DeleteBillingPlanCreditGrantRequestBody.d.ts +9 -0
  1309. package/dist/serialization/types/DeleteResponse.d.ts +2 -5
  1310. package/dist/serialization/types/DuplicatePlanEntitlementsResponseResponseData.d.ts +2 -5
  1311. package/dist/serialization/types/EntitlementPriceBehavior.d.ts +2 -5
  1312. package/dist/serialization/types/EntitlementTriggerConfig.d.ts +2 -5
  1313. package/dist/serialization/types/EntitlementType.d.ts +2 -5
  1314. package/dist/serialization/types/EntitlementValueType.d.ts +2 -5
  1315. package/dist/serialization/types/EntitlementsInPlan.d.ts +2 -5
  1316. package/dist/serialization/types/EntityKeyDefinitionResponseData.d.ts +2 -5
  1317. package/dist/serialization/types/EntityKeyDetailResponseData.d.ts +2 -5
  1318. package/dist/serialization/types/EntityKeyResponseData.d.ts +2 -5
  1319. package/dist/serialization/types/EntityTraitDefinitionResponseData.d.ts +2 -5
  1320. package/dist/serialization/types/EntityTraitDetailResponseData.d.ts +2 -5
  1321. package/dist/serialization/types/EntityTraitResponseData.d.ts +2 -5
  1322. package/dist/serialization/types/EntityTraitValue.d.ts +2 -5
  1323. package/dist/serialization/types/EntityType.d.ts +2 -5
  1324. package/dist/serialization/types/EnvironmentDetailResponseData.d.ts +2 -5
  1325. package/dist/serialization/types/EnvironmentResponseData.d.ts +2 -5
  1326. package/dist/serialization/types/EnvironmentType.d.ts +2 -5
  1327. package/dist/serialization/types/EventBody.d.ts +3 -6
  1328. package/dist/serialization/types/EventBodyFlagCheck.d.ts +2 -5
  1329. package/dist/serialization/types/EventBodyIdentify.d.ts +2 -5
  1330. package/dist/serialization/types/EventBodyIdentifyCompany.d.ts +2 -5
  1331. package/dist/serialization/types/EventBodyTrack.d.ts +2 -5
  1332. package/dist/serialization/types/EventDetailResponseData.d.ts +4 -7
  1333. package/dist/serialization/types/EventResponseData.d.ts +3 -6
  1334. package/dist/serialization/types/EventStatus.d.ts +2 -5
  1335. package/dist/serialization/types/EventSummaryResponseData.d.ts +2 -5
  1336. package/dist/serialization/types/EventType.d.ts +2 -5
  1337. package/dist/serialization/types/FeatureCompanyResponseData.d.ts +9 -10
  1338. package/dist/serialization/types/FeatureCompanyUserResponseData.d.ts +3 -6
  1339. package/dist/serialization/types/FeatureDetailResponseData.d.ts +4 -7
  1340. package/dist/serialization/types/FeatureLedgerResponseData.d.ts +2 -5
  1341. package/dist/serialization/types/FeatureLifecyclePhase.d.ts +2 -5
  1342. package/dist/serialization/types/FeatureResponseData.d.ts +3 -6
  1343. package/dist/serialization/types/FeatureType.d.ts +2 -5
  1344. package/dist/serialization/types/FeatureUsageDataResponseData.d.ts +3 -6
  1345. package/dist/serialization/types/FeatureUsageDetailResponseData.d.ts +2 -5
  1346. package/dist/serialization/types/FeatureUsageResponseData.d.ts +9 -10
  1347. package/dist/serialization/types/FlagDetailResponseData.d.ts +2 -5
  1348. package/dist/serialization/types/FlagResponseData.d.ts +2 -5
  1349. package/dist/serialization/types/FlagType.d.ts +2 -5
  1350. package/dist/serialization/types/GenericPreviewObject.d.ts +2 -5
  1351. package/dist/serialization/types/InvoiceRequestBody.d.ts +2 -5
  1352. package/dist/serialization/types/InvoiceResponseData.d.ts +4 -5
  1353. package/dist/serialization/types/IssueTemporaryAccessTokenResponseData.d.ts +2 -5
  1354. package/dist/serialization/types/KeysRequestBody.d.ts +2 -5
  1355. package/dist/serialization/types/ManagePlanPreviewResponseResponseData.d.ts +2 -5
  1356. package/dist/serialization/types/ManagePlanRequest.d.ts +2 -5
  1357. package/dist/serialization/types/ManagePlanResponseResponseData.d.ts +2 -5
  1358. package/dist/serialization/types/MeterRequestBody.d.ts +2 -5
  1359. package/dist/serialization/types/OrderedPlansInGroup.d.ts +2 -5
  1360. package/dist/serialization/types/PaymentMethodRequestBody.d.ts +2 -5
  1361. package/dist/serialization/types/PaymentMethodResponseData.d.ts +4 -5
  1362. package/dist/serialization/types/PlanBundleAction.d.ts +7 -0
  1363. package/dist/serialization/types/PlanBundleCreditGrantRequestBody.d.ts +17 -0
  1364. package/dist/serialization/types/PlanBundleEntitlementRequestBody.d.ts +13 -0
  1365. package/dist/serialization/types/PlanBundleResponseData.d.ts +18 -0
  1366. package/dist/serialization/types/PlanChangeAction.d.ts +2 -5
  1367. package/dist/serialization/types/PlanChangeActorType.d.ts +2 -5
  1368. package/dist/serialization/types/PlanChangeBasePlanAction.d.ts +2 -5
  1369. package/dist/serialization/types/PlanChangeResponseData.d.ts +6 -9
  1370. package/dist/serialization/types/PlanChangeSubscriptionAction.d.ts +3 -6
  1371. package/dist/serialization/types/PlanControlledByType.d.ts +2 -5
  1372. package/dist/serialization/types/PlanCreditGrantView.d.ts +2 -5
  1373. package/dist/serialization/types/PlanDetailResponseData.d.ts +7 -8
  1374. package/dist/serialization/types/PlanEntitlementResponseData.d.ts +7 -10
  1375. package/dist/serialization/types/PlanEntitlementsOrder.d.ts +2 -5
  1376. package/dist/serialization/types/PlanGroupBundleOrder.d.ts +2 -5
  1377. package/dist/serialization/types/PlanGroupDetailResponseData.d.ts +5 -8
  1378. package/dist/serialization/types/PlanGroupPlanDetailResponseData.d.ts +8 -9
  1379. package/dist/serialization/types/PlanGroupPlanEntitlementsOrder.d.ts +2 -5
  1380. package/dist/serialization/types/PlanGroupResponseData.d.ts +3 -6
  1381. package/dist/serialization/types/PlanIssueResponseData.d.ts +2 -5
  1382. package/dist/serialization/types/PlanResponseData.d.ts +2 -5
  1383. package/dist/serialization/types/PlanSelection.d.ts +2 -5
  1384. package/dist/serialization/types/PlanSnapshotView.d.ts +2 -5
  1385. package/dist/serialization/types/PlanTraitResponseData.d.ts +2 -5
  1386. package/dist/serialization/types/PlanType.d.ts +2 -5
  1387. package/dist/serialization/types/PlanVersionResponseData.d.ts +21 -0
  1388. package/dist/serialization/types/PlanVersionStatus.d.ts +7 -0
  1389. package/dist/serialization/types/PreviewObject.d.ts +2 -5
  1390. package/dist/serialization/types/PreviewObjectResponseData.d.ts +2 -5
  1391. package/dist/serialization/types/PreviewSubscriptionChangeResponseData.d.ts +3 -6
  1392. package/dist/serialization/types/PreviewSubscriptionFinanceResponseData.d.ts +2 -5
  1393. package/dist/serialization/types/PreviewSubscriptionUpcomingInvoiceLineItems.d.ts +2 -5
  1394. package/dist/serialization/types/ProrationBehavior.d.ts +2 -5
  1395. package/dist/serialization/types/QuickstartResp.d.ts +2 -5
  1396. package/dist/serialization/types/RawEventBatchResponseData.d.ts +2 -5
  1397. package/dist/serialization/types/RawEventResponseData.d.ts +3 -6
  1398. package/dist/serialization/types/Rule.d.ts +3 -6
  1399. package/dist/serialization/types/RuleConditionDetailResponseData.d.ts +3 -6
  1400. package/dist/serialization/types/RuleConditionGroupDetailResponseData.d.ts +2 -5
  1401. package/dist/serialization/types/RuleConditionGroupResponseData.d.ts +2 -5
  1402. package/dist/serialization/types/RuleConditionResponseData.d.ts +2 -5
  1403. package/dist/serialization/types/RuleDetailResponseData.d.ts +3 -6
  1404. package/dist/serialization/types/RuleResponseData.d.ts +2 -5
  1405. package/dist/serialization/types/RuleRuleType.d.ts +2 -5
  1406. package/dist/serialization/types/RulesDetailResponseData.d.ts +2 -5
  1407. package/dist/serialization/types/RulesEngineSchemaVersion.d.ts +2 -5
  1408. package/dist/serialization/types/RulesengineCheckFlagResult.d.ts +2 -5
  1409. package/dist/serialization/types/RulesengineCheckFlagResultFeatureUsagePeriod.d.ts +2 -5
  1410. package/dist/serialization/types/RulesengineCheckFlagResultRuleType.d.ts +2 -5
  1411. package/dist/serialization/types/RulesengineCompany.d.ts +2 -5
  1412. package/dist/serialization/types/RulesengineCompanyMetric.d.ts +2 -5
  1413. package/dist/serialization/types/RulesengineCompanyMetricMonthReset.d.ts +2 -5
  1414. package/dist/serialization/types/RulesengineCompanyMetricPeriod.d.ts +2 -5
  1415. package/dist/serialization/types/RulesengineCondition.d.ts +3 -6
  1416. package/dist/serialization/types/RulesengineConditionConditionType.d.ts +2 -5
  1417. package/dist/serialization/types/RulesengineConditionGroup.d.ts +2 -5
  1418. package/dist/serialization/types/RulesengineConditionMetricPeriod.d.ts +2 -5
  1419. package/dist/serialization/types/RulesengineConditionMetricPeriodMonthReset.d.ts +2 -5
  1420. package/dist/serialization/types/RulesengineConditionOperator.d.ts +2 -5
  1421. package/dist/serialization/types/RulesengineEntityType.d.ts +2 -5
  1422. package/dist/serialization/types/RulesengineFlag.d.ts +2 -5
  1423. package/dist/serialization/types/RulesengineRule.d.ts +3 -6
  1424. package/dist/serialization/types/RulesengineRuleRuleType.d.ts +2 -5
  1425. package/dist/serialization/types/RulesengineSubscription.d.ts +2 -5
  1426. package/dist/serialization/types/RulesengineTrait.d.ts +2 -5
  1427. package/dist/serialization/types/RulesengineTraitDefinition.d.ts +3 -6
  1428. package/dist/serialization/types/RulesengineTraitDefinitionComparableType.d.ts +2 -5
  1429. package/dist/serialization/types/RulesengineUser.d.ts +2 -5
  1430. package/dist/serialization/types/SegmentStatusResp.d.ts +2 -5
  1431. package/dist/serialization/types/SkippedEntitlementErrorResponseData.d.ts +2 -5
  1432. package/dist/serialization/types/SkippedEntitlementResponseData.d.ts +2 -5
  1433. package/dist/serialization/types/SortDirection.d.ts +2 -5
  1434. package/dist/serialization/types/StripeEmbedInfo.d.ts +2 -5
  1435. package/dist/serialization/types/SubscriptionStatus.d.ts +2 -5
  1436. package/dist/serialization/types/SubscriptionTraitUpdate.d.ts +2 -5
  1437. package/dist/serialization/types/SubscriptionType.d.ts +2 -5
  1438. package/dist/serialization/types/TemporaryAccessTokenResourceType.d.ts +2 -5
  1439. package/dist/serialization/types/TemporaryAccessTokenResponseData.d.ts +2 -5
  1440. package/dist/serialization/types/TraitDefinition.d.ts +3 -6
  1441. package/dist/serialization/types/TraitDefinitionComparableType.d.ts +2 -5
  1442. package/dist/serialization/types/TraitType.d.ts +2 -5
  1443. package/dist/serialization/types/UpdateAddOnRequestBody.d.ts +2 -5
  1444. package/dist/serialization/{resources/credits/client/requests → types}/UpdateBillingPlanCreditGrantRequestBody.d.ts +10 -13
  1445. package/dist/serialization/types/UpdateCreditBundleRequestBody.d.ts +2 -5
  1446. package/dist/serialization/types/UpdateEntitlementReqCommon.d.ts +3 -6
  1447. package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriod.d.ts +2 -5
  1448. package/dist/serialization/types/UpdateEntitlementReqCommonMetricPeriodMonthReset.d.ts +2 -5
  1449. package/dist/serialization/types/UpdatePayInAdvanceRequestBody.d.ts +2 -5
  1450. package/dist/serialization/types/UpdatePlanRequestBody.d.ts +11 -0
  1451. package/dist/serialization/types/UpdatePlanTraitTraitRequestBody.d.ts +2 -5
  1452. package/dist/serialization/types/UpdateRuleRequestBody.d.ts +2 -5
  1453. package/dist/serialization/{resources/plans/client/requests → types}/UpsertBillingProductRequestBody.d.ts +5 -8
  1454. package/dist/serialization/types/UpsertCompanyRequestBody.d.ts +2 -5
  1455. package/dist/serialization/types/UpsertTraitRequestBody.d.ts +2 -5
  1456. package/dist/serialization/types/UpsertUserRequestBody.d.ts +2 -5
  1457. package/dist/serialization/types/UpsertUserSubRequestBody.d.ts +2 -5
  1458. package/dist/serialization/types/UsageBasedEntitlementRequestBody.d.ts +3 -6
  1459. package/dist/serialization/types/UsageBasedEntitlementResponseData.d.ts +2 -5
  1460. package/dist/serialization/types/UserDetailResponseData.d.ts +3 -6
  1461. package/dist/serialization/types/UserResponseData.d.ts +2 -5
  1462. package/dist/serialization/types/WebhookEventDetailResponseData.d.ts +3 -6
  1463. package/dist/serialization/types/WebhookEventResponseData.d.ts +3 -6
  1464. package/dist/serialization/types/WebhookEventStatus.d.ts +2 -5
  1465. package/dist/serialization/types/WebhookRequestType.d.ts +3 -6
  1466. package/dist/serialization/types/WebhookResponseData.d.ts +2 -5
  1467. package/dist/serialization/types/WebhookStatus.d.ts +2 -5
  1468. package/dist/serialization/types/index.d.ts +39 -26
  1469. package/dist/wrapper.d.ts +10 -1
  1470. package/package.json +23 -10
  1471. package/dist/api/resources/companies/client/requests/GetActiveDealsRequest.d.ts +0 -24
  1472. package/dist/api/resources/companies/types/GetActiveDealsParams.d.ts +0 -14
  1473. package/dist/api/resources/companies/types/GetActiveDealsResponse.d.ts +0 -9
  1474. package/dist/api/resources/crm/client/Client.d.ts +0 -133
  1475. package/dist/api/resources/crm/client/requests/CreateCrmDealLineItemAssociationRequestBody.d.ts +0 -14
  1476. package/dist/api/resources/crm/client/requests/CreateCrmDealRequestBody.d.ts +0 -22
  1477. package/dist/api/resources/crm/client/requests/CreateCrmLineItemRequestBody.d.ts +0 -23
  1478. package/dist/api/resources/crm/client/requests/CreateCrmProductRequestBody.d.ts +0 -26
  1479. package/dist/api/resources/crm/client/requests/ListCrmProductsRequest.d.ts +0 -23
  1480. package/dist/api/resources/crm/client/requests/index.d.ts +0 -5
  1481. package/dist/api/resources/crm/types/ListCrmProductsParams.d.ts +0 -14
  1482. package/dist/api/resources/crm/types/ListCrmProductsResponse.d.ts +0 -9
  1483. package/dist/api/resources/crm/types/UpsertCrmDealResponse.d.ts +0 -9
  1484. package/dist/api/resources/crm/types/UpsertCrmProductResponse.d.ts +0 -9
  1485. package/dist/api/resources/crm/types/UpsertDealLineItemAssociationResponse.d.ts +0 -9
  1486. package/dist/api/resources/crm/types/UpsertLineItemResponse.d.ts +0 -9
  1487. package/dist/api/resources/crm/types/index.d.ts +0 -6
  1488. package/dist/api/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -18
  1489. package/dist/api/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -14
  1490. package/dist/api/types/CompanyCrmDealsResponseData.d.ts +0 -11
  1491. package/dist/api/types/CrmDealLineItem.d.ts +0 -18
  1492. package/dist/api/types/CrmDealResponseData.d.ts +0 -16
  1493. package/dist/api/types/CrmLineItemResponseData.d.ts +0 -11
  1494. package/dist/api/types/CrmProductResponseData.d.ts +0 -15
  1495. package/dist/api/types/Decimal.d.ts +0 -4
  1496. package/dist/serialization/resources/companies/types/GetActiveDealsParams.d.ts +0 -15
  1497. package/dist/serialization/resources/companies/types/GetActiveDealsResponse.d.ts +0 -15
  1498. package/dist/serialization/resources/crm/client/requests/CreateCrmDealLineItemAssociationRequestBody.d.ts +0 -13
  1499. package/dist/serialization/resources/crm/client/requests/CreateCrmDealRequestBody.d.ts +0 -20
  1500. package/dist/serialization/resources/crm/client/requests/CreateCrmLineItemRequestBody.d.ts +0 -19
  1501. package/dist/serialization/resources/crm/client/requests/CreateCrmProductRequestBody.d.ts +0 -19
  1502. package/dist/serialization/resources/crm/client/requests/index.d.ts +0 -4
  1503. package/dist/serialization/resources/crm/types/ListCrmProductsParams.d.ts +0 -15
  1504. package/dist/serialization/resources/crm/types/ListCrmProductsResponse.d.ts +0 -15
  1505. package/dist/serialization/resources/crm/types/UpsertCrmDealResponse.d.ts +0 -14
  1506. package/dist/serialization/resources/crm/types/UpsertCrmProductResponse.d.ts +0 -14
  1507. package/dist/serialization/resources/crm/types/UpsertDealLineItemAssociationResponse.d.ts +0 -14
  1508. package/dist/serialization/resources/crm/types/UpsertLineItemResponse.d.ts +0 -14
  1509. package/dist/serialization/resources/crm/types/index.d.ts +0 -6
  1510. package/dist/serialization/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -16
  1511. package/dist/serialization/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -14
  1512. package/dist/serialization/types/CompanyCrmDealsResponseData.d.ts +0 -17
  1513. package/dist/serialization/types/CrmDealLineItem.d.ts +0 -24
  1514. package/dist/serialization/types/CrmDealResponseData.d.ts +0 -22
  1515. package/dist/serialization/types/CrmLineItemResponseData.d.ts +0 -17
  1516. package/dist/serialization/types/CrmProductResponseData.d.ts +0 -21
  1517. package/dist/serialization/types/Decimal.d.ts +0 -10
  1518. package/dist/api/resources/{crm → planbundle}/client/index.d.ts +0 -0
  1519. package/dist/{serialization/resources/crm → api/resources/planbundle}/index.d.ts +1 -1
  1520. package/dist/serialization/resources/{crm → planbundle}/client/index.d.ts +0 -0
  1521. package/dist/{api/resources/crm → serialization/resources/planbundle}/index.d.ts +1 -1
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var pd=Object.create;var no=Object.defineProperty;var md=Object.getOwnPropertyDescriptor;var ud=Object.getOwnPropertyNames;var dd=Object.getPrototypeOf,hd=Object.prototype.hasOwnProperty;var Mt=(w,t)=>()=>(w&&(t=w(w=0)),t);var dr=(w,t)=>{for(var o in t)no(w,o,{get:t[o],enumerable:!0})},ca=(w,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ud(t))!hd.call(w,i)&&i!==o&&no(w,i,{get:()=>t[i],enumerable:!(r=md(t,i))||r.enumerable});return w};var re=(w,t,o)=>(o=w!=null?pd(dd(w)):{},ca(t||!w||!w.__esModule?no(o,"default",{value:w,enumerable:!0}):o,w)),gd=w=>ca(no({},"__esModule",{value:!0}),w);var ka={};dr(ka,{Node18UniversalStreamWrapper:()=>Ft});var Ft,Va=Mt(()=>{"use strict";Ft=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 Ba={};dr(Ba,{UndiciStreamWrapper:()=>It});var It,Da=Mt(()=>{"use strict";It=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 Ma={};dr(Ma,{NodePre18StreamWrapper:()=>Kt});var Kt,Aa=Mt(()=>{"use strict";Kt=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 mg={};dr(mg,{LocalCache:()=>_r,Schematic:()=>se,SchematicClient:()=>Vt,SchematicEnvironment:()=>f,SchematicError:()=>c,SchematicTimeoutError:()=>b,WEBHOOK_SIGNATURE_HEADER:()=>aa,WEBHOOK_TIMESTAMP_HEADER:()=>sa,WebhookSignatureError:()=>Ne,computeHexSignature:()=>cd,computeSignature:()=>Dt,verifySignature:()=>na,verifyWebhookSignature:()=>ld});module.exports=gd(mg);var se={};dr(se,{ApiKeyScope:()=>wd,BadRequestError:()=>P,BillingCreditBundleStatus:()=>yd,BillingCreditBurnStrategy:()=>zd,BillingCreditExpiryType:()=>bd,BillingCreditExpiryUnit:()=>Rd,BillingCreditGrantReason:()=>fd,BillingCreditGrantZeroedOutReason:()=>_d,BillingCreditRolloverPolicy:()=>Sd,BillingPlanCreditGrantResetCadence:()=>xd,BillingPlanCreditGrantResetStart:()=>Ed,BillingPlanCreditGrantResetType:()=>Ud,BillingPriceScheme:()=>Pd,BillingPriceUsageType:()=>Cd,BillingProductPriceInterval:()=>Td,BillingSubscriptionTrialEndSetting:()=>vd,BillingTiersMode:()=>Od,ChargeType:()=>jd,CompanyPlanInvalidReason:()=>kd,ComponentEntityType:()=>Vd,ComponentState:()=>Bd,ConditionConditionType:()=>Dd,ConditionMetricPeriod:()=>Md,ConditionMetricPeriodMonthReset:()=>Ad,ConditionOperator:()=>Fd,CreateCompanyOverrideRequestBodyMetricPeriod:()=>ha,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ga,CreateEntitlementReqCommonMetricPeriod:()=>Id,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>Kd,CreateOrUpdateConditionRequestBodyConditionType:()=>qd,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>Ld,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>Gd,CreateOrUpdateConditionRequestBodyOperator:()=>Nd,CreateOrUpdateRuleRequestBodyRuleType:()=>Xd,CreatePlanEntitlementRequestBodyMetricPeriod:()=>za,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ba,CreditGrantSortOrder:()=>Hd,CreditLedgerPeriod:()=>Wd,DataExportStatus:()=>Jd,EntitlementPriceBehavior:()=>$d,EntitlementType:()=>Zd,EntitlementValueType:()=>Yd,EntityType:()=>Qd,EnvironmentType:()=>eh,EventStatus:()=>rh,EventType:()=>oh,FeatureLifecyclePhase:()=>th,FeatureType:()=>ih,ForbiddenError:()=>x,InternalServerError:()=>U,NotFoundError:()=>E,PlanChangeAction:()=>ah,PlanChangeActorType:()=>sh,PlanChangeBasePlanAction:()=>nh,PlanChangeSubscriptionAction:()=>ch,PlanControlledByType:()=>lh,PlanType:()=>ph,ProrationBehavior:()=>mh,RuleRuleType:()=>uh,RulesEngineSchemaVersion:()=>dh,RulesengineCheckFlagResultFeatureUsagePeriod:()=>hh,RulesengineCheckFlagResultRuleType:()=>gh,RulesengineCompanyMetricMonthReset:()=>wh,RulesengineCompanyMetricPeriod:()=>yh,RulesengineConditionConditionType:()=>zh,RulesengineConditionMetricPeriod:()=>bh,RulesengineConditionMetricPeriodMonthReset:()=>Rh,RulesengineConditionOperator:()=>fh,RulesengineEntityType:()=>_h,RulesengineRuleRuleType:()=>Sh,RulesengineTraitDefinitionComparableType:()=>xh,SortDirection:()=>Eh,SubscriptionStatus:()=>Uh,SubscriptionType:()=>Ph,TraitDefinitionComparableType:()=>Ch,TraitType:()=>Th,UnauthorizedError:()=>S,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>wa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ya,UpdateEntitlementReqCommonMetricPeriod:()=>vh,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>Oh,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Ra,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>fa,WebhookEventStatus:()=>jh,WebhookRequestType:()=>kh,WebhookStatus:()=>Vh,accesstokens:()=>Ta,accounts:()=>la,billing:()=>pa,checkout:()=>ua,companies:()=>da,components:()=>Sa,credits:()=>ma,crm:()=>xa,dataexports:()=>Ea,entitlements:()=>At,events:()=>Ua,features:()=>Pa,plangroups:()=>Ca,plans:()=>_a,webhooks:()=>va});var la={};var pa={};var ma={};var ua={};var da={};var At={};dr(At,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>ha,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ga,CreatePlanEntitlementRequestBodyMetricPeriod:()=>za,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ba,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>wa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ya,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Ra,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>fa});var ha={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ga={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var wa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ya={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var za={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ba={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ra={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var fa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var _a={};var Sa={};var xa={};var Ea={};var Ua={};var Pa={};var Ca={};var Ta={};var va={};var wd={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var yd={Active:"active",Inactive:"inactive"};var zd={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var bd={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var Rd={BillingPeriods:"billing_periods",Days:"days"};var fd={BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var _d={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var Sd={Expire:"expire",None:"none",Rollover:"rollover"};var xd={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var Ed={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var Ud={NoReset:"no_reset",PlanPeriod:"plan_period"};var Pd={PerUnit:"per_unit",Tiered:"tiered"};var Cd={Licensed:"licensed",Metered:"metered"};var Td={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var vd={Cancel:"cancel",Subscribe:"subscribe"};var Od={Graduated:"graduated",Volume:"volume"};var jd={Free:"free",OneTime:"one_time",Recurring:"recurring"};var kd={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var Vd={Billing:"billing",Entitlement:"entitlement"};var Bd={Draft:"draft",Live:"live"};var Dd={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var Md={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Ad={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Fd={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Id={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Kd={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var qd={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",CrmProduct:"crm_product",BasePlan:"base_plan"};var Ld={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Gd={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Nd={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Xd={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Hd={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var Wd={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var Jd={Failure:"failure",Pending:"pending",Success:"success"};var $d={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var Zd={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var Yd={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Qd={Company:"company",User:"user"};var eh={Development:"development",Production:"production",Staging:"staging"};var rh={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var oh={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var th={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var ih={Boolean:"boolean",Event:"event",Trait:"trait"};var ah={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 sh={ApiKey:"api_key",AppUser:"app_user",System:"system",TemporaryAccessToken:"temporary_access_token"};var nh={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var ch={Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var lh={Schematic:"schematic",Stripe:"stripe"};var ph={Plan:"plan",AddOn:"add_on"};var mh={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};var uh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var dh={FiveHundredFortyNineE6Fea:"549e6fea",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var hh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var gh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var wh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var yh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var zh={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var bh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Rh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var fh={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var _h={Company:"company",User:"user"};var Sh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var xh={Bool:"bool",Date:"date",Int:"int",String:"string"};var Eh={Asc:"asc",Desc:"desc"};var Uh={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var Ph={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var Ch={Bool:"bool",Date:"date",Int:"int",String:"string"};var Th={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var vh={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Oh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var jh={Failure:"failure",Pending:"pending",Success:"success"};var kh={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 Vh={Active:"active",Inactive:"inactive"};var be=(w,t,o)=>JSON.stringify(w,t,o);var c=class w extends Error{constructor({message:t,statusCode:o,body:r,rawResponse:i}){super(Bh({message:t,statusCode:o,body:r})),Object.setPrototypeOf(this,w.prototype),this.statusCode=o,this.body=r,this.rawResponse=i}};function Bh({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: ${be(o,void 0,2)}`),r.join(`
2
- `)}var b=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 Qr=require("timers"),_r=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,Qr.setTimeout)(()=>this.evictItem(t,g),i)};this.cache.set(t,g)}resetCache(){this.cache.forEach(t=>{t.timeoutId&&(0,Qr.clearTimeout)(t.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(t,o){o.timeoutId&&(0,Qr.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 hr;typeof globalThis.Headers<"u"?hr=globalThis.Headers:hr=class Oa{constructor(t){if(this.headers=new Map,t)if(t instanceof Oa)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 gr={headers:new hr,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},wr={headers:new hr,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function Sr(w){return{headers:w.headers,redirected:w.redirected,status:w.status,statusText:w.statusText,type:w.type,url:w.url}}var ja=re(require("qs"));function co(w,t){return Object.keys(t??{}).length>0?`${w}?${ja.default.stringify(t,{arrayFormat:"repeat"})}`:w}var h=Dh();function Dh(){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 lo(){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 po({body:w,type:t}){return t.includes("json")?be(w):w}async function Fa(w){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?new(await Promise.resolve().then(()=>(Va(),ka))).Node18UniversalStreamWrapper(w):h.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Da(),Ba))).UndiciStreamWrapper(w):new(await Promise.resolve().then(()=>(Aa(),Ma))).NodePre18StreamWrapper(w)}async function mo(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 Fa(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 Mh="timeout";function Ia(w){let t=new AbortController,o=setTimeout(()=>t.abort(Mh),w);return{signal:t.signal,abortId:o}}function Ka(...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 uo=async(w,t,o,r,i,m,g,l,s)=>{let p=[],u;if(m!=null){let{signal:C,abortId:O}=Ia(m);u=O,p.push(C)}g!=null&&p.push(g);let y=Ka(p),z=await w(t,{method:o,headers:r,body:i,signal:y,credentials:l?"include":void 0,duplex:s});return u!=null&&clearTimeout(u),z};function Ah(w){let t=1+(Math.random()*2-1)*.2;return w*t}async function ho(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=Ah(i);await new Promise(g=>setTimeout(g,m)),o=await w()}return o}async function Fh(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=co(w.url,w.queryParameters),r=await po({body:w.body,type:w.requestType==="json"?"json":"other"}),i=await lo();try{let m=await ho(async()=>uo(i,o,w.method,t,r,w.timeoutMs,w.abortSignal,w.withCredentials,w.duplex),w.maxRetries),g=await mo(m,w.responseType);return m.status>=200&&m.status<400?{ok:!0,body:g,headers:m.headers,rawResponse:Sr(m)}:{ok:!1,error:{reason:"status-code",statusCode:m.status,body:g},rawResponse:Sr(m)}}catch(m){return w.abortSignal!=null&&w.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:gr}:m instanceof Error&&m.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:gr}:m instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:m.message},rawResponse:wr}:{ok:!1,error:{reason:"unknown",errorMessage:be(m)},rawResponse:wr}}}var _=Fh;var d={get:async w=>typeof w=="function"?w():w};var R=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={};dr(e,{JsonError:()=>xr,ParseError:()=>Er,any:()=>os,bigint:()=>La,boolean:()=>ts,booleanLiteral:()=>rs,date:()=>Ga,discriminant:()=>us,enum_:()=>wo,getObjectLikeUtils:()=>ve,getObjectUtils:()=>yr,getSchemaUtils:()=>I,isProperty:()=>$e,lazy:()=>Na,lazyObject:()=>Ya,list:()=>zo,number:()=>is,object:()=>yo,objectWithoutOptionalProperties:()=>Za,optional:()=>qt,property:()=>Ha,record:()=>cs,set:()=>ls,string:()=>as,stringLiteral:()=>es,transform:()=>Lt,undiscriminatedUnion:()=>ms,union:()=>hs,unknown:()=>ss,withParsedProperties:()=>Nt});var D={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function F(w,t){return`Expected ${t}. Received ${Ih(w)}.`}function Ih(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 ne(w){return{...w,json:qa(w.json),parse:qa(w.parse)}}function qa(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 go(w){return w.path.length===0?w.message:`${w.path.join(" -> ")}: ${w.message}`}var xr=class w extends Error{constructor(o){super(o.map(go).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};var Er=class w extends Error{constructor(o){super(o.map(go).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};function I(w){return{nullable:()=>Kh(w),optional:()=>qt(w),optionalNullable:()=>qh(w),transform:t=>Lt(w,t),parseOrThrow:(t,o)=>{let r=w.parse(t,o);if(r.ok)return r.value;throw new Er(r.errors)},jsonOrThrow:(t,o)=>{let r=w.json(t,o);if(r.ok)return r.value;throw new xr(r.errors)}}}function Kh(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:()=>D.NULLABLE};return{...t,...I(t)}}function qt(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:()=>D.OPTIONAL};return{...t,...I(t)}}function qh(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:()=>D.OPTIONAL_NULLABLE};return{...t,...I(t)}}function Lt(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,...I(o)}}function La(){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:F(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:o,message:F(t,"bigint")}]}:{ok:!0,value:t},getType:()=>D.BIGINT};return{...ne(w),...I(w)}}var Lh=/^([+-]?\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 Ga(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:o,message:F(t,"string")}]}:Lh.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:o,message:F(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:o,message:F(t,"Date object")}]},getType:()=>D.DATE};return{...ne(w),...I(w)}}function de(w,t){return()=>{let o={parse:t,json:t,getType:()=>w};return{...ne(o),...I(o)}}}function wo(w){let t=new Set(w);return de(D.ENUM,(r,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:m=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:m,message:F(r,"string")}]}:!t.has(r)&&!i?{ok:!1,errors:[{path:m,message:F(r,"enum")}]}:{ok:!0,value:r})()}function Na(w){let t=Gt(w);return{...t,...I(t)}}function Gt(w){return{parse:(t,o)=>Ur(w).parse(t,o),json:(t,o)=>Ur(w).json(t,o),getType:()=>Ur(w).getType()}}function Ur(w){let t=w;return t.__zurg_memoized==null&&(t.__zurg_memoized=w()),t.__zurg_memoized}function eo(w){return Object.entries(w)}function ro(w,t){let o=new Set(t);return Object.entries(w).reduce((r,[i,m])=>(o.has(i)&&(r[i]=m),r),{})}function Je(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 oo(w){return Object.keys(w)}function Xa(w,t){let o=[],r=[];for(let i of w)t(i)?o.push(i):r.push(i);return[o,r]}function ve(w){return{withParsedProperties:t=>Nt(w,t)}}function Nt(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);if(!m.ok)return m;let g=Object.entries(t).reduce((l,[s,p])=>({...l,[s]:typeof p=="function"?p(m.value):p}),{});return{ok:!0,value:{...m.value,...g}}},json:(r,i)=>{if(!Je(r))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:F(r,"object")}]};let m=new Set(Object.keys(t)),g=ro(r,Object.keys(r).filter(l=>!m.has(l)));return w.json(g,i)},getType:()=>w.getType()};return{...o,...I(o),...ve(o)}}function Ha(w,t){return{rawKey:w,valueSchema:t,isProperty:!0}}function $e(w){return w.isProperty}function yo(w){let t={_getRawProperties:()=>Object.entries(w).map(([o,r])=>$e(r)?r.rawKey:o),_getParsedProperties:()=>oo(w),parse:(o,r)=>{let i={},m=[];for(let[g,l]of eo(w)){let s=$e(l)?l.rawKey:g,p=$e(l)?l.valueSchema:l,u={rawKey:s,parsedKey:g,valueSchema:p};i[s]=u,$a(p)&&m.push(s)}return Wa({value:o,requiredKeys:m,getProperty:g=>{let l=i[g];if(l!=null)return{transformedKey:l.parsedKey,transform:s=>l.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 eo(w)){let l=$e(g)?g.valueSchema:g;$a(l)&&i.push(m)}return Wa({value:o,requiredKeys:i,getProperty:m=>{let g=w[m];if(g!=null)return $e(g)?{transformedKey:g.rawKey,transform:l=>g.valueSchema.json(l,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}:{transformedKey:m,transform:l=>g.json(l,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},getType:()=>D.OBJECT};return{...ne(t),...I(t),...ve(t),...yr(t)}}function Wa({value:w,requiredKeys:t,getProperty:o,unrecognizedObjectKeys:r="fail",skipValidation:i=!1,breadcrumbsPrefix:m=[]}){if(!Je(w))return{ok:!1,errors:[{path:m,message:F(w,"object")}]};let g=new Set(t),l=[],s={};for(let[p,u]of Object.entries(w)){let y=o(p);if(y!=null){g.delete(p);let z=y.transform(u);z.ok?s[y.transformedKey]=z.value:(s[p]=u,l.push(...z.errors))}else switch(r){case"fail":l.push({path:[...m,p],message:`Unexpected key "${p}"`});break;case"strip":break;case"passthrough":s[p]=u;break}}return l.push(...t.filter(p=>g.has(p)).map(p=>({path:m,message:`Missing required key "${p}"`}))),l.length===0||i?{ok:!0,value:s}:{ok:!1,errors:l}}function yr(w){return{extend:t=>{let o={_getParsedProperties:()=>[...w._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...w._getRawProperties(),...t._getRawProperties()],parse:(r,i)=>Ja({extensionKeys:t._getRawProperties(),value:r,transformBase:m=>w.parse(m,i),transformExtension:m=>t.parse(m,i)}),json:(r,i)=>Ja({extensionKeys:t._getParsedProperties(),value:r,transformBase:m=>w.json(m,i),transformExtension:m=>t.json(m,i)}),getType:()=>D.OBJECT};return{...o,...I(o),...ve(o),...yr(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:()=>D.OBJECT};return{...t,...I(t),...ve(t),...yr(t)}}}}function Ja({extensionKeys:w,value:t,transformBase:o,transformExtension:r}){let i=new Set(w),[m,g]=Xa(oo(t),p=>i.has(p)),l=o(ro(t,g)),s=r(ro(t,m));return l.ok&&s.ok?{ok:!0,value:{...l.value,...s.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...s.ok?[]:s.errors]}}function $a(w){return!Gh(w)}function Gh(w){switch(w.getType()){case D.ANY:case D.UNKNOWN:case D.OPTIONAL:case D.OPTIONAL_NULLABLE:return!0;default:return!1}}function Za(w){return yo(w)}function Ya(w){let t={...Gt(w),_getRawProperties:()=>Ur(w)._getRawProperties(),_getParsedProperties:()=>Ur(w)._getParsedProperties()};return{...t,...I(t),...ve(t),...yr(t)}}function zo(w){let t={parse:(o,r)=>Qa(o,(i,m)=>w.parse(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),json:(o,r)=>Qa(o,(i,m)=>w.json(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),getType:()=>D.LIST};return{...ne(t),...I(t)}}function Qa(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:F(w,"list"),path:[]}]}}function es(w){return de(D.STRING_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:F(o,`"${w}"`)}]})()}function rs(w){return de(D.BOOLEAN_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:F(o,`${w.toString()}`)}]})()}var os=de(D.ANY,w=>({ok:!0,value:w}));var ts=de(D.BOOLEAN,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="boolean"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:F(w,"boolean")}]});var is=de(D.NUMBER,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="number"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:F(w,"number")}]});var as=de(D.STRING,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="string"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:F(w,"string")}]});var ss=de(D.UNKNOWN,w=>({ok:!0,value:w}));function cs(w,t){let o={parse:(r,i)=>ns({value:r,isKeyNumeric:w.getType()===D.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)=>ns({value:r,isKeyNumeric:w.getType()===D.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:()=>D.RECORD};return{...ne(o),...I(o)}}function ns({value:w,isKeyNumeric:t,transformKey:o,transformValue:r,breadcrumbsPrefix:i=[]}){return Je(w)?eo(w).reduce((m,[g,l])=>{if(l===void 0)return m;let s=m,p=g;if(t){let C=g.length>0?Number(g):NaN;isNaN(C)||(p=C)}let u=o(p),y=r(l,p);if(s.ok&&u.ok&&y.ok)return{ok:!0,value:{...s.value,[u.value]:y.value}};let z=[];return s.ok||z.push(...s.errors),u.ok||z.push(...u.errors),y.ok||z.push(...y.errors),{ok:!1,errors:z}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:F(w,"object")}]}}function ls(w){let t=zo(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:F(r,"Set")}]},getType:()=>D.SET};return{...ne(o),...I(o)}}function ms(w){let t={parse:(o,r)=>ps((i,m)=>i.parse(o,m),w,r),json:(o,r)=>ps((i,m)=>i.json(o,m),w,r),getType:()=>D.UNDISCRIMINATED_UNION};return{...ne(t),...I(t)}}function ps(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 l of g.errors)r.push({path:l.path,message:`[Variant ${i}] ${l.message}`})}return{ok:!1,errors:r}}function us(w,t){return{parsedDiscriminant:w,rawDiscriminant:t}}function hs(w,t){let o=typeof w=="string"?w:w.rawDiscriminant,r=typeof w=="string"?w:w.parsedDiscriminant,i=wo(oo(t)),m={parse:(g,l)=>ds({value:g,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:s=>i.parse(s,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],o]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,p)=>p.parse(s,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(g,l)=>ds({value:g,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:s=>i.json(s,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,p)=>p.json(s,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>D.UNION};return{...ne(m),...I(m),...ve(m)}}function ds({value:w,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:r,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:m=!1,transformAdditionalProperties:g,breadcrumbsPrefix:l=[]}){if(!Je(w))return{ok:!1,errors:[{path:l,message:F(w,"object")}]};let{[t]:s,...p}=w;if(s==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let u=r(s);if(!u.ok)return{ok:!1,errors:u.errors};let y=i(u.value);if(y==null)return m?{ok:!0,value:{[o]:u.value,...p}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let z=g(p,y);return z.ok?{ok:!0,value:{[o]:s,...z.value}}:z}var ia=re(require("url-join"));var he=re(require("url-join"));var gs=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var bo=e.enum_(["admin","capture","read","write"]);var _e=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(bo),updatedAt:e.property("updated_at",e.date())});var ws=e.object({data:e.list(_e),params:gs});var ys=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(bo),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var zs=e.object({data:ys,params:e.record(e.string(),e.unknown())});var bs=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Rs=e.object({data:_e,params:e.record(e.string(),e.unknown())});var A=e.object({deleted:e.boolean().optional()});var fs=e.object({data:A,params:e.record(e.string(),e.unknown())});var _s=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var V=e.object({count:e.number().optional()});var Ss=e.object({data:V,params:_s});var xs=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 Ro=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 Es=e.object({data:e.list(Ro),params:xs});var Us=e.object({apiKey:e.property("api_key",_e.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 Ps=e.object({data:Us,params:e.record(e.string(),e.unknown())});var Cs=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 Ts=e.object({data:V,params:Cs});var vs=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Ze=e.enum_(["development","production","staging"]);var Pr=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ze),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Os=e.object({data:e.list(Pr),params:vs});var js=e.object({apiKeys:e.property("api_keys",e.list(_e)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ze),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var ks=e.object({data:js,params:e.record(e.string(),e.unknown())});var Vs=e.object({data:Pr,params:e.record(e.string(),e.unknown())});var Bs=e.object({data:Pr,params:e.record(e.string(),e.unknown())});var Ds=e.object({data:A,params:e.record(e.string(),e.unknown())});var Ms=e.object({ok:e.boolean()});var As=e.object({data:Ms,params:e.record(e.string(),e.unknown())});var Xt=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var Ht=e.object({description:e.string().optional(),name:e.string().optional()});var Wt=e.object({environmentType:e.property("environment_type",Ze),name:e.string()});var Jt=e.object({environmentType:e.property("environment_type",Ze.optional()),name:e.string().optional()});var Fs=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var fo=e.object({accountId:e.property("account_id",e.string()),amountOff:e.property("amount_off",e.number().optional()),currency:e.string().optional(),duration:e.string().optional(),durationInMonths:e.property("duration_in_months",e.number().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),isActive:e.property("is_active",e.boolean()),maxRedemptions:e.property("max_redemptions",e.number().optional()),metadata:e.record(e.string(),e.unknown()),name:e.string(),percentOff:e.property("percent_off",e.number().optional()),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var Is=e.object({data:e.list(fo),params:Fs});var Ks=e.object({data:fo,params:e.record(e.string(),e.unknown())});var qs=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 Ls=e.object({data:qs,params:e.record(e.string(),e.unknown())});var Gs=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 Ns=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(),subscriptions:e.list(Ns),updatedAt:e.property("updated_at",e.date())});var Hs=e.object({data:e.list(Xs),params:Gs});var Ws=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 Js=e.object({data:V,params:Ws});var $s=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 Re=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 Zs=e.object({data:e.list(Re),params:$s});var Ys=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Qs=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var _o=e.object({dispalyName:e.property("dispaly_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalPriceId:e.property("external_price_id",e.string()),id:e.string()});var en=e.object({data:e.list(_o),params:Qs});var rn=e.object({data:_o,params:e.record(e.string(),e.unknown())});var on=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 ye=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 tn=e.object({data:e.list(ye),params:on});var an=e.object({data:ye,params:e.record(e.string(),e.unknown())});var te=e.enum_(["graduated","volume"]);var W=e.enum_(["licensed","metered"]);var sn=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()),q:e.string().optional(),tiersMode:e.property("tiers_mode",te.optional()),usageType:e.property("usage_type",W.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var ke=e.enum_(["per_unit","tiered"]);var Cr=e.enum_(["day","month","one-time","year"]);var So=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 J=e.object({billingScheme:e.property("billing_scheme",ke),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Cr,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(So)),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",te.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",W)});var nn=e.object({data:e.list(J),params:sn});var $=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:Cr,price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),scheme:ke});var cn=e.object({data:$,params:e.record(e.string(),e.unknown())});var ln=e.object({data:A,params:e.record(e.string(),e.unknown())});var pn=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()),q:e.string().optional(),tiersMode:e.property("tiers_mode",te.optional()),usageType:e.property("usage_type",W.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var mn=e.object({data:e.list(J),params:pn});var un=e.object({data:A,params:e.record(e.string(),e.unknown())});var Tr=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 dn=e.object({data:Tr,params:e.record(e.string(),e.unknown())});var hn=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",W.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 Ye=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($),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 gn=e.object({data:e.list(Ye),params:hn});var wn=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",W.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 yn=e.object({data:V,params:wn});var Qe=e.enum_(["cancel","subscribe"]);var zn=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()),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",Qe.optional())});var bn=e.object({data:zn,params:e.record(e.string(),e.unknown())});var $t=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 Zt=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 Yt=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 Qt=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 ei=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 Rn=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 ri=e.object({billingScheme:e.property("billing_scheme",ke),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(Rn)),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",te.optional()),usageType:e.property("usage_type",W)});var oi=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),price:e.number()});var fn=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 _n=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",W)});var ti=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(fn),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(_n)),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",Qe.optional())});var Sn=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var vr=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var K=e.enum_(["billing_periods","days"]);var Or=e.enum_(["expire","none","rollover"]);var Ve=e.object({burnStrategy:e.property("burn_strategy",vr),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",K),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Or),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:$.optional(),product:Tr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var xn=e.object({data:e.list(Ve),params:Sn});var En=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var Un=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var Pn=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var Cn=e.object({data:A,params:e.record(e.string(),e.unknown())});var fe=e.stringLiteral("fixed");var ge=e.enum_(["active","inactive"]);var Tn=e.object({bundleType:e.property("bundle_type",fe.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ge.optional()});var N=e.enum_(["duration","end_of_billing_period","end_of_next_billing_period","end_of_trial","no_expiry"]);var Se=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",fe),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",N),expiryUnit:e.property("expiry_unit",K),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:$.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ge,unitPrice:e.property("unit_price",$.optional()),updatedAt:e.property("updated_at",e.date())});var vn=e.object({data:e.list(Se),params:Tn});var On=e.object({data:Se,params:e.record(e.string(),e.unknown())});var jn=e.object({data:Se,params:e.record(e.string(),e.unknown())});var kn=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Vn=e.object({data:A,params:e.record(e.string(),e.unknown())});var Bn=e.object({bundleType:e.property("bundle_type",fe.optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:ge.optional()});var Dn=e.object({data:V,params:Bn});var Mn=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var An=e.object({data:V,params:Mn});var xe=e.enum_(["billing_credit_auto_topup","free","plan","purchased"]);var jr=e.enum_(["expired","manual","plan_change","plan_period_reset"]);var er=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",xe),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:$.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",jr.optional())});var Fn=e.object({data:er,params:e.record(e.string(),e.unknown())});var In=e.object({data:er,params:e.record(e.string(),e.unknown())});var Oe=e.enum_(["asc","desc"]);var xo=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Kn=e.object({companyId:e.property("company_id",e.string().optional()),dir:Oe.optional(),limit:e.number().optional(),offset:e.number().optional(),order:xo.optional()});var qn=e.object({data:e.list(er),params:Kn});var Ln=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 Gn=e.object({data:V,params:Ln});var Nn=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 Xn=e.object({data:e.list(er),params:Nn});var zr=e.enum_(["daily","monthly","raw","weekly"]);var Hn=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:zr.optional(),startTime:e.property("start_time",e.string().optional())});var Wn=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var Jn=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 $n=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var Zn=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:Wn.optional(),companyId:e.property("company_id",e.string()),credit:Jn.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:$n.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 Yn=e.object({data:e.list(Zn),params:Hn});var Qn=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:zr.optional(),startTime:e.property("start_time",e.string().optional())});var ec=e.object({data:V,params:Qn});var rc=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 Be=e.enum_(["daily","monthly","weekly","yearly"]);var Ee=e.enum_(["billing_period","first_of_month"]);var De=e.enum_(["no_reset","plan_period"]);var Me=e.object({autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",e.string().optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),creditPluralName:e.property("credit_plural_name",e.string().optional()),creditSingularName:e.property("credit_singular_name",e.string().optional()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),resetCadence:e.property("reset_cadence",Be),resetStart:e.property("reset_start",Ee),resetType:e.property("reset_type",De.optional()),updatedAt:e.property("updated_at",e.date())});var oc=e.object({data:e.list(Me),params:rc});var tc=e.object({data:Me,params:e.record(e.string(),e.unknown())});var ic=e.object({data:Me,params:e.record(e.string(),e.unknown())});var ac=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var sc=e.object({data:A,params:ac});var nc=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 cc=e.object({data:V,params:nc});var ii=e.object({burnStrategy:e.property("burn_strategy",vr.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",K.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Or.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 ai=e.object({burnStrategy:e.property("burn_strategy",vr.optional()),defaultExpiryUnit:e.property("default_expiry_unit",K.optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",Or.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 si=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",fe.optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:ge.optional()});var ni=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:ge.optional()});var ci=e.object({reason:jr.optional()});var li=e.object({billingPeriodsCount:e.property("billing_periods_count",e.number().optional()),companyId:e.property("company_id",e.string()),creditId:e.property("credit_id",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:xe,renewalEnabled:e.property("renewal_enabled",e.boolean().optional()),renewalPeriod:e.property("renewal_period",Ee.optional())});var Eo=e.stringLiteral("credit");var pi=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",Eo.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",Be),resetStart:e.property("reset_start",Ee),resetType:e.property("reset_type",De.optional())});var mi=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",Eo.optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",N.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",K.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number().optional()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Be),resetStart:e.property("reset_start",Ee),resetType:e.property("reset_type",De.optional())});var lc=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()),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",Qe.optional())});var pc=e.object({data:lc,params:e.record(e.string(),e.unknown())});var Ae=e.enum_(["free","one_time","recurring"]);var rr=e.enum_(["schematic","stripe"]);var Uo=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 ie=e.enum_(["boolean","event","trait"]);var or=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var kr=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",or.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 tr=e.stringLiteral("boolean");var q=e.enum_(["company","user"]);var Y=e.enum_(["boolean","currency","date","number","string","url"]);var ae=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",q),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",Y),updatedAt:e.property("updated_at",e.date())});var mc=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Po=e.object({comparisonTrait:e.property("comparison_trait",ae.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(mc),ruleId:e.property("rule_id",e.string()),trait:ae.optional(),traitEntityType:e.property("trait_entity_type",q.optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var uc=e.object({conditions:e.list(Po),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 Co=e.object({conditionGroups:e.property("condition_groups",e.list(uc)),conditions:e.list(Po),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 Fe=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:kr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",tr),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(Co),updatedAt:e.property("updated_at",e.date())});var Vr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var oe=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",Uo.optional()),featureType:e.property("feature_type",ie),flags:e.list(Fe),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",or.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(Vr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:ae.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var pe=e.enum_(["plan","add_on"]);var ce=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ye.optional()),chargeType:e.property("charge_type",Ae),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",rr),createdAt:e.property("created_at",e.date()),description:e.string(),features:e.list(oe),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Me).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",$.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",$.optional()),planType:e.property("plan_type",pe),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",$.optional())});var ze=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var H=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var br=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",J.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",J.optional()),priceBehavior:e.property("price_behavior",ze.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",H),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var To=e.object({billingCreditAutoTopupAmount:e.property("billing_credit_auto_topup_amount",e.number().optional()),billingCreditAutoTopupAmountType:e.property("billing_credit_auto_topup_amount_type",e.string().optional()),billingCreditAutoTopupEnabled:e.property("billing_credit_auto_topup_enabled",e.boolean()),billingCreditAutoTopupExpiryType:e.property("billing_credit_auto_topup_expiry_type",N.optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",K.optional()),billingCreditAutoTopupExpiryUnitCount:e.property("billing_credit_auto_topup_expiry_unit_count",e.number().optional()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),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",Be),resetStart:e.property("reset_start",Ee),resetType:e.property("reset_type",De),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Br=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(To)),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional())});var vo=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 Oo=e.object({billingScheme:e.property("billing_scheme",ke),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(So)),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",W)});var ir=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(vo),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",Re.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",ye.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(Oo),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",Qe.optional())});var Dr=e.object({createdAt:e.property("created_at",e.date()),definition:ae.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 jo=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",q),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var Mr=e.object({createdAt:e.property("created_at",e.date()),definition:jo.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",q),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var ko=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 Vo=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var dc=e.enum_(["bool","date","int","string"]);var ui=e.object({comparableType:e.property("comparable_type",dc),entityType:e.property("entity_type",q),id:e.string()});var hc=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var gc=e.enum_(["all_time","current_day","current_month","current_week"]);var wc=e.enum_(["first_of_month","billing_cycle"]);var yc=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var Bo=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",ui.optional()),conditionType:e.property("condition_type",hc),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",gc.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",wc.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:yc,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",ui.optional()),traitValue:e.property("trait_value",e.string())});var zc=e.object({conditions:e.list(Bo)});var bc=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Do=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(zc)),conditions:e.list(Bo),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",bc),value:e.boolean()});var L=e.object({addOns:e.property("add_ons",e.list(Br)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",ir.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(ir)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ye.optional()),entityTraits:e.property("entity_traits",e.list(Dr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Mr),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(ko),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ye)),plan:Br.optional(),plans:e.list(Vo),rules:e.list(Do),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Rc=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 Ue=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:kr.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(Rc),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",ae.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",H)});var ar=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",xe),quantity:e.number()});var Ar=e.enum_(["company_override","plan_entitlement","unknown"]);var sr=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",pe),updatedAt:e.property("updated_at",e.date())});var le=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:kr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",J.optional()),meteredYearlyPrice:e.property("metered_yearly_price",J.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:sr.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",ze.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",Tr.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",Ve.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",ae.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",H)});var nr=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",H),companyOverride:e.property("company_override",Ue.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(ar).optional()),creditGrantReason:e.property("credit_grant_reason",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()),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",Ar),feature:oe.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",J.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:sr.optional(),planEntitlement:e.property("plan_entitlement",le.optional()),priceBehavior:e.property("price_behavior",ze.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var cr=e.object({features:e.list(nr)});var fc=e.object({bundle:Se.optional(),quantity:e.number(),total:e.number()});var lr=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(vo),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",Re.optional()),paymentMethod:e.property("payment_method",ye.optional()),products:e.list(Oo),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 _c=e.object({activeAddOns:e.property("active_add_ons",e.list(ce)),activePlan:e.property("active_plan",ce.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(br)),availableCreditBundles:e.property("available_credit_bundles",e.list(Se)),company:L.optional(),featureUsage:e.property("feature_usage",cr.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(fc)),selectedPlan:e.property("selected_plan",ce.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(br)),subscription:lr.optional()});var Sc=e.object({data:_c,params:e.record(e.string(),e.unknown())});var xc=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Ec=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(xc))});var Mo=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Ec.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(nr))});var Uc=e.object({data:Mo,params:e.record(e.string(),e.unknown())});var Ao=e.object({company:L.optional(),success:e.boolean()});var Pc=e.object({data:Ao,params:e.record(e.string(),e.unknown())});var Cc=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Mo.optional())});var Tc=e.object({data:Cc,params:e.record(e.string(),e.unknown())});var vc=e.object({data:Ao,params:e.record(e.string(),e.unknown())});var Oc=e.object({data:ir,params:e.record(e.string(),e.unknown())});var di=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var hi=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var gi=e.object({trialEnd:e.property("trial_end",e.date().optional())});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 Vc=e.object({data:L,params:e.record(e.string(),e.unknown())});var Bc=e.object({data:L,params:e.record(e.string(),e.unknown())});var Dc=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var Mc=e.object({data:A,params:Dc});var Ac=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 Fc=e.object({data:V,params:Ac});var Xe=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var He=e.enum_(["free","one_time","paid","trial"]);var Ic=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",Oe.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Xe).optional()),subscriptionTypes:e.property("subscription_types",e.list(He).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Kc=e.object({data:V,params:Ic});var qc=e.object({data:L,params:e.record(e.string(),e.unknown())});var Fr=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 Lc=e.object({data:Fr,params:e.record(e.string(),e.unknown())});var Gc=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",Oe.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Xe).optional()),subscriptionTypes:e.property("subscription_types",e.list(He).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Nc=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(ar)),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 Xc=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Nc.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",J.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",J.optional())});var Hc=e.object({addOns:e.property("add_ons",e.list(Br)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",ir.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(ir)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ye.optional()),entityTraits:e.property("entity_traits",e.list(Dr)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Xc)),id:e.string(),keys:e.list(Mr),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(ko),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ye)),plan:Br.optional(),plans:e.list(Vo),rules:e.list(Do),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Wc=e.object({data:e.list(Hc),params:Gc});var Jc=e.object({keys:e.record(e.string(),e.string()).optional()});var $c=e.object({data:L,params:Jc});var Zc=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 wi=e.record(e.string(),e.unknown());var Yc=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",wi.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",wi.optional()),updatedAt:e.property("updated_at",e.date())});var Qc=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(Yc))});var el=e.object({data:e.list(Qc),params:Zc});var rl=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 Ir=e.object({company:Fr.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 ol=e.object({data:e.list(Ir),params:rl});var tl=e.object({data:Ir,params:e.record(e.string(),e.unknown())});var il=e.object({data:A,params:e.record(e.string(),e.unknown())});var al=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 sl=e.object({data:e.list(lr),params:al});var nl=e.object({data:L,params:e.record(e.string(),e.unknown())});var cl=e.object({entityType:e.property("entity_type",q.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ll=e.object({data:e.list(jo),params:cl});var pl=e.object({entityType:e.property("entity_type",q.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ml=e.object({data:V,params:pl});var ul=e.object({entityType:e.property("entity_type",q.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 dl=e.object({data:e.list(ae),params:ul});var hl=e.object({data:ae,params:e.record(e.string(),e.unknown())});var gl=e.object({data:ae,params:e.record(e.string(),e.unknown())});var wl=e.object({data:ae,params:e.record(e.string(),e.unknown())});var yl=e.object({entityType:e.property("entity_type",q.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 zl=e.object({data:V,params:yl});var bl=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Rl=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var fl=e.object({data:e.list(Rl),params:bl});var _l=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 Sl=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","plan_trait_change","quickstart","subscription_change"]);var xl=e.enum_(["api_key","app_user","system","temporary_access_token"]);var to=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var El=e.enum_(["fallback","initial","trait","trial_expiry"]);var Ul=e.enum_(["downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var Pl=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 Fo=e.object({action:Sl,actorType:e.property("actor_type",xl),addOnsAdded:e.property("add_ons_added",e.list(to)),addOnsRemoved:e.property("add_ons_removed",e.list(to)),apiKey:e.property("api_key",_e.optional()),apiKeyRequest:e.property("api_key_request",Ro.optional()),basePlan:e.property("base_plan",to.optional()),basePlanAction:e.property("base_plan_action",El.optional()),company:Fr.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",to.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",Ul.optional()),traitsUpdated:e.property("traits_updated",e.list(Pl)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Cl=e.object({data:e.list(Fo),params:_l});var Tl=e.object({data:Fo,params:e.record(e.string(),e.unknown())});var vl=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 Ie=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 Ol=e.object({data:e.list(Ie),params:vl});var jl=e.object({data:Ie,params:e.record(e.string(),e.unknown())});var kl=e.object({data:Ie,params:e.record(e.string(),e.unknown())});var Vl=e.object({data:Ie,params:e.record(e.string(),e.unknown())});var Bl=e.object({data:A,params:e.record(e.string(),e.unknown())});var Dl=e.object({data:e.list(Ie),params:e.record(e.string(),e.unknown())});var Ml=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var Al=e.object({data:V,params:Ml});var Pe=e.object({companyMemberships:e.property("company_memberships",e.list(Ir)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(Dr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Mr),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 Fl=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Il=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 Kl=e.object({data:e.list(Pe),params:Il});var ql=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Ll=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Gl=e.object({data:A,params:e.record(e.string(),e.unknown())});var Nl=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var Xl=e.object({data:V,params:Nl});var Hl=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Io=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 Wl=e.object({data:Io,params:e.record(e.string(),e.unknown())});var Jl=e.object({keys:e.record(e.string(),e.string()).optional()});var $l=e.object({data:Pe,params:Jl});var yi=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var zi=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",q),hierarchy:e.list(e.string()),traitType:e.property("trait_type",Y)});var bi=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",Y)});var Ri=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var fi=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var Zl=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var _i=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(Zl)});var Yl=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 Ql=e.object({data:e.list(Ue),params:Yl});var ep=e.enum_(["all_time","current_month","current_week","current_day"]);var rp=e.enum_(["first_of_month","billing_cycle"]);var op=e.object({data:Ue,params:e.record(e.string(),e.unknown())});var tp=e.object({data:Ue,params:e.record(e.string(),e.unknown())});var ip=e.enum_(["all_time","current_month","current_week","current_day"]);var ap=e.enum_(["first_of_month","billing_cycle"]);var sp=e.object({data:Ue,params:e.record(e.string(),e.unknown())});var np=e.object({data:A,params:e.record(e.string(),e.unknown())});var cp=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 lp=e.object({data:V,params:cp});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 mp=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(ar).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 up=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",H),company:L.optional(),companyOverride:e.property("company_override",Ue.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(ar).optional()),creditGrantReason:e.property("credit_grant_reason",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()),creditUsage:e.property("credit_usage",mp.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",Ar),feature:oe.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",J.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:sr.optional(),planEntitlement:e.property("plan_entitlement",le.optional()),priceBehavior:e.property("price_behavior",ze.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var dp=e.object({data:e.list(up),params:pp});var hp=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var gp=e.object({data:V,params:hp});var wp=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 yp=e.object({data:e.list(nr),params:wp});var zp=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 bp=e.object({data:V,params:zp});var Rp=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var fp=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",H),company:L.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",Ar),feature:oe.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:sr.optional(),usage:e.number().optional(),user:Io.optional()});var _p=e.object({data:e.list(fp),params:Rp});var Sp=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:V,params:Sp});var Ep=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 Up=e.object({data:e.list(le),params:Ep});var Pp=e.enum_(["all_time","current_month","current_week","current_day"]);var Cp=e.enum_(["first_of_month","billing_cycle"]);var Tp=e.object({data:le,params:e.record(e.string(),e.unknown())});var vp=e.object({data:le,params:e.record(e.string(),e.unknown())});var Op=e.enum_(["all_time","current_month","current_week","current_day"]);var jp=e.enum_(["first_of_month","billing_cycle"]);var kp=e.object({data:le,params:e.record(e.string(),e.unknown())});var Vp=e.object({data:A,params:e.record(e.string(),e.unknown())});var Bp=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 Dp=e.object({data:V,params:Bp});var Mp=e.object({message:e.string()});var Ap=e.object({entitlementId:e.property("entitlement_id",e.string()),errors:e.list(Mp),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string())});var Fp=e.object({data:e.list(le),skipped:e.list(Ap)});var Ip=e.object({data:Fp,params:e.record(e.string(),e.unknown())});var Kp=e.object({keys:e.record(e.string(),e.string()).optional()});var qp=e.object({data:cr,params:Kp});var Si=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",ep.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",rp.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",H)});var xi=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",ip.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",ap.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",H)});var Ce=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 Ei=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",Pp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Cp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Ce).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",ze.optional()),priceTiers:e.property("price_tiers",e.list(Ce).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",te.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",H),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ce).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Ui=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",Op.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",jp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Ce).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",ze.optional()),priceTiers:e.property("price_tiers",e.list(Ce).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",te.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",H),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ce).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Pi=e.object({sourcePlanId:e.property("source_plan_id",e.string()),targetPlanId:e.property("target_plan_id",e.string())});var Lp=e.object({data:L,params:e.record(e.string(),e.unknown())});var Gp=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",pe.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 Np=e.object({data:e.list(ce),params:Gp});var Xp=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Hp=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Wp=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Jp=e.object({data:A,params:e.record(e.string(),e.unknown())});var $p=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",Ae),controlledBy:e.property("controlled_by",rr),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 Zp=e.object({data:$p,params:e.record(e.string(),e.unknown())});var Yp=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",pe.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 Qp=e.object({data:V,params:Yp});var em=e.object({planId:e.property("plan_id",e.string().optional())});var rm=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var om=e.object({data:e.list(rm),params:em});var Ci=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Ti=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",pe)});var vi=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Oi=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",Ae),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 tm=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ko=e.enum_(["draft","live"]);var Kr=e.enum_(["billing","entitlement"]);var Te=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:Ko,type:Kr,updatedAt:e.property("updated_at",e.date())});var im=e.object({data:e.list(Te),params:tm});var am=e.object({data:Te,params:e.record(e.string(),e.unknown())});var sm=e.object({data:Te,params:e.record(e.string(),e.unknown())});var nm=e.object({data:Te,params:e.record(e.string(),e.unknown())});var cm=e.object({data:A,params:e.record(e.string(),e.unknown())});var lm=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var pm=e.object({data:V,params:lm});var mm=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var qr=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 um=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var Lr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ye.optional()),chargeType:e.property("charge_type",Ae),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",rr),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",qr.optional()),description:e.string(),entitlements:e.list(le),features:e.list(oe),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(To)),invalidReason:e.property("invalid_reason",um.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",$.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",$.optional()),planType:e.property("plan_type",pe),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(nr)),valid:e.boolean(),yearlyPrice:e.property("yearly_price",$.optional())});var pr=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var qo=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var Lo=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 io=e.object({billingScheme:e.property("billing_scheme",ke),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Cr,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",te.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",W)});var Go=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",fe),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",N),expiryUnit:e.property("expiry_unit",K),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:io.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ge,unitPrice:e.property("unit_price",io.optional()),updatedAt:e.property("updated_at",e.date())});var No=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",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",xe),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:io.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",jr.optional())});var Xo=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 Ho=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 dm=e.object({activeAddOns:e.property("active_add_ons",e.list(Lr)),activePlans:e.property("active_plans",e.list(Lr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(br)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(pr)),capabilities:qo.optional(),checkoutSettings:e.property("checkout_settings",Lo),company:L.optional(),component:Te.optional(),creditBundles:e.property("credit_bundles",e.list(Go)),creditGrants:e.property("credit_grants",e.list(No)),defaultPlan:e.property("default_plan",ce.optional()),displaySettings:e.property("display_settings",Xo),featureUsage:e.property("feature_usage",cr.optional()),invoices:e.list(Re),postTrialPlan:e.property("post_trial_plan",ce.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",Ho.optional()),subscription:lr.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Re.optional())});var hm=e.object({data:dm,params:mm});var ji=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Kr),name:e.string()});var ki=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Kr.optional()),name:e.string().optional(),state:Ko.optional()});var Wo=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 gm=e.object({data:Wo,params:e.record(e.string(),e.unknown())});var wm=e.object({data:Wo,params:e.record(e.string(),e.unknown())});var ym=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 zm=e.object({data:ym,params:e.record(e.string(),e.unknown())});var bm=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Jo=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 Rm=e.object({data:e.list(Jo),params:bm});var fm=e.object({data:Jo,params:e.record(e.string(),e.unknown())});var Vi=e.object({dealExternalId:e.property("deal_external_id",e.string()),lineItemExternalId:e.property("line_item_external_id",e.string())});var Bi=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 Di=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 Mi=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 _m=e.stringLiteral("company-feature-usage");var Sm=e.stringLiteral("csv");var xm=e.enum_(["failure","pending","success"]);var Em=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",_m),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",Sm),status:xm,updatedAt:e.property("updated_at",e.date())});var Um=e.object({data:Em,params:e.record(e.string(),e.unknown())});var Ai=e.object({metadata:e.string()});var $o=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 Pm=e.object({events:e.list($o)});var Cm=e.object({data:Pm,params:e.record(e.string(),e.unknown())});var Tm=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 vm=e.object({data:e.list(Uo),params:Tm});var je=e.enum_(["flag_check","identify","track"]);var Om=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(je).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 Zo=e.enum_(["enriched","failed","pending","processed","unknown"]);var Yo=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:Vr.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(Vr),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:Zo,subtype:e.string().optional(),type:je,updatedAt:e.property("updated_at",e.date()),user:Vr.optional(),userId:e.property("user_id",e.string().optional())});var jm=e.object({data:e.list(Yo),params:Om});var km=e.object({data:$o,params:e.record(e.string(),e.unknown())});var Vm=e.object({data:Yo,params:e.record(e.string(),e.unknown())});var Bm=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var Dm=e.object({data:Bm,params:e.record(e.string(),e.unknown())});var Mm=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 Am=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 Fm=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var Im=e.object({company:Fm.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var Km=e.undiscriminatedUnion([Mm,Am,Im]);var Qo=e.object({body:Km.optional(),eventType:e.property("event_type",je),sentAt:e.property("sent_at",e.date().optional())});var Fi=e.object({events:e.list(Qo)});var qm=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 Lm=e.object({data:e.list(oe),params:qm});var Gm=e.object({data:oe,params:e.record(e.string(),e.unknown())});var Nm=e.object({data:oe,params:e.record(e.string(),e.unknown())});var Xm=e.object({data:oe,params:e.record(e.string(),e.unknown())});var Hm=e.object({data:A,params:e.record(e.string(),e.unknown())});var Wm=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 Jm=e.object({data:V,params:Wm});var $m=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 Zm=e.object({data:e.list(Fe),params:$m});var Ym=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var Qm=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var eu=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var ru=e.object({data:A,params:e.record(e.string(),e.unknown())});var ou=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",tr),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 tu=e.object({flag:ou.optional(),rules:e.list(Co)});var iu=e.object({data:tu,params:e.record(e.string(),e.unknown())});var et=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 au=e.object({data:et,params:e.record(e.string(),e.unknown())});var rt=e.object({flags:e.list(et)});var su=e.object({data:rt,params:e.record(e.string(),e.unknown())});var nu=e.object({data:e.list(rt)});var cu=e.object({data:nu,params:e.record(e.string(),e.unknown())});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 pu=e.object({data:V,params:lu});var ot=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",tr),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Ii=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ie),flag:ot.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",or.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 Ki=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",ie.optional()),flag:ot.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",or.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 mu=e.enum_(["company","metric","trait","user","plan","billing_product","crm_product","base_plan"]);var uu=e.enum_(["all_time","current_month","current_week","current_day"]);var du=e.enum_(["first_of_month","billing_cycle"]);var hu=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var Gr=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",mu),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",uu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",du.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:hu,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 tt=e.object({conditions:e.list(Gr),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var gu=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var wu=e.object({conditionGroups:e.property("condition_groups",e.list(tt)),conditions:e.list(Gr),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",gu.optional()),value:e.boolean()});var qi=e.object({rules:e.list(wu)});var ao=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var Li=e.object({contexts:e.list(ao)});var it=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 Rr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ye.optional()),chargeType:e.property("charge_type",Ae),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",rr),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",it.optional()),description:e.string(),entitlements:e.list(le),features:e.list(oe),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Me).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",$.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",$.optional()),planType:e.property("plan_type",pe),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",$.optional())});var at=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var st=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 yu=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Gi=e.object({entitlements:e.list(yu).optional(),planId:e.property("plan_id",e.string())});var Nr=e.object({bundleId:e.string()});var zu=e.object({addOns:e.property("add_ons",e.list(Rr)),checkoutSettings:e.property("checkout_settings",at),componentSettings:e.property("component_settings",st),customPlanConfig:e.property("custom_plan_config",it.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",Rr.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",Rr.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",Rr.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",J.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Gi)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlanList:e.property("ordered_plan_list",e.list(Gi)),plans:e.list(Rr),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",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",Rr.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",J.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var bu=e.object({data:zu,params:e.record(e.string(),e.unknown())});var Ru=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var fu=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var We=e.object({entitlements:e.list(fu).optional(),planId:e.property("plan_id",e.string())});var nt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Ru)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",at),componentSettings:e.property("component_settings",st),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(We)),planIds:e.property("plan_ids",e.list(We)),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 _u=e.object({data:nt,params:e.record(e.string(),e.unknown())});var Su=e.object({data:nt,params:e.record(e.string(),e.unknown())});var ct=e.enum_(["create_prorations","invoice_immediately"]);var Ni=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(pr).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",qr.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(We)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlans:e.property("ordered_plans",e.list(We)),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",ct),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),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 Xi=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(pr).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",qr.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(We)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlans:e.property("ordered_plans",e.list(We)),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",ct),showAsMonthlyPrices:e.property("show_as_monthly_prices",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),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 lt=e.stringLiteral("company");var xu=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",lt),token:e.string(),updatedAt:e.property("updated_at",e.date())});var Eu=e.object({data:xu,params:e.record(e.string(),e.unknown())});var Hi=e.object({lookup:e.record(e.string(),e.string()),resource_type:e.string()});var Uu=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 Ke=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 pt=e.enum_(["failure","pending","success"]);var Xr=e.object({creditId:e.property("credit_id",e.string())});var Hr=e.object({featureId:e.property("feature_id",e.string())});var mt=e.enum_(["active","inactive"]);var qe=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Xr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Hr).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(Ke)),secret:e.string(),status:mt,updatedAt:e.property("updated_at",e.date()),url:e.string()});var ut=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",Ke),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:pt,updatedAt:e.property("updated_at",e.date()),webhook:qe.optional(),webhookId:e.property("webhook_id",e.string())});var Pu=e.object({data:e.list(ut),params:Uu});var Cu=e.object({data:ut,params:e.record(e.string(),e.unknown())});var Tu=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 vu=e.object({data:V,params:Tu});var Ou=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ju=e.object({data:e.list(qe),params:Ou});var ku=e.object({data:qe,params:e.record(e.string(),e.unknown())});var Vu=e.object({data:qe,params:e.record(e.string(),e.unknown())});var Bu=e.object({data:qe,params:e.record(e.string(),e.unknown())});var Du=e.object({data:A,params:e.record(e.string(),e.unknown())});var Mu=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Au=e.object({data:V,params:Mu});var Wi=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Xr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Hr).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(Ke)),url:e.string()});var Ji=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Xr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(Hr).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(Ke).optional()),status:mt.optional(),url:e.string().optional()});var a=e.object({error:e.string()});var dt=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var Wr=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var Jr=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var $i=e.object({addOnIds:e.property("add_on_ids",e.list(dt)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(Wr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(Jr)),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 wee=e.object({addOnIds:e.property("add_on_ids",e.list(dt)),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(Wr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(Jr)),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 zee=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 Bee=e.object({activeAddOns:e.property("active_add_ons",e.list(Lr)),activePlans:e.property("active_plans",e.list(Lr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(br)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(pr)),capabilities:qo.optional(),checkoutSettings:e.property("checkout_settings",Lo),company:L.optional(),component:Te.optional(),creditBundles:e.property("credit_bundles",e.list(Go)),creditGrants:e.property("credit_grants",e.list(No)),defaultPlan:e.property("default_plan",ce.optional()),displaySettings:e.property("display_settings",Xo),featureUsage:e.property("feature_usage",cr.optional()),postTrialPlan:e.property("post_trial_plan",ce.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",Ho.optional()),subscription:lr.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Re.optional())});var Mee=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 Fu=e.enum_(["all_time","current_month","current_week","current_day"]);var Iu=e.enum_(["first_of_month","billing_cycle"]);var Gee=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",Fu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Iu.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",H)});var Zi=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",tr),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Qee=e.object({expiryType:e.property("expiry_type",N.optional()),expiryUnit:e.property("expiry_unit",K.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Be),resetStart:e.property("reset_start",Ee),resetType:e.property("reset_type",De.optional())});var ore=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",q),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var ire=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 cre=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:Zo,subtype:e.string().optional(),type:je,updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional())});var pre=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 Yi=e.object({keys:e.record(e.string(),e.string())});var Ku=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var Qi=e.object({addOnSelections:e.property("add_on_selections",e.list(Ku)),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(Wr)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(Jr)),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 zre=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 Rre=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 _re=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 Ere=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",q.optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Pre=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 Tre=e.enum_(["549e6fea","placeholder-for-fern-compatibility"]);var qu=e.enum_(["all_time","current_day","current_month","current_week"]);var Lu=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Bre=e.object({companyId:e.property("company_id",e.string().optional()),err: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",qu.optional()),featureUsageResetAt:e.property("feature_usage_reset_at",e.date().optional()),flagId:e.property("flag_id",e.string().optional()),flagKey:e.property("flag_key",e.string()),reason:e.string(),ruleId:e.property("rule_id",e.string().optional()),ruleType:e.property("rule_type",Lu.optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var Gu=e.enum_(["first_of_month","billing_cycle"]);var Nu=e.enum_(["all_time","current_day","current_month","current_week"]);var Xu=e.object({accountId:e.property("account_id",e.string()),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",Gu),period:Nu,validUntil:e.property("valid_until",e.date().optional()),value:e.number()});var Hu=e.enum_(["bool","date","int","string"]);var Wu=e.enum_(["company","user"]);var so=e.object({comparableType:e.property("comparable_type",Hu),entityType:e.property("entity_type",Wu),id:e.string()});var Ju=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var $u=e.enum_(["all_time","current_day","current_month","current_week"]);var Zu=e.enum_(["first_of_month","billing_cycle"]);var Yu=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var ht=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",so.optional()),conditionType:e.property("condition_type",Ju),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",$u.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Zu.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Yu,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",so.optional()),traitValue:e.property("trait_value",e.string())});var Qu=e.object({conditions:e.list(ht)});var ed=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var $r=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(Qu)),conditions:e.list(ht),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",ed),value:e.boolean()});var rd=e.object({id:e.string(),periodEnd:e.property("period_end",e.date()),periodStart:e.property("period_start",e.date())});var gt=e.object({traitDefinition:e.property("trait_definition",so.optional()),value:e.string()});var yoe=e.object({accountId:e.property("account_id",e.string()),basePlanId:e.property("base_plan_id",e.string().optional()),billingProductIds:e.property("billing_product_ids",e.list(e.string())),creditBalances:e.property("credit_balances",e.record(e.string(),e.number())),crmProductIds:e.property("crm_product_ids",e.list(e.string())),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.record(e.string(),e.string()),metrics:e.list(Xu),planIds:e.property("plan_ids",e.list(e.string())),rules:e.list($r),subscription:rd.optional(),traits:e.list(gt)});var Roe=e.object({accountId:e.property("account_id",e.string()),defaultValue:e.property("default_value",e.boolean()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),rules:e.list($r)});var xoe=e.object({accountId:e.property("account_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.record(e.string(),e.string()),rules:e.list($r),traits:e.list(gt)});var Poe=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",lt),updatedAt:e.property("updated_at",e.date())});var od=e.enum_(["all_time","current_month","current_week","current_day"]);var td=e.enum_(["first_of_month","billing_cycle"]);var Voe=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),metricPeriod:e.property("metric_period",od.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",td.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",H)});var Aoe=e.object({conditionGroups:e.property("condition_groups",e.list(tt)),conditions:e.list(Gr),name:e.string(),priority:e.number(),value:e.boolean()});var ea=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 ra=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 oa=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 Loe=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 Woe=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(Ce).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",ze.optional()),priceTiers:e.property("price_tiers",e.list(Ce).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",te.optional()),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ce).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Yoe=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",Ke),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:pt,updatedAt:e.property("updated_at",e.date()),webhookId:e.property("webhook_id",e.string())});var wt=class{constructor(t={}){this._options=t}listApiKeys(t,o){return R.fromPromise(this.__listApiKeys(t,o))}async __listApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,l={};r!=null&&(l.environment_id=r),l.require_environment=i.toString(),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:ws.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 b("Timeout exceeded when calling GET /api-keys.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createApiKey(t,o){return R.fromPromise(this.__createApiKey(t,o))}async __createApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /api-keys.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getApiKey(t,o){return R.fromPromise(this.__getApiKey(t,o))}async __getApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updateApiKey(t,o,r))}async __updateApiKey(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Rs.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 b("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 R.fromPromise(this.__deleteApiKey(t,o))}async __deleteApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__countApiKeys(t,o))}async __countApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,l={};r!=null&&(l.environment_id=r),l.require_environment=i.toString(),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:Ss.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 b("Timeout exceeded when calling GET /api-keys/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listApiRequests(t={},o){return R.fromPromise(this.__listApiRequests(t,o))}async __listApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:Es.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 b("Timeout exceeded when calling GET /api-requests.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getApiRequest(t,o){return R.fromPromise(this.__getApiRequest(t,o))}async __getApiRequest(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Ps.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("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 R.fromPromise(this.__countApiRequests(t,o))}async __countApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:Ts.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 b("Timeout exceeded when calling GET /api-requests/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listEnvironments(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:Os.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 b("Timeout exceeded when calling GET /environments.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createEnvironment(t,o){return R.fromPromise(this.__createEnvironment(t,o))}async __createEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /environments.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEnvironment(t,o){return R.fromPromise(this.__getEnvironment(t,o))}async __getEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Vs.parseOrThrow(r.body,{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 b("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 R.fromPromise(this.__updateEnvironment(t,o,r))}async __updateEnvironment(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Bs.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 b("Timeout exceeded when calling PUT /environments/{environment_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteEnvironment(t,o){return R.fromPromise(this.__deleteEnvironment(t,o))}async __deleteEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Ds.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling DELETE /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}quickstart(t){return R.fromPromise(this.__quickstart(t))}async __quickstart(t){let o=await(this._options.fetcher??_)({url:(0,he.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:As.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 b("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 Q=re(require("url-join"));var yt=class{constructor(t={}){this._options=t}listCoupons(t={},o){return R.fromPromise(this.__listCoupons(t,o))}async __listCoupons(t={},o){let{isActive:r,q:i,limit:m,offset:g}=t,l={};r!=null&&(l.is_active=r.toString()),i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:Is.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 b("Timeout exceeded when calling GET /billing/coupons.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertBillingCoupon(t,o){return R.fromPromise(this.__upsertBillingCoupon(t,o))}async __upsertBillingCoupon(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /billing/coupons.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingCustomer(t,o){return R.fromPromise(this.__upsertBillingCustomer(t,o))}async __upsertBillingCustomer(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /billing/customer/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCustomersWithSubscriptions(t={},o){return R.fromPromise(this.__listCustomersWithSubscriptions(t,o))}async __listCustomersWithSubscriptions(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.company_ids=r.map(y=>y):p.company_ids=r),i!=null&&(p.name=i),m!=null&&(p.failed_to_import=m.toString()),g!=null&&(p.q=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Hs.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 b("Timeout exceeded when calling GET /billing/customers.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countCustomers(t={},o){return R.fromPromise(this.__countCustomers(t,o))}async __countCustomers(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.company_ids=r.map(y=>y):p.company_ids=r),i!=null&&(p.name=i),m!=null&&(p.failed_to_import=m.toString()),g!=null&&(p.q=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Js.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 b("Timeout exceeded when calling GET /billing/customers/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}listInvoices(t,o){return R.fromPromise(this.__listInvoices(t,o))}async __listInvoices(t,o){let{companyId:r,customerExternalId:i,subscriptionExternalId:m,limit:g,offset:l}=t,s={};r!=null&&(s.company_id=r),s.customer_external_id=i,s.subscription_external_id=m,g!=null&&(s.limit=g.toString()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:Zs.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 b("Timeout exceeded when calling GET /billing/invoices.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}upsertInvoice(t,o){return R.fromPromise(this.__upsertInvoice(t,o))}async __upsertInvoice(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Ys.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /billing/invoices.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMeters(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:en.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 b("Timeout exceeded when calling GET /billing/meter.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}upsertBillingMeter(t,o){return R.fromPromise(this.__upsertBillingMeter(t,o))}async __upsertBillingMeter(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Qt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:rn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /billing/meter/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaymentMethods(t,o){return R.fromPromise(this.__listPaymentMethods(t,o))}async __listPaymentMethods(t,o){let{companyId:r,customerExternalId:i,limit:m,offset:g}=t,l={};r!=null&&(l.company_id=r),l.customer_external_id=i,m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(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 b("Timeout exceeded when calling GET /billing/payment-methods.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertPaymentMethod(t,o){return R.fromPromise(this.__upsertPaymentMethod(t,o))}async __upsertPaymentMethod(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:an.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /billing/payment-methods.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingPrices(t={},o){return R.fromPromise(this.__listBillingPrices(t,o))}async __listBillingPrices(t={},o){let{forInitialPlan:r,forTrialExpiryPlan:i,ids:m,interval:g,isActive:l,price:s,productId:p,productIds:u,q:y,tiersMode:z,usageType:C,withMeter:O,limit:v,offset:j}=t,B={};r!=null&&(B.for_initial_plan=r.toString()),i!=null&&(B.for_trial_expiry_plan=i.toString()),m!=null&&(Array.isArray(m)?B.ids=m.map(k=>k):B.ids=m),g!=null&&(B.interval=g),l!=null&&(B.is_active=l.toString()),s!=null&&(B.price=s.toString()),p!=null&&(B.product_id=p),u!=null&&(Array.isArray(u)?B.product_ids=u.map(k=>k):B.product_ids=u),y!=null&&(B.q=y),z!=null&&(B.tiers_mode=te.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})),C!=null&&(B.usage_type=W.jsonOrThrow(C,{unrecognizedObjectKeys:"strip"})),O!=null&&(B.with_meter=O.toString()),v!=null&&(B.limit=v.toString()),j!=null&&(B.offset=j.toString());let T=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:B,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:nn.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 b("Timeout exceeded when calling GET /billing/price.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}upsertBillingPrice(t,o){return R.fromPromise(this.__upsertBillingPrice(t,o))}async __upsertBillingPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /billing/price/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBillingProduct(t,o){return R.fromPromise(this.__deleteBillingProduct(t,o))}async __deleteBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:ln.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling DELETE /billing/product/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingProductPrices(t={},o){return R.fromPromise(this.__listBillingProductPrices(t,o))}async __listBillingProductPrices(t={},o){let{forInitialPlan:r,forTrialExpiryPlan:i,ids:m,interval:g,isActive:l,price:s,productId:p,productIds:u,q:y,tiersMode:z,usageType:C,withMeter:O,limit:v,offset:j}=t,B={};r!=null&&(B.for_initial_plan=r.toString()),i!=null&&(B.for_trial_expiry_plan=i.toString()),m!=null&&(Array.isArray(m)?B.ids=m.map(k=>k):B.ids=m),g!=null&&(B.interval=g),l!=null&&(B.is_active=l.toString()),s!=null&&(B.price=s.toString()),p!=null&&(B.product_id=p),u!=null&&(Array.isArray(u)?B.product_ids=u.map(k=>k):B.product_ids=u),y!=null&&(B.q=y),z!=null&&(B.tiers_mode=te.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})),C!=null&&(B.usage_type=W.jsonOrThrow(C,{unrecognizedObjectKeys:"strip"})),O!=null&&(B.with_meter=O.toString()),v!=null&&(B.limit=v.toString()),j!=null&&(B.offset=j.toString());let T=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:B,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:mn.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 b("Timeout exceeded when calling GET /billing/product/prices.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}deleteProductPrice(t,o){return R.fromPromise(this.__deleteProductPrice(t,o))}async __deleteProductPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 R.fromPromise(this.__upsertBillingProduct(t,o))}async __upsertBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:oi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /billing/product/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingProducts(t={},o){return R.fromPromise(this.__listBillingProducts(t,o))}async __listBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:l,withOneTimeCharges:s,withZeroPrice:p,withPricesOnly:u,isActive:y,limit:z,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(j=>j):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=W.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(O.without_linked_to_plan=l.toString()),s!=null&&(O.with_one_time_charges=s.toString()),p!=null&&(O.with_zero_price=p.toString()),u!=null&&(O.with_prices_only=u.toString()),y!=null&&(O.is_active=y.toString()),z!=null&&(O.limit=z.toString()),C!=null&&(O.offset=C.toString());let v=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(v.ok)return{data:gn.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 b("Timeout exceeded when calling GET /billing/products.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}countBillingProducts(t={},o){return R.fromPromise(this.__countBillingProducts(t,o))}async __countBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:l,withOneTimeCharges:s,withZeroPrice:p,withPricesOnly:u,isActive:y,limit:z,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(j=>j):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=W.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(O.without_linked_to_plan=l.toString()),s!=null&&(O.with_one_time_charges=s.toString()),p!=null&&(O.with_zero_price=p.toString()),u!=null&&(O.with_prices_only=u.toString()),y!=null&&(O.is_active=y.toString()),z!=null&&(O.limit=z.toString()),C!=null&&(O.offset=C.toString());let v=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(v.ok)return{data:yn.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 b("Timeout exceeded when calling GET /billing/products/count.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}upsertBillingSubscription(t,o){return R.fromPromise(this.__upsertBillingSubscription(t,o))}async __upsertBillingSubscription(t,o){let r=await(this._options.fetcher??_)({url:(0,Q.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 X=re(require("url-join"));var zt=class{constructor(t={}){this._options=t}listBillingCredits(t={},o){return R.fromPromise(this.__listBillingCredits(t,o))}async __listBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(p=>p):l.ids=r),i!=null&&(l.name=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.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/credits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:xn.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 b("Timeout exceeded when calling GET /billing/credits.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createBillingCredit(t,o){return R.fromPromise(this.__createBillingCredit(t,o))}async __createBillingCredit(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/credits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /billing/credits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSingleBillingCredit(t,o){return R.fromPromise(this.__getSingleBillingCredit(t,o))}async __getSingleBillingCredit(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/credits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 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 b("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 R.fromPromise(this.__updateBillingCredit(t,o,r))}async __updateBillingCredit(t,o,r){let i=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Pn.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 b("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 R.fromPromise(this.__softDeleteBillingCredit(t,o))}async __softDeleteBillingCredit(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/credits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__listCreditBundles(t,o))}async __listCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(y=>y):p.ids=r),i!=null&&(p.credit_id=i),m!=null&&(p.status=ge.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(p.bundle_type=fe.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(p.limit=l.toString()),s!=null&&(p.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/credits/bundles"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:vn.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 b("Timeout exceeded when calling GET /billing/credits/bundles.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createCreditBundle(t,o){return R.fromPromise(this.__createCreditBundle(t,o))}async __createCreditBundle(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/credits/bundles"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 b("Timeout exceeded when calling POST /billing/credits/bundles.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCreditBundle(t,o){return R.fromPromise(this.__getCreditBundle(t,o))}async __getCreditBundle(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/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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updateCreditBundleDetails(t,o,r))}async __updateCreditBundleDetails(t,o,r){let i=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:kn.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 b("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 R.fromPromise(this.__deleteCreditBundle(t,o))}async __deleteCreditBundle(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/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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Vn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("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 R.fromPromise(this.__countCreditBundles(t,o))}async __countCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(y=>y):p.ids=r),i!=null&&(p.credit_id=i),m!=null&&(p.status=ge.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(p.bundle_type=fe.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(p.limit=l.toString()),s!=null&&(p.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/credits/bundles/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Dn.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 b("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 R.fromPromise(this.__countBillingCredits(t,o))}async __countBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(p=>p):l.ids=r),i!=null&&(l.name=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.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/credits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:An.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 b("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 R.fromPromise(this.__zeroOutGrant(t,o,r))}async __zeroOutGrant(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Fn.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 b("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 R.fromPromise(this.__grantBillingCreditsToCompany(t,o))}async __grantBillingCreditsToCompany(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/credits/grants/company"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:In.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("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 R.fromPromise(this.__listCompanyGrants(t,o))}async __listCompanyGrants(t={},o){let{companyId:r,order:i,dir:m,limit:g,offset:l}=t,s={};r!=null&&(s.company_id=r),i!=null&&(s.order=xo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"})),m!=null&&(s.dir=Oe.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(s.limit=g.toString()),l!=null&&(s.offset=l.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/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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:qn.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 b("Timeout exceeded when calling GET /billing/credits/grants/company/list.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}countBillingCreditsGrants(t={},o){return R.fromPromise(this.__countBillingCreditsGrants(t,o))}async __countBillingCreditsGrants(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(p=>p):l.ids=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.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/credits/grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:Gn.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 b("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 R.fromPromise(this.__listGrantsForCredit(t,o))}async __listGrantsForCredit(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(p=>p):l.ids=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.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/credits/grants/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:Xn.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 b("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 R.fromPromise(this.__getEnrichedCreditLedger(t,o))}async __getEnrichedCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:l,endTime:s,limit:p,offset:u}=t,y={};y.company_id=r,i!=null&&(y.billing_credit_id=i),m!=null&&(y.feature_id=m),y.period=zr.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),l!=null&&(y.start_time=l),s!=null&&(y.end_time=s),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:Yn.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 b("Timeout exceeded when calling GET /billing/credits/ledger.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}countCreditLedger(t,o){return R.fromPromise(this.__countCreditLedger(t,o))}async __countCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:l,endTime:s,limit:p,offset:u}=t,y={};y.company_id=r,i!=null&&(y.billing_credit_id=i),m!=null&&(y.feature_id=m),y.period=zr.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),l!=null&&(y.start_time=l),s!=null&&(y.end_time=s),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:ec.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 b("Timeout exceeded when calling GET /billing/credits/ledger/count.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}listBillingPlanCreditGrants(t={},o){return R.fromPromise(this.__listBillingPlanCreditGrants(t,o))}async __listBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:l,offset:s}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(p.plan_id=i),m!=null&&(Array.isArray(m)?p.plan_ids=m.map(y=>y):p.plan_ids=m),g!=null&&(Array.isArray(g)?p.ids=g.map(y=>y):p.ids=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.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/credits/plan-grants"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:oc.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 b("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 R.fromPromise(this.__createBillingPlanCreditGrant(t,o))}async __createBillingPlanCreditGrant(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/credits/plan-grants"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updateBillingPlanCreditGrant(t,o,r))}async __updateBillingPlanCreditGrant(t,o,r){let i=await(this._options.fetcher??_)({url:(0,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ic.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 b("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 R.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,X.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:sc.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 b("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 R.fromPromise(this.__countBillingPlanCreditGrants(t,o))}async __countBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:l,offset:s}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(p.plan_id=i),m!=null&&(Array.isArray(m)?p.plan_ids=m.map(y=>y):p.plan_ids=m),g!=null&&(Array.isArray(g)?p.ids=g.map(y=>y):p.ids=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.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/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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:cc.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 b("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 mr=re(require("url-join"));var bt=class{constructor(t={}){this._options=t}internal(t,o){return R.fromPromise(this.__internal(t,o))}async __internal(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:$i.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /checkout-internal.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCheckoutData(t,o){return R.fromPromise(this.__getCheckoutData(t,o))}async __getCheckoutData(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:di.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /checkout-internal/data.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewCheckoutInternal(t,o){return R.fromPromise(this.__previewCheckoutInternal(t,o))}async __previewCheckoutInternal(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:$i.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Uc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /checkout-internal/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}managePlan(t,o){return R.fromPromise(this.__managePlan(t,o))}async __managePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Qi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /manage-plan.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewManagePlan(t,o){return R.fromPromise(this.__previewManagePlan(t,o))}async __previewManagePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Qi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /manage-plan/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancelSubscription(t,o){return R.fromPromise(this.__cancelSubscription(t,o))}async __cancelSubscription(t,o){let r=await(this._options.fetcher??_)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan/subscription/cancel"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:hi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),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 b("Timeout exceeded when calling POST /manage-plan/subscription/cancel.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCustomerSubscriptionTrialEnd(t,o={},r){return R.fromPromise(this.__updateCustomerSubscriptionTrialEnd(t,o,r))}async __updateCustomerSubscriptionTrialEnd(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,mr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:gi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Oc.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 b("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 M=re(require("url-join"));var Rt=class{constructor(t={}){this._options=t}listCompanies(t={},o){return R.fromPromise(this.__listCompanies(t,o))}async __listCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:l,withSubscription:s,limit:p,offset:u}=t,y={};r!=null&&(Array.isArray(r)?y.ids=r.map(C=>C):y.ids=r),i!=null&&(y.plan_id=i),m!=null&&(y.q=m),g!=null&&(y.without_feature_override_for=g),l!=null&&(y.without_plan=l.toString()),s!=null&&(y.with_subscription=s.toString()),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:kc.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 b("Timeout exceeded when calling GET /companies.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}upsertCompany(t,o){return R.fromPromise(this.__upsertCompany(t,o))}async __upsertCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),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 b("Timeout exceeded when calling POST /companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompany(t,o){return R.fromPromise(this.__getCompany(t,o))}async __getCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 R.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 l=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:Mc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling DELETE /companies/{company_id}.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countCompanies(t={},o){return R.fromPromise(this.__countCompanies(t,o))}async __countCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:l,withSubscription:s,limit:p,offset:u}=t,y={};r!=null&&(Array.isArray(r)?y.ids=r.map(C=>C):y.ids=r),i!=null&&(y.plan_id=i),m!=null&&(y.q=m),g!=null&&(y.without_feature_override_for=g),l!=null&&(y.without_plan=l.toString()),s!=null&&(y.with_subscription=s.toString()),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:Fc.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 b("Timeout exceeded when calling GET /companies/count.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}countCompaniesForAdvancedFilter(t={},o){return R.fromPromise(this.__countCompaniesForAdvancedFilter(t,o))}async __countCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:l,subscriptionTypes:s,monetizedSubscriptions:p,q:u,withoutPlan:y,withoutSubscription:z,sortOrderColumn:C,sortOrderDirection:O,displayProperties:v,limit:j,offset:B}=t,T={};r!=null&&(Array.isArray(r)?T.ids=r.map(G=>G):T.ids=r),i!=null&&(Array.isArray(i)?T.plan_ids=i.map(G=>G):T.plan_ids=i),m!=null&&(Array.isArray(m)?T.feature_ids=m.map(G=>G):T.feature_ids=m),g!=null&&(Array.isArray(g)?T.credit_type_ids=g.map(G=>G):T.credit_type_ids=g),l!=null&&(Array.isArray(l)?T.subscription_statuses=l.map(G=>Xe.jsonOrThrow(G,{unrecognizedObjectKeys:"strip"})):T.subscription_statuses=Xe.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?T.subscription_types=s.map(G=>He.jsonOrThrow(G,{unrecognizedObjectKeys:"strip"})):T.subscription_types=He.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),p!=null&&(T.monetized_subscriptions=p.toString()),u!=null&&(T.q=u),y!=null&&(T.without_plan=y.toString()),z!=null&&(T.without_subscription=z.toString()),C!=null&&(T.sort_order_column=C),O!=null&&(T.sort_order_direction=Oe.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),v!=null&&(Array.isArray(v)?T.display_properties=v.map(G=>G):T.display_properties=v),j!=null&&(T.limit=j.toString()),B!=null&&(T.offset=B.toString());let k=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(k.ok)return{data:Kc.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 P(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new S(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new U(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);default:throw new c({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}switch(k.error.reason){case"non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case"timeout":throw new b("Timeout exceeded when calling GET /companies/count2.");case"unknown":throw new c({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createCompany(t,o){return R.fromPromise(this.__createCompany(t,o))}async __createCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:qc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /companies/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyByKeys(t,o){return R.fromPromise(this.__deleteCompanyByKeys(t,o))}async __deleteCompanyByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Yi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),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 b("Timeout exceeded when calling POST /companies/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompaniesForAdvancedFilter(t={},o){return R.fromPromise(this.__listCompaniesForAdvancedFilter(t,o))}async __listCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:l,subscriptionTypes:s,monetizedSubscriptions:p,q:u,withoutPlan:y,withoutSubscription:z,sortOrderColumn:C,sortOrderDirection:O,displayProperties:v,limit:j,offset:B}=t,T={};r!=null&&(Array.isArray(r)?T.ids=r.map(G=>G):T.ids=r),i!=null&&(Array.isArray(i)?T.plan_ids=i.map(G=>G):T.plan_ids=i),m!=null&&(Array.isArray(m)?T.feature_ids=m.map(G=>G):T.feature_ids=m),g!=null&&(Array.isArray(g)?T.credit_type_ids=g.map(G=>G):T.credit_type_ids=g),l!=null&&(Array.isArray(l)?T.subscription_statuses=l.map(G=>Xe.jsonOrThrow(G,{unrecognizedObjectKeys:"strip"})):T.subscription_statuses=Xe.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(Array.isArray(s)?T.subscription_types=s.map(G=>He.jsonOrThrow(G,{unrecognizedObjectKeys:"strip"})):T.subscription_types=He.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),p!=null&&(T.monetized_subscriptions=p.toString()),u!=null&&(T.q=u),y!=null&&(T.without_plan=y.toString()),z!=null&&(T.without_subscription=z.toString()),C!=null&&(T.sort_order_column=C),O!=null&&(T.sort_order_direction=Oe.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),v!=null&&(Array.isArray(v)?T.display_properties=v.map(G=>G):T.display_properties=v),j!=null&&(T.limit=j.toString()),B!=null&&(T.offset=B.toString());let k=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(k.ok)return{data:Wc.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 P(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new S(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new x(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new U(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);default:throw new c({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}switch(k.error.reason){case"non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case"timeout":throw new b("Timeout exceeded when calling GET /companies/list2.");case"unknown":throw new c({message:k.error.errorMessage,rawResponse:k.rawResponse})}}lookupCompany(t,o){return R.fromPromise(this.__lookupCompany(t,o))}async __lookupCompany(t,o){let{keys:r}=t,i={};i.keys=be(r);let m=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:$c.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 b("Timeout exceeded when calling GET /companies/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}getActiveDeals(t,o){return R.fromPromise(this.__getActiveDeals(t,o))}async __getActiveDeals(t,o){let{companyId:r,dealStage:i,limit:m,offset:g}=t,l={};l.company_id=r,l.deal_stage=i,m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:el.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 b("Timeout exceeded when calling GET /company-crm-deals.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listCompanyMemberships(t={},o){return R.fromPromise(this.__listCompanyMemberships(t,o))}async __listCompanyMemberships(t={},o){let{companyId:r,userId:i,limit:m,offset:g}=t,l={};r!=null&&(l.company_id=r),i!=null&&(l.user_id=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:ol.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 b("Timeout exceeded when calling GET /company-memberships.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getOrCreateCompanyMembership(t,o){return R.fromPromise(this.__getOrCreateCompanyMembership(t,o))}async __getOrCreateCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:yi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:tl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /company-memberships.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyMembership(t,o){return R.fromPromise(this.__deleteCompanyMembership(t,o))}async __deleteCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__getActiveCompanySubscription(t,o))}async __getActiveCompanySubscription(t={},o){let{companyId:r,companyIds:i,limit:m,offset:g}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.company_ids=i.map(p=>p):l.company_ids=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:sl.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 b("Timeout exceeded when calling GET /company-subscriptions.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCompanyTrait(t,o){return R.fromPromise(this.__upsertCompanyTrait(t,o))}async __upsertCompanyTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /company-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEntityKeyDefinitions(t={},o){return R.fromPromise(this.__listEntityKeyDefinitions(t,o))}async __listEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:l}=t,s={};r!=null&&(s.entity_type=q.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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:ll.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 b("Timeout exceeded when calling GET /entity-key-definitions.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}countEntityKeyDefinitions(t={},o){return R.fromPromise(this.__countEntityKeyDefinitions(t,o))}async __countEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:l}=t,s={};r!=null&&(s.entity_type=q.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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:ml.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 b("Timeout exceeded when calling GET /entity-key-definitions/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listEntityTraitDefinitions(t={},o){return R.fromPromise(this.__listEntityTraitDefinitions(t,o))}async __listEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,traitTypes:l,limit:s,offset:p}=t,u={};r!=null&&(u.entity_type=q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?u.ids=i.map(z=>z):u.ids=i),m!=null&&(u.q=m),g!=null&&(u.trait_type=Y.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(Array.isArray(l)?u.trait_types=l.map(z=>Y.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})):u.trait_types=Y.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(y.ok)return{data:dl.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 b("Timeout exceeded when calling GET /entity-trait-definitions.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}getOrCreateEntityTraitDefinition(t,o){return R.fromPromise(this.__getOrCreateEntityTraitDefinition(t,o))}async __getOrCreateEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:zi.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 b("Timeout exceeded when calling POST /entity-trait-definitions.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEntityTraitDefinition(t,o){return R.fromPromise(this.__getEntityTraitDefinition(t,o))}async __getEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:gl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("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 R.fromPromise(this.__updateEntityTraitDefinition(t,o,r))}async __updateEntityTraitDefinition(t,o,r){let i=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:bi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:wl.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 b("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 R.fromPromise(this.__countEntityTraitDefinitions(t,o))}async __countEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,traitTypes:l,limit:s,offset:p}=t,u={};r!=null&&(u.entity_type=q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?u.ids=i.map(z=>z):u.ids=i),m!=null&&(u.q=m),g!=null&&(u.trait_type=Y.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),l!=null&&(Array.isArray(l)?u.trait_types=l.map(z=>Y.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})):u.trait_types=Y.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(y.ok)return{data:zl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling GET /entity-trait-definitions/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}getEntityTraitValues(t,o){return R.fromPromise(this.__getEntityTraitValues(t,o))}async __getEntityTraitValues(t,o){let{definitionId:r,q:i,limit:m,offset:g}=t,l={};l.definition_id=r,i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(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 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 b("Timeout exceeded when calling GET /entity-trait-values.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanChanges(t={},o){return R.fromPromise(this.__listPlanChanges(t,o))}async __listPlanChanges(t={},o){let{action:r,basePlanAction:i,companyId:m,companyIds:g,planIds:l,limit:s,offset:p}=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(z=>z):u.company_ids=g),l!=null&&(Array.isArray(l)?u.plan_ids=l.map(z=>z):u.plan_ids=l),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(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 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 b("Timeout exceeded when calling GET /plan-changes.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}getPlanChange(t,o){return R.fromPromise(this.__getPlanChange(t,o))}async __getPlanChange(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Tl.parseOrThrow(r.body,{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 b("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 R.fromPromise(this.__listPlanTraits(t,o))}async __listPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(y=>y):p.ids=r),i!=null&&(p.plan_id=i),m!=null&&(p.trait_id=m),g!=null&&(Array.isArray(g)?p.trait_ids=g.map(y=>y):p.trait_ids=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Ol.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 b("Timeout exceeded when calling GET /plan-traits.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createPlanTrait(t,o){return R.fromPromise(this.__createPlanTrait(t,o))}async __createPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("Timeout exceeded when calling POST /plan-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanTrait(t,o){return R.fromPromise(this.__getPlanTrait(t,o))}async __getPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:kl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new 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 b("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 R.fromPromise(this.__updatePlanTrait(t,o,r))}async __updatePlanTrait(t,o,r){let i=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:fi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Vl.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 b("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 R.fromPromise(this.__deletePlanTrait(t,o))}async __deletePlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updatePlanTraitsBulk(t,o))}async __updatePlanTraitsBulk(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:_i.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 b("Timeout exceeded when calling POST /plan-traits/bulk.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanTraits(t={},o){return R.fromPromise(this.__countPlanTraits(t,o))}async __countPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:l,offset:s}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(y=>y):p.ids=r),i!=null&&(p.plan_id=i),m!=null&&(p.trait_id=m),g!=null&&(Array.isArray(g)?p.trait_ids=g.map(y=>y):p.trait_ids=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Al.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 b("Timeout exceeded when calling GET /plan-traits/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUserTrait(t,o){return R.fromPromise(this.__upsertUserTrait(t,o))}async __upsertUserTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ra.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 b("Timeout exceeded when calling POST /user-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listUsers(t={},o){return R.fromPromise(this.__listUsers(t,o))}async __listUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:l,offset:s}=t,p={};r!=null&&(p.company_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(y=>y):p.ids=i),m!=null&&(p.plan_id=m),g!=null&&(p.q=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Kl.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 b("Timeout exceeded when calling GET /users.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUser(t,o){return R.fromPromise(this.__upsertUser(t,o))}async __upsertUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:oa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),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 b("Timeout exceeded when calling POST /users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getUser(t,o){return R.fromPromise(this.__getUser(t,o))}async __getUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Ll.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("Timeout exceeded when calling GET /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUser(t,o){return R.fromPromise(this.__deleteUser(t,o))}async __deleteUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Gl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling DELETE /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countUsers(t={},o){return R.fromPromise(this.__countUsers(t,o))}async __countUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:l,offset:s}=t,p={};r!=null&&(p.company_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(y=>y):p.ids=i),m!=null&&(p.plan_id=m),g!=null&&(p.q=g),l!=null&&(p.limit=l.toString()),s!=null&&(p.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(u.ok)return{data:Xl.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 b("Timeout exceeded when calling GET /users/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createUser(t,o){return R.fromPromise(this.__createUser(t,o))}async __createUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:oa.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 b("Timeout exceeded when calling POST /users/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUserByKeys(t,o){return R.fromPromise(this.__deleteUserByKeys(t,o))}async __deleteUserByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Yi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /users/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}lookupUser(t,o){return R.fromPromise(this.__lookupUser(t,o))}async __lookupUser(t,o){let{keys:r}=t,i={};i.keys=be(r);let m=await(this._options.fetcher??_)({url:(0,M.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:$l.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 b("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 ee=re(require("url-join"));var ft=class{constructor(t={}){this._options=t}listCompanyOverrides(t={},o){return R.fromPromise(this.__listCompanyOverrides(t,o))}async __listCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:l,withoutExpired:s,q:p,limit:u,offset:y}=t,z={};r!=null&&(z.company_id=r),i!=null&&(Array.isArray(i)?z.company_ids=i.map(O=>O):z.company_ids=i),m!=null&&(z.feature_id=m),g!=null&&(Array.isArray(g)?z.feature_ids=g.map(O=>O):z.feature_ids=g),l!=null&&(Array.isArray(l)?z.ids=l.map(O=>O):z.ids=l),s!=null&&(z.without_expired=s.toString()),p!=null&&(z.q=p),u!=null&&(z.limit=u.toString()),y!=null&&(z.offset=y.toString());let C=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(C.ok)return{data:Ql.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 b("Timeout exceeded when calling GET /company-overrides.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createCompanyOverride(t,o){return R.fromPromise(this.__createCompanyOverride(t,o))}async __createCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:op.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /company-overrides.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompanyOverride(t,o){return R.fromPromise(this.__getCompanyOverride(t,o))}async __getCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updateCompanyOverride(t,o,r))}async __updateCompanyOverride(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:xi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:sp.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 b("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 R.fromPromise(this.__deleteCompanyOverride(t,o))}async __deleteCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 b("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 R.fromPromise(this.__countCompanyOverrides(t,o))}async __countCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:l,withoutExpired:s,q:p,limit:u,offset:y}=t,z={};r!=null&&(z.company_id=r),i!=null&&(Array.isArray(i)?z.company_ids=i.map(O=>O):z.company_ids=i),m!=null&&(z.feature_id=m),g!=null&&(Array.isArray(g)?z.feature_ids=g.map(O=>O):z.feature_ids=g),l!=null&&(Array.isArray(l)?z.ids=l.map(O=>O):z.ids=l),s!=null&&(z.without_expired=s.toString()),p!=null&&(z.q=p),u!=null&&(z.limit=u.toString()),y!=null&&(z.offset=y.toString());let C=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(C.ok)return{data:lp.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 b("Timeout exceeded when calling GET /company-overrides/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}listFeatureCompanies(t,o){return R.fromPromise(this.__listFeatureCompanies(t,o))}async __listFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,l={};l.feature_id=r,i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:dp.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 b("Timeout exceeded when calling GET /feature-companies.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureCompanies(t,o){return R.fromPromise(this.__countFeatureCompanies(t,o))}async __countFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,l={};l.feature_id=r,i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(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 b("Timeout exceeded when calling GET /feature-companies/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listFeatureUsage(t={},o){return R.fromPromise(this.__listFeatureUsage(t,o))}async __listFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:l,limit:s,offset:p}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=be(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(z=>z):u.feature_ids=m),g!=null&&(u.q=g),l!=null&&(u.without_negative_entitlements=l.toString()),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(y.ok)return{data:yp.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 b("Timeout exceeded when calling GET /feature-usage.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countFeatureUsage(t={},o){return R.fromPromise(this.__countFeatureUsage(t,o))}async __countFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:l,limit:s,offset:p}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=be(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(z=>z):u.feature_ids=m),g!=null&&(u.q=g),l!=null&&(u.without_negative_entitlements=l.toString()),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(y.ok)return{data:bp.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 b("Timeout exceeded when calling GET /feature-usage/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listFeatureUsers(t,o){return R.fromPromise(this.__listFeatureUsers(t,o))}async __listFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,l={};l.feature_id=r,i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:_p.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 b("Timeout exceeded when calling GET /feature-users.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureUsers(t,o){return R.fromPromise(this.__countFeatureUsers(t,o))}async __countFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,l={};l.feature_id=r,i!=null&&(l.q=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:xp.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 b("Timeout exceeded when calling GET /feature-users/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanEntitlements(t={},o){return R.fromPromise(this.__listPlanEntitlements(t,o))}async __listPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:l,q:s,withMeteredProducts:p,limit:u,offset:y}=t,z={};r!=null&&(z.feature_id=r),i!=null&&(Array.isArray(i)?z.feature_ids=i.map(O=>O):z.feature_ids=i),m!=null&&(Array.isArray(m)?z.ids=m.map(O=>O):z.ids=m),g!=null&&(z.plan_id=g),l!=null&&(Array.isArray(l)?z.plan_ids=l.map(O=>O):z.plan_ids=l),s!=null&&(z.q=s),p!=null&&(z.with_metered_products=p.toString()),u!=null&&(z.limit=u.toString()),y!=null&&(z.offset=y.toString());let C=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(C.ok)return{data:Up.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 b("Timeout exceeded when calling GET /plan-entitlements.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createPlanEntitlement(t,o){return R.fromPromise(this.__createPlanEntitlement(t,o))}async __createPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});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 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 b("Timeout exceeded when calling POST /plan-entitlements.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanEntitlement(t,o){return R.fromPromise(this.__getPlanEntitlement(t,o))}async __getPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:vp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("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 R.fromPromise(this.__updatePlanEntitlement(t,o,r))}async __updatePlanEntitlement(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ui.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:kp.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 b("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 R.fromPromise(this.__deletePlanEntitlement(t,o))}async __deletePlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Vp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("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 R.fromPromise(this.__countPlanEntitlements(t,o))}async __countPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:l,q:s,withMeteredProducts:p,limit:u,offset:y}=t,z={};r!=null&&(z.feature_id=r),i!=null&&(Array.isArray(i)?z.feature_ids=i.map(O=>O):z.feature_ids=i),m!=null&&(Array.isArray(m)?z.ids=m.map(O=>O):z.ids=m),g!=null&&(z.plan_id=g),l!=null&&(Array.isArray(l)?z.plan_ids=l.map(O=>O):z.plan_ids=l),s!=null&&(z.q=s),p!=null&&(z.with_metered_products=p.toString()),u!=null&&(z.limit=u.toString()),y!=null&&(z.offset=y.toString());let C=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(C.ok)return{data:Dp.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 b("Timeout exceeded when calling GET /plan-entitlements/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}duplicatePlanEntitlements(t,o){return R.fromPromise(this.__duplicatePlanEntitlements(t,o))}async __duplicatePlanEntitlements(t,o){let r=await(this._options.fetcher??_)({url:(0,ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements/duplicate"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Ip.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /plan-entitlements/duplicate.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFeatureUsageByCompany(t,o){return R.fromPromise(this.__getFeatureUsageByCompany(t,o))}async __getFeatureUsageByCompany(t,o){let{keys:r}=t,i={};i.keys=be(r);let m=await(this._options.fetcher??_)({url:(0,ee.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:qp.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 b("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 Le=re(require("url-join"));var _t=class{constructor(t={}){this._options=t}updateCompanyPlans(t,o,r){return R.fromPromise(this.__updateCompanyPlans(t,o,r))}async __updateCompanyPlans(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ci.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Lp.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 b("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 R.fromPromise(this.__listPlans(t,o))}async __listPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:l,ids:s,planType:p,q:u,withoutEntitlementFor:y,withoutPaidProductId:z,limit:C,offset:O}=t,v={};r!=null&&(v.company_id=r),i!=null&&(v.for_fallback_plan=i.toString()),m!=null&&(v.for_initial_plan=m.toString()),g!=null&&(v.for_trial_expiry_plan=g.toString()),l!=null&&(v.has_product_id=l.toString()),s!=null&&(Array.isArray(s)?v.ids=s.map(B=>B):v.ids=s),p!=null&&(v.plan_type=pe.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),u!=null&&(v.q=u),y!=null&&(v.without_entitlement_for=y),z!=null&&(v.without_paid_product_id=z.toString()),C!=null&&(v.limit=C.toString()),O!=null&&(v.offset=O.toString());let j=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(j.ok)return{data:Np.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new S(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new U(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new c({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}switch(j.error.reason){case"non-json":throw new c({statusCode:j.error.statusCode,body:j.error.rawBody,rawResponse:j.rawResponse});case"timeout":throw new b("Timeout exceeded when calling GET /plans.");case"unknown":throw new c({message:j.error.errorMessage,rawResponse:j.rawResponse})}}createPlan(t,o){return R.fromPromise(this.__createPlan(t,o))}async __createPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Xp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("Timeout exceeded when calling POST /plans.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlan(t,o){return R.fromPromise(this.__getPlan(t,o))}async __getPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Hp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new 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 b("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 R.fromPromise(this.__updatePlan(t,o,r))}async __updatePlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:vi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Wp.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 b("Timeout exceeded when calling PUT /plans/{plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlan(t,o){return R.fromPromise(this.__deletePlan(t,o))}async __deletePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__upsertBillingProductPlan(t,o,r))}async __upsertBillingProductPlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Zp.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 b("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 R.fromPromise(this.__countPlans(t,o))}async __countPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:l,ids:s,planType:p,q:u,withoutEntitlementFor:y,withoutPaidProductId:z,limit:C,offset:O}=t,v={};r!=null&&(v.company_id=r),i!=null&&(v.for_fallback_plan=i.toString()),m!=null&&(v.for_initial_plan=m.toString()),g!=null&&(v.for_trial_expiry_plan=g.toString()),l!=null&&(v.has_product_id=l.toString()),s!=null&&(Array.isArray(s)?v.ids=s.map(B=>B):v.ids=s),p!=null&&(v.plan_type=pe.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),u!=null&&(v.q=u),y!=null&&(v.without_entitlement_for=y),z!=null&&(v.without_paid_product_id=z.toString()),C!=null&&(v.limit=C.toString()),O!=null&&(v.offset=O.toString());let j=await(this._options.fetcher??_)({url:(0,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(j.ok)return{data:Qp.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new S(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new U(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new c({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}switch(j.error.reason){case"non-json":throw new c({statusCode:j.error.statusCode,body:j.error.rawBody,rawResponse:j.rawResponse});case"timeout":throw new b("Timeout exceeded when calling GET /plans/count.");case"unknown":throw new c({message:j.error.errorMessage,rawResponse:j.rawResponse})}}listPlanIssues(t,o){return R.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,Le.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:om.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 b("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 ur=re(require("url-join"));var St=class{constructor(t={}){this._options=t}listComponents(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:im.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 b("Timeout exceeded when calling GET /components.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createComponent(t,o){return R.fromPromise(this.__createComponent(t,o))}async __createComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ji.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),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 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 b("Timeout exceeded when calling POST /components.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getComponent(t,o){return R.fromPromise(this.__getComponent(t,o))}async __getComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:sm.parseOrThrow(r.body,{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 b("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 R.fromPromise(this.__updateComponent(t,o,r))}async __updateComponent(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ki.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:nm.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 b("Timeout exceeded when calling PUT /components/{component_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteComponent(t,o){return R.fromPromise(this.__deleteComponent(t,o))}async __deleteComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:cm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling DELETE /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countComponents(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:pm.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 b("Timeout exceeded when calling GET /components/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}previewComponentData(t={},o){return R.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,ur.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:hm.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 b("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 Zr=re(require("url-join"));var xt=class{constructor(t={}){this._options=t}upsertDealLineItemAssociation(t,o){return R.fromPromise(this.__upsertDealLineItemAssociation(t,o))}async __upsertDealLineItemAssociation(t,o){let r=await(this._options.fetcher??_)({url:(0,Zr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Vi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("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 R.fromPromise(this.__upsertLineItem(t,o))}async __upsertLineItem(t,o){let r=await(this._options.fetcher??_)({url:(0,Zr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Bi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:wm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("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 R.fromPromise(this.__upsertCrmDeal(t,o))}async __upsertCrmDeal(t,o){let r=await(this._options.fetcher??_)({url:(0,Zr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Di.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:zm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("Timeout exceeded when calling POST /crm/deals/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCrmProducts(t={},o){return R.fromPromise(this.__listCrmProducts(t,o))}async __listCrmProducts(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(p=>p):l.ids=r),i!=null&&(l.name=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Zr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(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 b("Timeout exceeded when calling GET /crm/products.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCrmProduct(t,o){return R.fromPromise(this.__upsertCrmProduct(t,o))}async __upsertCrmProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,Zr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Mi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:fm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("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 ta=re(require("url-join"));var Et=class{constructor(t={}){this._options=t}createDataExport(t,o){return R.fromPromise(this.__createDataExport(t,o))}async __createDataExport(t,o){let r=await(this._options.fetcher??_)({url:(0,ta.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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"}),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:Um.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /data-exports.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDataExportArtifact(t,o){return R.fromPromise(this.__getDataExportArtifact(t,o))}async __getDataExportArtifact(t,o){let r=await(this._options.fetcher??_)({url:(0,ta.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 fr=re(require("url-join"));var Ut=class{constructor(t={}){this._options=t}createEventBatch(t,o){return R.fromPromise(this.__createEventBatch(t,o))}async __createEventBatch(t,o){let r=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Fi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Cm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /event-batch.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEventSummaries(t={},o){return R.fromPromise(this.__getEventSummaries(t,o))}async __getEventSummaries(t={},o){let{q:r,eventSubtypes:i,limit:m,offset:g}=t,l={};r!=null&&(l.q=r),i!=null&&(Array.isArray(i)?l.event_subtypes=i.map(p=>p):l.event_subtypes=i),m!=null&&(l.limit=m.toString()),g!=null&&(l.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(s.ok)return{data:vm.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 b("Timeout exceeded when calling GET /event-types.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listEvents(t={},o){return R.fromPromise(this.__listEvents(t,o))}async __listEvents(t={},o){let{companyId:r,eventSubtype:i,eventTypes:m,flagId:g,userId:l,limit:s,offset:p}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.event_subtype=i),m!=null&&(Array.isArray(m)?u.event_types=m.map(z=>je.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})):u.event_types=je.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(u.flag_id=g),l!=null&&(u.user_id=l),s!=null&&(u.limit=s.toString()),p!=null&&(u.offset=p.toString());let y=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(y.ok)return{data:jm.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 b("Timeout exceeded when calling GET /events.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}createEvent(t,o){return R.fromPromise(this.__createEvent(t,o))}async __createEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Qo.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 b("Timeout exceeded when calling POST /events.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEvent(t,o){return R.fromPromise(this.__getEvent(t,o))}async __getEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Vm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("Timeout exceeded when calling GET /events/{event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSegmentIntegrationStatus(t){return R.fromPromise(this.__getSegmentIntegrationStatus(t))}async __getSegmentIntegrationStatus(t){let o=await(this._options.fetcher??_)({url:(0,fr.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Dm.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 b("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 me=re(require("url-join"));var Pt=class{constructor(t={}){this._options=t}listFeatures(t={},o){return R.fromPromise(this.__listFeatures(t,o))}async __listFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:l,booleanRequireEvent:s,limit:p,offset:u}=t,y={};r!=null&&(Array.isArray(r)?y.ids=r.map(C=>C):y.ids=r),i!=null&&(y.q=i),m!=null&&(y.without_company_override_for=m),g!=null&&(y.without_plan_entitlement_for=g),l!=null&&(Array.isArray(l)?y.feature_type=l.map(C=>ie.jsonOrThrow(C,{unrecognizedObjectKeys:"strip"})):y.feature_type=ie.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(y.boolean_require_event=s.toString()),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,me.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:Lm.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 b("Timeout exceeded when calling GET /features.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}createFeature(t,o){return R.fromPromise(this.__createFeature(t,o))}async __createFeature(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,"features"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Gm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 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 b("Timeout exceeded when calling POST /features.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFeature(t,o){return R.fromPromise(this.__getFeature(t,o))}async __getFeature(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,`features/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 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 b("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 R.fromPromise(this.__updateFeature(t,o,r))}async __updateFeature(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,`features/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ki.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Xm.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 b("Timeout exceeded when calling PUT /features/{feature_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeature(t,o){return R.fromPromise(this.__deleteFeature(t,o))}async __deleteFeature(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,`features/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Hm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling DELETE /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFeatures(t={},o){return R.fromPromise(this.__countFeatures(t,o))}async __countFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:l,booleanRequireEvent:s,limit:p,offset:u}=t,y={};r!=null&&(Array.isArray(r)?y.ids=r.map(C=>C):y.ids=r),i!=null&&(y.q=i),m!=null&&(y.without_company_override_for=m),g!=null&&(y.without_plan_entitlement_for=g),l!=null&&(Array.isArray(l)?y.feature_type=l.map(C=>ie.jsonOrThrow(C,{unrecognizedObjectKeys:"strip"})):y.feature_type=ie.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),s!=null&&(y.boolean_require_event=s.toString()),p!=null&&(y.limit=p.toString()),u!=null&&(y.offset=u.toString());let z=await(this._options.fetcher??_)({url:(0,me.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(z.ok)return{data:Jm.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 b("Timeout exceeded when calling GET /features/count.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}listFlags(t={},o){return R.fromPromise(this.__listFlags(t,o))}async __listFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.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,"flags"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:Zm.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 b("Timeout exceeded when calling GET /flags.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createFlag(t,o){return R.fromPromise(this.__createFlag(t,o))}async __createFlag(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,"flags"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Zi.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 b("Timeout exceeded when calling POST /flags.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFlag(t,o){return R.fromPromise(this.__getFlag(t,o))}async __getFlag(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,`flags/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 R.fromPromise(this.__updateFlag(t,o,r))}async __updateFlag(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,`flags/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Zi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:eu.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 b("Timeout exceeded when calling PUT /flags/{flag_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFlag(t,o){return R.fromPromise(this.__deleteFlag(t,o))}async __deleteFlag(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,`flags/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 R.fromPromise(this.__updateFlagRules(t,o,r))}async __updateFlagRules(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,`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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:qi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:iu.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 b("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 R.fromPromise(this.__checkFlag(t,o,r))}async __checkFlag(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,`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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ao.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:au.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 b("Timeout exceeded when calling POST /flags/{key}/check.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlags(t,o){return R.fromPromise(this.__checkFlags(t,o))}async __checkFlags(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,"flags/check"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:su.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /flags/check.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}checkFlagsBulk(t,o){return R.fromPromise(this.__checkFlagsBulk(t,o))}async __checkFlagsBulk(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,"flags/check-bulk"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:cu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /flags/check-bulk.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFlags(t={},o){return R.fromPromise(this.__countFlags(t,o))}async __countFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.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,"flags/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:pu.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 b("Timeout exceeded when calling GET /flags/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 Ct=re(require("url-join"));var Tt=class{constructor(t={}){this._options=t}getPlanGroup(t){return R.fromPromise(this.__getPlanGroup(t))}async __getPlanGroup(t){let o=await(this._options.fetcher??_)({url:(0,Ct.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:bu.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 b("Timeout exceeded when calling GET /plan-groups.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPlanGroup(t,o){return R.fromPromise(this.__createPlanGroup(t,o))}async __createPlanGroup(t,o){let r=await(this._options.fetcher??_)({url:(0,Ct.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:_u.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!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 b("Timeout exceeded when calling POST /plan-groups.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanGroup(t,o,r){return R.fromPromise(this.__updatePlanGroup(t,o,r))}async __updatePlanGroup(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Ct.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Xi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Su.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 b("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 id=re(require("url-join"));var vt=class{constructor(t={}){this._options=t}issueTemporaryAccessToken(t,o){return R.fromPromise(this.__issueTemporaryAccessToken(t,o))}async __issueTemporaryAccessToken(t,o){let r=await(this._options.fetcher??_)({url:(0,id.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...Hi.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: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 b("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 Ge=re(require("url-join"));var Ot=class{constructor(t={}){this._options=t}listWebhookEvents(t={},o){return R.fromPromise(this.__listWebhookEvents(t,o))}async __listWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:Pu.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 b("Timeout exceeded when calling GET /webhook-events.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getWebhookEvent(t,o){return R.fromPromise(this.__getWebhookEvent(t,o))}async __getWebhookEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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:Cu.parseOrThrow(r.body,{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 b("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 R.fromPromise(this.__countWebhookEvents(t,o))}async __countWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:l}=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()),l!=null&&(s.offset=l.toString());let p=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(p.ok)return{data:vu.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 b("Timeout exceeded when calling GET /webhook-events/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listWebhooks(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:ju.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 b("Timeout exceeded when calling GET /webhooks.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createWebhook(t,o){return R.fromPromise(this.__createWebhook(t,o))}async __createWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Wi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ku.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new 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 b("Timeout exceeded when calling POST /webhooks.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWebhook(t,o){return R.fromPromise(this.__getWebhook(t,o))}async __getWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 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 b("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 R.fromPromise(this.__updateWebhook(t,o,r))}async __updateWebhook(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ji.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Bu.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 b("Timeout exceeded when calling PUT /webhooks/{webhook_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteWebhook(t,o){return R.fromPromise(this.__deleteWebhook(t,o))}async __deleteWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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: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 b("Timeout exceeded when calling DELETE /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhooks(t={},o){return R.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 l=await(this._options.fetcher??_)({url:(0,Ge.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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(l.ok)return{data:Au.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 b("Timeout exceeded when calling GET /webhooks/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 jt=class{constructor(t={}){this._options=t}get accounts(){return this._accounts??=new wt(this._options)}get billing(){return this._billing??=new yt(this._options)}get credits(){return this._credits??=new zt(this._options)}get checkout(){return this._checkout??=new bt(this._options)}get companies(){return this._companies??=new Rt(this._options)}get entitlements(){return this._entitlements??=new ft(this._options)}get plans(){return this._plans??=new _t(this._options)}get components(){return this._components??=new St(this._options)}get crm(){return this._crm??=new xt(this._options)}get dataexports(){return this._dataexports??=new Et(this._options)}get events(){return this._events??=new Ut(this._options)}get features(){return this._features??=new Pt(this._options)}get plangroups(){return this._plangroups??=new Tt(this._options)}get accesstokens(){return this._accesstokens??=new vt(this._options)}get webhooks(){return this._webhooks??=new Ot(this._options)}putPlanAudiencesPlanAudienceId(t,o){return R.fromPromise(this.__putPlanAudiencesPlanAudienceId(t,o))}async __putPlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ia.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 R.fromPromise(this.__deletePlanAudiencesPlanAudienceId(t,o))}async __deletePlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ia.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.7","User-Agent":"@schematichq/schematic-typescript-node/1.2.7","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 b("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 Yr=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 sg=1e3,ng=1e3,cg=3,lg=1e3,kt=class{constructor(t,o){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:r=new Yr,maxSize:i=ng,interval:m=sg,offline:g=!1,maxRetries:l=cg,initialRetryDelay:s=lg}=o||{};this.eventsApi=t,this.interval=m,this.logger=r,this.maxSize=i,this.offline=g,this.maxRetries=l,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),l=Math.random()*.1*g,s=g+l;this.logger.warn(`Event batch submission failed: ${m}. Retrying in ${(s/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(p=>setTimeout(p,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 ad(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[l,s]of Object.entries(o.headers))s!=null&&(r[l]=s);let i=co(o.url,o.queryParameters),m=await po({body:o.body,type:o.requestType==="json"?"json":"other"}),g=await lo();try{let l=await ho(async()=>uo(g,i,o.method,r,m,o.timeoutMs,o.abortSignal,o.withCredentials,o.duplex),o.maxRetries),s=await mo(l,o.responseType),p=Sr(l);return l.status>=200&&l.status<400?{ok:!0,body:s,headers:l.headers,rawResponse:p}:{ok:!1,error:{reason:"status-code",statusCode:l.status,body:s},rawResponse:p}}catch(l){return o.abortSignal!=null&&o.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:gr}:l instanceof Error&&l.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:gr}:l instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:l.message},rawResponse:wr}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(l)},rawResponse:wr}}}}async function pg(w){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new hr,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var sd=pg;var Vt=class extends jt{constructor(t){let{apiKey:o="",basePath:r,eventBufferInterval:i,flagDefaults:m={},logger:g=new Yr}=t??{},{offline:l=!1}=t??{},s={};t?.environmentId&&(s["X-Schematic-Environment-Id"]=t.environmentId),t?.headers&&Object.assign(s,t.headers),l?o!==""&&g.debug("Offline mode enabled, ignoring API key"):o===""&&!l&&(g.warn("No API key was provided, running in offline mode"),l=!0),super({apiKey:o,environment:r,fetcher:l?sd:ad(s)}),this.logger=g,this.eventBuffer=new kt(this.events,{interval:i,logger:g,offline:l}),this.flagCheckCacheProviders=t?.cacheProviders?.flagChecks??[new _r],this.flagDefaults=m,this.offline=l}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 p=JSON.stringify({evalCtx:t,key:s}),u=!1;for(let y of this.flagCheckCacheProviders){let z=await y.get(p);if(z!==void 0){this.logger.debug(`${y.constructor.name} cache hit for flag ${s}`),r.set(s,{flag:s,value:z,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,l=[];for(let s of o){let p=g.find(u=>u.flag===s);if(p){let u=JSON.stringify({evalCtx:t,key:s});for(let y of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${u} in ${y.constructor.name}`),await y.set(u,p.value);l.push(p)}else{let u=r.get(s);if(u)l.push(u);else{this.logger.debug(`Flag ${s} not found in API response or cache, using default value`);let y={flag:s,value:this.getFlagDefault(s),reason:"Flag not found - using default value"};l.push(y)}}}return this.logger.debug(`Checked ${o.length} flags: used fresh API values for consistency (${i.length} were cache misses)`),l}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 Bt=re(require("crypto")),aa="X-Schematic-Webhook-Signature",sa="X-Schematic-Webhook-Timestamp",Ne=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 Dt(w,t,o){let r=Buffer.isBuffer(w)?w:Buffer.from(w),i=Buffer.concat([r,Buffer.from(`+${t}`)]),m=Bt.createHmac("sha256",o);return m.update(i),m.digest()}function cd(w,t,o){return Dt(w,t,o).toString("hex")}function na(w,t,o,r){if(!t)throw Ne.missingSignature();if(!o)throw Ne.missingTimestamp();let i;try{i=Buffer.from(t,"hex")}catch(g){throw new Ne(`Invalid signature format: ${g?.message||"Unknown error"}`)}let m=Dt(w,o,r);if(i.length!==m.length||!Bt.timingSafeEqual(i,m))throw Ne.invalidSignature()}function ld(w,t,o,r={}){let i=w.headers,m=r.signatureHeader||aa,g=r.timestampHeader||sa,l=nd(i,m),s=nd(i,g),p;if(o!==void 0)p=o;else if("rawBody"in w&&w.rawBody)p=w.rawBody;else throw new Ne("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");na(p,l,s,t)}function nd(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 om=Object.create;var ci=Object.defineProperty;var tm=Object.getOwnPropertyDescriptor;var am=Object.getOwnPropertyNames;var sm=Object.getPrototypeOf,nm=Object.prototype.hasOwnProperty;var Bo=(p,o)=>()=>(p&&(o=p(p=0)),o);var Ke=(p,o)=>{for(var i in o)ci(p,i,{get:o[i],enumerable:!0})},ra=(p,o,i,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of am(o))!nm.call(p,n)&&n!==i&&ci(p,n,{get:()=>o[n],enumerable:!(a=tm(o,n))||a.enumerable});return p};var Ao=(p,o,i)=>(i=p!=null?om(sm(p)):{},ra(o||!p||!p.__esModule?ci(i,"default",{value:p,enumerable:!0}):i,p)),cm=p=>ra(ci({},"__esModule",{value:!0}),p);var Ua={};Ke(Ua,{Node18UniversalStreamWrapper:()=>Mo});var Mo,Ta=Bo(()=>{"use strict";Mo=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 va={};Ke(va,{UndiciStreamWrapper:()=>Fo});var Fo,Oa=Bo(()=>{"use strict";Fo=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 ja={};Ke(ja,{NodePre18StreamWrapper:()=>Io});var Io,ka=Bo(()=>{"use strict";Io=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 og={};Ke(og,{LocalCache:()=>hr,Schematic:()=>se,SchematicClient:()=>Oo,SchematicEnvironment:()=>_,SchematicError:()=>z,SchematicTimeoutError:()=>cr,WEBHOOK_SIGNATURE_HEADER:()=>Yt,WEBHOOK_TIMESTAMP_HEADER:()=>Xt,WebhookSignatureError:()=>Ie,computeHexSignature:()=>rm,computeSignature:()=>ko,verifySignature:()=>ea,verifyWebhookSignature:()=>im});module.exports=cm(og);var se={};Ke(se,{ApiKeyScope:()=>pm,BadRequestError:()=>v,BillingCreditBundleStatus:()=>um,BillingCreditBurnStrategy:()=>dm,BillingCreditExpiryType:()=>mm,BillingCreditExpiryUnit:()=>hm,BillingCreditGrantReason:()=>gm,BillingCreditGrantZeroedOutReason:()=>ym,BillingCreditRolloverPolicy:()=>wm,BillingPlanCreditGrantResetCadence:()=>bm,BillingPlanCreditGrantResetStart:()=>zm,BillingPlanCreditGrantResetType:()=>Rm,BillingPriceScheme:()=>fm,BillingPriceUsageType:()=>_m,BillingProductPriceInterval:()=>Sm,BillingProviderType:()=>Pm,BillingSubscriptionTrialEndSetting:()=>xm,BillingTiersMode:()=>Em,ChargeType:()=>Cm,CompanyPlanInvalidReason:()=>Um,ComponentEntityType:()=>Tm,ComponentState:()=>vm,ConditionConditionType:()=>Om,ConditionMetricPeriod:()=>jm,ConditionMetricPeriodMonthReset:()=>km,ConditionOperator:()=>Bm,CreateCompanyOverrideRequestBodyMetricPeriod:()=>pa,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ua,CreateEntitlementInBundleRequestBodyMetricPeriod:()=>Am,CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset:()=>Vm,CreateEntitlementReqCommonMetricPeriod:()=>qm,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>Dm,CreateOrUpdateConditionRequestBodyConditionType:()=>Mm,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>Fm,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>Im,CreateOrUpdateConditionRequestBodyOperator:()=>Km,CreateOrUpdateRuleRequestBodyRuleType:()=>Gm,CreatePlanEntitlementRequestBodyMetricPeriod:()=>da,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ma,CreditGrantSortOrder:()=>Lm,CreditLedgerPeriod:()=>Wm,DataExportStatus:()=>Nm,EntitlementPriceBehavior:()=>Hm,EntitlementType:()=>$m,EntitlementValueType:()=>Zm,EntityType:()=>Jm,EnvironmentType:()=>Qm,EventStatus:()=>Ym,EventType:()=>Xm,FeatureLifecyclePhase:()=>eh,FeatureType:()=>rh,ForbiddenError:()=>P,InternalServerError:()=>x,NotFoundError:()=>E,PlanBundleAction:()=>ih,PlanChangeAction:()=>oh,PlanChangeActorType:()=>th,PlanChangeBasePlanAction:()=>ah,PlanChangeSubscriptionAction:()=>sh,PlanControlledByType:()=>nh,PlanType:()=>ch,PlanVersionStatus:()=>lh,ProrationBehavior:()=>ph,RuleRuleType:()=>uh,RulesEngineSchemaVersion:()=>dh,RulesengineCheckFlagResultFeatureUsagePeriod:()=>mh,RulesengineCheckFlagResultRuleType:()=>hh,RulesengineCompanyMetricMonthReset:()=>gh,RulesengineCompanyMetricPeriod:()=>yh,RulesengineConditionConditionType:()=>wh,RulesengineConditionMetricPeriod:()=>bh,RulesengineConditionMetricPeriodMonthReset:()=>zh,RulesengineConditionOperator:()=>Rh,RulesengineEntityType:()=>fh,RulesengineRuleRuleType:()=>_h,RulesengineTraitDefinitionComparableType:()=>Sh,SortDirection:()=>Ph,SubscriptionStatus:()=>xh,SubscriptionType:()=>Eh,TraitDefinitionComparableType:()=>Ch,TraitType:()=>Uh,UnauthorizedError:()=>C,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ha,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ga,UpdateEntitlementReqCommonMetricPeriod:()=>Th,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>vh,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>ya,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>wa,WebhookEventStatus:()=>Oh,WebhookRequestType:()=>jh,WebhookStatus:()=>kh,accesstokens:()=>ia,accounts:()=>oa,billing:()=>ta,checkout:()=>aa,companies:()=>sa,components:()=>na,credits:()=>ca,dataexports:()=>la,entitlements:()=>Vo,events:()=>ba,features:()=>za,planbundle:()=>Ra,plangroups:()=>fa,plans:()=>_a,webhooks:()=>Sa});var me=(p,o,i)=>JSON.stringify(p,o,i);function Jr(p,o){return JSON.parse(p,o)}var z=class extends Error{constructor({message:o,statusCode:i,body:a,rawResponse:n}){super(lm({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 lm({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 v=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 P=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 x=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 E=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 C=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 ia={};var oa={};var ta={};var aa={};var sa={};var na={};var ca={};var la={};var Vo={};Ke(Vo,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>pa,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ua,CreatePlanEntitlementRequestBodyMetricPeriod:()=>da,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>ma,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>ha,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ga,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>ya,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>wa});var pa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ua={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var da={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ma={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ha={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ga={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ya={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var wa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ba={};var za={};var Ra={};var fa={};var _a={};var Sa={};var pm={Admin:"admin",Capture:"capture",Read:"read",Write:"write"};var um={Active:"active",Inactive:"inactive"};var dm={ExpirationPriority:"expiration_priority",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out"};var mm={Duration:"duration",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period",EndOfTrial:"end_of_trial",NoExpiry:"no_expiry"};var hm={BillingPeriods:"billing_periods",Days:"days"};var gm={BillingCreditAutoTopup:"billing_credit_auto_topup",Free:"free",Plan:"plan",Purchased:"purchased"};var ym={Expired:"expired",Manual:"manual",PlanChange:"plan_change",PlanPeriodReset:"plan_period_reset"};var wm={Expire:"expire",None:"none",Rollover:"rollover"};var bm={Daily:"daily",Monthly:"monthly",Weekly:"weekly",Yearly:"yearly"};var zm={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var Rm={NoReset:"no_reset",PlanPeriod:"plan_period"};var fm={PerUnit:"per_unit",Tiered:"tiered"};var _m={Licensed:"licensed",Metered:"metered"};var Sm={Day:"day",Month:"month",OneTime:"one-time",Year:"year"};var Pm={Schematic:"schematic",Stripe:"stripe"};var xm={Cancel:"cancel",Subscribe:"subscribe"};var Em={Graduated:"graduated",Volume:"volume"};var Cm={Free:"free",OneTime:"one_time",Recurring:"recurring"};var Um={DowngradeNotPermitted:"downgrade_not_permitted",FeatureUsageExceeded:"feature_usage_exceeded"};var Tm={Billing:"billing",Entitlement:"entitlement"};var vm={Draft:"draft",Live:"live"};var Om={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 km={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Bm={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Am={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Vm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var qm={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Dm={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Mm={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",BasePlan:"base_plan"};var Fm={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Im={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Km={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Gm={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Lm={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var Wm={Daily:"daily",Monthly:"monthly",Raw:"raw",Weekly:"weekly"};var Nm={Failure:"failure",Pending:"pending",Success:"success"};var Hm={CreditBurndown:"credit_burndown",Overage:"overage",PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Tier:"tier"};var $m={CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Unknown:"unknown"};var Zm={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unknown:"unknown",Unlimited:"unlimited"};var Jm={Company:"company",User:"user"};var Qm={Development:"development",Production:"production",Staging:"staging"};var Ym={Enriched:"enriched",Failed:"failed",Pending:"pending",Processed:"processed",Unknown:"unknown"};var Xm={FlagCheck:"flag_check",Identify:"identify",Track:"track"};var eh={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",Inactive:"inactive",InPlan:"in_plan",InternalTesting:"internal_testing",Legacy:"legacy"};var rh={Boolean:"boolean",Event:"event",Trait:"trait"};var ih={Create:"create",Update:"update",Delete:"delete"};var oh={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 th={ApiKey:"api_key",AppUser:"app_user",System:"system",TemporaryAccessToken:"temporary_access_token"};var ah={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var sh={Adjustment:"adjustment",Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var nh={Schematic:"schematic",Stripe:"stripe"};var ch={Plan:"plan",AddOn:"add_on"};var lh={Published:"published",Draft:"draft",Archived:"archived"};var ph={CreateProrations:"create_prorations",InvoiceImmediately:"invoice_immediately"};var uh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var dh={FiveHundredFortyNineE6Fea:"549e6fea",PlaceholderForFernCompatibility:"placeholder-for-fern-compatibility"};var mh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var hh={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var gh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var yh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var wh={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var bh={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var zh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Rh={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var fh={Company:"company",User:"user"};var _h={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var Sh={Bool:"bool",Date:"date",Int:"int",String:"string"};var Ph={Asc:"asc",Desc:"desc"};var xh={Active:"active",Canceled:"canceled",Expired:"expired",Incomplete:"incomplete",IncompleteExpired:"incomplete_expired",PastDue:"past_due",Paused:"paused",Trialing:"trialing",Unpaid:"unpaid"};var Eh={Free:"free",OneTime:"one_time",Paid:"paid",Trial:"trial"};var Ch={Bool:"bool",Date:"date",Int:"int",String:"string"};var Uh={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Th={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var vh={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Oh={Failure:"failure",Pending:"pending",Success:"success"};var jh={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",AutoTopupHardFailure:"auto.topup.hard.failure",AutoTopupRetryExceeded:"auto.topup.retry.exceeded"};var kh={Active:"active",Inactive:"inactive"};var Qr=require("timers"),hr=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,Qr.setTimeout)(()=>this.evictItem(o,s),n)};this.cache.set(o,s)}resetCache(){this.cache.forEach(o=>{o.timeoutId&&(0,Qr.clearTimeout)(o.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(o,i){i.timeoutId&&(0,Qr.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 Yr=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var Pa={get:async(p,o)=>typeof p=="function"?p(o):p};var Te={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},xa={[Te.Debug]:1,[Te.Info]:2,[Te.Warn]:3,[Te.Error]:4},Xr=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)}},gr=class{constructor(o){this.level=xa[o.level],this.logger=o.logger,this.silent=o.silent}shouldLog(o){return!this.silent&&this.level<=xa[o]}isDebug(){return this.shouldLog(Te.Debug)}debug(o,...i){this.isDebug()&&this.logger.debug(o,...i)}isInfo(){return this.shouldLog(Te.Info)}info(o,...i){this.isInfo()&&this.logger.info(o,...i)}isWarn(){return this.shouldLog(Te.Warn)}warn(o,...i){this.isWarn()&&this.logger.warn(o,...i)}isError(){return this.shouldLog(Te.Error)}error(o,...i){this.isError()&&this.logger.error(o,...i)}};function qo(p){return p==null?Bh:p instanceof gr?p:(p=p??{},p.level??=Te.Info,p.logger??=new Xr,p.silent??=!0,new gr(p))}var Bh=new gr({level:Te.Info,logger:new Xr,silent:!0});var Ah={arrayFormat:"indices",encode:!0};function Ea(p,o){if(p===void 0||p===null)return"";let i=String(p);return o?encodeURIComponent(i):i}function Do(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(...Do(g,d,i))}else{let d=i.arrayFormat==="indices"?`${s}[${u}]`:s,l=i.encode?encodeURIComponent(d):d;a.push(`${l}=${Ea(g,i.encode)}`)}}}else if(typeof r=="object"&&r!==null){if(Object.keys(r).length===0)continue;a.push(...Do(r,s,i))}else{let u=i.encode?encodeURIComponent(s):s;a.push(`${u}=${Ea(r,i.encode)}`)}}return a}function yr(p,o){return p==null||typeof p!="object"?"":Do(p,"",{...Ah,...o}).join("&")}function li(p,o){let i=yr(o,{arrayFormat:"repeat"});return i?`${p}?${i}`:p}function Ca(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=Vh();function Vh(){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 Ba(p){return he.type==="node"&&he.parsedVersion!=null&&he.parsedVersion>=18?new(await Promise.resolve().then(()=>(Ta(),Ua))).Node18UniversalStreamWrapper(p):he.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Oa(),va))).UndiciStreamWrapper(p):new(await Promise.resolve().then(()=>(ka(),ja))).NodePre18StreamWrapper(p)}async function wr(p,o){switch(o){case"binary-response":return Ca(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}}:Ba(p.body);case"text":return await p.text()}let i=await p.text();if(i.length>0)try{return Jr(i)}catch{return{ok:!1,error:{reason:"non-json",statusCode:p.status,rawBody:i}}}}async function Aa(p){let o=p.headers.get("Content-Type")?.toLowerCase();if(o==null||o.length===0)return wr(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?Jr(i):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let i=await p.text();return i.length>0?Jr(i):void 0}return await p.text()}}async function pi(){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 ui({body:p,type:o}){return o==="form"?yr(p,{arrayFormat:"repeat",encode:!0}):o.includes("json")?me(p):p}var je;typeof globalThis.Headers<"u"?je=globalThis.Headers:je=class Va{constructor(o){if(this.headers=new Map,o)if(o instanceof Va)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 qh="timeout";function qa(p){let o=new AbortController,i=setTimeout(()=>o.abort(qh),p);return{signal:o.signal,abortId:i}}function Da(...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 di=async(p,o,i,a,n,r,s,u,g)=>{let d=[],l;if(r!=null){let{signal:j,abortId:b}=qa(r);l=b,d.push(j)}s!=null&&d.push(s);let m=Da(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 br={headers:new je,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},zr={headers:new je,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function ei(p){return{headers:p.headers,redirected:p.redirected,status:p.status,statusText:p.statusText,type:p.type,url:p.url}}function Dh(p){let o=1+Math.random()*.2;return p*o}function Mh(p){let o=1+(Math.random()-.5)*.2;return p*o}function Fh(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 Dh(Math.min(r,6e4))}}return Mh(Math.min(1e3*2**o,6e4))}async function mi(p,o=2){let i=await p();for(let a=0;a<o&&([408,429].includes(i.status)||i.status>=500);++a){let n=Fh(i,a);await new Promise(r=>setTimeout(r,n)),i=await p()}return i}var Ih=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 Ko(p){let o={};for(let[i,a]of p instanceof je?p.entries():Object.entries(p))Ih.has(i.toLowerCase())?o[i]="[REDACTED]":o[i]=a;return o}var Go=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 Kh(p){if(p==null)return p;let o={};for(let[i,a]of Object.entries(p))Go.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=[],j=d.split("&");for(let b of j){let T=b.indexOf("=");if(T===-1){y.push(b);continue}let V=b.slice(0,T),H=Go.has(V.toLowerCase());if(!H&&V.includes("%"))try{let O=decodeURIComponent(V);H=Go.has(O.toLowerCase())}catch{}y.push(H?`${V}=[REDACTED]`:b)}return p.slice(0,n+1)+y.join("&")+p.slice(g)}async function Gh(p){let o=new je;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 Pa.get(a,{endpointMetadata:p.endpointMetadata??{}});if(typeof n=="string"){o.set(i,n);continue}n!=null&&o.set(i,`${n}`)}return o}async function Lh(p){let o=li(p.url,p.queryParameters),i=await ui({body:p.body,type:p.requestType??"other"}),a=p.fetchFn??await pi(),n=await Gh(p),r=qo(p.logging);if(r.isDebug()){let s={method:p.method,url:lr(o),headers:Ko(n),queryParameters:Kh(p.queryParameters),hasBody:i!=null};r.debug("Making HTTP request",s)}try{let s=await mi(async()=>di(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:Ko(s.headers)};r.debug("HTTP request succeeded",g)}return{ok:!0,body:await wr(s,p.responseType),headers:s.headers,rawResponse:ei(s)}}else{if(r.isError()){let u={method:p.method,url:lr(o),statusCode:s.status,responseHeaders:Ko(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 Aa(s)},rawResponse:ei(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:br}}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:br}}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:zr}}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:zr}}}var S=Lh;var R=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 hi={};Ke(hi,{ConsoleLogger:()=>Xr,LogLevel:()=>Te,Logger:()=>gr,createLogger:()=>qo});var e={};Ke(e,{JsonError:()=>Rr,ParseError:()=>fr,any:()=>Xa,bigint:()=>Fa,boolean:()=>es,booleanLiteral:()=>Qa,date:()=>Ia,discriminant:()=>ps,enum_:()=>yi,getObjectLikeUtils:()=>ve,getObjectUtils:()=>pr,getSchemaUtils:()=>I,isProperty:()=>$e,lazy:()=>Ka,lazyObject:()=>Za,list:()=>bi,never:()=>rs,number:()=>is,object:()=>wi,objectWithoutOptionalProperties:()=>$a,optional:()=>Lo,property:()=>La,record:()=>ss,set:()=>ns,string:()=>os,stringLiteral:()=>Ya,transform:()=>Wo,undiscriminatedUnion:()=>ls,union:()=>ds,unknown:()=>ts,withParsedProperties:()=>Ho});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 ${Wh(p)}.`}function Wh(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 ne(p){return{...p,json:Ma(p.json),parse:Ma(p.parse)}}function Ma(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 gi(p){return p.path.length===0?p.message:`${p.path.join(" -> ")}: ${p.message}`}var Rr=class p extends Error{constructor(i){super(i.map(gi).join("; "));this.errors=i;Object.setPrototypeOf(this,p.prototype)}};var fr=class p extends Error{constructor(i){super(i.map(gi).join("; "));this.errors=i;Object.setPrototypeOf(this,p.prototype)}};function I(p){return{nullable:()=>Nh(p),optional:()=>Lo(p),optionalNullable:()=>Hh(p),transform:o=>Wo(p,o),parseOrThrow:(o,i)=>{let a=p.parse(o,i);if(a.ok)return a.value;throw new fr(a.errors)},jsonOrThrow:(o,i)=>{let a=p.json(o,i);if(a.ok)return a.value;throw new Rr(a.errors)}}}function Nh(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 Lo(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 Hh(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 Wo(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 Fa(){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{...ne(p),...I(p)}}var $h=/^([+-]?\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 Ia(){let p={parse:(o,{breadcrumbsPrefix:i=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:i,message:F(o,"string")}]}:$h.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{...ne(p),...I(p)}}function ce(p,o){return()=>{let i={parse:o,json:o,getType:()=>p};return{...ne(i),...I(i)}}}function yi(p){let o=new Set(p);return ce(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 Ka(p){let o=No(p);return{...o,...I(o)}}function No(p){return{parse:(o,i)=>_r(p).parse(o,i),json:(o,i)=>_r(p).json(o,i),getType:()=>_r(p).getType()}}function _r(p){let o=p;return o.__zurg_memoized==null&&(o.__zurg_memoized=p()),o.__zurg_memoized}function ri(p){return Object.entries(p)}function ii(p,o){let i=new Set(o);return Object.entries(p).reduce((a,[n,r])=>(i.has(n)&&(a[n]=r),a),{})}function Ge(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 oi(p){return Object.keys(p)}function Ga(p,o){let i=[],a=[];for(let n of p)o(n)?i.push(n):a.push(n);return[i,a]}function ve(p){return{withParsedProperties:o=>Ho(p,o)}}function Ho(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(!Ge(a))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:F(a,"object")}]};let r=new Set(Object.keys(o)),s=ii(a,Object.keys(a).filter(u=>!r.has(u)));return p.json(s,n)},getType:()=>p.getType()};return{...i,...I(i),...ve(i)}}function La(p,o){return{rawKey:p,valueSchema:o,isProperty:!0}}function $e(p){return p.isProperty}function wi(p){let o={_getRawProperties:()=>Object.entries(p).map(([i,a])=>$e(a)?a.rawKey:i),_getParsedProperties:()=>oi(p),parse:(i,a)=>{let n={},r=[];for(let[s,u]of ri(p)){let g=$e(u)?u.rawKey:s,d=$e(u)?u.valueSchema:u,l={rawKey:g,parsedKey:s,valueSchema:d};n[g]=l,Ha(d)&&r.push(g)}return Wa({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 ri(p)){let u=$e(s)?s.valueSchema:s;Ha(u)&&n.push(r)}return Wa({value:i,requiredKeys:n,getProperty:r=>{let s=p[r];if(s!=null)return $e(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{...ne(o),...I(o),...ve(o),...pr(o)}}function Wa({value:p,requiredKeys:o,getProperty:i,unrecognizedObjectKeys:a="fail",skipValidation:n=!1,breadcrumbsPrefix:r=[]}){if(!Ge(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)=>Na({extensionKeys:o._getRawProperties(),value:a,transformBase:r=>p.parse(r,n),transformExtension:r=>o.parse(r,n),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(a,n)=>Na({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),...ve(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),...ve(o),...pr(o)}}}}function Na({extensionKeys:p,value:o,transformBase:i,transformExtension:a,breadcrumbsPrefix:n=[]}){if(!Ge(o))return{ok:!1,errors:[{path:n,message:F(o,"object")}]};let r=new Set(p),[s,u]=Ga(oi(o),l=>r.has(l)),g=i(ii(o,u)),d=a(ii(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 Ha(p){return!Zh(p)}function Zh(p){switch(p.getType()){case q.ANY:case q.UNKNOWN:case q.OPTIONAL:case q.OPTIONAL_NULLABLE:return!0;default:return!1}}function $a(p){return wi(p)}function Za(p){let o={...No(p),_getRawProperties:()=>_r(p)._getRawProperties(),_getParsedProperties:()=>_r(p)._getParsedProperties()};return{...o,...I(o),...ve(o),...pr(o)}}function bi(p){let o={parse:(i,a)=>Ja(i,(n,r)=>p.parse(n,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],`[${r}]`]})),json:(i,a)=>Ja(i,(n,r)=>p.json(n,{...a,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],`[${r}]`]})),getType:()=>q.LIST};return{...ne(o),...I(o)}}function Ja(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 Qa(p){return ce(q.BOOLEAN_LITERAL,(i,{breadcrumbsPrefix:a=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:a,message:F(i,`${p.toString()}`)}]})()}function Ya(p){return ce(q.STRING_LITERAL,(i,{breadcrumbsPrefix:a=[]}={})=>i===p?{ok:!0,value:p}:{ok:!1,errors:[{path:a,message:F(i,`"${p}"`)}]})()}var Xa=ce(q.ANY,p=>({ok:!0,value:p}));var es=ce(q.BOOLEAN,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="boolean"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"boolean")}]});var rs=ce(q.NEVER,(p,{breadcrumbsPrefix:o=[]}={})=>({ok:!1,errors:[{path:o,message:"Expected never"}]}));var is=ce(q.NUMBER,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="number"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"number")}]});var os=ce(q.STRING,(p,{breadcrumbsPrefix:o=[]}={})=>typeof p=="string"?{ok:!0,value:p}:{ok:!1,errors:[{path:o,message:F(p,"string")}]});var ts=ce(q.UNKNOWN,p=>({ok:!0,value:p}));function ss(p,o){let i={parse:(a,n)=>as({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)=>as({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{...ne(i),...I(i)}}function as({value:p,isKeyNumeric:o,transformKey:i,transformValue:a,breadcrumbsPrefix:n=[]}){return Ge(p)?ri(p).reduce((r,[s,u])=>{if(u===void 0)return r;let g=r,d=s;if(o){let j=s.length>0?Number(s):NaN;Number.isNaN(j)||(d=j)}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 ns(p){let o=bi(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{...ne(i),...I(i)}}function ls(p){let o={parse:(i,a)=>cs((n,r)=>n.parse(i,r),p,a),json:(i,a)=>cs((n,r)=>n.json(i,r),p,a),getType:()=>q.UNDISCRIMINATED_UNION};return{...ne(o),...I(o)}}function cs(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 ps(p,o){return{parsedDiscriminant:p,rawDiscriminant:o}}function ds(p,o){let i=typeof p=="string"?p:p.rawDiscriminant,a=typeof p=="string"?p:p.parsedDiscriminant,n=yi(oi(o)),r={parse:(s,u)=>us({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)=>us({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{...ne(r),...I(r),...ve(r)}}function us({value:p,discriminant:o,transformedDiscriminant:i,transformDiscriminantValue:a,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:r=!1,transformAdditionalProperties:s,breadcrumbsPrefix:u=[]}){if(!Ge(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={};Ke(w,{encodePathParam:()=>ms,join:()=>gs,toQueryString:()=>yr});function ms(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 gs(p,...o){if(!p)return"";if(o.length===0)return p;if(p.includes("://")){let i;try{i=new URL(p)}catch{return hs(p,...o)}let n=o[o.length-1]?.endsWith("/");for(let r of o){let s=ws(r);s&&(i.pathname=ys(i.pathname,s))}return n&&!i.pathname.endsWith("/")&&(i.pathname+="/"),i.toString()}return hs(p,...o)}function hs(p,...o){if(o.length===0)return p;let i=p,n=o[o.length-1]?.endsWith("/");for(let r of o){let s=ws(r);s&&(i=ys(i,s))}return n&&!i.endsWith("/")&&(i+="/"),i}function ys(p,o){return p.endsWith("/")?p+o:`${p}/${o}`}function ws(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 zi=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 f(...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 Jh(p){let o=f({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.3.1","User-Agent":"@schematichq/schematic-typescript-node/1.3.1","X-Fern-Runtime":he.type,"X-Fern-Runtime-Version":he.version},p?.headers);return{...p,logging:hi.createLogger(p?.logging),headers:o}}function K(p){let o=Jh(p),i=Qh(o);return o.authProvider??=new zi(i),o}function Qh(p){return{...p,authProvider:new Yr}}var _={Default:"https://api.schematichq.com"};function U(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 $o=e.object({lookup:e.record(e.string(),e.string())});var bs=e.stringLiteral("company");var zs=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",bs),token:e.string(),updatedAt:e.property("updated_at",e.date())});var Rs=e.object({data:zs,params:e.record(e.string(),e.unknown())});var Zo=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var Ze=e.enum_(["development","production","staging"]);var Jo=e.object({environmentType:e.property("environment_type",Ze),name:e.string()});var Qo=e.object({description:e.string().optional(),name:e.string().optional()});var Yo=e.object({environmentType:e.property("environment_type",Ze.optional()),name:e.string().optional()});var fs=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 _s=e.object({data:A,params:fs});var Ss=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 Ps=e.object({data:A,params:Ss});var Ri=e.enum_(["admin","capture","read","write"]);var xs=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(Ri),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var Es=e.object({data:xs,params:e.record(e.string(),e.unknown())});var Re=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(Ri),updatedAt:e.property("updated_at",e.date())});var Cs=e.object({apiKeys:e.property("api_keys",e.list(Re)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ze),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Us=e.object({data:Cs,params:e.record(e.string(),e.unknown())});var D=e.object({deleted:e.boolean().optional()});var Ts=e.object({data:D,params:e.record(e.string(),e.unknown())});var vs=e.object({data:D,params:e.record(e.string(),e.unknown())});var Os=e.object({data:Re,params:e.record(e.string(),e.unknown())});var js=e.object({apiKey:e.property("api_key",Re.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 ks=e.object({data:js,params:e.record(e.string(),e.unknown())});var Sr=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",Ze),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Bs=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var As=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 Vs=e.object({data:e.list(Re),params:As});var qs=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 fi=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 Ds=e.object({data:e.list(fi),params:qs});var Ms=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Fs=e.object({data:e.list(Sr),params:Ms});var Is=e.object({ok:e.boolean()});var Ks=e.object({data:Is,params:e.record(e.string(),e.unknown())});var Gs=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Ls=e.object({data:Sr,params:e.record(e.string(),e.unknown())});var B=e.enum_(["schematic","stripe"]);var Xo=e.object({companyId:e.property("company_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),email:e.string(),externalId:e.property("external_id",e.string()),meta:e.record(e.string(),e.string()),name:e.string(),providerType:e.property("provider_type",B.optional())});var ke=e.enum_(["per_unit","tiered"]);var Z=e.enum_(["licensed","metered"]);var ie=e.enum_(["graduated","volume"]);var Ws=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 et=e.object({billingScheme:e.property("billing_scheme",ke),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(Ws)),productExternalId:e.property("product_external_id",e.string()),providerType:e.property("provider_type",B.optional()),tiersMode:e.property("tiers_mode",ie.optional()),usageType:e.property("usage_type",Z)});var rt=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 Ns=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",Z)});var Hs=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 Je=e.enum_(["cancel","subscribe"]);var it=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(Hs),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(Ns)),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",Je.optional())});var ot=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 tt=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 at=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 st=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 $s=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",Z.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 Zs=e.object({data:A,params:$s});var Js=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",B.optional()),q:e.string().optional()});var Qs=e.object({data:A,params:Js});var Ys=e.object({data:D,params:e.record(e.string(),e.unknown())});var Xs=e.object({data:D,params:e.record(e.string(),e.unknown())});var en=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",ie.optional()),usageType:e.property("usage_type",Z.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var Pr=e.enum_(["day","month","one-time","year"]);var _i=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 J=e.object({billingScheme:e.property("billing_scheme",ke),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Pr,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(_i)),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",ie.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Z)});var rn=e.object({data:e.list(J),params:en});var on=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",ie.optional()),usageType:e.property("usage_type",Z.optional()),withMeter:e.property("with_meter",e.boolean().optional())});var tn=e.object({data:e.list(J),params:on});var an=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",Z.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 Q=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:Pr,price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),providerType:e.property("provider_type",B),scheme:ke});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()),prices:e.list(Q),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 sn=e.object({data:e.list(Qe),params:an});var nn=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Si=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 cn=e.object({data:e.list(Si),params:nn});var ln=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),providerType:e.property("provider_type",B.optional()),q:e.string().optional()});var pn=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 un=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",B),subscriptions:e.list(pn),updatedAt:e.property("updated_at",e.date())});var dn=e.object({data:e.list(un),params:ln});var mn=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 Oe=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 hn=e.object({data:e.list(Oe),params:mn});var gn=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Pi=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 yn=e.object({data:e.list(Pi),params:gn});var wn=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 bn=e.object({data:e.list(ge),params:wn});var zn=e.object({data:Si,params:e.record(e.string(),e.unknown())});var Rn=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),id:e.string(),name:e.string(),providerType:e.property("provider_type",B),updatedAt:e.property("updated_at",e.date())});var fn=e.object({data:Rn,params:e.record(e.string(),e.unknown())});var _n=e.object({data:Pi,params:e.record(e.string(),e.unknown())});var Sn=e.object({data:Q,params:e.record(e.string(),e.unknown())});var xr=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),productId:e.property("product_id",e.string()),providerType:e.property("provider_type",B),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var Pn=e.object({data:xr,params:e.record(e.string(),e.unknown())});var xn=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",Je.optional())});var En=e.object({data:xn,params:e.record(e.string(),e.unknown())});var Cn=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var Un=e.object({data:ge,params:e.record(e.string(),e.unknown())});var nt=e.object({cancelImmediately:e.property("cancel_immediately",e.boolean().optional()),companyId:e.property("company_id",e.string()),prorate:e.boolean().optional()});var ct=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var lt=e.object({trialEnd:e.property("trial_end",e.date().optional())});var xi=e.object({billingScheme:e.property("billing_scheme",ke),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(_i)),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",Z)});var Ei=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 Ye=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(Ei),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",Oe.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(xi),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",Je.optional())});var Ci=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 fe=e.enum_(["daily","monthly","weekly","yearly"]);var Be=e.enum_(["billing_period","first_of_month"]);var Xe=e.enum_(["no_reset","plan_period"]);var Ui=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",fe),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",Xe),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Er=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(Ui)),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional()),planVersionId:e.property("plan_version_id",e.string().optional())});var W=e.enum_(["company","user"]);var Ti=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 Cr=e.object({createdAt:e.property("created_at",e.date()),definition:Ti.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 X=e.enum_(["boolean","currency","date","number","string","url"]);var oe=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",X),updatedAt:e.property("updated_at",e.date())});var Ur=e.object({createdAt:e.property("created_at",e.date()),definition:oe.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 vi=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Tn=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var vn=e.enum_(["all_time","current_day","current_month","current_week"]);var On=e.enum_(["first_of_month","billing_cycle"]);var jn=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var kn=e.enum_(["bool","date","int","string"]);var pt=e.object({comparableType:e.property("comparable_type",kn),entityType:e.property("entity_type",W),id:e.string()});var Oi=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",pt.optional()),conditionType:e.property("condition_type",Tn),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",vn.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",On.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:jn,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",pt.optional()),traitValue:e.property("trait_value",e.string())});var Bn=e.object({conditions:e.list(Oi)});var An=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var ji=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(Bn)),conditions:e.list(Oi),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",An),value:e.boolean()});var L=e.object({addOns:e.property("add_ons",e.list(Er)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Ye.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Ye)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ge.optional()),entityTraits:e.property("entity_traits",e.list(Ur)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Cr),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Ci),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ge)),plan:Er.optional(),plans:e.list(vi),rules:e.list(ji),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var ki=e.object({company:L.optional(),success:e.boolean()});var Vn=e.object({data:ki,params:e.record(e.string(),e.unknown())});var qn=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",Je.optional())});var Dn=e.object({data:qn,params:e.record(e.string(),e.unknown())});var ue=e.enum_(["active","inactive"]);var ze=e.stringLiteral("fixed");var _e=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",ze),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:Q.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ue,unitPrice:e.property("unit_price",Q.optional()),updatedAt:e.property("updated_at",e.date())});var Tr=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(Ei),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",Oe.optional()),paymentMethod:e.property("payment_method",ge.optional()),products:e.list(xi),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 Mn=e.object({bundle:_e.optional(),quantity:e.number(),total:e.number()});var Se=e.enum_(["billing_credit_auto_topup","free","plan","purchased"]);var Fn=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 Y=e.enum_(["boolean","credit","numeric","trait","unknown","unlimited"]);var er=e.enum_(["add_on","alpha","beta","deprecated","ga","inactive","in_plan","internal_testing","legacy"]);var te=e.enum_(["boolean","event","trait"]);var vr=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",te),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",er.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 Pe=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:vr.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(Fn),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",oe.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var rr=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Se),quantity:e.number()});var Or=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 ye=e.enum_(["credit_burndown","overage","pay_as_you_go","pay_in_advance","tier"]);var jr=e.enum_(["company_override","plan_entitlement","unknown"]);var Bi=e.object({companyCount:e.property("company_count",e.number()),environmentId:e.property("environment_id",e.string()),eventCount:e.property("event_count",e.number()),eventSubtype:e.property("event_subtype",e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),userCount:e.property("user_count",e.number())});var ir=e.stringLiteral("boolean");var In=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Ai=e.object({comparisonTrait:e.property("comparison_trait",oe.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(In),ruleId:e.property("rule_id",e.string()),trait:oe.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 Kn=e.object({conditions:e.list(Ai),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 Vi=e.object({conditionGroups:e.property("condition_groups",e.list(Kn)),conditions:e.list(Ai),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 Ae=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:vr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),rules:e.list(Vi),updatedAt:e.property("updated_at",e.date())});var kr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var 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",Bi.optional()),featureType:e.property("feature_type",te),flags:e.list(Ae),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",er.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(kr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:oe.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Br=e.enum_(["expiration_priority","first_in_first_out","last_in_first_out","plan_first_then_credit_bundles_first_in_first_out"]);var Ar=e.enum_(["expire","none","rollover"]);var Ve=e.object({burnStrategy:e.property("burn_strategy",Br),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",Ar),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:Q.optional(),product:xr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ae=e.enum_(["plan","add_on"]);var qe=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",ae),updatedAt:e.property("updated_at",e.date())});var re=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),feature:vr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",J.optional()),meteredYearlyPrice:e.property("metered_yearly_price",J.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:qe.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",ye.optional()),ruleId:e.property("rule_id",e.string()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageBasedProduct:e.property("usage_based_product",xr.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",Ve.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",oe.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var or=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),companyOverride:e.property("company_override",Pe.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(rr).optional()),creditGrantReason:e.property("credit_grant_reason",Se.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",Or.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",jr),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",J.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:qe.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",ye.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var Vr=e.object({features:e.list(or)});var xe=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",fe),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",Xe.optional()),updatedAt:e.property("updated_at",e.date())});var De=e.enum_(["free","one_time","recurring"]);var tr=e.enum_(["schematic","stripe"]);var Gn=e.enum_(["published","draft","archived"]);var qr=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),environmentId:e.property("environment_id",e.string()),icon:e.string(),id:e.string(),name:e.string(),originalPlanId:e.property("original_plan_id",e.string().optional()),planType:e.property("plan_type",ae),status:Gn,updatedAt:e.property("updated_at",e.date()),version:e.number()});var de=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Qe.optional()),chargeType:e.property("charge_type",De),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",tr),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(xe).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",Q.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",Q.optional()),planType:e.property("plan_type",ae),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(qr),yearlyPrice:e.property("yearly_price",Q.optional())});var ti=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",J.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",J.optional()),priceBehavior:e.property("price_behavior",ye.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",Y),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var Ln=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(ti)),availableCreditBundles:e.property("available_credit_bundles",e.list(_e)),company:L.optional(),featureUsage:e.property("feature_usage",Vr.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Mn)),selectedPlan:e.property("selected_plan",de.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(ti)),subscription:Tr.optional()});var Wn=e.object({data:Ln,params:e.record(e.string(),e.unknown())});var Nn=e.object({data:ki,params:e.record(e.string(),e.unknown())});var Hn=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var $n=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(Hn))});var qi=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:$n.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(or))});var Zn=e.object({data:qi,params:e.record(e.string(),e.unknown())});var Jn=e.object({subscriptionChangePreview:e.property("subscription_change_preview",qi.optional())});var Qn=e.object({data:Jn,params:e.record(e.string(),e.unknown())});var Yn=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var ut=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",X)});var dt=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var mt=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var ht=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",X)});var Dr=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var gt=e.object({applyToExistingCompanies:e.property("apply_to_existing_companies",e.boolean()),planId:e.property("plan_id",e.string()),traits:e.list(Dr)});var yt=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var we=e.enum_(["asc","desc"]);var Le=e.enum_(["active","canceled","expired","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]);var We=e.enum_(["free","one_time","paid","trial"]);var Xn=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",we.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Le).optional()),subscriptionTypes:e.property("subscription_types",e.list(We).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var ec=e.object({data:A,params:Xn});var rc=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 ic=e.object({data:A,params:rc});var oc=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 tc=e.object({data:A,params:oc});var ac=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",X.optional()),traitTypes:e.property("trait_types",e.list(X).optional())});var sc=e.object({data:A,params:ac});var nc=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 cc=e.object({data:A,params:nc});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 pc=e.object({data:A,params:lc});var uc=e.object({data:L,params:e.record(e.string(),e.unknown())});var Ee=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 dc=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var Mr=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 Fr=e.object({company:Mr.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 Ce=e.object({companyMemberships:e.property("company_memberships",e.list(Fr)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(Ur)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(Cr),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 mc=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var hc=e.object({data:Mr,params:e.record(e.string(),e.unknown())});var gc=e.object({data:D,params:e.record(e.string(),e.unknown())});var yc=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var wc=e.object({data:D,params:yc});var bc=e.object({data:D,params:e.record(e.string(),e.unknown())});var Di=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 zc=e.object({data:Di,params:e.record(e.string(),e.unknown())});var Rc=e.object({data:D,params:e.record(e.string(),e.unknown())});var fc=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 _c=e.object({data:e.list(Tr),params:fc});var Sc=e.object({data:L,params:e.record(e.string(),e.unknown())});var Pc=e.object({data:oe,params:e.record(e.string(),e.unknown())});var xc=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ec=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var Cc=e.object({data:e.list(Ec),params:xc});var Uc=e.object({data:Fr,params:e.record(e.string(),e.unknown())});var Tc=e.object({data:oe,params:e.record(e.string(),e.unknown())});var vc=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","plan_trait_change","quickstart","subscription_change"]);var Oc=e.enum_(["api_key","app_user","system","temporary_access_token"]);var jc=e.enum_(["fallback","initial","trait","trial_expiry"]);var kc=e.enum_(["adjustment","downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var ai=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Bc=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",X),value:e.string()});var Mi=e.object({action:vc,actorType:e.property("actor_type",Oc),addOnsAdded:e.property("add_ons_added",e.list(ai)),addOnsRemoved:e.property("add_ons_removed",e.list(ai)),apiKey:e.property("api_key",Re.optional()),apiKeyRequest:e.property("api_key_request",fi.optional()),basePlan:e.property("base_plan",ai.optional()),basePlanAction:e.property("base_plan_action",jc.optional()),company:Mr.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",ai.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",kc.optional()),traitsUpdated:e.property("traits_updated",e.list(Bc)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Ac=e.object({data:Mi,params:e.record(e.string(),e.unknown())});var Vc=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var qc=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var Dc=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",we.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(Le).optional()),subscriptionTypes:e.property("subscription_types",e.list(We).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Mc=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(rr)),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 Fc=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Mc.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",te),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",J.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",J.optional())});var Ic=e.object({addOns:e.property("add_ons",e.list(Er)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Ye.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Ye)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ge.optional()),entityTraits:e.property("entity_traits",e.list(Ur)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Fc)),id:e.string(),keys:e.list(Cr),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Ci),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ge)),plan:Er.optional(),plans:e.list(vi),rules:e.list(ji),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Kc=e.object({data:e.list(Ic),params:Dc});var Gc=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 Lc=e.object({data:e.list(L),params:Gc});var Wc=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 Nc=e.object({data:e.list(Fr),params:Wc});var Hc=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 $c=e.object({data:e.list(Ti),params:Hc});var Zc=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",X.optional()),traitTypes:e.property("trait_types",e.list(X).optional())});var Jc=e.object({data:e.list(oe),params:Zc});var Qc=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 Yc=e.object({data:e.list(Mi),params:Qc});var Xc=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 el=e.object({data:e.list(Ee),params:Xc});var rl=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 il=e.object({data:e.list(Ce),params:rl});var ol=e.object({keys:e.record(e.string(),e.string()).optional()});var tl=e.object({data:L,params:ol});var al=e.object({keys:e.record(e.string(),e.string()).optional()});var sl=e.object({data:Ce,params:al});var nl=e.object({data:oe,params:e.record(e.string(),e.unknown())});var cl=e.object({data:Ee,params:e.record(e.string(),e.unknown())});var ll=e.object({data:e.list(Ee),params:e.record(e.string(),e.unknown())});var pl=e.object({data:L,params:e.record(e.string(),e.unknown())});var ul=e.object({data:L,params:e.record(e.string(),e.unknown())});var dl=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var ml=e.object({data:Ce,params:e.record(e.string(),e.unknown())});var Ir=e.enum_(["billing","entitlement"]);var wt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Ir),name:e.string()});var Fi=e.enum_(["draft","live"]);var bt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Ir.optional()),name:e.string().optional(),state:Fi.optional()});var hl=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var gl=e.object({data:A,params:hl});var Me=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:Fi,type:Ir,updatedAt:e.property("updated_at",e.date())});var yl=e.object({data:Me,params:e.record(e.string(),e.unknown())});var wl=e.object({data:D,params:e.record(e.string(),e.unknown())});var bl=e.object({data:Me,params:e.record(e.string(),e.unknown())});var zl=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Rl=e.object({data:e.list(Me),params:zl});var fl=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var si=e.object({billingScheme:e.property("billing_scheme",ke),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:Pr,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",ie.optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",Z)});var _l=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",ze),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:si.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:ue,unitPrice:e.property("unit_price",si.optional()),updatedAt:e.property("updated_at",e.date())});var Sl=e.enum_(["downgrade_not_permitted","feature_usage_exceeded"]);var Kr=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 zt=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Qe.optional()),chargeType:e.property("charge_type",De),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",tr),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",Kr.optional()),description:e.string(),entitlements:e.list(re),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ui)),invalidReason:e.property("invalid_reason",Sl.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",Q.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",Q.optional()),planType:e.property("plan_type",ae),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(or)),valid:e.boolean(),versions:e.list(qr),yearlyPrice:e.property("yearly_price",Q.optional())});var Gr=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Pl=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var xl=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 El=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 Lr=e.enum_(["expired","manual","plan_change","plan_period_reset"]);var Cl=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 Ul=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",Se),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:si.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",fe.optional()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(Cl).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",Lr.optional())});var Tl=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 vl=e.object({activeAddOns:e.property("active_add_ons",e.list(zt)),activePlans:e.property("active_plans",e.list(zt)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(ti)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(Gr)),capabilities:Pl.optional(),checkoutSettings:e.property("checkout_settings",xl),company:L.optional(),component:Me.optional(),creditBundles:e.property("credit_bundles",e.list(_l)),creditGrants:e.property("credit_grants",e.list(Ul)),defaultPlan:e.property("default_plan",de.optional()),displaySettings:e.property("display_settings",El),featureUsage:e.property("feature_usage",Vr.optional()),invoices:e.list(Oe),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",Tl.optional()),subscription:Tr.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",Oe.optional())});var Ol=e.object({data:vl,params:fl});var jl=e.object({data:Me,params:e.record(e.string(),e.unknown())});var Rt=e.object({burnStrategy:e.property("burn_strategy",Br.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",Ar.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 ft=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:Se,renewalEnabled:e.property("renewal_enabled",e.boolean().optional()),renewalPeriod:e.property("renewal_period",Be.optional())});var _t=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",ze.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 St=e.object({burnStrategy:e.property("burn_strategy",Br.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",Ar.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 Pt=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 xt=e.object({reason:Lr.optional()});var kl=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 Bl=e.object({data:A,params:kl});var Al=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Vl=e.object({data:A,params:Al});var ql=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 Dl=e.object({data:A,params:ql});var ur=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Ml=e.object({companyId:e.property("company_id",e.string().optional()),dir:we.optional(),limit:e.number().optional(),offset:e.number().optional(),order:ur.optional()});var Fl=e.object({data:A,params:Ml});var Il=e.object({bundleType:e.property("bundle_type",ze.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 Kl=e.object({data:A,params:Il});var dr=e.enum_(["daily","monthly","raw","weekly"]);var Gl=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:dr.optional(),startTime:e.property("start_time",e.string().optional())});var Ll=e.object({data:A,params:Gl});var Wl=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var Nl=e.object({data:xe,params:e.record(e.string(),e.unknown())});var Hl=e.object({data:_e,params:e.record(e.string(),e.unknown())});var $l=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Zl=e.object({data:D,params:$l});var Jl=e.object({data:D,params:e.record(e.string(),e.unknown())});var Ql=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Yl=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:dr.optional(),startTime:e.property("start_time",e.string().optional())});var Xl=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 ep=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var rp=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var ip=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:ep.optional(),companyId:e.property("company_id",e.string()),credit:Xl.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:rp.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 op=e.object({data:e.list(ip),params:Yl});var tp=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var ap=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 ar=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",Se),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:Q.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),renewalEnabled:e.property("renewal_enabled",e.boolean()),renewalPeriod:e.property("renewal_period",fe.optional()),sourceLabel:e.property("source_label",e.string()),transfers:e.list(ap).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",Lr.optional())});var sp=e.object({data:ar,params:e.record(e.string(),e.unknown())});var np=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var cp=e.object({data:e.list(Ve),params:np});var lp=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 pp=e.object({data:e.list(xe),params:lp});var up=e.object({companyId:e.property("company_id",e.string().optional()),dir:we.optional(),limit:e.number().optional(),offset:e.number().optional(),order:ur.optional()});var dp=e.object({data:e.list(ar),params:up});var mp=e.object({bundleType:e.property("bundle_type",ze.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 hp=e.object({data:e.list(_e),params:mp});var gp=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(ar),params:gp});var wp=e.object({data:D,params:e.record(e.string(),e.unknown())});var bp=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var zp=e.object({data:xe,params:e.record(e.string(),e.unknown())});var Rp=e.object({data:_e,params:e.record(e.string(),e.unknown())});var fp=e.object({data:ar,params:e.record(e.string(),e.unknown())});var Et=e.object({metadata:e.string()});var _p=e.stringLiteral("csv");var Sp=e.enum_(["failure","pending","success"]);var Pp=e.stringLiteral("company-feature-usage");var xp=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",Pp),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",_p),status:Sp,updatedAt:e.property("updated_at",e.date())});var Ep=e.object({data:xp,params:e.record(e.string(),e.unknown())});var Cp=e.enum_(["all_time","current_month","current_week","current_day"]);var Up=e.enum_(["first_of_month","billing_cycle"]);var Ct=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",Cp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Up.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var Ue=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 Tp=e.enum_(["all_time","current_month","current_week","current_day"]);var vp=e.enum_(["first_of_month","billing_cycle"]);var Ut=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",Tp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",vp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Ue).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",ye.optional()),priceTiers:e.property("price_tiers",e.list(Ue).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ie.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ue).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Tt=e.object({sourcePlanId:e.property("source_plan_id",e.string()),targetPlanId:e.property("target_plan_id",e.string())});var Op=e.enum_(["all_time","current_month","current_week","current_day"]);var jp=e.enum_(["first_of_month","billing_cycle"]);var vt=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",Op.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",jp.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y)});var kp=e.enum_(["all_time","current_month","current_week","current_day"]);var Bp=e.enum_(["first_of_month","billing_cycle"]);var Ot=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",kp.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Bp.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Ue).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",ye.optional()),priceTiers:e.property("price_tiers",e.list(Ue).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ie.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ue).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Ap=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 Vp=e.object({data:A,params:Ap});var qp=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Dp=e.object({data:A,params:qp});var Mp=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 Fp=e.object({data:A,params:Mp});var Ip=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Kp=e.object({data:A,params:Ip});var Gp=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 Lp=e.object({data:A,params:Gp});var Wp=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var Np=e.object({data:re,params:e.record(e.string(),e.unknown())});var Hp=e.object({data:D,params:e.record(e.string(),e.unknown())});var $p=e.object({data:D,params:e.record(e.string(),e.unknown())});var Zp=e.object({message:e.string()});var Jp=e.object({entitlementId:e.property("entitlement_id",e.string()),errors:e.list(Zp),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string())});var Qp=e.object({data:e.list(re),skipped:e.list(Jp)});var Yp=e.object({data:Qp,params:e.record(e.string(),e.unknown())});var Xp=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var eu=e.object({keys:e.record(e.string(),e.string()).optional()});var ru=e.object({data:Vr,params:eu});var iu=e.object({data:re,params:e.record(e.string(),e.unknown())});var ou=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 tu=e.object({data:e.list(Pe),params:ou});var au=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.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(rr).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",Or.optional())});var nu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),company:L.optional(),companyOverride:e.property("company_override",Pe.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(rr).optional()),creditGrantReason:e.property("credit_grant_reason",Se.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",su.optional()),creditUsageAggregation:e.property("credit_usage_aggregation",Or.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",jr),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",J.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:qe.optional(),planEntitlement:e.property("plan_entitlement",re.optional()),priceBehavior:e.property("price_behavior",ye.optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",J.optional())});var cu=e.object({data:e.list(nu),params:au});var lu=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 pu=e.object({data:e.list(or),params:lu});var uu=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.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Y),company:L.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",jr),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:qe.optional(),usage:e.number().optional(),user:Di.optional()});var mu=e.object({data:e.list(du),params:uu});var hu=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 gu=e.object({data:e.list(re),params:hu});var yu=e.object({data:Pe,params:e.record(e.string(),e.unknown())});var wu=e.object({data:re,params:e.record(e.string(),e.unknown())});var bu=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 zu=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var Ru=e.object({company:zu.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var fu=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 _u=e.undiscriminatedUnion([fu,bu,Ru]);var Ne=e.enum_(["flag_check","identify","track"]);var Ii=e.object({body:_u.optional(),eventType:e.property("event_type",Ne),sentAt:e.property("sent_at",e.date().optional())});var jt=e.object({events:e.list(Ii)});var Ki=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string().optional()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var Su=e.object({events:e.list(Ki)});var Pu=e.object({data:Su,params:e.record(e.string(),e.unknown())});var xu=e.object({data:Ki,params:e.record(e.string(),e.unknown())});var Eu=e.enum_(["enriched","failed","pending","processed","unknown"]);var Gi=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:kr.optional(),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),features:e.list(kr),id:e.string(),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:Eu,subtype:e.string().optional(),type:Ne,updatedAt:e.property("updated_at",e.date().optional()),user:kr.optional(),userId:e.property("user_id",e.string().optional())});var Cu=e.object({data:Gi,params:e.record(e.string(),e.unknown())});var Uu=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 Tu=e.object({data:e.list(Bi),params:Uu});var vu=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var Ou=e.object({data:vu,params:e.record(e.string(),e.unknown())});var ju=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(Ne).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 ku=e.object({data:e.list(Gi),params:ju});var ni=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var kt=e.object({contexts:e.list(ni)});var Li=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Bt=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",te),flag:Li.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",er.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 At=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",te.optional()),flag:Li.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",er.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 Bu=e.enum_(["company","metric","trait","user","plan","billing_product","base_plan"]);var Au=e.enum_(["all_time","current_month","current_week","current_day"]);var Vu=e.enum_(["first_of_month","billing_cycle"]);var qu=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var Wi=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",Bu),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",Au.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Vu.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:qu,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 Du=e.object({conditions:e.list(Wi),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Mu=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var Fu=e.object({conditionGroups:e.property("condition_groups",e.list(Du)),conditions:e.list(Wi),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Mu.optional()),value:e.boolean()});var Vt=e.object({rules:e.list(Fu)});var Ni=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 Iu=e.object({data:Ni,params:e.record(e.string(),e.unknown())});var Hi=e.object({flags:e.list(Ni)});var Ku=e.object({data:e.list(Hi)});var Gu=e.object({data:Ku,params:e.record(e.string(),e.unknown())});var Lu=e.object({data:Hi,params:e.record(e.string(),e.unknown())});var Wu=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(te).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 Nu=e.object({data:A,params:Wu});var Hu=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 $u=e.object({data:A,params:Hu});var Zu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Ju=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var Qu=e.object({data:D,params:e.record(e.string(),e.unknown())});var Yu=e.object({data:D,params:e.record(e.string(),e.unknown())});var Xu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var ed=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var rd=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(te).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 id=e.object({data:e.list(ee),params:rd});var od=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 td=e.object({data:e.list(Ae),params:od});var ad=e.object({data:ee,params:e.record(e.string(),e.unknown())});var sd=e.object({data:Ae,params:e.record(e.string(),e.unknown())});var nd=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),id:e.string(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var cd=e.object({flag:nd.optional(),rules:e.list(Vi)});var ld=e.object({data:cd,params:e.record(e.string(),e.unknown())});var $i=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",ae)});var Zi=e.stringLiteral("credit");var Ji=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",Zi.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",fe),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",Xe.optional())});var pd=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Qi=e.enum_(["create","update","delete"]);var Yi=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",Zi.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",fe),resetStart:e.property("reset_start",Be),resetType:e.property("reset_type",Xe.optional())});var Xi=e.object({action:Qi,createReq:e.property("create_req",Ji.optional()),creditGrantId:e.property("credit_grant_id",e.string().optional()),deleteReq:e.property("delete_req",pd.optional()),updateReq:e.property("update_req",Yi.optional())});var ud=e.enum_(["all_time","current_month","current_week","current_day"]);var dd=e.enum_(["first_of_month","billing_cycle"]);var md=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",ud.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",dd.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(Ue).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",ye.optional()),priceTiers:e.property("price_tiers",e.list(Ue).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",ie.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Y),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(Ue).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var eo=e.object({action:Qi,entitlementId:e.property("entitlement_id",e.string().optional()),req:md.optional()});var Wr=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",De),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 qt=e.object({billingProduct:e.property("billing_product",Wr.optional()),creditGrants:e.property("credit_grants",e.list(Xi).optional()),entitlements:e.list(eo),plan:$i.optional(),traits:e.list(Dr).optional()});var ro=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Dt=e.object({billingProduct:e.property("billing_product",Wr.optional()),creditGrants:e.property("credit_grants",e.list(Xi).optional()),entitlements:e.list(eo),plan:ro.optional(),traits:e.list(Dr).optional()});var io=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",De),controlledBy:e.property("controlled_by",tr),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 oo=e.object({billingProduct:e.property("billing_product",io.optional()),creditGrants:e.property("credit_grants",e.list(xe).optional()),entitlements:e.list(re).optional(),plan:qe.optional(),traits:e.list(Ee).optional()});var hd=e.object({data:oo,params:e.record(e.string(),e.unknown())});var gd=e.object({data:oo,params:e.record(e.string(),e.unknown())});var yd=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var He=e.object({entitlements:e.list(yd).optional(),planId:e.property("plan_id",e.string())});var Nr=e.object({bundleId:e.string()});var to=e.enum_(["create_prorations","invoice_immediately"]);var Mt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Gr).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",Kr.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(He)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlans:e.property("ordered_plans",e.list(He)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",to),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 Ft=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Gr).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",Kr.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(He)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlans:e.property("ordered_plans",e.list(He)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),preventSelfServiceDowngrade:e.property("prevent_self_service_downgrade",e.boolean()),preventSelfServiceDowngradeButtonText:e.property("prevent_self_service_downgrade_button_text",e.string().optional()),preventSelfServiceDowngradeUrl:e.property("prevent_self_service_downgrade_url",e.string().optional()),prorationBehavior:e.property("proration_behavior",to),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 ao=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var wd=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var so=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 no=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(wd)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",ao),componentSettings:e.property("component_settings",so),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(He)),planIds:e.property("plan_ids",e.list(He)),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 bd=e.object({data:no,params:e.record(e.string(),e.unknown())});var co=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 mr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Qe.optional()),chargeType:e.property("charge_type",De),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",tr),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",co.optional()),description:e.string(),entitlements:e.list(re),features:e.list(ee),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(xe).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",Q.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",Q.optional()),planType:e.property("plan_type",ae),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),versions:e.list(qr),yearlyPrice:e.property("yearly_price",Q.optional())});var zd=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var It=e.object({entitlements:e.list(zd).optional(),planId:e.property("plan_id",e.string())});var Rd=e.object({addOns:e.property("add_ons",e.list(mr)),checkoutSettings:e.property("checkout_settings",ao),componentSettings:e.property("component_settings",so),customPlanConfig:e.property("custom_plan_config",co.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",mr.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",mr.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",mr.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",J.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(It)),orderedBundleList:e.property("ordered_bundle_list",e.list(Nr)),orderedPlanList:e.property("ordered_plan_list",e.list(It)),plans:e.list(mr),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",mr.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",J.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var fd=e.object({data:Rd,params:e.record(e.string(),e.unknown())});var _d=e.object({data:no,params:e.record(e.string(),e.unknown())});var Kt=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Sd=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",ae.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 Pd=e.object({data:A,params:Sd});var xd=e.object({data:de,params:e.record(e.string(),e.unknown())});var Ed=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 Ud=e.object({planId:e.property("plan_id",e.string().optional())});var Td=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var vd=e.object({data:e.list(Td),params:Ud});var Od=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",ae.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 jd=e.object({data:e.list(de),params:Od});var kd=e.object({data:L,params:e.record(e.string(),e.unknown())});var Bd=e.object({data:de,params:e.record(e.string(),e.unknown())});var Ad=e.object({data:io,params:e.record(e.string(),e.unknown())});var Hr=e.object({creditId:e.property("credit_id",e.string())});var $r=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","auto.topup.hard.failure","auto.topup.retry.exceeded"]);var Gt=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Hr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list($r).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(sr)),url:e.string()});var lo=e.enum_(["active","inactive"]);var Lt=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Hr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list($r).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(sr).optional()),status:lo.optional(),url:e.string().optional()});var Vd=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 qd=e.object({data:A,params:Vd});var Dd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Md=e.object({data:A,params:Dd});var Fe=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(Hr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list($r).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(sr)),secret:e.string(),status:lo,updatedAt:e.property("updated_at",e.date()),url:e.string()});var Fd=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var Id=e.object({data:D,params:e.record(e.string(),e.unknown())});var Kd=e.enum_(["failure","pending","success"]);var po=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:Kd,updatedAt:e.property("updated_at",e.date()),webhook:Fe.optional(),webhookId:e.property("webhook_id",e.string())});var Gd=e.object({data:po,params:e.record(e.string(),e.unknown())});var Ld=e.object({data:Fe,params:e.record(e.string(),e.unknown())});var Wd=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 Nd=e.object({data:e.list(po),params:Wd});var Hd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var $d=e.object({data:e.list(Fe),params:Hd});var Zd=e.object({data:Fe,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 uo=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var mo=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var Wt=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(uo)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(mo)),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 Nt=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",ir),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Ht=e.object({keys:e.record(e.string(),e.string())});var Qd=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var $t=e.object({addOnSelections:e.property("add_on_selections",e.list(Qd)),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(uo)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(mo)),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 Zt=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 Jt=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 Qt=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 ho=class{constructor(o){this._options=K(o)}issueTemporaryAccessToken(o,i){return R.fromPromise(this.__issueTemporaryAccessToken(o,i))}async __issueTemporaryAccessToken(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"temporary-access-tokens"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...$o.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:Rs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/temporary-access-tokens")}};var go=class{constructor(o){this._options=K(o)}listApiKeys(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Vs.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/api-keys")}createApiKey(o,i){return R.fromPromise(this.__createApiKey(o,i))}async __createApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"api-keys"),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:Es.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/api-keys")}getApiKey(o,i){return R.fromPromise(this.__getApiKey(o,i))}async __getApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Os.parseOrThrow(r.body,{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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/api-keys/{api_key_id}")}updateApiKey(o,i={},a){return R.fromPromise(this.__updateApiKey(o,i,a))}async __updateApiKey(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`api-keys/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Qo.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:Gs.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/api-keys/{api_key_id}")}deleteApiKey(o,i){return R.fromPromise(this.__deleteApiKey(o,i))}async __deleteApiKey(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ts.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/api-keys/{api_key_id}")}countApiKeys(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:_s.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/api-keys/count")}listApiRequests(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ds.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/api-requests")}getApiRequest(o,i){return R.fromPromise(this.__getApiRequest(o,i))}async __getApiRequest(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/api-requests/{api_request_id}")}countApiRequests(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ps.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/api-requests/count")}listEnvironments(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Fs.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/environments")}createEnvironment(o,i){return R.fromPromise(this.__createEnvironment(o,i))}async __createEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"environments"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Jo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Us.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/environments")}getEnvironment(o,i){return R.fromPromise(this.__getEnvironment(o,i))}async __getEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/environments/{environment_id}")}updateEnvironment(o,i={},a){return R.fromPromise(this.__updateEnvironment(o,i,a))}async __updateEnvironment(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`environments/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Yo.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:Ls.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/environments/{environment_id}")}deleteEnvironment(o,i){return R.fromPromise(this.__deleteEnvironment(o,i))}async __deleteEnvironment(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:vs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/environments/{environment_id}")}quickstart(o){return R.fromPromise(this.__quickstart(o))}async __quickstart(o){let i=await this._options.authProvider.getAuthRequest(),a=f(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ks.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 v(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 401:throw new C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new E(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(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 U(n.error,n.rawResponse,"POST","/quickstart")}};var yo=class{constructor(o){this._options=K(o)}listCoupons(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:cn.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/coupons")}upsertBillingCoupon(o,i){return R.fromPromise(this.__upsertBillingCoupon(o,i))}async __upsertBillingCoupon(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/coupons"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ot.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/coupons")}upsertBillingCustomer(o,i){return R.fromPromise(this.__upsertBillingCustomer(o,i))}async __upsertBillingCustomer(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/customer/upsert"),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:fn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/customer/upsert")}listCustomersWithSubscriptions(o={},i){return R.fromPromise(this.__listCustomersWithSubscriptions(o,i))}async __listCustomersWithSubscriptions(o={},i){let{companyIds:a,name:n,providerType:r,q:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.company_ids=a.map(j=>j):d.company_ids=a),n!=null&&(d.name=n),r!=null&&(d.provider_type=B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),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=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/customers"),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:dn.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/customers")}countCustomers(o={},i){return R.fromPromise(this.__countCustomers(o,i))}async __countCustomers(o={},i){let{companyIds:a,name:n,providerType:r,q:s,limit:u,offset:g}=o,d={};a!=null&&(Array.isArray(a)?d.company_ids=a.map(j=>j):d.company_ids=a),n!=null&&(d.name=n),r!=null&&(d.provider_type=B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),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=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/customers/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:Qs.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/customers/count")}listInvoices(o,i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/billing/invoices")}upsertInvoice(o,i){return R.fromPromise(this.__upsertInvoice(o,i))}async __upsertInvoice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/invoices"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/invoices")}listMeters(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:yn.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/billing/meter")}upsertBillingMeter(o,i){return R.fromPromise(this.__upsertBillingMeter(o,i))}async __upsertBillingMeter(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/meter/upsert"),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:_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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/meter/upsert")}listPaymentMethods(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:bn.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/payment-methods")}upsertPaymentMethod(o,i){return R.fromPromise(this.__upsertPaymentMethod(o,i))}async __upsertPaymentMethod(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/payment-methods"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/payment-methods")}listBillingPrices(o={},i){return R.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:j,usageType:b,withMeter:T,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),j!=null&&(O.tiers_mode=ie.jsonOrThrow(j,{unrecognizedObjectKeys:"strip"})),b!=null&&(O.usage_type=Z.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),T!=null&&(O.with_meter=T.toString()),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let pe=await this._options.authProvider.getAuthRequest(),nr=f(pe.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:rn.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 v(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(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 U(k.error,k.rawResponse,"GET","/billing/price")}upsertBillingPrice(o,i){return R.fromPromise(this.__upsertBillingPrice(o,i))}async __upsertBillingPrice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/price/upsert"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/price/upsert")}deleteBillingProduct(o,i){return R.fromPromise(this.__deleteBillingProduct(o,i))}async __deleteBillingProduct(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ys.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/billing/product/{billing_id}")}listBillingProductPrices(o={},i){return R.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:j,usageType:b,withMeter:T,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),j!=null&&(O.tiers_mode=ie.jsonOrThrow(j,{unrecognizedObjectKeys:"strip"})),b!=null&&(O.usage_type=Z.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),T!=null&&(O.with_meter=T.toString()),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let pe=await this._options.authProvider.getAuthRequest(),nr=f(pe.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:tn.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 v(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(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 U(k.error,k.rawResponse,"GET","/billing/product/prices")}deleteProductPrice(o,i){return R.fromPromise(this.__deleteProductPrice(o,i))}async __deleteProductPrice(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Xs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/billing/product/prices/{billing_id}")}upsertBillingProduct(o,i){return R.fromPromise(this.__upsertBillingProduct(o,i))}async __upsertBillingProduct(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/product/upsert"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:rt.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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/product/upsert")}listBillingProducts(o={},i){return R.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:j,offset:b}=o,T={};a!=null&&(Array.isArray(a)?T.ids=a.map(pe=>pe):T.ids=a),n!=null&&(T.is_active=n.toString()),r!=null&&(T.name=r),s!=null&&(T.price_usage_type=Z.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(T.provider_type=B.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(T.q=g),d!=null&&(T.with_one_time_charges=d.toString()),l!=null&&(T.with_prices_only=l.toString()),m!=null&&(T.with_zero_price=m.toString()),y!=null&&(T.without_linked_to_plan=y.toString()),j!=null&&(T.limit=j.toString()),b!=null&&(T.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=f(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/products"),method:"GET",headers:H,queryParameters:{...T,...i?.queryParams},timeoutMs:(i?.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:sn.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 v(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new E(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(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 U(O.error,O.rawResponse,"GET","/billing/products")}countBillingProducts(o={},i){return R.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:j,offset:b}=o,T={};a!=null&&(Array.isArray(a)?T.ids=a.map(pe=>pe):T.ids=a),n!=null&&(T.is_active=n.toString()),r!=null&&(T.name=r),s!=null&&(T.price_usage_type=Z.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(T.provider_type=B.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(T.q=g),d!=null&&(T.with_one_time_charges=d.toString()),l!=null&&(T.with_prices_only=l.toString()),m!=null&&(T.with_zero_price=m.toString()),y!=null&&(T.without_linked_to_plan=y.toString()),j!=null&&(T.limit=j.toString()),b!=null&&(T.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=f(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/products/count"),method:"GET",headers:H,queryParameters:{...T,...i?.queryParams},timeoutMs:(i?.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:Zs.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 v(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new E(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(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 U(O.error,O.rawResponse,"GET","/billing/products/count")}upsertBillingSubscription(o,i){return R.fromPromise(this.__upsertBillingSubscription(o,i))}async __upsertBillingSubscription(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/subscription/upsert"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/subscription/upsert")}};var wo=class{constructor(o){this._options=K(o)}internal(o,i){return R.fromPromise(this.__internal(o,i))}async __internal(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"checkout-internal"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/checkout-internal")}getCheckoutData(o,i){return R.fromPromise(this.__getCheckoutData(o,i))}async __getCheckoutData(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"checkout-internal/data"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/checkout-internal/data")}previewCheckoutInternal(o,i){return R.fromPromise(this.__previewCheckoutInternal(o,i))}async __previewCheckoutInternal(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"checkout-internal/preview"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/checkout-internal/preview")}managePlan(o,i){return R.fromPromise(this.__managePlan(o,i))}async __managePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"manage-plan"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/manage-plan")}previewManagePlan(o,i){return R.fromPromise(this.__previewManagePlan(o,i))}async __previewManagePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"manage-plan/preview"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/manage-plan/preview")}cancelSubscription(o,i){return R.fromPromise(this.__cancelSubscription(o,i))}async __cancelSubscription(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"manage-plan/subscription/cancel"),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:Vn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/manage-plan/subscription/cancel")}updateCustomerSubscriptionTrialEnd(o,i={},a){return R.fromPromise(this.__updateCustomerSubscriptionTrialEnd(o,i,a))}async __updateCustomerSubscriptionTrialEnd(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`subscription/${w.encodePathParam(o)}/edit-trial-end`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:lt.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:Yn.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/subscription/{subscription_id}/edit-trial-end")}};var bo=class{constructor(o){this._options=K(o)}listCompanies(o={},i){return R.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(T=>T):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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"companies"),method:"GET",headers:j,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:Lc.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/companies")}upsertCompany(o,i){return R.fromPromise(this.__upsertCompany(o,i))}async __upsertCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"companies"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Zt.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:pl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/companies")}getCompany(o,i){return R.fromPromise(this.__getCompany(o,i))}async __getCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Sc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/companies/{company_id}")}deleteCompany(o,i={},a){return R.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=f(u.headers,this._options?.headers,a?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:wc.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"DELETE","/companies/{company_id}")}countCompanies(o={},i){return R.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(T=>T):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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"companies/count"),method:"GET",headers:j,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:ic.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/companies/count")}countCompaniesForAdvancedFilter(o={},i){return R.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:j,sortOrderDirection:b,displayProperties:T,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=>Le.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_statuses=Le.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(Array.isArray(g)?O.subscription_types=g.map(M=>We.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_types=We.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()),j!=null&&(O.sort_order_column=j),b!=null&&(O.sort_order_direction=we.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?O.display_properties=T.map(M=>M):O.display_properties=T),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let pe=await this._options.authProvider.getAuthRequest(),nr=f(pe.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:ec.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 v(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(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 U(k.error,k.rawResponse,"GET","/companies/count2")}createCompany(o,i){return R.fromPromise(this.__createCompany(o,i))}async __createCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"companies/create"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Zt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:uc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/companies/create")}deleteCompanyByKeys(o,i){return R.fromPromise(this.__deleteCompanyByKeys(o,i))}async __deleteCompanyByKeys(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"companies/delete"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ht.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:hc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/companies/delete")}listCompaniesForAdvancedFilter(o={},i){return R.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:j,sortOrderDirection:b,displayProperties:T,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=>Le.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_statuses=Le.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(Array.isArray(g)?O.subscription_types=g.map(M=>We.jsonOrThrow(M,{unrecognizedObjectKeys:"strip"})):O.subscription_types=We.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()),j!=null&&(O.sort_order_column=j),b!=null&&(O.sort_order_direction=we.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?O.display_properties=T.map(M=>M):O.display_properties=T),V!=null&&(O.limit=V.toString()),H!=null&&(O.offset=H.toString());let pe=await this._options.authProvider.getAuthRequest(),nr=f(pe.headers,this._options?.headers,i?.headers),k=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Kc.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 v(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new C(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new P(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new E(t.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new x(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 U(k.error,k.rawResponse,"GET","/companies/list2")}lookupCompany(o,i){return R.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=f(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:tl.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 C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(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 U(u.error,u.rawResponse,"GET","/companies/lookup")}listCompanyMemberships(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Nc.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/company-memberships")}getOrCreateCompanyMembership(o,i){return R.fromPromise(this.__getOrCreateCompanyMembership(o,i))}async __getOrCreateCompanyMembership(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"company-memberships"),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:Uc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/company-memberships")}deleteCompanyMembership(o,i){return R.fromPromise(this.__deleteCompanyMembership(o,i))}async __deleteCompanyMembership(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/company-memberships/{company_membership_id}")}getActiveCompanySubscription(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:_c.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/company-subscriptions")}upsertCompanyTrait(o,i){return R.fromPromise(this.__upsertCompanyTrait(o,i))}async __upsertCompanyTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"company-traits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ul.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/company-traits")}listEntityKeyDefinitions(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:$c.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/entity-key-definitions")}countEntityKeyDefinitions(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:tc.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/entity-key-definitions/count")}listEntityTraitDefinitions(o={},i){return R.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=X.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(Array.isArray(u)?l.trait_types=u.map(b=>X.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.trait_types=X.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=f(m.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(j.ok)return{data:Jc.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new v(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new C(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/entity-trait-definitions")}getOrCreateEntityTraitDefinition(o,i){return R.fromPromise(this.__getOrCreateEntityTraitDefinition(o,i))}async __getOrCreateEntityTraitDefinition(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"entity-trait-definitions"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ut.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/entity-trait-definitions")}getEntityTraitDefinition(o,i){return R.fromPromise(this.__getEntityTraitDefinition(o,i))}async __getEntityTraitDefinition(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/entity-trait-definitions/{entity_trait_definition_id}")}updateEntityTraitDefinition(o,i,a){return R.fromPromise(this.__updateEntityTraitDefinition(o,i,a))}async __updateEntityTraitDefinition(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`entity-trait-definitions/${w.encodePathParam(o)}`),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:nl.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/entity-trait-definitions/{entity_trait_definition_id}")}countEntityTraitDefinitions(o={},i){return R.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=X.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(Array.isArray(u)?l.trait_types=u.map(b=>X.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.trait_types=X.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.limit=g.toString()),d!=null&&(l.offset=d.toString());let m=await this._options.authProvider.getAuthRequest(),y=f(m.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(j.ok)return{data:sc.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new v(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new C(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/entity-trait-definitions/count")}getEntityTraitValues(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Cc.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/entity-trait-values")}listPlanChanges(o={},i){return R.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=f(m.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(j.ok)return{data:Yc.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new v(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new C(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/plan-changes")}getPlanChange(o,i){return R.fromPromise(this.__getPlanChange(o,i))}async __getPlanChange(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/plan-changes/{plan_change_id}")}listPlanTraits(o={},i){return R.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(j=>j):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(j=>j):d.trait_ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:el.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/plan-traits")}createPlanTrait(o,i){return R.fromPromise(this.__createPlanTrait(o,i))}async __createPlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-traits"),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: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 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-traits")}getPlanTrait(o,i){return R.fromPromise(this.__getPlanTrait(o,i))}async __getPlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/plan-traits/{plan_trait_id}")}updatePlanTrait(o,i,a){return R.fromPromise(this.__updatePlanTrait(o,i,a))}async __updatePlanTrait(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plan-traits/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:yt.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:cl.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plan-traits/{plan_trait_id}")}deletePlanTrait(o,i){return R.fromPromise(this.__deletePlanTrait(o,i))}async __deletePlanTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/plan-traits/{plan_trait_id}")}updatePlanTraitsBulk(o,i){return R.fromPromise(this.__updatePlanTraitsBulk(o,i))}async __updatePlanTraitsBulk(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-traits/bulk"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:gt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ll.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-traits/bulk")}countPlanTraits(o={},i){return R.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(j=>j):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(j=>j):d.trait_ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:cc.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/plan-traits/count")}upsertUserTrait(o,i){return R.fromPromise(this.__upsertUserTrait(o,i))}async __upsertUserTrait(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"user-traits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:ml.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/user-traits")}listUsers(o={},i){return R.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(j=>j):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=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:il.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/users")}upsertUser(o,i){return R.fromPromise(this.__upsertUser(o,i))}async __upsertUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"users"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/users")}getUser(o,i){return R.fromPromise(this.__getUser(o,i))}async __getUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:qc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/users/{user_id}")}deleteUser(o,i){return R.fromPromise(this.__deleteUser(o,i))}async __deleteUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/users/{user_id}")}countUsers(o={},i){return R.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(j=>j):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=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:pc.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/users/count")}createUser(o,i){return R.fromPromise(this.__createUser(o,i))}async __createUser(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"users/create"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/users/create")}deleteUserByKeys(o,i){return R.fromPromise(this.__deleteUserByKeys(o,i))}async __deleteUserByKeys(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"users/delete"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ht.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:zc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/users/delete")}lookupUser(o,i){return R.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=f(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:sl.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 C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(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 U(u.error,u.rawResponse,"GET","/users/lookup")}};var zo=class{constructor(o){this._options=K(o)}listComponents(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Rl.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/components")}createComponent(o,i){return R.fromPromise(this.__createComponent(o,i))}async __createComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"components"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/components")}getComponent(o,i){return R.fromPromise(this.__getComponent(o,i))}async __getComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/components/{component_id}")}updateComponent(o,i={},a){return R.fromPromise(this.__updateComponent(o,i,a))}async __updateComponent(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`components/${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: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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/components/{component_id}")}deleteComponent(o,i){return R.fromPromise(this.__deleteComponent(o,i))}async __deleteComponent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/components/{component_id}")}countComponents(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:gl.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/components/count")}previewComponentData(o={},i){return R.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=f(s.headers,this._options?.headers,i?.headers),g=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ol.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 C(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(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 U(g.error,g.rawResponse,"GET","/components/preview-data")}};var Ro=class{constructor(o){this._options=K(o)}listBillingCredits(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:cp.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/credits")}createBillingCredit(o,i){return R.fromPromise(this.__createBillingCredit(o,i))}async __createBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Rt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/credits")}getSingleBillingCredit(o,i){return R.fromPromise(this.__getSingleBillingCredit(o,i))}async __getSingleBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/billing/credits/{credit_id}")}updateBillingCredit(o,i,a){return R.fromPromise(this.__updateBillingCredit(o,i,a))}async __updateBillingCredit(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`billing/credits/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:St.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:bp.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/billing/credits/{credit_id}")}softDeleteBillingCredit(o,i){return R.fromPromise(this.__softDeleteBillingCredit(o,i))}async __softDeleteBillingCredit(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:wp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/billing/credits/{credit_id}")}listCreditBundles(o={},i){return R.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(j=>j):d.ids=a),n!=null&&(d.credit_id=n),r!=null&&(d.status=ue.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(d.bundle_type=ze.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:hp.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/credits/bundles")}createCreditBundle(o,i){return R.fromPromise(this.__createCreditBundle(o,i))}async __createCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/bundles"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/credits/bundles")}getCreditBundle(o,i){return R.fromPromise(this.__getCreditBundle(o,i))}async __getCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/billing/credits/bundles/{bundle_id}")}updateCreditBundleDetails(o,i,a){return R.fromPromise(this.__updateCreditBundleDetails(o,i,a))}async __updateCreditBundleDetails(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`billing/credits/bundles/${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:Rp.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/billing/credits/bundles/{bundle_id}")}deleteCreditBundle(o,i){return R.fromPromise(this.__deleteCreditBundle(o,i))}async __deleteCreditBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/billing/credits/bundles/{bundle_id}")}countCreditBundles(o={},i){return R.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(j=>j):d.ids=a),n!=null&&(d.credit_id=n),r!=null&&(d.status=ue.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(d.bundle_type=ze.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Kl.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/credits/bundles/count")}countBillingCredits(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Vl.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/credits/count")}zeroOutGrant(o,i={},a){return R.fromPromise(this.__zeroOutGrant(o,i,a))}async __zeroOutGrant(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`billing/credits/grants/${w.encodePathParam(o)}/zero-out`),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:fp.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/billing/credits/grants/{grant_id}/zero-out")}grantBillingCreditsToCompany(o,i){return R.fromPromise(this.__grantBillingCreditsToCompany(o,i))}async __grantBillingCreditsToCompany(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/grants/company"),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:sp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/credits/grants/company")}countCompanyGrants(o={},i){return R.fromPromise(this.__countCompanyGrants(o,i))}async __countCompanyGrants(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=ur.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"})),r!=null&&(g.dir=we.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/grants/company/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:Fl.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/billing/credits/grants/company/count")}listCompanyGrants(o={},i){return R.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=ur.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"})),r!=null&&(g.dir=we.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),s!=null&&(g.limit=s.toString()),u!=null&&(g.offset=u.toString());let d=await this._options.authProvider.getAuthRequest(),l=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:dp.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/billing/credits/grants/company/list")}countBillingCreditsGrants(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Bl.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/credits/grants/count")}listGrantsForCredit(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:yp.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/billing/credits/grants/list")}getEnrichedCreditLedger(o,i){return R.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=dr.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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/ledger"),method:"GET",headers:j,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:op.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/billing/credits/ledger")}countCreditLedger(o,i){return R.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=dr.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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/ledger/count"),method:"GET",headers:j,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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/billing/credits/ledger/count")}listBillingPlanCreditGrants(o={},i){return R.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(j=>j):d.plan_ids=r),s!=null&&(Array.isArray(s)?d.ids=s.map(j=>j):d.ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:pp.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/credits/plan-grants")}createBillingPlanCreditGrant(o,i){return R.fromPromise(this.__createBillingPlanCreditGrant(o,i))}async __createBillingPlanCreditGrant(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"billing/credits/plan-grants"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ji.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: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 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/billing/credits/plan-grants")}updateBillingPlanCreditGrant(o,i,a){return R.fromPromise(this.__updateBillingPlanCreditGrant(o,i,a))}async __updateBillingPlanCreditGrant(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`billing/credits/plan-grants/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Yi.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:zp.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/billing/credits/plan-grants/{plan_grant_id}")}deleteBillingPlanCreditGrant(o,i={},a){return R.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=f(s.headers,this._options?.headers,a?.headers),g=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Zl.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 v(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new C(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new P(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(t.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new x(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 U(g.error,g.rawResponse,"DELETE","/billing/credits/plan-grants/{plan_grant_id}")}countBillingPlanCreditGrants(o={},i){return R.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(j=>j):d.plan_ids=r),s!=null&&(Array.isArray(s)?d.ids=s.map(j=>j):d.ids=s),u!=null&&(d.limit=u.toString()),g!=null&&(d.offset=g.toString());let l=await this._options.authProvider.getAuthRequest(),m=f(l.headers,this._options?.headers,i?.headers),y=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Dl.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 v(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new C(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new P(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(t.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new x(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 U(y.error,y.rawResponse,"GET","/billing/credits/plan-grants/count")}};var fo=class{constructor(o){this._options=K(o)}createDataExport(o,i){return R.fromPromise(this.__createDataExport(o,i))}async __createDataExport(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"data-exports"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:{...Et.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:Ep.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/data-exports")}getDataExportArtifact(o,i){return R.fromPromise(this.__getDataExportArtifact(o,i))}async __getDataExportArtifact(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/data-exports/{data_export_id}/artifact")}};var _o=class{constructor(o){this._options=K(o)}listCompanyOverrides(o={},i){return R.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 j=await this._options.authProvider.getAuthRequest(),b=f(j.headers,this._options?.headers,i?.headers),T=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(T.ok)return{data:tu.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 v(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new C(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new P(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new x(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new z({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}return U(T.error,T.rawResponse,"GET","/company-overrides")}createCompanyOverride(o,i){return R.fromPromise(this.__createCompanyOverride(o,i))}async __createCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"company-overrides"),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:Wp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/company-overrides")}getCompanyOverride(o,i){return R.fromPromise(this.__getCompanyOverride(o,i))}async __getCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Xp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/company-overrides/{company_override_id}")}updateCompanyOverride(o,i,a){return R.fromPromise(this.__updateCompanyOverride(o,i,a))}async __updateCompanyOverride(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`company-overrides/${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:yu.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/company-overrides/{company_override_id}")}deleteCompanyOverride(o,i){return R.fromPromise(this.__deleteCompanyOverride(o,i))}async __deleteCompanyOverride(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Hp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/company-overrides/{company_override_id}")}countCompanyOverrides(o={},i){return R.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 j=await this._options.authProvider.getAuthRequest(),b=f(j.headers,this._options?.headers,i?.headers),T=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(T.ok)return{data:Vp.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 v(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new C(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new P(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new x(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new z({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}return U(T.error,T.rawResponse,"GET","/company-overrides/count")}listFeatureCompanies(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:cu.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/feature-companies")}countFeatureCompanies(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/feature-companies/count")}listFeatureUsage(o={},i){return R.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(T=>T):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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"feature-usage"),method:"GET",headers:j,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:pu.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/feature-usage")}countFeatureUsage(o={},i){return R.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(T=>T):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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"feature-usage/count"),method:"GET",headers:j,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:Fp.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/feature-usage/count")}listFeatureUsers(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:mu.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/feature-users")}countFeatureUsers(o,i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Kp.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/feature-users/count")}listPlanEntitlements(o={},i){return R.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 j=await this._options.authProvider.getAuthRequest(),b=f(j.headers,this._options?.headers,i?.headers),T=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(T.ok)return{data:gu.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 v(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new C(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new P(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new x(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new z({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}return U(T.error,T.rawResponse,"GET","/plan-entitlements")}createPlanEntitlement(o,i){return R.fromPromise(this.__createPlanEntitlement(o,i))}async __createPlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-entitlements"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ut.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i?.timeoutInSeconds??this._options?.timeoutInSeconds??60)*1e3,maxRetries:i?.maxRetries??this._options?.maxRetries,abortSignal:i?.abortSignal,fetchFn:this._options?.fetch,logging:this._options.logging});if(r.ok)return{data:Np.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-entitlements")}getPlanEntitlement(o,i){return R.fromPromise(this.__getPlanEntitlement(o,i))}async __getPlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/plan-entitlements/{plan_entitlement_id}")}updatePlanEntitlement(o,i,a){return R.fromPromise(this.__updatePlanEntitlement(o,i,a))}async __updatePlanEntitlement(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plan-entitlements/${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:wu.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plan-entitlements/{plan_entitlement_id}")}deletePlanEntitlement(o,i){return R.fromPromise(this.__deletePlanEntitlement(o,i))}async __deletePlanEntitlement(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:$p.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/plan-entitlements/{plan_entitlement_id}")}countPlanEntitlements(o={},i){return R.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 j=await this._options.authProvider.getAuthRequest(),b=f(j.headers,this._options?.headers,i?.headers),T=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(T.ok)return{data:Lp.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 v(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new C(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new P(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new x(t.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new z({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}return U(T.error,T.rawResponse,"GET","/plan-entitlements/count")}duplicatePlanEntitlements(o,i){return R.fromPromise(this.__duplicatePlanEntitlements(o,i))}async __duplicatePlanEntitlements(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-entitlements/duplicate"),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:Yp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-entitlements/duplicate")}getFeatureUsageByCompany(o,i){return R.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=f(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:ru.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 C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(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 U(u.error,u.rawResponse,"GET","/usage-by-company")}};var So=class{constructor(o){this._options=K(o)}createEventBatch(o,i){return R.fromPromise(this.__createEventBatch(o,i))}async __createEventBatch(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"event-batch"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:jt.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:Pu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/event-batch")}getEventSummaries(o={},i){return R.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=f(g.headers,this._options?.headers,i?.headers),l=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Tu.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 v(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new C(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new P(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(t.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new x(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 U(l.error,l.rawResponse,"GET","/event-types")}listEvents(o={},i){return R.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=>Ne.jsonOrThrow(b,{unrecognizedObjectKeys:"strip"})):l.event_types=Ne.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=f(m.headers,this._options?.headers,i?.headers),j=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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(j.ok)return{data:ku.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new v(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new C(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new P(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new x(t.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new z({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}return U(j.error,j.rawResponse,"GET","/events")}createEvent(o,i){return R.fromPromise(this.__createEvent(o,i))}async __createEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"events"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Ii.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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/events")}getEvent(o,i){return R.fromPromise(this.__getEvent(o,i))}async __getEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Cu.parseOrThrow(r.body,{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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/events/{event_id}")}getSegmentIntegrationStatus(o){return R.fromPromise(this.__getSegmentIntegrationStatus(o))}async __getSegmentIntegrationStatus(o){let i=await this._options.authProvider.getAuthRequest(),a=f(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Ou.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 C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new E(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(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 U(n.error,n.rawResponse,"GET","/segment-integration")}};var Po=class{constructor(o){this._options=K(o)}listFeatures(o={},i){return R.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(T=>T):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(T=>te.jsonOrThrow(T,{unrecognizedObjectKeys:"strip"})):m.feature_type=te.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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"features"),method:"GET",headers:j,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:id.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/features")}createFeature(o,i){return R.fromPromise(this.__createFeature(o,i))}async __createFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"features"),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:Zu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/features")}getFeature(o,i){return R.fromPromise(this.__getFeature(o,i))}async __getFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/features/{feature_id}")}updateFeature(o,i={},a){return R.fromPromise(this.__updateFeature(o,i,a))}async __updateFeature(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`features/${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:ad.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/features/{feature_id}")}deleteFeature(o,i){return R.fromPromise(this.__deleteFeature(o,i))}async __deleteFeature(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/features/{feature_id}")}countFeatures(o={},i){return R.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(T=>T):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(T=>te.jsonOrThrow(T,{unrecognizedObjectKeys:"strip"})):m.feature_type=te.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(),j=f(y.headers,this._options?.headers,i?.headers),b=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"features/count"),method:"GET",headers:j,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:Nu.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 v(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 401:throw new C(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 403:throw new P(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 404:throw new E(t.parseOrThrow(b.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),b.rawResponse);case 500:throw new x(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 U(b.error,b.rawResponse,"GET","/features/count")}listFlags(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 400:throw new v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/flags")}createFlag(o,i){return R.fromPromise(this.__createFlag(o,i))}async __createFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"flags"),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:Ju.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/flags")}getFlag(o,i){return R.fromPromise(this.__getFlag(o,i))}async __getFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/flags/{flag_id}")}updateFlag(o,i,a){return R.fromPromise(this.__updateFlag(o,i,a))}async __updateFlag(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`flags/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Nt.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:sd.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/flags/{flag_id}")}deleteFlag(o,i){return R.fromPromise(this.__deleteFlag(o,i))}async __deleteFlag(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Yu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/flags/{flag_id}")}updateFlagRules(o,i,a){return R.fromPromise(this.__updateFlagRules(o,i,a))}async __updateFlagRules(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`flags/${w.encodePathParam(o)}/rules`),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:ld.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/flags/{flag_id}/rules")}checkFlag(o,i,a){return R.fromPromise(this.__checkFlag(o,i,a))}async __checkFlag(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`flags/${w.encodePathParam(o)}/check`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:ni.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:Iu.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"POST","/flags/{key}/check")}checkFlags(o,i){return R.fromPromise(this.__checkFlags(o,i))}async __checkFlags(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"flags/check"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:ni.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:Lu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/flags/check")}checkFlagsBulk(o,i){return R.fromPromise(this.__checkFlagsBulk(o,i))}async __checkFlagsBulk(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"flags/check-bulk"),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:Gu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/flags/check-bulk")}countFlags(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:$u.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/flags/count")}};var xo=class{constructor(o){this._options=K(o)}createPlanBundle(o,i){return R.fromPromise(this.__createPlanBundle(o,i))}async __createPlanBundle(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-bundles"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-bundles")}updatePlanBundle(o,i,a){return R.fromPromise(this.__updatePlanBundle(o,i,a))}async __updatePlanBundle(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plan-bundles/${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: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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plan-bundles/{plan_bundle_id}")}};var Eo=class{constructor(o){this._options=K(o)}getPlanGroup(o){return R.fromPromise(this.__getPlanGroup(o))}async __getPlanGroup(o){let i=await this._options.authProvider.getAuthRequest(),a=f(i.headers,this._options?.headers,o?.headers),n=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:fd.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 C(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 403:throw new P(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 404:throw new E(t.parseOrThrow(n.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),n.rawResponse);case 500:throw new x(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 U(n.error,n.rawResponse,"GET","/plan-groups")}createPlanGroup(o,i){return R.fromPromise(this.__createPlanGroup(o,i))}async __createPlanGroup(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plan-groups"),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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plan-groups")}updatePlanGroup(o,i,a){return R.fromPromise(this.__updatePlanGroup(o,i,a))}async __updatePlanGroup(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plan-groups/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Ft.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:_d.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plan-groups/{plan_group_id}")}};var Co=class{constructor(o){this._options=K(o)}updateCompanyPlans(o,i,a){return R.fromPromise(this.__updateCompanyPlans(o,i,a))}async __updateCompanyPlans(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`company-plans/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Kt.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:kd.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/company-plans/{company_plan_id}")}listPlans(o={},i){return R.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:j,offset:b}=o,T={};a!=null&&(T.company_id=a),n!=null&&(T.for_fallback_plan=n.toString()),r!=null&&(T.for_initial_plan=r.toString()),s!=null&&(T.for_trial_expiry_plan=s.toString()),u!=null&&(T.has_product_id=u.toString()),g!=null&&(Array.isArray(g)?T.ids=g.map(pe=>pe):T.ids=g),d!=null&&(T.plan_type=ae.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),l!=null&&(T.q=l),m!=null&&(T.without_entitlement_for=m),y!=null&&(T.without_paid_product_id=y.toString()),j!=null&&(T.limit=j.toString()),b!=null&&(T.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=f(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plans"),method:"GET",headers:H,queryParameters:{...T,...i?.queryParams},timeoutMs:(i?.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:jd.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 v(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new E(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(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 U(O.error,O.rawResponse,"GET","/plans")}createPlan(o,i){return R.fromPromise(this.__createPlan(o,i))}async __createPlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plans"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:$i.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: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 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/plans")}getPlan(o,i){return R.fromPromise(this.__getPlan(o,i))}async __getPlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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 C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/plans/{plan_id}")}updatePlan(o,i,a){return R.fromPromise(this.__updatePlan(o,i,a))}async __updatePlan(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plans/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:ro.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:Bd.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plans/{plan_id}")}deletePlan(o,i){return R.fromPromise(this.__deletePlan(o,i))}async __deletePlan(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/plans/{plan_id}")}upsertBillingProductPlan(o,i,a){return R.fromPromise(this.__upsertBillingProductPlan(o,i,a))}async __upsertBillingProductPlan(o,i,a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`plans/${w.encodePathParam(o)}/billing_products`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Wr.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:Ad.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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/plans/{plan_id}/billing_products")}countPlans(o={},i){return R.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:j,offset:b}=o,T={};a!=null&&(T.company_id=a),n!=null&&(T.for_fallback_plan=n.toString()),r!=null&&(T.for_initial_plan=r.toString()),s!=null&&(T.for_trial_expiry_plan=s.toString()),u!=null&&(T.has_product_id=u.toString()),g!=null&&(Array.isArray(g)?T.ids=g.map(pe=>pe):T.ids=g),d!=null&&(T.plan_type=ae.jsonOrThrow(d,{unrecognizedObjectKeys:"strip"})),l!=null&&(T.q=l),m!=null&&(T.without_entitlement_for=m),y!=null&&(T.without_paid_product_id=y.toString()),j!=null&&(T.limit=j.toString()),b!=null&&(T.offset=b.toString());let V=await this._options.authProvider.getAuthRequest(),H=f(V.headers,this._options?.headers,i?.headers),O=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"plans/count"),method:"GET",headers:H,queryParameters:{...T,...i?.queryParams},timeoutMs:(i?.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:Pd.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 v(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 401:throw new C(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 403:throw new P(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 404:throw new E(t.parseOrThrow(O.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),O.rawResponse);case 500:throw new x(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 U(O.error,O.rawResponse,"GET","/plans/count")}listPlanIssues(o,i){return R.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=f(r.headers,this._options?.headers,i?.headers),u=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:vd.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 v(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new C(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new P(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(t.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new x(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 U(u.error,u.rawResponse,"GET","/plans/issues")}};var Uo=class{constructor(o){this._options=K(o)}listWebhookEvents(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Nd.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/webhook-events")}getWebhookEvent(o,i){return R.fromPromise(this.__getWebhookEvent(o,i))}async __getWebhookEvent(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Gd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/webhook-events/{webhook_event_id}")}countWebhookEvents(o={},i){return R.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=f(d.headers,this._options?.headers,i?.headers),m=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:qd.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 v(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new C(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new P(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(t.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new x(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 U(m.error,m.rawResponse,"GET","/webhook-events/count")}listWebhooks(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:$d.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/webhooks")}createWebhook(o,i){return R.fromPromise(this.__createWebhook(o,i))}async __createWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,"webhooks"),method:"POST",headers:n,contentType:"application/json",queryParameters:i?.queryParams,requestType:"json",body:Gt.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: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 v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"POST","/webhooks")}getWebhook(o,i){return R.fromPromise(this.__getWebhook(o,i))}async __getWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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: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 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"GET","/webhooks/{webhook_id}")}updateWebhook(o,i={},a){return R.fromPromise(this.__updateWebhook(o,i,a))}async __updateWebhook(o,i={},a){let n=await this._options.authProvider.getAuthRequest(),r=f(n.headers,this._options?.headers,a?.headers),s=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.Default,`webhooks/${w.encodePathParam(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:Lt.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: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 v(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new C(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new P(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(t.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new x(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 U(s.error,s.rawResponse,"PUT","/webhooks/{webhook_id}")}deleteWebhook(o,i){return R.fromPromise(this.__deleteWebhook(o,i))}async __deleteWebhook(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Id.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new v(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new C(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new P(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(t.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new x(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 U(r.error,r.rawResponse,"DELETE","/webhooks/{webhook_id}")}countWebhooks(o={},i){return R.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=f(u.headers,this._options?.headers,i?.headers),d=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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:Md.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 v(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 401:throw new C(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 403:throw new P(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 404:throw new E(t.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),d.rawResponse);case 500:throw new x(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 U(d.error,d.rawResponse,"GET","/webhooks/count")}};var To=class{constructor(o){this._options=K(o)}get accounts(){return this._accounts??=new go(this._options)}get billing(){return this._billing??=new yo(this._options)}get credits(){return this._credits??=new Ro(this._options)}get checkout(){return this._checkout??=new wo(this._options)}get companies(){return this._companies??=new bo(this._options)}get entitlements(){return this._entitlements??=new _o(this._options)}get plans(){return this._plans??=new Co(this._options)}get components(){return this._components??=new zo(this._options)}get dataexports(){return this._dataexports??=new fo(this._options)}get events(){return this._events??=new So(this._options)}get features(){return this._features??=new Po(this._options)}get planbundle(){return this._planbundle??=new xo(this._options)}get plangroups(){return this._plangroups??=new Eo(this._options)}get accesstokens(){return this._accesstokens??=new ho(this._options)}get webhooks(){return this._webhooks??=new Uo(this._options)}putPlanAudiencesPlanAudienceId(o,i){return R.fromPromise(this.__putPlanAudiencesPlanAudienceId(o,i))}async __putPlanAudiencesPlanAudienceId(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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 U(r.error,r.rawResponse,"PUT","/plan-audiences/{plan_audience_id}")}deletePlanAudiencesPlanAudienceId(o,i){return R.fromPromise(this.__deletePlanAudiencesPlanAudienceId(o,i))}async __deletePlanAudiencesPlanAudienceId(o,i){let a=await this._options.authProvider.getAuthRequest(),n=f(a.headers,this._options?.headers,i?.headers),r=await(this._options.fetcher??S)({url:w.join(await h.get(this._options.baseUrl)??await h.get(this._options.environment)??_.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 U(r.error,r.rawResponse,"DELETE","/plan-audiences/{plan_audience_id}")}};var Zr=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 Yh=1e3,Xh=1e3,eg=3,rg=1e3,vo=class{constructor(o,i){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:a=new Zr,maxSize:n=Xh,interval:r=Yh,offline:s=!1,maxRetries:u=eg,initialRetryDelay:g=rg}=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 Yd(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=li(i.url,i.queryParameters),r=await ui({body:i.body,type:i.requestType==="json"?"json":"other"}),s=await pi();try{let u=await mi(async()=>di(s,n,i.method,a,r,i.timeoutMs,i.abortSignal,i.withCredentials,i.duplex),i.maxRetries),g=await wr(u,i.responseType),d=ei(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:br}:u instanceof Error&&u.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:br}:u instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:u.message},rawResponse:zr}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(u)},rawResponse:zr}}}}async function ig(p){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new je,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Xd=ig;var Oo=class extends To{constructor(o){let{apiKey:i="",basePath:a,eventBufferInterval:n,flagDefaults:r={},logger:s=new Zr,timeoutMs:u}=o??{},{offline:g=!1}=o??{},d={};o?.environmentId&&(d["X-Schematic-Environment-Id"]=o.environmentId),o?.headers&&Object.assign(d,o.headers),g?i!==""&&s.debug("Offline mode enabled, ignoring API key"):i===""&&!g&&(s.warn("No API key was provided, running in offline mode"),g=!0),super({apiKey:i,environment:a,fetcher:g?Xd:Yd(d),timeoutInSeconds:u!==void 0?u/1e3:void 0}),this.logger=s,this.eventBuffer=new vo(this.events,{interval:n,logger:s,offline:g}),this.flagCheckCacheProviders=o?.cacheProviders?.flagChecks??[new hr],this.flagDefaults=r,this.offline=g}async checkFlag(o,i,a){let n=()=>a?.defaultValue===void 0?this.getFlagDefault(i):typeof a.defaultValue=="function"?a.defaultValue():a.defaultValue;if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${i}`),n();try{let r=JSON.stringify({evalCtx:o,key:i});for(let u of this.flagCheckCacheProviders){let g=await u.get(r);if(g!==void 0)return this.logger.debug(`${u.constructor.name} cache hit for flag ${i}`),g}let s=await this.features.checkFlag(i,o,{timeoutInSeconds:a?.timeoutMs!==void 0?a.timeoutMs/1e3:void 0});if(s.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${i}, falling back to default`),n();for(let u of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${i} in ${u.constructor.name}`),await u.set(r,s.data.value);return this.logger.debug(`Feature flag API response for ${i}: ${JSON.stringify(s.data)}`),s.data.value}catch(r){return this.logger.error(`Error checking flag ${i}: ${r}`),n()}}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 jo=Ao(require("crypto")),Yt="X-Schematic-Webhook-Signature",Xt="X-Schematic-Webhook-Timestamp",Ie=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 ko(p,o,i){let a=Buffer.isBuffer(p)?p:Buffer.from(p),n=Buffer.concat([a,Buffer.from(`+${o}`)]),r=jo.createHmac("sha256",i);return r.update(n),r.digest()}function rm(p,o,i){return ko(p,o,i).toString("hex")}function ea(p,o,i,a){if(!o)throw Ie.missingSignature();if(!i)throw Ie.missingTimestamp();let n;try{n=Buffer.from(o,"hex")}catch(s){throw new Ie(`Invalid signature format: ${s?.message||"Unknown error"}`)}let r=ko(p,i,a);if(n.length!==r.length||!jo.timingSafeEqual(n,r))throw Ie.invalidSignature()}function im(p,o,i,a={}){let n=p.headers,r=a.signatureHeader||Yt,s=a.timestampHeader||Xt,u=em(n,r),g=em(n,s),d;if(i!==void 0)d=i;else if("rawBody"in p&&p.rawBody)d=p.rawBody;else throw new Ie("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");ea(d,u,g,o)}function em(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});