schematichq 1.4.0 → 1.4.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 (210) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +4 -4
  3. data/lib/schematic/accounts/client.rb +76 -0
  4. data/lib/schematic/{companies/types/update_plan_trait_response.rb → accounts/types/get_account_member_response.rb} +3 -3
  5. data/lib/schematic/accounts/types/list_account_members_params.rb +15 -0
  6. data/lib/schematic/accounts/types/list_account_members_request.rb +14 -0
  7. data/lib/schematic/accounts/types/list_account_members_response.rb +12 -0
  8. data/lib/schematic/billing/types/create_billing_price_request_body.rb +1 -0
  9. data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +1 -0
  10. data/lib/schematic/billing/types/create_meter_request_body.rb +1 -0
  11. data/lib/schematic/cache.rb +7 -4
  12. data/lib/schematic/client.rb +11 -1
  13. data/lib/schematic/companies/client.rb +8 -105
  14. data/lib/schematic/companies/types/count_companies_params.rb +1 -0
  15. data/lib/schematic/companies/types/count_companies_request.rb +1 -0
  16. data/lib/schematic/companies/types/list_companies_params.rb +1 -0
  17. data/lib/schematic/companies/types/list_companies_request.rb +1 -0
  18. data/lib/schematic/companies/types/list_plan_changes_params.rb +2 -2
  19. data/lib/schematic/companies/types/list_plan_changes_request.rb +2 -2
  20. data/lib/schematic/credits/client.rb +38 -0
  21. data/lib/schematic/credits/types/list_company_credit_balances_params.rb +12 -0
  22. data/lib/schematic/credits/types/list_company_credit_balances_request.rb +11 -0
  23. data/lib/schematic/credits/types/list_company_credit_balances_response.rb +12 -0
  24. data/lib/schematic/datastream/client.rb +28 -21
  25. data/lib/schematic/entitlements/client.rb +32 -0
  26. data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +40 -0
  27. data/lib/schematic/entitlements/types/create_company_override_request_body.rb +2 -2
  28. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +2 -2
  29. data/lib/schematic/entitlements/types/update_company_override_request_body.rb +2 -2
  30. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +2 -2
  31. data/lib/schematic/entitlements/types/upsert_plan_entitlement_for_billing_product_response.rb +12 -0
  32. data/lib/schematic/features/client.rb +46 -14
  33. data/lib/schematic/features/types/count_features_request.rb +3 -3
  34. data/lib/schematic/features/types/create_billing_linked_feature_request_body.rb +23 -0
  35. data/lib/schematic/features/types/create_feature_request_body.rb +1 -1
  36. data/lib/schematic/features/types/list_features_request.rb +3 -3
  37. data/lib/schematic/features/types/update_feature_request_body.rb +1 -1
  38. data/lib/schematic/features/types/upsert_feature_for_billing_product_response.rb +12 -0
  39. data/lib/schematic/insights/client.rb +251 -0
  40. data/lib/schematic/insights/types/get_activity_params.rb +12 -0
  41. data/lib/schematic/insights/types/get_activity_request.rb +11 -0
  42. data/lib/schematic/insights/types/get_activity_response.rb +12 -0
  43. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_params.rb +15 -0
  44. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_request.rb +14 -0
  45. data/lib/schematic/insights/types/get_environment_feature_usage_time_series_response.rb +12 -0
  46. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_params.rb +15 -0
  47. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_request.rb +14 -0
  48. data/lib/schematic/insights/types/get_environment_trait_usage_time_series_response.rb +12 -0
  49. data/lib/schematic/insights/types/get_plan_growth_params.rb +12 -0
  50. data/lib/schematic/insights/types/get_plan_growth_request.rb +11 -0
  51. data/lib/schematic/insights/types/get_plan_growth_response.rb +12 -0
  52. data/lib/schematic/{companies/types/create_plan_trait_response.rb → insights/types/get_summary_response.rb} +3 -3
  53. data/lib/schematic/insights/types/get_top_features_by_usage_params.rb +14 -0
  54. data/lib/schematic/insights/types/get_top_features_by_usage_request.rb +13 -0
  55. data/lib/schematic/insights/types/get_top_features_by_usage_response.rb +12 -0
  56. data/lib/schematic/integrationsapi/client.rb +46 -0
  57. data/lib/schematic/integrationsapi/types/get_integration_webhook_url_response.rb +12 -0
  58. data/lib/schematic/plans/client.rb +247 -2
  59. data/lib/schematic/plans/types/count_billing_product_match_companies_params.rb +15 -0
  60. data/lib/schematic/plans/types/count_billing_product_match_companies_request.rb +14 -0
  61. data/lib/schematic/plans/types/count_billing_product_match_companies_response.rb +12 -0
  62. data/lib/schematic/plans/types/count_plans_params.rb +2 -0
  63. data/lib/schematic/plans/types/count_plans_request.rb +2 -0
  64. data/lib/schematic/plans/types/create_billing_linked_plan_request_body.rb +16 -0
  65. data/lib/schematic/plans/types/create_custom_plan_request_body.rb +15 -0
  66. data/lib/schematic/{companies/types/delete_plan_trait_response.rb → plans/types/create_custom_plan_response.rb} +3 -3
  67. data/lib/schematic/plans/types/list_billing_product_match_companies_params.rb +15 -0
  68. data/lib/schematic/plans/types/list_billing_product_match_companies_request.rb +14 -0
  69. data/lib/schematic/plans/types/list_billing_product_match_companies_response.rb +12 -0
  70. data/lib/schematic/plans/types/list_custom_plan_billings_params.rb +17 -0
  71. data/lib/schematic/plans/types/list_custom_plan_billings_request.rb +16 -0
  72. data/lib/schematic/plans/types/list_custom_plan_billings_response.rb +12 -0
  73. data/lib/schematic/plans/types/list_plans_params.rb +2 -0
  74. data/lib/schematic/plans/types/list_plans_request.rb +2 -0
  75. data/lib/schematic/plans/types/publish_plan_version_request_body.rb +4 -0
  76. data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +15 -0
  77. data/lib/schematic/plans/types/retry_custom_plan_billing_response.rb +12 -0
  78. data/lib/schematic/plans/types/upsert_plan_for_billing_product_response.rb +12 -0
  79. data/lib/schematic/redis_cache.rb +5 -2
  80. data/lib/schematic/schematic_client.rb +0 -1
  81. data/lib/schematic/types/account_member_permission.rb +25 -0
  82. data/lib/schematic/types/account_member_response_data.rb +16 -0
  83. data/lib/schematic/types/{rulesengine_company_metric_month_reset.rb → account_member_role.rb} +3 -3
  84. data/lib/schematic/types/activity_entry_response_data.rb +14 -0
  85. data/lib/schematic/types/activity_response_response_data.rb +9 -0
  86. data/lib/schematic/types/api_key_create_response_data.rb +1 -0
  87. data/lib/schematic/types/api_key_response_data.rb +1 -0
  88. data/lib/schematic/types/audit_log_list_response_data.rb +1 -0
  89. data/lib/schematic/types/audit_log_response_data.rb +1 -0
  90. data/lib/schematic/types/billing_linked_resource_response_data.rb +11 -0
  91. data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +1 -0
  92. data/lib/schematic/types/billing_price_response_data.rb +1 -0
  93. data/lib/schematic/types/billing_price_view.rb +1 -0
  94. data/lib/schematic/types/billing_product_plan_response_data.rb +1 -1
  95. data/lib/schematic/types/billing_product_price_response_data.rb +1 -0
  96. data/lib/schematic/types/billing_provider_type.rb +1 -0
  97. data/lib/schematic/types/check_flag_response_data.rb +2 -2
  98. data/lib/schematic/types/checkout_subscription.rb +1 -0
  99. data/lib/schematic/types/company_credit_balance_response_data.rb +12 -0
  100. data/lib/schematic/types/company_detail_response_data.rb +1 -0
  101. data/lib/schematic/types/company_event_period_metrics_response_data.rb +2 -2
  102. data/lib/schematic/types/company_override_response_data.rb +2 -2
  103. data/lib/schematic/types/company_plan_detail_response_data.rb +7 -3
  104. data/lib/schematic/types/company_subscription_response_data.rb +1 -0
  105. data/lib/schematic/types/{condition_operator.rb → comparable_operator.rb} +4 -4
  106. data/lib/schematic/types/condition.rb +4 -4
  107. data/lib/schematic/types/condition_response_data.rb +4 -4
  108. data/lib/schematic/types/{condition_condition_type.rb → condition_type.rb} +1 -1
  109. data/lib/schematic/types/condition_view.rb +4 -4
  110. data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +1 -0
  111. data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +2 -2
  112. data/lib/schematic/types/create_entitlement_req_common.rb +2 -2
  113. data/lib/schematic/types/create_flag_request_body.rb +1 -1
  114. data/lib/schematic/types/create_or_update_condition_request_body.rb +4 -4
  115. data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
  116. data/lib/schematic/types/create_or_update_rule_request_body.rb +1 -1
  117. data/lib/schematic/types/create_plan_request_body.rb +1 -1
  118. data/lib/schematic/types/custom_plan_activation_strategy.rb +12 -0
  119. data/lib/schematic/types/custom_plan_billing_response_data.rb +19 -0
  120. data/lib/schematic/types/custom_plan_billing_status.rb +14 -0
  121. data/lib/schematic/types/datastream_company_plan.rb +1 -0
  122. data/lib/schematic/types/environment_feature_usage_time_series_response_data.rb +11 -0
  123. data/lib/schematic/types/environment_trait_usage_time_series_response_data.rb +11 -0
  124. data/lib/schematic/types/environment_usage_point_response_data.rb +10 -0
  125. data/lib/schematic/types/feature_company_response_data.rb +3 -3
  126. data/lib/schematic/types/feature_company_user_response_data.rb +2 -2
  127. data/lib/schematic/types/feature_detail_response_data.rb +3 -1
  128. data/lib/schematic/types/feature_entitlement.rb +2 -2
  129. data/lib/schematic/types/feature_in_plan_response_data.rb +26 -0
  130. data/lib/schematic/types/feature_response_data.rb +1 -1
  131. data/lib/schematic/types/feature_usage_response_data.rb +3 -3
  132. data/lib/schematic/types/feature_view.rb +1 -1
  133. data/lib/schematic/types/flag_detail_response_data.rb +2 -1
  134. data/lib/schematic/types/flag_in_plan_response_data.rb +21 -0
  135. data/lib/schematic/types/flag_response_data.rb +1 -1
  136. data/lib/schematic/types/flag_view.rb +0 -1
  137. data/lib/schematic/types/insights_summary_response_data.rb +14 -0
  138. data/lib/schematic/types/{plan_controlled_by_type.rb → integration_type.rb} +4 -2
  139. data/lib/schematic/types/integration_webhook_url_response_data.rb +10 -0
  140. data/lib/schematic/types/{condition_metric_period.rb → metric_period.rb} +1 -1
  141. data/lib/schematic/types/{feature_entitlement_month_reset.rb → metric_period_month_reset.rb} +2 -2
  142. data/lib/schematic/types/mrr_response_data.rb +10 -0
  143. data/lib/schematic/types/plan_credit_grant_view.rb +1 -0
  144. data/lib/schematic/types/plan_detail_response_data.rb +7 -3
  145. data/lib/schematic/types/plan_entitlement_response_data.rb +3 -2
  146. data/lib/schematic/types/plan_group_plan_detail_response_data.rb +7 -3
  147. data/lib/schematic/types/plan_growth_point_response_data.rb +12 -0
  148. data/lib/schematic/types/plan_growth_response_data.rb +9 -0
  149. data/lib/schematic/types/plan_icon.rb +35 -0
  150. data/lib/schematic/types/plan_response_data.rb +3 -1
  151. data/lib/schematic/types/plan_version_response_data.rb +1 -1
  152. data/lib/schematic/types/plan_view_public_response_data.rb +7 -3
  153. data/lib/schematic/types/rule.rb +1 -1
  154. data/lib/schematic/types/rule_condition_detail_response_data.rb +4 -4
  155. data/lib/schematic/types/rule_condition_response_data.rb +4 -4
  156. data/lib/schematic/types/rule_detail_response_data.rb +1 -1
  157. data/lib/schematic/types/rule_response_data.rb +1 -1
  158. data/lib/schematic/types/{rule_rule_type.rb → rule_type.rb} +3 -3
  159. data/lib/schematic/types/rule_view.rb +1 -1
  160. data/lib/schematic/types/rules_engine_schema_version.rb +1 -1
  161. data/lib/schematic/types/rulesengine_check_flag_result.rb +2 -2
  162. data/lib/schematic/types/rulesengine_company_metric.rb +2 -2
  163. data/lib/schematic/types/rulesengine_condition.rb +4 -4
  164. data/lib/schematic/types/{rulesengine_condition_condition_type.rb → rulesengine_condition_type.rb} +1 -1
  165. data/lib/schematic/types/rulesengine_feature_entitlement.rb +2 -2
  166. data/lib/schematic/types/{feature_entitlement_metric_period.rb → rulesengine_metric_period.rb} +1 -1
  167. data/lib/schematic/types/{condition_metric_period_month_reset.rb → rulesengine_metric_period_month_reset.rb} +2 -2
  168. data/lib/schematic/types/rulesengine_rule.rb +1 -1
  169. data/lib/schematic/types/{rulesengine_rule_rule_type.rb → rulesengine_rule_type.rb} +3 -3
  170. data/lib/schematic/types/top_feature_by_usage_response_data.rb +14 -0
  171. data/lib/schematic/types/top_features_by_usage_response_data.rb +9 -0
  172. data/lib/schematic/types/trial_status.rb +13 -0
  173. data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +1 -0
  174. data/lib/schematic/types/update_entitlement_req_common.rb +2 -2
  175. data/lib/schematic/types/update_plan_request_body.rb +1 -1
  176. data/lib/schematic/types/usage_based_entitlement_response_data.rb +2 -2
  177. data/lib/schematic/types/webhook_url.rb +10 -0
  178. data/lib/schematic/version.rb +1 -1
  179. data/lib/schematic.rb +85 -48
  180. data/reference.md +2326 -889
  181. metadata +82 -45
  182. data/lib/schematic/companies/types/create_plan_trait_request_body.rb +0 -13
  183. data/lib/schematic/companies/types/update_plan_trait_request_body.rb +0 -13
  184. data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period.rb +0 -16
  185. data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period_month_reset.rb +0 -14
  186. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period.rb +0 -16
  187. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period_month_reset.rb +0 -14
  188. data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period.rb +0 -16
  189. data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period_month_reset.rb +0 -14
  190. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period.rb +0 -16
  191. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period_month_reset.rb +0 -14
  192. data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period.rb +0 -14
  193. data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period_month_reset.rb +0 -12
  194. data/lib/schematic/types/create_entitlement_req_common_metric_period.rb +0 -14
  195. data/lib/schematic/types/create_entitlement_req_common_metric_period_month_reset.rb +0 -12
  196. data/lib/schematic/types/create_or_update_condition_request_body_condition_type.rb +0 -17
  197. data/lib/schematic/types/create_or_update_condition_request_body_metric_period.rb +0 -14
  198. data/lib/schematic/types/create_or_update_condition_request_body_metric_period_month_reset.rb +0 -12
  199. data/lib/schematic/types/create_or_update_condition_request_body_operator.rb +0 -18
  200. data/lib/schematic/types/create_or_update_rule_request_body_rule_type.rb +0 -15
  201. data/lib/schematic/types/rulesengine_check_flag_result_feature_usage_period.rb +0 -14
  202. data/lib/schematic/types/rulesengine_check_flag_result_rule_type.rb +0 -17
  203. data/lib/schematic/types/rulesengine_company_metric_period.rb +0 -14
  204. data/lib/schematic/types/rulesengine_condition_metric_period.rb +0 -14
  205. data/lib/schematic/types/rulesengine_condition_metric_period_month_reset.rb +0 -12
  206. data/lib/schematic/types/rulesengine_condition_operator.rb +0 -18
  207. data/lib/schematic/types/rulesengine_feature_entitlement_metric_period.rb +0 -14
  208. data/lib/schematic/types/rulesengine_feature_entitlement_month_reset.rb +0 -12
  209. data/lib/schematic/types/update_entitlement_req_common_metric_period.rb +0 -14
  210. data/lib/schematic/types/update_entitlement_req_common_metric_period_month_reset.rb +0 -12
