schematichq 1.4.0 → 1.4.2

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 (279) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +4 -4
  3. data/.fern/replay.lock +10 -0
  4. data/.fernignore +3 -0
  5. data/README.md +1 -1
  6. data/lib/schematic/accounts/client.rb +76 -0
  7. data/lib/schematic/accounts/types/get_account_member_response.rb +12 -0
  8. data/lib/schematic/accounts/types/list_account_members_params.rb +15 -0
  9. data/lib/schematic/accounts/types/list_account_members_request.rb +14 -0
  10. data/lib/schematic/accounts/types/list_account_members_response.rb +12 -0
  11. data/lib/schematic/billing/client.rb +6 -2
  12. data/lib/schematic/billing/types/count_billing_products_params.rb +1 -0
  13. data/lib/schematic/billing/types/count_billing_products_request.rb +1 -0
  14. data/lib/schematic/billing/types/create_billing_price_request_body.rb +2 -0
  15. data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +1 -0
  16. data/lib/schematic/billing/types/create_meter_request_body.rb +1 -0
  17. data/lib/schematic/billing/types/list_billing_products_params.rb +1 -0
  18. data/lib/schematic/billing/types/list_billing_products_request.rb +1 -0
  19. data/lib/schematic/cache.rb +7 -4
  20. data/lib/schematic/client.rb +14 -4
  21. data/lib/schematic/companies/client.rb +8 -105
  22. data/lib/schematic/companies/types/count_companies_params.rb +1 -0
  23. data/lib/schematic/companies/types/count_companies_request.rb +1 -0
  24. data/lib/schematic/companies/types/list_companies_params.rb +1 -0
  25. data/lib/schematic/companies/types/list_companies_request.rb +1 -0
  26. data/lib/schematic/companies/types/list_plan_changes_params.rb +2 -2
  27. data/lib/schematic/companies/types/list_plan_changes_request.rb +2 -2
  28. data/lib/schematic/credits/client.rb +44 -2
  29. data/lib/schematic/credits/types/count_billing_plan_credit_grants_params.rb +1 -0
  30. data/lib/schematic/credits/types/count_billing_plan_credit_grants_request.rb +1 -0
  31. data/lib/schematic/credits/types/list_billing_plan_credit_grants_params.rb +1 -0
  32. data/lib/schematic/credits/types/list_billing_plan_credit_grants_request.rb +1 -0
  33. data/lib/schematic/credits/types/list_company_credit_balances_params.rb +12 -0
  34. data/lib/schematic/credits/types/list_company_credit_balances_request.rb +11 -0
  35. data/lib/schematic/credits/types/list_company_credit_balances_response.rb +12 -0
  36. data/lib/schematic/datastream/client.rb +28 -21
  37. data/lib/schematic/datastream/websocket_client.rb +32 -1
  38. data/lib/schematic/entitlements/client.rb +38 -2
  39. data/lib/schematic/entitlements/types/count_feature_usage_params.rb +1 -0
  40. data/lib/schematic/entitlements/types/count_feature_usage_request.rb +1 -0
  41. data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +44 -0
  42. data/lib/schematic/entitlements/types/create_company_override_request_body.rb +2 -2
  43. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +6 -2
  44. data/lib/schematic/entitlements/types/list_feature_usage_params.rb +1 -0
  45. data/lib/schematic/entitlements/types/list_feature_usage_request.rb +1 -0
  46. data/lib/schematic/entitlements/types/update_company_override_request_body.rb +2 -2
  47. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +6 -2
  48. data/lib/schematic/entitlements/types/upsert_plan_entitlement_for_billing_product_response.rb +12 -0
  49. data/lib/schematic/event_buffer.rb +10 -2
  50. data/lib/schematic/events/client.rb +3 -1
  51. data/lib/schematic/events/types/list_events_params.rb +1 -0
  52. data/lib/schematic/events/types/list_events_request.rb +1 -0
  53. data/lib/schematic/features/client.rb +50 -14
  54. data/lib/schematic/features/types/count_features_params.rb +1 -0
  55. data/lib/schematic/features/types/count_features_request.rb +4 -3
  56. data/lib/schematic/features/types/create_billing_linked_feature_request_body.rb +23 -0
  57. data/lib/schematic/features/types/create_feature_request_body.rb +1 -1
  58. data/lib/schematic/features/types/list_features_params.rb +1 -0
  59. data/lib/schematic/features/types/list_features_request.rb +4 -3
  60. data/lib/schematic/features/types/update_feature_request_body.rb +1 -1
  61. data/lib/schematic/features/types/upsert_feature_for_billing_product_response.rb +12 -0
  62. data/lib/schematic/insights/client.rb +251 -0
  63. data/lib/schematic/insights/types/get_activity_params.rb +12 -0
  64. data/lib/schematic/insights/types/get_activity_request.rb +11 -0
  65. data/lib/schematic/insights/types/get_activity_response.rb +12 -0
  66. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_params.rb +15 -0
  67. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_request.rb +14 -0
  68. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_response.rb +12 -0
  69. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_params.rb +15 -0
  70. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_request.rb +14 -0
  71. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_response.rb +12 -0
  72. data/lib/schematic/insights/types/get_plan_growth_params.rb +12 -0
  73. data/lib/schematic/insights/types/get_plan_growth_request.rb +11 -0
  74. data/lib/schematic/insights/types/get_plan_growth_response.rb +12 -0
  75. data/lib/schematic/{companies/types/create_plan_trait_response.rb → insights/types/get_summary_response.rb} +3 -3
  76. data/lib/schematic/insights/types/get_top_features_by_usage_params.rb +14 -0
  77. data/lib/schematic/insights/types/get_top_features_by_usage_request.rb +13 -0
  78. data/lib/schematic/insights/types/get_top_features_by_usage_response.rb +12 -0
  79. data/lib/schematic/integrationsapi/client.rb +223 -0
  80. data/lib/schematic/integrationsapi/types/get_integration_webhook_url_response.rb +12 -0
  81. data/lib/schematic/integrationsapi/types/list_integrations_params.rb +18 -0
  82. data/lib/schematic/integrationsapi/types/list_integrations_request.rb +17 -0
  83. data/lib/schematic/integrationsapi/types/list_integrations_response.rb +12 -0
  84. data/lib/schematic/integrationsapi/types/load_sample_data_set_v_2_response.rb +12 -0
  85. data/lib/schematic/integrationsapi/types/run_integration_response.rb +12 -0
  86. data/lib/schematic/integrationsapi/types/start_data_import_request_body.rb +13 -0
  87. data/lib/schematic/integrationsapi/types/start_data_import_response.rb +12 -0
  88. data/lib/schematic/{companies/types/delete_plan_trait_response.rb → integrationsapi/types/uninstall_integration_response.rb} +2 -2
  89. data/lib/schematic/planbundle/client.rb +32 -0
  90. data/lib/schematic/planbundle/types/create_custom_plan_bundle_request_body.rb +13 -0
  91. data/lib/schematic/planbundle/types/create_custom_plan_bundle_response.rb +12 -0
  92. data/lib/schematic/plans/client.rb +251 -2
  93. data/lib/schematic/plans/types/count_billing_product_match_companies_params.rb +15 -0
  94. data/lib/schematic/plans/types/count_billing_product_match_companies_request.rb +14 -0
  95. data/lib/schematic/plans/types/count_billing_product_match_companies_response.rb +12 -0
  96. data/lib/schematic/plans/types/count_plans_params.rb +3 -0
  97. data/lib/schematic/plans/types/count_plans_request.rb +3 -0
  98. data/lib/schematic/plans/types/create_billing_linked_plan_request_body.rb +17 -0
  99. data/lib/schematic/plans/types/create_custom_plan_request_body.rb +15 -0
  100. data/lib/schematic/{companies/types/update_plan_trait_response.rb → plans/types/create_custom_plan_response.rb} +3 -3
  101. data/lib/schematic/plans/types/list_billing_product_match_companies_params.rb +15 -0
  102. data/lib/schematic/plans/types/list_billing_product_match_companies_request.rb +14 -0
  103. data/lib/schematic/plans/types/list_billing_product_match_companies_response.rb +12 -0
  104. data/lib/schematic/plans/types/list_custom_plan_billings_params.rb +17 -0
  105. data/lib/schematic/plans/types/list_custom_plan_billings_request.rb +16 -0
  106. data/lib/schematic/plans/types/list_custom_plan_billings_response.rb +12 -0
  107. data/lib/schematic/plans/types/list_plans_params.rb +3 -0
  108. data/lib/schematic/plans/types/list_plans_request.rb +3 -0
  109. data/lib/schematic/plans/types/publish_plan_version_request_body.rb +4 -0
  110. data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +15 -0
  111. data/lib/schematic/plans/types/retry_custom_plan_billing_response.rb +12 -0
  112. data/lib/schematic/plans/types/upsert_plan_for_billing_product_response.rb +12 -0
  113. data/lib/schematic/redis_cache.rb +5 -2
  114. data/lib/schematic/schematic_client.rb +0 -1
  115. data/lib/schematic/types/account_member_permission.rb +25 -0
  116. data/lib/schematic/types/account_member_response_data.rb +16 -0
  117. data/lib/schematic/types/{rulesengine_company_metric_month_reset.rb → account_member_role.rb} +3 -3
  118. data/lib/schematic/types/activity_entry_response_data.rb +14 -0
  119. data/lib/schematic/types/activity_response_response_data.rb +9 -0
  120. data/lib/schematic/types/api_key_create_response_data.rb +2 -0
  121. data/lib/schematic/types/api_key_integration_response_data.rb +11 -0
  122. data/lib/schematic/types/api_key_response_data.rb +2 -0
  123. data/lib/schematic/types/audit_log_list_response_data.rb +2 -0
  124. data/lib/schematic/types/audit_log_response_data.rb +2 -0
  125. data/lib/schematic/types/billing_credit_bundle_view.rb +1 -1
  126. data/lib/schematic/types/billing_credit_view.rb +1 -0
  127. data/lib/schematic/types/billing_linked_resource_response_data.rb +11 -0
  128. data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +2 -0
  129. data/lib/schematic/types/billing_price_response_data.rb +2 -0
  130. data/lib/schematic/types/billing_price_view.rb +2 -0
  131. data/lib/schematic/types/billing_product_for_subscription_response_data.rb +1 -0
  132. data/lib/schematic/types/billing_product_plan_response_data.rb +2 -1
  133. data/lib/schematic/types/billing_product_price_response_data.rb +2 -0
  134. data/lib/schematic/types/billing_provider_type.rb +1 -0
  135. data/lib/schematic/types/billing_strategy.rb +13 -0
  136. data/lib/schematic/types/change_subscription_internal_request_body.rb +1 -0
  137. data/lib/schematic/types/change_subscription_request_body.rb +1 -0
  138. data/lib/schematic/types/charge_type.rb +1 -0
  139. data/lib/schematic/types/check_flag_response_data.rb +2 -2
  140. data/lib/schematic/types/checkout_subscription.rb +1 -0
  141. data/lib/schematic/types/clerk_integration_config.rb +10 -0
  142. data/lib/schematic/types/company_credit_balance_response_data.rb +12 -0
  143. data/lib/schematic/types/company_detail_response_data.rb +1 -0
  144. data/lib/schematic/types/company_event_period_metrics_response_data.rb +2 -2
  145. data/lib/schematic/types/company_matching_criteria.rb +12 -0
  146. data/lib/schematic/types/company_override_response_data.rb +2 -2
  147. data/lib/schematic/types/company_plan_credit_grant_view.rb +40 -0
  148. data/lib/schematic/types/company_plan_detail_response_data.rb +9 -3
  149. data/lib/schematic/types/company_plan_with_billing_sub_view.rb +1 -1
  150. data/lib/schematic/types/company_subscription_response_data.rb +1 -0
  151. data/lib/schematic/types/{condition_operator.rb → comparable_operator.rb} +4 -4
  152. data/lib/schematic/types/condition.rb +4 -4
  153. data/lib/schematic/types/condition_response_data.rb +4 -4
  154. data/lib/schematic/types/{condition_condition_type.rb → condition_type.rb} +1 -1
  155. data/lib/schematic/types/condition_view.rb +4 -4
  156. data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +2 -0
  157. data/lib/schematic/types/create_custom_plan_bundle_plan_request_body.rb +12 -0
  158. data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +6 -2
  159. data/lib/schematic/types/create_entitlement_req_common.rb +2 -2
  160. data/lib/schematic/types/create_event_request_body.rb +3 -0
  161. data/lib/schematic/types/create_flag_request_body.rb +1 -1
  162. data/lib/schematic/types/create_or_update_condition_request_body.rb +4 -4
  163. data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
  164. data/lib/schematic/types/create_or_update_rule_request_body.rb +1 -1
  165. data/lib/schematic/types/create_plan_request_body.rb +1 -1
  166. data/lib/schematic/types/credit_currency_price.rb +10 -0
  167. data/lib/schematic/types/currency_price_request_body.rb +3 -0
  168. data/lib/schematic/types/custom_plan_activation_strategy.rb +12 -0
  169. data/lib/schematic/types/custom_plan_billing_response_data.rb +19 -0
  170. data/lib/schematic/types/custom_plan_billing_status.rb +14 -0
  171. data/lib/schematic/types/data_event_payload.rb +3 -0
  172. data/lib/schematic/types/datastream_company_plan.rb +1 -0
  173. data/lib/schematic/types/duplicate_plan_entitlements_response_response_data.rb +1 -0
  174. data/lib/schematic/types/entitlement_currency_prices_response_data.rb +1 -0
  175. data/lib/schematic/types/environment_feature_usage_time_series_response_data.rb +11 -0
  176. data/lib/schematic/types/environment_trait_usage_time_series_response_data.rb +11 -0
  177. data/lib/schematic/types/environment_usage_point_response_data.rb +10 -0
  178. data/lib/schematic/types/event_detail_response_data.rb +2 -0
  179. data/lib/schematic/types/event_response_data.rb +1 -0
  180. data/lib/schematic/types/feature_company_response_data.rb +4 -3
  181. data/lib/schematic/types/feature_company_user_response_data.rb +2 -2
  182. data/lib/schematic/types/feature_detail_response_data.rb +3 -1
  183. data/lib/schematic/types/feature_entitlement.rb +2 -2
  184. data/lib/schematic/types/feature_in_plan_response_data.rb +26 -0
  185. data/lib/schematic/types/feature_response_data.rb +1 -1
  186. data/lib/schematic/types/feature_usage_response_data.rb +4 -3
  187. data/lib/schematic/types/feature_view.rb +1 -1
  188. data/lib/schematic/types/flag_detail_response_data.rb +2 -1
  189. data/lib/schematic/types/flag_in_plan_response_data.rb +21 -0
  190. data/lib/schematic/types/flag_response_data.rb +1 -1
  191. data/lib/schematic/types/flag_view.rb +0 -1
  192. data/lib/schematic/types/insights_summary_response_data.rb +14 -0
  193. data/lib/schematic/types/integration_capabilities.rb +11 -0
  194. data/lib/schematic/types/integration_config.rb +15 -0
  195. data/lib/schematic/types/integration_response_data.rb +13 -0
  196. data/lib/schematic/types/integration_state.rb +13 -0
  197. data/lib/schematic/types/{plan_controlled_by_type.rb → integration_type.rb} +4 -2
  198. data/lib/schematic/types/integration_webhook_url_response_data.rb +10 -0
  199. data/lib/schematic/types/integrations_data_set_response_data.rb +9 -0
  200. data/lib/schematic/types/integrations_list_response_data.rb +15 -0
  201. data/lib/schematic/types/integrations_response_data.rb +13 -0
  202. data/lib/schematic/types/{condition_metric_period.rb → metric_period.rb} +1 -1
  203. data/lib/schematic/types/{feature_entitlement_month_reset.rb → metric_period_month_reset.rb} +2 -2
  204. data/lib/schematic/types/mrr_response_data.rb +10 -0
  205. data/lib/schematic/types/orb_integration_config.rb +9 -0
  206. data/lib/schematic/types/plan_credit_grant_view.rb +2 -0
  207. data/lib/schematic/types/plan_currency_price_request_body.rb +1 -0
  208. data/lib/schematic/types/plan_currency_prices_response_data.rb +1 -0
  209. data/lib/schematic/types/plan_detail_response_data.rb +9 -3
  210. data/lib/schematic/types/plan_entitlement_response_data.rb +4 -2
  211. data/lib/schematic/types/plan_group_plan_detail_response_data.rb +9 -3
  212. data/lib/schematic/types/plan_growth_point_response_data.rb +12 -0
  213. data/lib/schematic/types/plan_growth_response_data.rb +9 -0
  214. data/lib/schematic/types/plan_icon.rb +35 -0
  215. data/lib/schematic/types/plan_response_data.rb +3 -1
  216. data/lib/schematic/types/plan_version_response_data.rb +1 -1
  217. data/lib/schematic/types/plan_view_public_response_data.rb +9 -3
  218. data/lib/schematic/types/rule.rb +1 -1
  219. data/lib/schematic/types/rule_condition_detail_response_data.rb +4 -4
  220. data/lib/schematic/types/rule_condition_response_data.rb +4 -4
  221. data/lib/schematic/types/rule_detail_response_data.rb +1 -1
  222. data/lib/schematic/types/rule_response_data.rb +1 -1
  223. data/lib/schematic/types/{rule_rule_type.rb → rule_type.rb} +3 -3
  224. data/lib/schematic/types/rule_view.rb +1 -1
  225. data/lib/schematic/types/rules_engine_schema_version.rb +1 -1
  226. data/lib/schematic/types/rulesengine_check_flag_result.rb +2 -2
  227. data/lib/schematic/types/rulesengine_company_metric.rb +2 -2
  228. data/lib/schematic/types/rulesengine_condition.rb +4 -4
  229. data/lib/schematic/types/{rulesengine_condition_condition_type.rb → rulesengine_condition_type.rb} +1 -1
  230. data/lib/schematic/types/rulesengine_feature_entitlement.rb +2 -2
  231. data/lib/schematic/types/{feature_entitlement_metric_period.rb → rulesengine_metric_period.rb} +1 -1
  232. data/lib/schematic/types/{condition_metric_period_month_reset.rb → rulesengine_metric_period_month_reset.rb} +2 -2
  233. data/lib/schematic/types/rulesengine_rule.rb +1 -1
  234. data/lib/schematic/types/{rulesengine_rule_rule_type.rb → rulesengine_rule_type.rb} +3 -3
  235. data/lib/schematic/types/stripe_integration_config.rb +15 -0
  236. data/lib/schematic/types/top_feature_by_usage_response_data.rb +14 -0
  237. data/lib/schematic/types/top_features_by_usage_response_data.rb +9 -0
  238. data/lib/schematic/types/trial_status.rb +13 -0
  239. data/lib/schematic/types/update_auto_topup_override_request_body.rb +12 -0
  240. data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +2 -0
  241. data/lib/schematic/types/update_entitlement_req_common.rb +2 -2
  242. data/lib/schematic/types/update_plan_request_body.rb +1 -1
  243. data/lib/schematic/types/upsert_billing_product_request_body.rb +3 -0
  244. data/lib/schematic/types/usage_based_entitlement_request_body.rb +4 -0
  245. data/lib/schematic/types/usage_based_entitlement_response_data.rb +3 -2
  246. data/lib/schematic/types/webhook_url.rb +10 -0
  247. data/lib/schematic/version.rb +1 -1
  248. data/lib/schematic.rb +121 -57
  249. data/reference.md +2910 -886
  250. metadata +110 -45
  251. data/lib/schematic/companies/types/create_plan_trait_request_body.rb +0 -13
  252. data/lib/schematic/companies/types/update_plan_trait_request_body.rb +0 -13
  253. data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period.rb +0 -16
  254. data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period_month_reset.rb +0 -14
  255. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period.rb +0 -16
  256. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period_month_reset.rb +0 -14
  257. data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period.rb +0 -16
  258. data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period_month_reset.rb +0 -14
  259. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period.rb +0 -16
  260. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period_month_reset.rb +0 -14
  261. data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period.rb +0 -14
  262. data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period_month_reset.rb +0 -12
  263. data/lib/schematic/types/create_entitlement_req_common_metric_period.rb +0 -14
  264. data/lib/schematic/types/create_entitlement_req_common_metric_period_month_reset.rb +0 -12
  265. data/lib/schematic/types/create_or_update_condition_request_body_condition_type.rb +0 -17
  266. data/lib/schematic/types/create_or_update_condition_request_body_metric_period.rb +0 -14
  267. data/lib/schematic/types/create_or_update_condition_request_body_metric_period_month_reset.rb +0 -12
  268. data/lib/schematic/types/create_or_update_condition_request_body_operator.rb +0 -18
  269. data/lib/schematic/types/create_or_update_rule_request_body_rule_type.rb +0 -15
  270. data/lib/schematic/types/rulesengine_check_flag_result_feature_usage_period.rb +0 -14
  271. data/lib/schematic/types/rulesengine_check_flag_result_rule_type.rb +0 -17
  272. data/lib/schematic/types/rulesengine_company_metric_period.rb +0 -14
  273. data/lib/schematic/types/rulesengine_condition_metric_period.rb +0 -14
  274. data/lib/schematic/types/rulesengine_condition_metric_period_month_reset.rb +0 -12
  275. data/lib/schematic/types/rulesengine_condition_operator.rb +0 -18
  276. data/lib/schematic/types/rulesengine_feature_entitlement_metric_period.rb +0 -14
  277. data/lib/schematic/types/rulesengine_feature_entitlement_month_reset.rb +0 -12
  278. data/lib/schematic/types/update_entitlement_req_common_metric_period.rb +0 -14
  279. data/lib/schematic/types/update_entitlement_req_common_metric_period_month_reset.rb +0 -12
