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
@@ -0,0 +1,251 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ class Client
6
+ # @param client [Schematic::Internal::Http::RawClient]
7
+ #
8
+ # @return [void]
9
+ def initialize(client:)
10
+ @client = client
11
+ end
12
+
13
+ # @param request_options [Hash]
14
+ # @param params [Hash]
15
+ # @option request_options [String] :base_url
16
+ # @option request_options [Hash{String => Object}] :additional_headers
17
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
18
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
19
+ # @option request_options [Integer] :timeout_in_seconds
20
+ # @option params [Integer, nil] :limit
21
+ #
22
+ # @return [Schematic::Insights::Types::GetActivityResponse]
23
+ def get_activity(request_options: {}, **params)
24
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
25
+ query_param_names = %i[limit]
26
+ query_params = {}
27
+ query_params["limit"] = params[:limit] if params.key?(:limit)
28
+ params.except(*query_param_names)
29
+
30
+ request = Schematic::Internal::JSON::Request.new(
31
+ base_url: request_options[:base_url],
32
+ method: "GET",
33
+ path: "insights/activity",
34
+ query: query_params,
35
+ request_options: request_options
36
+ )
37
+ begin
38
+ response = @client.send(request)
39
+ rescue Net::HTTPRequestTimeout
40
+ raise Schematic::Errors::TimeoutError
41
+ end
42
+ code = response.code.to_i
43
+ if code.between?(200, 299)
44
+ Schematic::Insights::Types::GetActivityResponse.load(response.body)
45
+ else
46
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
47
+ raise error_class.new(response.body, code: code)
48
+ end
49
+ end
50
+
51
+ # @param request_options [Hash]
52
+ # @param params [Hash]
53
+ # @option request_options [String] :base_url
54
+ # @option request_options [Hash{String => Object}] :additional_headers
55
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
56
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
57
+ # @option request_options [Integer] :timeout_in_seconds
58
+ # @option params [String] :end_time
59
+ # @option params [String] :feature_id
60
+ # @option params [Schematic::Types::TimeSeriesGranularity, nil] :granularity
61
+ # @option params [String] :start_time
62
+ #
63
+ # @return [Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesResponse]
64
+ def get_environment_feature_usage_time_series(request_options: {}, **params)
65
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
66
+ query_param_names = %i[end_time feature_id granularity start_time]
67
+ query_params = {}
68
+ query_params["end_time"] = params[:end_time] if params.key?(:end_time)
69
+ query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
70
+ query_params["granularity"] = params[:granularity] if params.key?(:granularity)
71
+ query_params["start_time"] = params[:start_time] if params.key?(:start_time)
72
+ params.except(*query_param_names)
73
+
74
+ request = Schematic::Internal::JSON::Request.new(
75
+ base_url: request_options[:base_url],
76
+ method: "GET",
77
+ path: "insights/feature-usage-timeseries",
78
+ query: query_params,
79
+ request_options: request_options
80
+ )
81
+ begin
82
+ response = @client.send(request)
83
+ rescue Net::HTTPRequestTimeout
84
+ raise Schematic::Errors::TimeoutError
85
+ end
86
+ code = response.code.to_i
87
+ if code.between?(200, 299)
88
+ Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesResponse.load(response.body)
89
+ else
90
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
91
+ raise error_class.new(response.body, code: code)
92
+ end
93
+ end
94
+
95
+ # @param request_options [Hash]
96
+ # @param params [Hash]
97
+ # @option request_options [String] :base_url
98
+ # @option request_options [Hash{String => Object}] :additional_headers
99
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
100
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
101
+ # @option request_options [Integer] :timeout_in_seconds
102
+ # @option params [Integer, nil] :months
103
+ #
104
+ # @return [Schematic::Insights::Types::GetPlanGrowthResponse]
105
+ def get_plan_growth(request_options: {}, **params)
106
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
107
+ query_param_names = %i[months]
108
+ query_params = {}
109
+ query_params["months"] = params[:months] if params.key?(:months)
110
+ params.except(*query_param_names)
111
+
112
+ request = Schematic::Internal::JSON::Request.new(
113
+ base_url: request_options[:base_url],
114
+ method: "GET",
115
+ path: "insights/plan-growth",
116
+ query: query_params,
117
+ request_options: request_options
118
+ )
119
+ begin
120
+ response = @client.send(request)
121
+ rescue Net::HTTPRequestTimeout
122
+ raise Schematic::Errors::TimeoutError
123
+ end
124
+ code = response.code.to_i
125
+ if code.between?(200, 299)
126
+ Schematic::Insights::Types::GetPlanGrowthResponse.load(response.body)
127
+ else
128
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
129
+ raise error_class.new(response.body, code: code)
130
+ end
131
+ end
132
+
133
+ # @param request_options [Hash]
134
+ # @param params [Hash]
135
+ # @option request_options [String] :base_url
136
+ # @option request_options [Hash{String => Object}] :additional_headers
137
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
138
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
139
+ # @option request_options [Integer] :timeout_in_seconds
140
+ #
141
+ # @return [Schematic::Insights::Types::GetSummaryResponse]
142
+ def get_summary(request_options: {}, **params)
143
+ Schematic::Internal::Types::Utils.normalize_keys(params)
144
+ request = Schematic::Internal::JSON::Request.new(
145
+ base_url: request_options[:base_url],
146
+ method: "GET",
147
+ path: "insights/summary",
148
+ request_options: request_options
149
+ )
150
+ begin
151
+ response = @client.send(request)
152
+ rescue Net::HTTPRequestTimeout
153
+ raise Schematic::Errors::TimeoutError
154
+ end
155
+ code = response.code.to_i
156
+ if code.between?(200, 299)
157
+ Schematic::Insights::Types::GetSummaryResponse.load(response.body)
158
+ else
159
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
160
+ raise error_class.new(response.body, code: code)
161
+ end
162
+ end
163
+
164
+ # @param request_options [Hash]
165
+ # @param params [Hash]
166
+ # @option request_options [String] :base_url
167
+ # @option request_options [Hash{String => Object}] :additional_headers
168
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
169
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
170
+ # @option request_options [Integer] :timeout_in_seconds
171
+ # @option params [String] :end_time
172
+ # @option params [Integer, nil] :limit
173
+ # @option params [String] :start_time
174
+ #
175
+ # @return [Schematic::Insights::Types::GetTopFeaturesByUsageResponse]
176
+ def get_top_features_by_usage(request_options: {}, **params)
177
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
178
+ query_param_names = %i[end_time limit start_time]
179
+ query_params = {}
180
+ query_params["end_time"] = params[:end_time] if params.key?(:end_time)
181
+ query_params["limit"] = params[:limit] if params.key?(:limit)
182
+ query_params["start_time"] = params[:start_time] if params.key?(:start_time)
183
+ params.except(*query_param_names)
184
+
185
+ request = Schematic::Internal::JSON::Request.new(
186
+ base_url: request_options[:base_url],
187
+ method: "GET",
188
+ path: "insights/top-features",
189
+ query: query_params,
190
+ request_options: request_options
191
+ )
192
+ begin
193
+ response = @client.send(request)
194
+ rescue Net::HTTPRequestTimeout
195
+ raise Schematic::Errors::TimeoutError
196
+ end
197
+ code = response.code.to_i
198
+ if code.between?(200, 299)
199
+ Schematic::Insights::Types::GetTopFeaturesByUsageResponse.load(response.body)
200
+ else
201
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
202
+ raise error_class.new(response.body, code: code)
203
+ end
204
+ end
205
+
206
+ # @param request_options [Hash]
207
+ # @param params [Hash]
208
+ # @option request_options [String] :base_url
209
+ # @option request_options [Hash{String => Object}] :additional_headers
210
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
211
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
212
+ # @option request_options [Integer] :timeout_in_seconds
213
+ # @option params [String] :end_time
214
+ # @option params [String] :feature_id
215
+ # @option params [Schematic::Types::TimeSeriesGranularity, nil] :granularity
216
+ # @option params [String] :start_time
217
+ #
218
+ # @return [Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesResponse]
219
+ def get_environment_trait_usage_time_series(request_options: {}, **params)
220
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
221
+ query_param_names = %i[end_time feature_id granularity start_time]
222
+ query_params = {}
223
+ query_params["end_time"] = params[:end_time] if params.key?(:end_time)
224
+ query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
225
+ query_params["granularity"] = params[:granularity] if params.key?(:granularity)
226
+ query_params["start_time"] = params[:start_time] if params.key?(:start_time)
227
+ params.except(*query_param_names)
228
+
229
+ request = Schematic::Internal::JSON::Request.new(
230
+ base_url: request_options[:base_url],
231
+ method: "GET",
232
+ path: "insights/trait-usage-timeseries",
233
+ query: query_params,
234
+ request_options: request_options
235
+ )
236
+ begin
237
+ response = @client.send(request)
238
+ rescue Net::HTTPRequestTimeout
239
+ raise Schematic::Errors::TimeoutError
240
+ end
241
+ code = response.code.to_i
242
+ if code.between?(200, 299)
243
+ Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesResponse.load(response.body)
244
+ else
245
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
246
+ raise error_class.new(response.body, code: code)
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ # Input parameters
7
+ class GetActivityParams < Internal::Types::Model
8
+ field :limit, -> { Integer }, 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 Insights
5
+ module Types
6
+ class GetActivityRequest < Internal::Types::Model
7
+ field :limit, -> { Integer }, optional: true, 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 Insights
5
+ module Types
6
+ class GetActivityResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::ActivityResponseResponseData }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Insights::Types::GetActivityParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ # Input parameters
7
+ class GetEnvironmentFeatureUsageTimeSeriesParams < Internal::Types::Model
8
+ field :end_time, -> { String }, optional: true, nullable: false
9
+ field :feature_id, -> { String }, optional: true, nullable: false
10
+ field :granularity, -> { Schematic::Types::TimeSeriesGranularity }, optional: true, nullable: false
11
+ field :start_time, -> { String }, optional: true, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetEnvironmentFeatureUsageTimeSeriesRequest < Internal::Types::Model
7
+ field :end_time, -> { String }, optional: false, nullable: false
8
+ field :feature_id, -> { String }, optional: false, nullable: false
9
+ field :granularity, -> { Schematic::Types::TimeSeriesGranularity }, optional: true, nullable: false
10
+ field :start_time, -> { String }, optional: false, nullable: false
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetEnvironmentFeatureUsageTimeSeriesResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::EnvironmentFeatureUsageTimeSeriesResponseData }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ # Input parameters
7
+ class GetEnvironmentTraitUsageTimeSeriesParams < Internal::Types::Model
8
+ field :end_time, -> { String }, optional: true, nullable: false
9
+ field :feature_id, -> { String }, optional: true, nullable: false
10
+ field :granularity, -> { Schematic::Types::TimeSeriesGranularity }, optional: true, nullable: false
11
+ field :start_time, -> { String }, optional: true, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetEnvironmentTraitUsageTimeSeriesRequest < Internal::Types::Model
7
+ field :end_time, -> { String }, optional: false, nullable: false
8
+ field :feature_id, -> { String }, optional: false, nullable: false
9
+ field :granularity, -> { Schematic::Types::TimeSeriesGranularity }, optional: true, nullable: false
10
+ field :start_time, -> { String }, optional: false, nullable: false
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetEnvironmentTraitUsageTimeSeriesResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::EnvironmentTraitUsageTimeSeriesResponseData }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ # Input parameters
7
+ class GetPlanGrowthParams < Internal::Types::Model
8
+ field :months, -> { Integer }, 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 Insights
5
+ module Types
6
+ class GetPlanGrowthRequest < Internal::Types::Model
7
+ field :months, -> { Integer }, optional: true, 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 Insights
5
+ module Types
6
+ class GetPlanGrowthResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::PlanGrowthResponseData }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Insights::Types::GetPlanGrowthParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- module Companies
4
+ module Insights
5
5
  module Types