@@ -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)
@@ -768,6 +768,38 @@ module Schematic
768
768
  end
769
769
  end
770
770
 
771
+ # @param request_options [Hash]
772
+ # @param params [Schematic::Entitlements::Types::CreateBillingLinkedPlanEntitlementRequestBody]
773
+ # @option request_options [String] :base_url
774
+ # @option request_options [Hash{String => Object}] :additional_headers
775
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
776
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
777
+ # @option request_options [Integer] :timeout_in_seconds
778
+ #
779
+ # @return [Schematic::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse]
780
+ def upsert_plan_entitlement_for_billing_product(request_options: {}, **params)
781
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
782
+ request = Schematic::Internal::JSON::Request.new(
783
+ base_url: request_options[:base_url],
784
+ method: "POST",
785
+ path: "plan-entitlements/billing-linked",
786
+ body: Schematic::Entitlements::Types::CreateBillingLinkedPlanEntitlementRequestBody.new(params).to_h,
787
+ request_options: request_options
788
+ )
789
+ begin
790
+ response = @client.send(request)
791
+ rescue Net::HTTPRequestTimeout
792
+ raise Schematic::Errors::TimeoutError
793
+ end
794
+ code = response.code.to_i
795
+ if code.between?(200, 299)
796
+ Schematic::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse.load(response.body)
797
+ else
798
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
799
+ raise error_class.new(response.body, code: code)
800
+ end
801
+ end
802
+
771
803
  # @param request_options [Hash]