@@ -187,6 +187,44 @@ module Schematic
187
187
  end
188
188
  end
189
189
 
190
+ # @param request_options [Hash]
191
+ # @param params [Hash]
192
+ # @option request_options [String] :base_url
193
+ # @option request_options [Hash{String => Object}] :additional_headers
194
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
195
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
196
+ # @option request_options [Integer] :timeout_in_seconds
197
+ # @option params [String] :company_id
198
+ #
199
+ # @return [Schematic::Credits::Types::ListCompanyCreditBalancesResponse]
200
+ def list_company_credit_balances(request_options: {}, **params)
201
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
202
+ query_param_names = %i[company_id]
203
+ query_params = {}
204
+ query_params["company_id"] = params[:company_id] if params.key?(:company_id)
205
+ params.except(*query_param_names)
206
+
207
+ request = Schematic::Internal::JSON::Request.new(
208
+ base_url: request_options[:base_url],
209
+ method: "GET",
210
+ path: "billing/credits/balance",
211
+ query: query_params,
212
+ request_options: request_options
213
+ )
214
+ begin
215
+ response = @client.send(request)
216
+ rescue Net::HTTPRequestTimeout
217
+ raise Schematic::Errors::TimeoutError
218
+ end
219
+ code = response.code.to_i
220
+ if code.between?(200, 299)
221
+ Schematic::Credits::Types::ListCompanyCreditBalancesResponse.load(response.body)
222
+ else
223
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
224
+ raise error_class.new(response.body, code: code)
225
+ end
226
+ end
227
+
190
228
  # @param request_options [Hash]