6
- class CreatePlanTraitResponse < Internal::Types::Model
7
- field :data, -> { Schematic::Types::PlanTraitResponseData }, optional: false, nullable: false
6
+ class GetSummaryResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::InsightsSummaryResponseData }, optional: false, nullable: false
8
8
  field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
9
  end
10
10
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ # Input parameters
7
+ class GetTopFeaturesByUsageParams < Internal::Types::Model
8
+ field :end_time, -> { String }, optional: true, nullable: false
9
+ field :limit, -> { Integer }, optional: true, nullable: false
10
+ field :start_time, -> { String }, optional: true, nullable: false
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetTopFeaturesByUsageRequest < Internal::Types::Model
7
+ field :end_time, -> { String }, optional: false, nullable: false
8
+ field :limit, -> { Integer }, optional: true, nullable: false
9
+ field :start_time, -> { String }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Insights
5
+ module Types
6
+ class GetTopFeaturesByUsageResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::TopFeaturesByUsageResponseData }, optional: false, nullable: false
8
+ field :params, -> { Schematic::Insights::Types::GetTopFeaturesByUsageParams }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Integrationsapi
5
+ class Client
6
+ # @param client [Schematic::Internal::Http::RawClient]
7
+ #
8
+ # @return [void]
9
+ def initialize(client:)
10
+ @client = client
11
+ end
12
+
13
+ # @param request_options [Hash]
14
+ # @param params [Hash]
15
+ # @option request_options [String] :base_url
16
+ # @option request_options [Hash{String => Object}] :additional_headers
17
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
18
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
19
+ # @option request_options [Integer] :timeout_in_seconds
20
+ # @option params [String] :type
21
+ #
22
+ # @return [Schematic::Integrationsapi::Types::GetIntegrationWebhookUrlResponse]
23
+ def get_integration_webhook_url(request_options: {}, **params)
24
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
25
+ request = Schematic::Internal::JSON::Request.new(
26
+ base_url: request_options[:base_url],
27
+ method: "GET",
28
+ path: "integrations/#{URI.encode_uri_component(params[:type].to_s)}/webhook-url",
29
+ request_options: request_options
30
+ )
31
+ begin
32
+ response = @client.send(request)
33
+ rescue Net::HTTPRequestTimeout
34
+ raise Schematic::Errors::TimeoutError
35
+ end
36
+ code = response.code.to_i
37
+ if code.between?(200, 299)
38
+ Schematic::Integrationsapi::Types::GetIntegrationWebhookUrlResponse.load(response.body)
39
+ else
40
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
41
+ raise error_class.new(response.body, code: code)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Integrationsapi
5
+ module Types
6
+ class GetIntegrationWebhookUrlResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::IntegrationWebhookUrlResponseData }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end