772
804
  # @param params [Hash]
773
805
  # @option request_options [String] :base_url
@@ -0,0 +1,40 @@
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 :soft_limit, -> { Integer }, optional: true, nullable: false
27
+ field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
28
+ field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
29
+ field :value_credit_id, -> { String }, optional: true, nullable: false
30
+ field :value_numeric, -> { Integer }, optional: true, nullable: false
31
+ field :value_trait_id, -> { String }, optional: true, nullable: false
32
+ field :value_type, -> { Schematic::Types::EntitlementValueType }, optional: false, nullable: false
33
+ field :yearly_metered_price_id, -> { String }, optional: true, nullable: false
34
+ field :yearly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
35
+ field :yearly_unit_price, -> { Integer }, optional: true, nullable: false
36
+ field :yearly_unit_price_decimal, -> { String }, optional: true, nullable: false
37
+ end
38
+ end
39
+ end
40
+ 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
@@ -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
@@ -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
@@ -17,28 +17,28 @@ module Schematic
17
17
  # @option request_options [Hash{String => Object}] :additional_query_parameters
18
18
  # @option request_options [Hash{String => Object}] :additional_body_parameters
19
19
  # @option request_options [Integer] :timeout_in_seconds
20
+ # @option params [Boolean, nil] :boolean_require_event
21
+ # @option params [Schematic::Types::FeatureType, nil] :feature_type
20
22
  # @option params [String, nil] :ids