191
229
  # @param params [Hash]
192
230
  # @option request_options [String] :base_url
@@ -825,19 +863,21 @@ module Schematic
825
863
  # @option params [String, nil] :plan_id
826
864
  # @option params [String, nil] :plan_ids
827
865
  # @option params [String, nil] :plan_version_id
866
+ # @option params [String, nil] :plan_version_ids
828
867
  # @option params [Integer, nil] :limit
829
868
  # @option params [Integer, nil] :offset
830
869
  #
831
870
  # @return [Schematic::Credits::Types::ListBillingPlanCreditGrantsResponse]
832
871
  def list_billing_plan_credit_grants(request_options: {}, **params)
833
872
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
834
- query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id limit offset]
873
+ query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id plan_version_ids limit offset]
835
874
  query_params = {}
836
875
  query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id)
837
876
  query_params["ids"] = params[:ids] if params.key?(:ids)
838
877
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
839
878
  query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids)
840
879
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
880
+ query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids)
841
881
  query_params["limit"] = params[:limit] if params.key?(:limit)
842
882
  query_params["offset"] = params[:offset] if params.key?(:offset)
843
883
  params.except(*query_param_names)
@@ -1011,19 +1051,21 @@ module Schematic
1011
1051
  # @option params [String, nil] :plan_id