23
+ # @option params [String, nil] :plan_version_id
21
24
  # @option params [String, nil] :q
22
25
  # @option params [String, nil] :without_company_override_for
23
- # @option params [String, nil] :plan_version_id
24
26
  # @option params [String, nil] :without_plan_entitlement_for
25
- # @option params [Schematic::Types::FeatureType, nil] :feature_type
26
- # @option params [Boolean, nil] :boolean_require_event
27
27
  # @option params [Integer, nil] :limit
28
28
  # @option params [Integer, nil] :offset
29
29
  #
30
30
  # @return [Schematic::Features::Types::ListFeaturesResponse]
31
31
  def list_features(request_options: {}, **params)
32
32
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
33
- query_param_names = %i[ids q without_company_override_for plan_version_id without_plan_entitlement_for feature_type boolean_require_event limit offset]
33
+ query_param_names = %i[boolean_require_event feature_type ids plan_version_id q without_company_override_for without_plan_entitlement_for limit offset]
34
34
  query_params = {}
35
+ query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event)
36
+ query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type)
35
37
  query_params["ids"] = params[:ids] if params.key?(:ids)
38
+ query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
36
39
  query_params["q"] = params[:q] if params.key?(:q)
37
40
  query_params["without_company_override_for"] = params[:without_company_override_for] if params.key?(:without_company_override_for)