1012
1052
  # @option params [String, nil] :plan_ids
1013
1053
  # @option params [String, nil] :plan_version_id
1054
+ # @option params [String, nil] :plan_version_ids
1014
1055
  # @option params [Integer, nil] :limit
1015
1056
  # @option params [Integer, nil] :offset
1016
1057
  #
1017
1058
  # @return [Schematic::Credits::Types::CountBillingPlanCreditGrantsResponse]
1018
1059
  def count_billing_plan_credit_grants(request_options: {}, **params)
1019
1060
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
1020
- query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id limit offset]
1061
+ query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id plan_version_ids limit offset]
1021
1062
  query_params = {}
1022
1063
  query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id)
1023
1064
  query_params["ids"] = params[:ids] if params.key?(:ids)
1024
1065
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
1025
1066
  query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids)
1026
1067
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
1068
+ query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids)
1027
1069
  query_params["limit"] = params[:limit] if params.key?(:limit)
1028
1070
  query_params["offset"] = params[:offset] if params.key?(:offset)
1029
1071
  params.except(*query_param_names)
@@ -12,6 +12,7 @@ module Schematic
12
12
  field :plan_id, -> { String }, optional: true, nullable: false
13
13
  field :plan_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
14
14
  field :plan_version_id, -> { String }, optional: true, nullable: false
15
+ field :plan_version_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
15
16
  end
16
17
  end
17
18
  end
@@ -9,6 +9,7 @@ module Schematic
9
9
  field :plan_id, -> { String }, optional: true, nullable: false
10
10
  field :plan_ids, -> { String }, optional: true, nullable: false
11
11
  field :plan_version_id, -> { String }, optional: true, nullable: false
12
+ field :plan_version_ids, -> { String }, optional: true, nullable: false
12
13
  field :limit, -> { Integer }, optional: true, nullable: false
13
14
  field :offset, -> { Integer }, optional: true, nullable: false
14
15
  end
@@ -12,6 +12,7 @@ module Schematic
12
12
  field :plan_id, -> { String }, optional: true, nullable: false
13
13
  field :plan_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
14
14
  field :plan_version_id, -> { String }, optional: true, nullable: false
15
+ field :plan_version_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
15
16
  end
16
17
  end
17
18
  end
@@ -9,6 +9,7 @@ module Schematic
9
9
  field :plan_id, -> { String }, optional: true, nullable: false
10
10
  field :plan_ids, -> { String }, optional: true, nullable: false
11
11
  field :plan_version_id, -> { String }, optional: true, nullable: false
12
+ field :plan_version_ids, -> { String }, optional: true, nullable: false
12
13
  field :limit, -> { Integer }, optional: true, nullable: false
13
14
  field :offset, -> { Integer }, optional: true, nullable: false
14
15
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Credits
5
+ module Types
6
+ # Input parameters
7
+ class ListCompanyCreditBalancesParams < Internal::Types::Model
8
+ field :company_id, -> { String }, optional: true, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Credits
5
+ module Types
6
+ class ListCompanyCreditBalancesRequest < Internal::Types::Model
7
+ field :company_id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Credits
5
+ module Types
6
+ class ListCompanyCreditBalancesResponse < Internal::Types::Model
7
+ field :data, -> { Internal::Types::Array[Schematic::Types::CompanyCreditBalanceResponseData] }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Credits::Types::ListCompanyCreditBalancesParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -295,6 +295,7 @@ module Schematic
295
295
  def handle_message(message)
296
296
  entity_type = message[:entity_type] || message["entity_type"]
297
297
  message_type = message[:message_type] || message["message_type"]
298
+ entity_id = message[:entity_id] || message["entity_id"]
298
299
  data = message[:data] || message["data"]
299
300
 
300
301
  @logger.debug("Processing DataStream message: EntityType=#{entity_type}, MessageType=#{message_type}")
@@ -305,9 +306,9 @@ module Schematic
305
306
  when ENTITY_TYPE_FLAG
306
307
  handle_flag_message(data, message_type)
307
308
  when ENTITY_TYPE_COMPANY, ENTITY_TYPE_COMPANIES
308
- handle_company_message(data, message_type)
309
+ handle_company_message(data, message_type, entity_id)
309
310
  when ENTITY_TYPE_USER, ENTITY_TYPE_USERS
310
- handle_user_message(data, message_type)
311
+ handle_user_message(data, message_type, entity_id)
311
312
  else
312
313
  if message[:error] || message["error"]
313
314
  handle_error_message(message)
@@ -335,7 +336,7 @@ module Schematic
335
336
  keys_to_keep << versioned_key
336
337
  end
337
338
 
338
- @flag_cache.delete_missing(keys_to_keep) if @flag_cache.respond_to?(:delete_missing)
339
+ @flag_cache.delete_missing(keys_to_keep, scope: "flags:") if @flag_cache.respond_to?(:delete_missing)
339
340
 
340
341
  @logger.debug("Cached #{data.size} flags from DataStream")
341
342
 
@@ -357,25 +358,28 @@ module Schematic
357
358
  end
358
359
  end
359
360
 
360
- def handle_company_message(data, message_type)
361
- id = data[:id] || data["id"]
362
-
361
+ def handle_company_message(data, message_type, entity_id = nil)
363
362
  case message_type
364
363
  when MESSAGE_TYPE_DELETE
365
- @company_cache.delete_entity(data) if id
364
+ delete_id = data[:id] || data["id"] if data.is_a?(Hash)
365
+ @company_cache.delete_entity(data) if delete_id
366
366
  when MESSAGE_TYPE_PARTIAL
367
- if id
368
- existing = @company_cache.get_by_id(id)
367
+ # Cache lookup uses envelope entity_id; data is the wrapped partial
368
+ # payload (e.g. {"credit_balances": {...}}), with no top-level id.
369
+ if entity_id
370
+ existing = @company_cache.get_by_id(entity_id)
369
371
  if existing
370
372
  merged = Merge.partial_company(existing, data)
371
373
  @company_cache.cache_entity(merged, ttl: @cache_ttl)
372
374
  else
373
- @logger.warn("Cache miss for partial company '#{id}', caching as new")
374
- @company_cache.cache_entity(data, ttl: @cache_ttl)
375
+ @logger.warn("Cache miss for partial company '#{entity_id}', skipping")
375
376
  end
377
+ else
378
+ @logger.warn("Partial company message missing entity_id")
376
379
  end
377
380
  when MESSAGE_TYPE_FULL
378
- @company_cache.cache_entity(data, ttl: @cache_ttl) if id
381
+ full_id = data[:id] || data["id"] if data.is_a?(Hash)
382
+ @company_cache.cache_entity(data, ttl: @cache_ttl) if full_id
379
383
  end
380
384
 
381
385
  notify_pending(:company, data)
@@ -383,25 +387,28 @@ module Schematic
383
387
  @logger.error("Failed to process company message: #{e.message}")
384
388
  end
385
389
 