38
- query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
39
41
  query_params["without_plan_entitlement_for"] = params[:without_plan_entitlement_for] if params.key?(:without_plan_entitlement_for)
40
- query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type)
41
- query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event)
42
42
  query_params["limit"] = params[:limit] if params.key?(:limit)
43
43
  query_params["offset"] = params[:offset] if params.key?(:offset)
44
44
  params.except(*query_param_names)
@@ -197,6 +197,38 @@ module Schematic
197
197
  end
198
198
  end
199
199
 
200
+ # @param request_options [Hash]
201
+ # @param params [Schematic::Features::Types::CreateBillingLinkedFeatureRequestBody]
202
+ # @option request_options [String] :base_url
203
+ # @option request_options [Hash{String => Object}] :additional_headers
204
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
205
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
206
+ # @option request_options [Integer] :timeout_in_seconds
207
+ #
208
+ # @return [Schematic::Features::Types::UpsertFeatureForBillingProductResponse]
209
+ def upsert_feature_for_billing_product(request_options: {}, **params)
210
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
211
+ request = Schematic::Internal::JSON::Request.new(
212
+ base_url: request_options[:base_url],
213
+ method: "POST",
214
+ path: "features/billing-linked",
215
+ body: Schematic::Features::Types::CreateBillingLinkedFeatureRequestBody.new(params).to_h,
216
+ request_options: request_options
217
+ )
218
+ begin
219
+ response = @client.send(request)
220
+ rescue Net::HTTPRequestTimeout
221
+ raise Schematic::Errors::TimeoutError
222
+ end
223
+ code = response.code.to_i
224
+ if code.between?(200, 299)
225
+ Schematic::Features::Types::UpsertFeatureForBillingProductResponse.load(response.body)
226
+ else
227
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
228
+ raise error_class.new(response.body, code: code)
229
+ end
230
+ end
231
+
200
232
  # @param request_options [Hash]