386
- def handle_user_message(data, message_type)
387
- id = data[:id] || data["id"]
388
-
390
+ def handle_user_message(data, message_type, entity_id = nil)
389
391
  case message_type
390
392
  when MESSAGE_TYPE_DELETE
391
- @user_cache.delete_entity(data) if id
393
+ delete_id = data[:id] || data["id"] if data.is_a?(Hash)
394
+ @user_cache.delete_entity(data) if delete_id
392
395
  when MESSAGE_TYPE_PARTIAL
393
- if id
394
- existing = @user_cache.get_by_id(id)
396
+ # Cache lookup uses envelope entity_id; data is the wrapped partial
397
+ # payload with no top-level id.
398
+ if entity_id
399
+ existing = @user_cache.get_by_id(entity_id)
395
400
  if existing
396
401
  merged = Merge.partial_user(existing, data)
397
402
  @user_cache.cache_entity(merged, ttl: @cache_ttl)
398
403
  else
399
- @logger.warn("Cache miss for partial user '#{id}', caching as new")
400
- @user_cache.cache_entity(data, ttl: @cache_ttl)
404
+ @logger.warn("Cache miss for partial user '#{entity_id}', skipping")
401
405
  end
406
+ else
407
+ @logger.warn("Partial user message missing entity_id")
402
408
  end
403
409
  when MESSAGE_TYPE_FULL
404
- @user_cache.cache_entity(data, ttl: @cache_ttl) if id
410
+ full_id = data[:id] || data["id"] if data.is_a?(Hash)
411
+ @user_cache.cache_entity(data, ttl: @cache_ttl) if full_id
405
412
  end
406
413
 
407
414
  notify_pending(:user, data)
@@ -6,6 +6,8 @@ require "uri"
6
6
  require "json"
7
7
  require "websocket"
8
8
 
9
+ require_relative "../version"
10
+
9
11
  module Schematic
10
12
  module DataStream
11
13
  WRITE_WAIT = 10 # seconds
@@ -27,6 +29,14 @@ module Schematic
27
29
  MESSAGE_TYPE_DELETE = "delete"
28
30
  MESSAGE_TYPE_ERROR = "error"
29
31
 
32
+ # Headers attached to the WebSocket handshake so the backend can distinguish
33
+ # direct-SDK connections from the schematic-datastream-replicator and
34
+ # correlate either to a specific release. Mode is always "direct" here —
35
+ # replicator mode in this SDK doesn't open a WebSocket at all.
36
+ CLIENT_NAME = "schematic-ruby"
37
+ DATASTREAM_MODE_DIRECT = "direct"
38
+ UNKNOWN_VERSION = "unknown"
39
+
30
40
  class WebSocketClient
31
41
  attr_reader :url, :connected, :ready
32
42
 
@@ -154,7 +164,7 @@ module Schematic
154
164
  def perform_handshake
155
165
  @handshake = WebSocket::Handshake::Client.new(
156
166
  url: @url,
157
- headers: { "X-Schematic-Api-Key" => @api_key }
167
+ headers: handshake_headers
158
168
  )
159
169
 
160
170
  @socket.write(@handshake.to_s)
@@ -310,6 +320,27 @@ module Schematic
310
320
  )
311
321
  @write_mutex.synchronize { @socket&.write(frame.to_s) }
312
322
  end
323
+
324
+ # Headers attached to the WebSocket handshake. The mode/client headers let
325
+ # the backend tell direct-SDK connections apart from the
326
+ # schematic-datastream-replicator and correlate them to a release.
327
+ def handshake_headers
328
+ {
329
+ "X-Schematic-Api-Key" => @api_key,
330
+ "X-Schematic-Datastream-Mode" => DATASTREAM_MODE_DIRECT,
331
+ "X-Schematic-Client" => CLIENT_NAME,
332
+ "X-Schematic-Client-Version" => sdk_version
333
+ }
334
+ end
335
+
336
+ # Resolves the SDK version reported in handshake headers. Schematic::VERSION
337
+ # is stamped into the Fern-generated lib/schematic/version.rb on each release;
338
+ # fall back to "unknown" if the constant is missing (e.g. a partial checkout).
339
+ def sdk_version
340
+ return Schematic::VERSION if defined?(Schematic::VERSION) && !Schematic::VERSION.to_s.empty?
341
+
342
+ UNKNOWN_VERSION
343
+ end
313
344
  end
314
345
  end
315
346
  end
@@ -350,6 +350,7 @@ module Schematic
350
350
  # @option params [Hash[String, String], nil] :company_keys
351
351
  # @option params [String, nil] :feature_ids
352
352
  # @option params [Boolean, nil] :include_usage_aggregation
353
+ # @option params [Schematic::Types::BillingProviderType, nil] :managed_by
353
354
  # @option params [String, nil] :q
354
355
  # @option params [Boolean, nil] :without_negative_entitlements
355
356
  # @option params [Integer, nil] :limit
@@ -358,12 +359,13 @@ module Schematic
358
359
  # @return [Schematic::Entitlements::Types::ListFeatureUsageResponse]
359
360
  def list_feature_usage(request_options: {}, **params)
360
361
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
361
- query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation q without_negative_entitlements limit offset]
362
+ query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
362
363
  query_params = {}
363
364
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
364
365
  query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
365
366
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
366
367
  query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
368
+ query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
367
369
  query_params["q"] = params[:q] if params.key?(:q)
368
370
  query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
369
371
  query_params["limit"] = params[:limit] if params.key?(:limit)
@@ -448,6 +450,7 @@ module Schematic
448
450
  # @option params [Hash[String, String], nil] :company_keys
449
451
  # @option params [String, nil] :feature_ids
450
452
  # @option params [Boolean, nil] :include_usage_aggregation
453
+ # @option params [Schematic::Types::BillingProviderType, nil] :managed_by
451
454
  # @option params [String, nil] :q
452
455
  # @option params [Boolean, nil] :without_negative_entitlements
453
456
  # @option params [Integer, nil] :limit
@@ -456,12 +459,13 @@ module Schematic
456
459
  # @return [Schematic::Entitlements::Types::CountFeatureUsageResponse]
457
460
  def count_feature_usage(request_options: {}, **params)
458
461
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
459
- query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation q without_negative_entitlements limit offset]
462
+ query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
460
463
  query_params = {}
461
464
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
462
465
  query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
463
466
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
464
467
  query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
468
+ query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
465
469
  query_params["q"] = params[:q] if params.key?(:q)
466
470
  query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
467
471
  query_params["limit"] = params[:limit] if params.key?(:limit)
@@ -768,6 +772,38 @@ module Schematic
768
772
  end
769
773
  end
770
774
 
775
+ # @param request_options [Hash]
776
+ # @param params [Schematic::Entitlements::Types::CreateBillingLinkedPlanEntitlementRequestBody]
777
+ # @option request_options [String] :base_url
778
+ # @option request_options [Hash{String => Object}] :additional_headers
779
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
780
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
781
+ # @option request_options [Integer] :timeout_in_seconds
782
+ #
783
+ # @return [Schematic::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse]
784
+ def upsert_plan_entitlement_for_billing_product(request_options: {}, **params)
785
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
786
+ request = Schematic::Internal::JSON::Request.new(
787
+ base_url: request_options[:base_url],
788
+ method: "POST",
789
+ path: "plan-entitlements/billing-linked",
790
+ body: Schematic::Entitlements::Types::CreateBillingLinkedPlanEntitlementRequestBody.new(params).to_h,
791
+ request_options: request_options
792
+ )
793
+ begin
794
+ response = @client.send(request)
795
+ rescue Net::HTTPRequestTimeout
796
+ raise Schematic::Errors::TimeoutError
797
+ end
798
+ code = response.code.to_i
799
+ if code.between?(200, 299)
800
+ Schematic::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse.load(response.body)
801
+ else
802
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
803
+ raise error_class.new(response.body, code: code)
804
+ end
805
+ end
806
+
771
807
  # @param request_options [Hash]
772
808
  # @param params [Hash]
773
809
  # @option request_options [String] :base_url
@@ -10,6 +10,7 @@ module Schematic
10
10
  field :feature_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
11
11
  field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
12
12
  field :limit, -> { Integer }, optional: true, nullable: false
13
+ field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
13
14
  field :offset, -> { Integer }, optional: true, nullable: false
14
15
  field :q, -> { String }, optional: true, nullable: false
15
16
  field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
@@ -8,6 +8,7 @@ module Schematic
8
8
  field :company_keys, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
9
9
  field :feature_ids, -> { String }, optional: true, nullable: false
10
10
  field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
11
+ field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
11
12
  field :q, -> { String }, optional: true, nullable: false
12
13
  field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
13
14
  field :limit, -> { Integer }, optional: true, nullable: false
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Entitlements
5
+ module Types
6
+ class CreateBillingLinkedPlanEntitlementRequestBody < Internal::Types::Model
7
+ field :billing_product_id, -> { String }, optional: true, nullable: false
8
+ field :billing_provider, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
9
+ field :billing_threshold, -> { Integer }, optional: true, nullable: false
10
+ field :credit_consumption_rate, -> { Integer }, optional: true, nullable: false
11
+ field :currency, -> { String }, optional: true, nullable: false
12
+ field :currency_prices, -> { Internal::Types::Array[Schematic::Types::CurrencyPriceRequestBody] }, optional: true, nullable: false
13
+ field :external_resource_id, -> { String }, optional: false, nullable: false
14
+ field :feature_id, -> { String }, optional: false, nullable: false
15
+ field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
16
+ field :metric_period_month_reset, -> { Schematic::Types::MetricPeriodMonthReset }, optional: true, nullable: false
17
+ field :monthly_metered_price_id, -> { String }, optional: true, nullable: false
18
+ field :monthly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
19
+ field :monthly_unit_price, -> { Integer }, optional: true, nullable: false
20
+ field :monthly_unit_price_decimal, -> { String }, optional: true, nullable: false
21
+ field :overage_billing_product_id, -> { String }, optional: true, nullable: false
22
+ field :plan_id, -> { String }, optional: false, nullable: false
23
+ field :plan_version_id, -> { String }, optional: true, nullable: false
24
+ field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
25
+ field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
26
+ field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
27
+ field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
28
+ field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
29
+ field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
30
+ field :soft_limit, -> { Integer }, optional: true, nullable: false
31
+ field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
32
+ field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
33
+ field :value_credit_id, -> { String }, optional: true, nullable: false
34
+ field :value_numeric, -> { Integer }, optional: true, nullable: false
35
+ field :value_trait_id, -> { String }, optional: true, nullable: false
36
+ field :value_type, -> { Schematic::Types::EntitlementValueType }, optional: false, nullable: false
37
+ field :yearly_metered_price_id, -> { String }, optional: true, nullable: false
38
+ field :yearly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
39
+ field :yearly_unit_price, -> { Integer }, optional: true, nullable: false
40
+ field :yearly_unit_price_decimal, -> { String }, optional: true, nullable: false
41
+ end
42
+ end
43
+ end
44
+ end
@@ -8,8 +8,8 @@ module Schematic
8
8
  field :credit_consumption_rate, -> { Integer }, optional: true, nullable: false
9
9
  field :expiration_date, -> { String }, optional: true, nullable: false
10
10
  field :feature_id, -> { String }, optional: false, nullable: false
11
- field :metric_period, -> { Schematic::Entitlements::Types::CreateCompanyOverrideRequestBodyMetricPeriod }, optional: true, nullable: false
12
- field :metric_period_month_reset, -> { Schematic::Entitlements::Types::CreateCompanyOverrideRequestBodyMetricPeriodMonthReset }, optional: true, nullable: false
11
+ field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
12
+ field :metric_period_month_reset, -> { Schematic::Types::MetricPeriodMonthReset }, optional: true, nullable: false
13
13
  field :note, -> { String }, optional: true, nullable: false
14
14
  field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
15
15
  field :value_credit_id, -> { String }, optional: true, nullable: false
@@ -10,8 +10,8 @@ module Schematic
10
10
  field :currency, -> { String }, optional: true, nullable: false
11
11
  field :currency_prices, -> { Internal::Types::Array[Schematic::Types::CurrencyPriceRequestBody] }, optional: true, nullable: false
12
12
  field :feature_id, -> { String }, optional: false, nullable: false
13
- field :metric_period, -> { Schematic::Entitlements::Types::CreatePlanEntitlementRequestBodyMetricPeriod }, optional: true, nullable: false
14
- field :metric_period_month_reset, -> { Schematic::Entitlements::Types::CreatePlanEntitlementRequestBodyMetricPeriodMonthReset }, optional: true, nullable: false
13
+ field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
14
+ field :metric_period_month_reset, -> { Schematic::Types::MetricPeriodMonthReset }, optional: true, nullable: false
15
15
  field :monthly_metered_price_id, -> { String }, optional: true, nullable: false