201
233
  # @param params [Hash]
202
234
  # @option request_options [String] :base_url
@@ -204,28 +236,28 @@ module Schematic
204
236
  # @option request_options [Hash{String => Object}] :additional_query_parameters
205
237
  # @option request_options [Hash{String => Object}] :additional_body_parameters
206
238
  # @option request_options [Integer] :timeout_in_seconds
239
+ # @option params [Boolean, nil] :boolean_require_event
240
+ # @option params [Schematic::Types::FeatureType, nil] :feature_type
207
241
  # @option params [String, nil] :ids
242
+ # @option params [String, nil] :plan_version_id
208
243
  # @option params [String, nil] :q
209
244
  # @option params [String, nil] :without_company_override_for
210
- # @option params [String, nil] :plan_version_id
211
245
  # @option params [String, nil] :without_plan_entitlement_for
212
- # @option params [Schematic::Types::FeatureType, nil] :feature_type
213
- # @option params [Boolean, nil] :boolean_require_event
214
246
  # @option params [Integer, nil] :limit
215
247
  # @option params [Integer, nil] :offset
216
248
  #
217
249
  # @return [Schematic::Features::Types::CountFeaturesResponse]
218
250
  def count_features(request_options: {}, **params)
219
251
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
220
- query_param_names = %i[ids q without_company_override_for plan_version_id without_plan_entitlement_for feature_type boolean_require_event limit offset]
252
+ query_param_names = %i[boolean_require_event feature_type ids plan_version_id q without_company_override_for without_plan_entitlement_for limit offset]
221
253
  query_params = {}
254
+ query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event)
255
+ query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type)
222
256
  query_params["ids"] = params[:ids] if params.key?(:ids)
257
+ query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
223
258
  query_params["q"] = params[:q] if params.key?(:q)
224
259
  query_params["without_company_override_for"] = params[:without_company_override_for] if params.key?(:without_company_override_for)
225
- query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
226
260
  query_params["without_plan_entitlement_for"] = params[:without_plan_entitlement_for] if params.key?(:without_plan_entitlement_for)
227
- query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type)
228
- query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event)
229
261
  query_params["limit"] = params[:limit] if params.key?(:limit)
230
262
  query_params["offset"] = params[:offset] if params.key?(:offset)
231
263
  params.except(*query_param_names)
@@ -4,13 +4,13 @@ module Schematic
4
4
  module Features
5
5
  module Types
6
6
  class CountFeaturesRequest < Internal::Types::Model
7
+ field :boolean_require_event, -> { Internal::Types::Boolean }, optional: true, nullable: false
8
+ field :feature_type, -> { Schematic::Types::FeatureType }, optional: true, nullable: false
7
9
  field :ids, -> { String }, optional: true, nullable: false
10
+ field :plan_version_id, -> { String }, optional: true, nullable: false
8
11
  field :q, -> { String }, optional: true, nullable: false
9
12
  field :without_company_override_for, -> { String }, optional: true, nullable: false