16
16
  field :monthly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
17
17
  field :monthly_unit_price, -> { Integer }, optional: true, nullable: false
@@ -21,6 +21,10 @@ module Schematic
21
21
  field :plan_version_id, -> { String }, optional: true, nullable: false
22
22
  field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
23
23
  field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
24
+ field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
25
+ field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
26
+ field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
27
+ field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
24
28
  field :soft_limit, -> { Integer }, optional: true, nullable: false
25
29
  field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
26
30
  field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
@@ -10,6 +10,7 @@ module Schematic
10
10
  field :feature_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
11
11
  field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
12
12
  field :limit, -> { Integer }, optional: true, nullable: false
13
+ field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
13
14
  field :offset, -> { Integer }, optional: true, nullable: false
14
15
  field :q, -> { String }, optional: true, nullable: false
15
16
  field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
@@ -8,6 +8,7 @@ module Schematic
8
8
  field :company_keys, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
9
9
  field :feature_ids, -> { String }, optional: true, nullable: false
10
10
  field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
11
+ field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
11
12
  field :q, -> { String }, optional: true, nullable: false
12
13
  field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
13
14
  field :limit, -> { Integer }, optional: true, nullable: false
@@ -7,8 +7,8 @@ module Schematic
7
7
  field :company_override_id, -> { String }, optional: false, nullable: false
8
8
  field :credit_consumption_rate, -> { Integer }, optional: true, nullable: false
9
9
  field :expiration_date, -> { String }, optional: true, nullable: false
10
- field :metric_period, -> { Schematic::Entitlements::Types::UpdateCompanyOverrideRequestBodyMetricPeriod }, optional: true, nullable: false
11
- field :metric_period_month_reset, -> { Schematic::Entitlements::Types::UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset }, optional: true, nullable: false
10
+ field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
11
+ field :metric_period_month_reset, -> { Schematic::Types::MetricPeriodMonthReset }, optional: true, nullable: false
12
12
  field :note, -> { String }, optional: true, nullable: false
13
13
  field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
14
  field :value_credit_id, -> { String }, optional: true, nullable: false
@@ -10,8 +10,8 @@ module Schematic
10
10
  field :credit_consumption_rate, -> { Integer }, optional: true, nullable: false
11
11
  field :currency, -> { String }, optional: true, nullable: false
12
12
  field :currency_prices, -> { Internal::Types::Array[Schematic::Types::CurrencyPriceRequestBody] }, optional: true, nullable: false
13
- field :metric_period, -> { Schematic::Entitlements::Types::UpdatePlanEntitlementRequestBodyMetricPeriod }, optional: true, nullable: false
14
- field :metric_period_month_reset, -> { Schematic::Entitlements::Types::UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset }, optional: true, nullable: false
13
+ field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
14
+ field :metric_period_month_reset, -> { Schematic::Types::MetricPeriodMonthReset }, optional: true, nullable: false
15
15
  field :monthly_metered_price_id, -> { String }, optional: true, nullable: false
16
16
  field :monthly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
17
17
  field :monthly_unit_price, -> { Integer }, optional: true, nullable: false
@@ -19,6 +19,10 @@ module Schematic
19
19
  field :overage_billing_product_id, -> { String }, optional: true, nullable: false
20
20
  field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
21
21
  field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
22
+ field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
23
+ field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
24
+ field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
25
+ field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
22
26
  field :soft_limit, -> { Integer }, optional: true, nullable: false
23
27
  field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
24
28
  field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Entitlements
5
+ module Types
6
+ class UpsertPlanEntitlementForBillingProductResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::PlanEntitlementResponseData }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -26,6 +26,7 @@ module Schematic
26
26
  @stopped = false
27
27
  @flushing = false
28
28
  @flush_done = ConditionVariable.new
29
+ @stop_cv = ConditionVariable.new
29
30
 
30
31
  start_periodic_flush unless @offline
31
32
  end
@@ -77,6 +78,10 @@ module Schematic
77
78
  @mutex.synchronize do
78
79
  @stopped = true
79
80
 
81
+ # Wake the periodic flush thread so it sees @stopped immediately
82
+ # instead of sleeping out the rest of @interval.
83
+ @stop_cv.broadcast
84
+
80
85
  # Wait for any in-flight flush to complete before our final flush,
81
86
  # so we don't skip events that arrived during the in-flight batch.
82
87
  @flush_done.wait(@mutex, 30) if @flushing
@@ -92,8 +97,11 @@ module Schematic
92
97
  def start_periodic_flush
93
98
  @flush_thread = Thread.new do
94
99
  loop do
95
- sleep(@interval)
96
- break if @stopped
100
+ should_break = @mutex.synchronize do
101
+ @stop_cv.wait(@mutex, @interval) unless @stopped
102
+ @stopped
103
+ end
104
+ break if should_break
97
105
 
98
106
  begin
99
107
  flush
@@ -97,6 +97,7 @@ module Schematic
97
97
  # @option params [String, nil] :event_subtype
98
98
  # @option params [Schematic::Types::EventType, nil] :event_types
99
99
  # @option params [String, nil] :flag_id
100
+ # @option params [String, nil] :idempotency_key
100
101
  # @option params [String, nil] :user_id
101
102
  # @option params [Integer, nil] :limit
102
103
  # @option params [Integer, nil] :offset
@@ -104,12 +105,13 @@ module Schematic
104
105
  # @return [Schematic::Events::Types::ListEventsResponse]
105
106
  def list_events(request_options: {}, **params)
106
107
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
107
- query_param_names = %i[company_id event_subtype event_types flag_id user_id limit offset]
108
+ query_param_names = %i[company_id event_subtype event_types flag_id idempotency_key user_id limit offset]
108
109
  query_params = {}
109
110
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
110
111
  query_params["event_subtype"] = params[:event_subtype] if params.key?(:event_subtype)
111
112
  query_params["event_types"] = params[:event_types] if params.key?(:event_types)
112
113
  query_params["flag_id"] = params[:flag_id] if params.key?(:flag_id)
114
+ query_params["idempotency_key"] = params[:idempotency_key] if params.key?(:idempotency_key)
113
115
  query_params["user_id"] = params[:user_id] if params.key?(:user_id)
114
116
  query_params["limit"] = params[:limit] if params.key?(:limit)
115
117
  query_params["offset"] = params[:offset] if params.key?(:offset)