10
- field :plan_version_id, -> { String }, optional: true, nullable: false
11
13
  field :without_plan_entitlement_for, -> { String }, optional: true, nullable: false
12
- field :feature_type, -> { Schematic::Types::FeatureType }, optional: true, nullable: false
13
- field :boolean_require_event, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
14
  field :limit, -> { Integer }, optional: true, nullable: false
15
15
  field :offset, -> { Integer }, optional: true, nullable: false
16
16
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Features
5
+ module Types
6
+ class CreateBillingLinkedFeatureRequestBody < Internal::Types::Model
7
+ field :billing_provider, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
8
+ field :description, -> { String }, optional: false, nullable: false
9
+ field :event_subtype, -> { String }, optional: true, nullable: false
10
+ field :external_resource_id, -> { String }, optional: false, nullable: false
11
+ field :feature_type, -> { Schematic::Types::FeatureType }, optional: false, nullable: false
12
+ field :flag, -> { Schematic::Types::CreateOrUpdateFlagRequestBody }, optional: true, nullable: false
13
+ field :icon, -> { String }, optional: true, nullable: false
14
+ field :lifecycle_phase, -> { Schematic::Types::FeatureLifecyclePhase }, optional: true, nullable: false
15
+ field :maintainer_account_member_id, -> { String }, optional: true, nullable: false
16
+ field :name, -> { String }, optional: false, nullable: false
17
+ field :plural_name, -> { String }, optional: true, nullable: false
18
+ field :singular_name, -> { String }, optional: true, nullable: false
19
+ field :trait_id, -> { String }, optional: true, nullable: false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -10,7 +10,7 @@ module Schematic
10
10
  field :flag, -> { Schematic::Types::CreateOrUpdateFlagRequestBody }, optional: true, nullable: false
11
11
  field :icon, -> { String }, optional: true, nullable: false
12
12
  field :lifecycle_phase, -> { Schematic::Types::FeatureLifecyclePhase }, optional: true, nullable: false
13
- field :maintainer_id, -> { String }, optional: true, nullable: false
13
+ field :maintainer_account_member_id, -> { String }, optional: true, nullable: false
14
14
  field :name, -> { String }, optional: false, nullable: false
15
15
  field :plural_name, -> { String }, optional: true, nullable: false
16
16
  field :singular_name, -> { String }, optional: true, nullable: false
@@ -4,13 +4,13 @@ module Schematic
4
4
  module Features
5
5
  module Types
6
6
  class ListFeaturesRequest < Internal::Types::Model
7
+ field :boolean_require_event, -> { Internal::Types::Boolean }, optional: true, nullable: false
8
+ field :feature_type, -> { Schematic::Types::FeatureType }, optional: true, nullable: false
7
9
  field :ids, -> { String }, optional: true, nullable: false
10
+ field :plan_version_id, -> { String }, optional: true, nullable: false
8
11
  field :q, -> { String }, optional: true, nullable: false
9
12
  field :without_company_override_for, -> { String }, optional: true, nullable: false
10
- field :plan_version_id, -> { String }, optional: true, nullable: false
11
13
  field :without_plan_entitlement_for, -> { String }, optional: true, nullable: false
12
- field :feature_type, -> { Schematic::Types::FeatureType }, optional: true, nullable: false
13
- field :boolean_require_event, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
14
  field :limit, -> { Integer }, optional: true, nullable: false
15
15
  field :offset, -> { Integer }, optional: true, nullable: false
16
16
  end
@@ -11,7 +11,7 @@ module Schematic
11
11
  field :flag, -> { Schematic::Types::CreateOrUpdateFlagRequestBody }, optional: true, nullable: false
12
12
  field :icon, -> { String }, optional: true, nullable: false
13
13
  field :lifecycle_phase, -> { Schematic::Types::FeatureLifecyclePhase }, optional: true, nullable: false
14
- field :maintainer_id, -> { String }, optional: true, nullable: false
14
+ field :maintainer_account_member_id, -> { String }, optional: true, nullable: false
15
15
  field :name, -> { String }, optional: true, nullable: false
16
16
  field :plural_name, -> { String }, optional: true, nullable: false
17
17
  field :singular_name, -> { String }, optional: true, nullable: false
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Features
5
+ module Types
6
+ class UpsertFeatureForBillingProductResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::FeatureDetailResponseData }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end