schematichq 1.5.7 → 1.5.9

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +5 -5
  3. data/.fern/replay.lock +13 -1
  4. data/README.md +7 -1
  5. data/lib/schematic/accesstokens/client.rb +1 -1
  6. data/lib/schematic/accounts/client.rb +15 -15
  7. data/lib/schematic/billing/client.rb +706 -83
  8. data/lib/schematic/billing/types/charge_native_invoice_response.rb +15 -0
  9. data/lib/schematic/billing/types/convert_company_trial_response.rb +15 -0
  10. data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +6 -0
  11. data/lib/schematic/billing/types/delete_contract_document_response.rb +15 -0
  12. data/lib/schematic/billing/types/end_company_trial_response.rb +15 -0
  13. data/lib/schematic/billing/types/get_company_contract_response.rb +15 -0
  14. data/lib/schematic/billing/types/get_company_trial_response.rb +15 -0
  15. data/lib/schematic/billing/types/get_company_upcoming_invoices_response.rb +15 -0
  16. data/lib/schematic/billing/types/move_to_default_plan_response.rb +15 -0
  17. data/lib/schematic/billing/types/reissue_native_invoice_link_response.rb +15 -0
  18. data/lib/schematic/billing/types/revoke_native_invoice_link_response.rb +15 -0
  19. data/lib/schematic/billing/types/start_company_trial_request_body.rb +21 -0
  20. data/lib/schematic/billing/types/start_company_trial_response.rb +15 -0
  21. data/lib/schematic/billing/types/update_billing_settings_request_body.rb +4 -0
  22. data/lib/schematic/billing/types/update_company_billing_profile_request_body.rb +6 -0
  23. data/lib/schematic/billing/types/update_company_trial_request_body.rb +15 -0
  24. data/lib/schematic/billing/types/update_company_trial_response.rb +15 -0
  25. data/lib/schematic/billing/types/upload_contract_document_request.rb +11 -0
  26. data/lib/schematic/billing/types/upload_contract_document_response.rb +15 -0
  27. data/lib/schematic/cache.rb +19 -2
  28. data/lib/schematic/catalogs/client.rb +16 -16
  29. data/lib/schematic/catalogs/types/update_catalog_configuration_request_body.rb +2 -0
  30. data/lib/schematic/checkout/client.rb +98 -9
  31. data/lib/schematic/checkout/types/checkout_data_request_body.rb +2 -0
  32. data/lib/schematic/checkout/types/pause_subscription_request.rb +15 -0
  33. data/lib/schematic/checkout/types/pause_subscription_response.rb +15 -0
  34. data/lib/schematic/checkout/types/resume_subscription_request.rb +13 -0
  35. data/lib/schematic/checkout/types/resume_subscription_response.rb +15 -0
  36. data/lib/schematic/client.rb +7 -196
  37. data/lib/schematic/companies/client.rb +140 -44
  38. data/lib/schematic/companies/types/get_billing_entity_settings_response.rb +15 -0
  39. data/lib/schematic/companies/types/list_users_params.rb +4 -0
  40. data/lib/schematic/companies/types/list_users_request.rb +4 -0
  41. data/lib/schematic/companies/types/update_billing_entity_settings_request_body.rb +13 -0
  42. data/lib/schematic/companies/types/update_billing_entity_settings_response.rb +15 -0
  43. data/lib/schematic/components/client.rb +8 -8
  44. data/lib/schematic/componentspublic/client.rb +1 -1
  45. data/lib/schematic/credits/client.rb +41 -41
  46. data/lib/schematic/customplangrouprollouts/client.rb +258 -0
  47. data/lib/schematic/customplangrouprollouts/types/copy_custom_plan_request_body.rb +15 -0
  48. data/lib/schematic/customplangrouprollouts/types/copy_custom_plan_response.rb +15 -0
  49. data/lib/schematic/customplangrouprollouts/types/get_group_rollout_response.rb +15 -0
  50. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_params.rb +14 -0
  51. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_request.rb +11 -0
  52. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_response.rb +15 -0
  53. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_params.rb +16 -0
  54. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_request.rb +15 -0
  55. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_response.rb +15 -0
  56. data/lib/schematic/customplangrouprollouts/types/start_group_rollout_request_body.rb +17 -0
  57. data/lib/schematic/customplangrouprollouts/types/start_group_rollout_response.rb +15 -0
  58. data/lib/schematic/dataexports/client.rb +4 -4
  59. data/lib/schematic/datastream/client.rb +52 -22
  60. data/lib/schematic/datastream/resource_cache.rb +13 -3
  61. data/lib/schematic/entitlements/client.rb +28 -28
  62. data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +2 -0
  63. data/lib/schematic/entitlements/types/create_company_override_request_body.rb +2 -0
  64. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +2 -0
  65. data/lib/schematic/entitlements/types/update_company_override_request_body.rb +2 -0
  66. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +2 -0
  67. data/lib/schematic/errors/response_error.rb +4 -2
  68. data/lib/schematic/events/client.rb +213 -9
  69. data/lib/schematic/events/types/create_account_inference_cost_rate_request_body.rb +19 -0
  70. data/lib/schematic/events/types/create_account_inference_cost_rate_response.rb +15 -0
  71. data/lib/schematic/events/types/delete_account_inference_cost_rate_response.rb +15 -0
  72. data/lib/schematic/events/types/list_account_inference_cost_rates_params.rb +20 -0
  73. data/lib/schematic/events/types/list_account_inference_cost_rates_request.rb +17 -0
  74. data/lib/schematic/events/types/list_account_inference_cost_rates_response.rb +15 -0
  75. data/lib/schematic/events/types/update_account_inference_cost_rate_request_body.rb +13 -0
  76. data/lib/schematic/events/types/update_account_inference_cost_rate_response.rb +15 -0
  77. data/lib/schematic/features/client.rb +18 -18
  78. data/lib/schematic/insights/client.rb +6 -6
  79. data/lib/schematic/integrationsapi/client.rb +14 -14
  80. data/lib/schematic/internal/http/raw_client.rb +2 -2
  81. data/lib/schematic/internal/iterators/offset_page_iterator.rb +2 -0
  82. data/lib/schematic/licenses/client.rb +3 -3
  83. data/lib/schematic/planbundle/client.rb +3 -3
  84. data/lib/schematic/plangroups/client.rb +3 -3
  85. data/lib/schematic/planmigrations/client.rb +11 -11
  86. data/lib/schematic/plans/client.rb +20 -20
  87. data/lib/schematic/redis_cache.rb +10 -1
  88. data/lib/schematic/scheduledcheckout/client.rb +4 -4
  89. data/lib/schematic/schematic_client.rb +21 -3
  90. data/lib/schematic/types/account_inference_cost_rate_response_data.rb +29 -0
  91. data/lib/schematic/types/billing_customer_subscription.rb +2 -0
  92. data/lib/schematic/types/billing_invoice_billing_details_response_data.rb +2 -0
  93. data/lib/schematic/types/billing_invoice_detail_response_data.rb +2 -0
  94. data/lib/schematic/types/billing_moved_to_default_plan_response_data.rb +15 -0
  95. data/lib/schematic/types/billing_native_subscription_response_data.rb +4 -0
  96. data/lib/schematic/types/billing_product_for_subscription_response_data.rb +2 -0
  97. data/lib/schematic/types/billing_product_plan_response_data.rb +2 -0
  98. data/lib/schematic/types/billing_settings_response_data.rb +4 -0
  99. data/lib/schematic/types/billing_subscription_pause_behavior.rb +15 -0
  100. data/lib/schematic/types/billing_subscription_response_data.rb +6 -0
  101. data/lib/schematic/types/billing_subscription_view.rb +6 -0
  102. data/lib/schematic/types/billing_upcoming_invoice_response_data.rb +43 -0
  103. data/lib/schematic/types/billing_upcoming_invoices_response_data.rb +13 -0
  104. data/lib/schematic/types/catalog_configuration_response_data.rb +2 -0
  105. data/lib/schematic/types/catalog_plan_response_data.rb +4 -0
  106. data/lib/schematic/types/catalog_response_data.rb +2 -0
  107. data/lib/schematic/types/checkout_subscription.rb +6 -0
  108. data/lib/schematic/types/company_billing_entity_settings_response_data.rb +15 -0
  109. data/lib/schematic/types/company_billing_entity_subscription_response_data.rb +10 -0
  110. data/lib/schematic/types/company_billing_profile_contract_response_data.rb +55 -0
  111. data/lib/schematic/types/company_billing_profile_document_response_data.rb +15 -0
  112. data/lib/schematic/types/company_override_response_data.rb +2 -0
  113. data/lib/schematic/types/company_subscription_response_data.rb +10 -0
  114. data/lib/schematic/types/company_trial_response_data.rb +35 -0
  115. data/lib/schematic/types/company_trial_status.rb +16 -0
  116. data/lib/schematic/types/contract_billing_details_request_body.rb +19 -0
  117. data/lib/schematic/types/contract_postpaid_credit_response_data.rb +23 -0
  118. data/lib/schematic/types/contract_postpaid_response_data.rb +15 -0
  119. data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +2 -0
  120. data/lib/schematic/types/create_entitlement_req_common.rb +2 -0
  121. data/lib/schematic/types/credit_burn_breakdown_line.rb +4 -0
  122. data/lib/schematic/types/credit_ledger_export_metadata.rb +25 -0
  123. data/lib/schematic/types/credit_ledger_export_metadata_event_type.rb +19 -0
  124. data/lib/schematic/types/credit_model_rate.rb +17 -0
  125. data/lib/schematic/types/custom_plan_billing_response_data.rb +2 -0
  126. data/lib/schematic/types/data_export_metadata.rb +2 -0
  127. data/lib/schematic/types/data_export_type.rb +1 -0
  128. data/lib/schematic/types/group_rollout_change_response_data.rb +13 -0
  129. data/lib/schematic/types/group_rollout_changes_response_data.rb +23 -0
  130. data/lib/schematic/types/group_rollout_company_response_data.rb +15 -0
  131. data/lib/schematic/types/group_rollout_company_result_response_data.rb +19 -0
  132. data/lib/schematic/types/group_rollout_preview_response_data.rb +19 -0
  133. data/lib/schematic/types/group_rollout_response_data.rb +25 -0
  134. data/lib/schematic/types/group_rollout_versions_request_body.rb +13 -0
  135. data/lib/schematic/types/manage_plan_request.rb +4 -0
  136. data/lib/schematic/types/manage_plan_response_response_data.rb +2 -0
  137. data/lib/schematic/types/migration_error_code.rb +1 -0
  138. data/lib/schematic/types/plan_change_action.rb +2 -0
  139. data/lib/schematic/types/plan_change_response_data.rb +4 -0
  140. data/lib/schematic/types/plan_entitlement_response_data.rb +2 -0
  141. data/lib/schematic/types/publish_plan_version_request_body.rb +8 -0
  142. data/lib/schematic/types/publish_preview_interval_change_response_data.rb +13 -0
  143. data/lib/schematic/types/publish_preview_response_data.rb +6 -0
  144. data/lib/schematic/types/scheduled_downgrade_response_data.rb +4 -0
  145. data/lib/schematic/types/stripe_integration_config.rb +2 -0
  146. data/lib/schematic/types/trial_source.rb +15 -0
  147. data/lib/schematic/types/update_entitlement_req_common.rb +2 -0
  148. data/lib/schematic/types/web_scheduled_downgrade_webhook_output.rb +2 -0
  149. data/lib/schematic/version.rb +1 -1
  150. data/lib/schematic/webhooks/client.rb +10 -10
  151. data/lib/schematic.rb +79 -5
  152. data/reference.md +5208 -3800
  153. metadata +70 -2
@@ -64,7 +64,7 @@ module Schematic
64
64
  500 => Schematic::Types::ApiError
65
65
  }
66
66
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
67
- raise error_class.new(response.body, code: code, body: error_body)
67
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
68
68
  end
69
69
  end
70
70
 
@@ -116,7 +116,7 @@ module Schematic
116
116
  500 => Schematic::Types::ApiError
117
117
  }
118
118
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
119
- raise error_class.new(response.body, code: code, body: error_body)
119
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
120
120
  end
121
121
  end
122
122
 
@@ -159,7 +159,7 @@ module Schematic
159
159
  500 => Schematic::Types::ApiError
160
160
  }
161
161
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
162
- raise error_class.new(response.body, code: code, body: error_body)
162
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
163
163
  end
164
164
  end
165
165
 
@@ -202,7 +202,7 @@ module Schematic
202
202
  500 => Schematic::Types::ApiError
203
203
  }
204
204
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
205
- raise error_class.new(response.body, code: code, body: error_body)
205
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
206
206
  end
207
207
  end
208
208
 
@@ -252,7 +252,7 @@ module Schematic
252
252
  500 => Schematic::Types::ApiError
253
253
  }
254
254
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
255
- raise error_class.new(response.body, code: code, body: error_body)
255
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
256
256
  end
257
257
  end
258
258
 
@@ -316,7 +316,7 @@ module Schematic
316
316
  500 => Schematic::Types::ApiError
317
317
  }
318
318
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
319
- raise error_class.new(response.body, code: code, body: error_body)
319
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
320
320
  end
321
321
  end
322
322
 
@@ -380,7 +380,7 @@ module Schematic
380
380
  500 => Schematic::Types::ApiError
381
381
  }
382
382
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
383
- raise error_class.new(response.body, code: code, body: error_body)
383
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
384
384
  end
385
385
  end
386
386
 
@@ -441,7 +441,7 @@ module Schematic
441
441
  500 => Schematic::Types::ApiError
442
442
  }
443
443
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
444
- raise error_class.new(response.body, code: code, body: error_body)
444
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
445
445
  end
446
446
  end
447
447
 
@@ -492,7 +492,7 @@ module Schematic
492
492
  500 => Schematic::Types::ApiError
493
493
  }
494
494
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
495
- raise error_class.new(response.body, code: code, body: error_body)
495
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
496
496
  end
497
497
  end
498
498
 
@@ -535,7 +535,7 @@ module Schematic
535
535
  500 => Schematic::Types::ApiError
536
536
  }
537
537
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
538
- raise error_class.new(response.body, code: code, body: error_body)
538
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
539
539
  end
540
540
  end
541
541
 
@@ -590,7 +590,7 @@ module Schematic
590
590
  500 => Schematic::Types::ApiError
591
591
  }
592
592
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
593
- raise error_class.new(response.body, code: code, body: error_body)
593
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
594
594
  end
595
595
  end
596
596
 
@@ -638,7 +638,7 @@ module Schematic
638
638
  500 => Schematic::Types::ApiError
639
639
  }
640
640
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
641
- raise error_class.new(response.body, code: code, body: error_body)
641
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
642
642
  end
643
643
  end
644
644
 
@@ -696,7 +696,7 @@ module Schematic
696
696
  500 => Schematic::Types::ApiError
697
697
  }
698
698
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
699
- raise error_class.new(response.body, code: code, body: error_body)
699
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
700
700
  end
701
701
  end
702
702
 
@@ -743,7 +743,7 @@ module Schematic
743
743
  500 => Schematic::Types::ApiError
744
744
  }
745
745
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
746
- raise error_class.new(response.body, code: code, body: error_body)
746
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
747
747
  end
748
748
  end
749
749
 
@@ -786,7 +786,7 @@ module Schematic
786
786
  500 => Schematic::Types::ApiError
787
787
  }
788
788
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
789
- raise error_class.new(response.body, code: code, body: error_body)
789
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
790
790
  end
791
791
  end
792
792
 
@@ -886,7 +886,7 @@ module Schematic
886
886
  500 => Schematic::Types::ApiError
887
887
  }
888
888
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
889
- raise error_class.new(response.body, code: code, body: error_body)
889
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
890
890
  end
891
891
  end
892
892
 
@@ -942,7 +942,7 @@ module Schematic
942
942
  500 => Schematic::Types::ApiError
943
943
  }
944
944
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
945
- raise error_class.new(response.body, code: code, body: error_body)
945
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
946
946
  end
947
947
  end
948
948
 
@@ -985,7 +985,7 @@ module Schematic
985
985
  500 => Schematic::Types::ApiError
986
986
  }
987
987
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
988
- raise error_class.new(response.body, code: code, body: error_body)
988
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
989
989
  end
990
990
  end
991
991
 
@@ -1085,7 +1085,7 @@ module Schematic
1085
1085
  500 => Schematic::Types::ApiError
1086
1086
  }
1087
1087
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1088
- raise error_class.new(response.body, code: code, body: error_body)
1088
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1089
1089
  end
1090
1090
  end
1091
1091
 
@@ -1128,7 +1128,7 @@ module Schematic
1128
1128
  500 => Schematic::Types::ApiError
1129
1129
  }
1130
1130
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1131
- raise error_class.new(response.body, code: code, body: error_body)
1131
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1132
1132
  end
1133
1133
  end
1134
1134
 
@@ -1174,7 +1174,7 @@ module Schematic
1174
1174
  500 => Schematic::Types::ApiError
1175
1175
  }
1176
1176
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1177
- raise error_class.new(response.body, code: code, body: error_body)
1177
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1178
1178
  end
1179
1179
  end
1180
1180
 
@@ -1259,7 +1259,7 @@ module Schematic
1259
1259
  500 => Schematic::Types::ApiError
1260
1260
  }
1261
1261
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1262
- raise error_class.new(response.body, code: code, body: error_body)
1262
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1263
1263
  end
1264
1264
  end
1265
1265
 
@@ -1344,7 +1344,7 @@ module Schematic
1344
1344
  500 => Schematic::Types::ApiError
1345
1345
  }
1346
1346
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1347
- raise error_class.new(response.body, code: code, body: error_body)
1347
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1348
1348
  end
1349
1349
  end
1350
1350
 
@@ -1405,7 +1405,7 @@ module Schematic
1405
1405
  500 => Schematic::Types::ApiError
1406
1406
  }
1407
1407
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1408
- raise error_class.new(response.body, code: code, body: error_body)
1408
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1409
1409
  end
1410
1410
  end
1411
1411
 
@@ -1456,7 +1456,188 @@ module Schematic
1456
1456
  500 => Schematic::Types::ApiError
1457
1457
  }
1458
1458
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1459
- raise error_class.new(response.body, code: code, body: error_body)
1459
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1460
+ end
1461
+ end
1462
+
1463
+ # @param request_options [Hash]
1464
+ # @param params [Hash]
1465
+ # @option request_options [String] :base_url
1466
+ # @option request_options [Hash{String => Object}] :additional_headers
1467
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1468
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1469
+ # @option request_options [Integer] :timeout_in_seconds
1470
+ # @option params [String] :billing_profile_id
1471
+ #
1472
+ # @example
1473
+ # client.billing.get_company_contract(billing_profile_id: "billing_profile_id")
1474
+ #
1475
+ # @return [Schematic::Billing::Types::GetCompanyContractResponse]
1476
+ def get_company_contract(request_options: {}, **params)
1477
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1478
+ request = Schematic::Internal::JSON::Request.new(
1479
+ base_url: request_options[:base_url],
1480
+ method: "GET",
1481
+ path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}/contract",
1482
+ request_options: request_options
1483
+ )
1484
+ begin
1485
+ response = @client.send(request)
1486
+ rescue Net::HTTPRequestTimeout
1487
+ raise Schematic::Errors::TimeoutError
1488
+ end
1489
+ code = response.code.to_i
1490
+ if code.between?(200, 299)
1491
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyContractResponse.load(response.body))
1492
+ else
1493
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1494
+ error_types = {
1495
+ 401 => Schematic::Types::ApiError,
1496
+ 403 => Schematic::Types::ApiError,
1497
+ 404 => Schematic::Types::ApiError,
1498
+ 500 => Schematic::Types::ApiError
1499
+ }
1500
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1501
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1502
+ end
1503
+ end
1504
+
1505
+ # @param request_options [Hash]
1506
+ # @param params [Hash]
1507
+ # @option request_options [String] :base_url
1508
+ # @option request_options [Hash{String => Object}] :additional_headers
1509
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1510
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1511
+ # @option request_options [Integer] :timeout_in_seconds
1512
+ # @option params [String] :billing_profile_id
1513
+ #
1514
+ # @example
1515
+ # client.billing.download_contract_document(billing_profile_id: "billing_profile_id")
1516
+ #
1517
+ # @return [String]
1518
+ def download_contract_document(request_options: {}, **params)
1519
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1520
+ request = Schematic::Internal::JSON::Request.new(
1521
+ base_url: request_options[:base_url],
1522
+ method: "GET",
1523
+ path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}/document",
1524
+ request_options: request_options
1525
+ )
1526
+ begin
1527
+ response = @client.send(request)
1528
+ rescue Net::HTTPRequestTimeout
1529
+ raise Schematic::Errors::TimeoutError
1530
+ end
1531
+ code = response.code.to_i
1532
+ return response.body if code.between?(200, 299)
1533
+
1534
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1535
+ error_types = {
1536
+ 401 => Schematic::Types::ApiError,
1537
+ 403 => Schematic::Types::ApiError,
1538
+ 404 => Schematic::Types::ApiError,
1539
+ 500 => Schematic::Types::ApiError
1540
+ }
1541
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1542
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1543
+ end
1544
+
1545
+ # @param request_options [Hash]
1546
+ # @param params [void]
1547
+ # @option request_options [String] :base_url
1548
+ # @option request_options [Hash{String => Object}] :additional_headers
1549
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1550
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1551
+ # @option request_options [Integer] :timeout_in_seconds
1552
+ # @option params [String] :billing_profile_id
1553
+ #
1554
+ # @example
1555
+ # client.billing.upload_contract_document(
1556
+ # billing_profile_id: "billing_profile_id",
1557
+ # file: "/path/to/your/file"
1558
+ # )
1559
+ #
1560
+ # @return [Schematic::Billing::Types::UploadContractDocumentResponse]
1561
+ def upload_contract_document(request_options: {}, **params)
1562
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1563
+ body = Internal::Multipart::FormData.new
1564
+
1565
+ if params[:file]
1566
+ body.add_file(
1567
+ name: "file",
1568
+ file: params[:file]
1569
+ )
1570
+ end
1571
+
1572
+ request = Schematic::Internal::Multipart::Request.new(
1573
+ base_url: request_options[:base_url],
1574
+ method: "PUT",
1575
+ path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}/document",
1576
+ body: body,
1577
+ request_options: request_options
1578
+ )
1579
+ begin
1580
+ response = @client.send(request)
1581
+ rescue Net::HTTPRequestTimeout
1582
+ raise Schematic::Errors::TimeoutError
1583
+ end
1584
+ code = response.code.to_i
1585
+ if code.between?(200, 299)
1586
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UploadContractDocumentResponse.load(response.body))
1587
+ else
1588
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1589
+ error_types = {
1590
+ 400 => Schematic::Types::ApiError,
1591
+ 401 => Schematic::Types::ApiError,
1592
+ 403 => Schematic::Types::ApiError,
1593
+ 404 => Schematic::Types::ApiError,
1594
+ 500 => Schematic::Types::ApiError
1595
+ }
1596
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1597
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1598
+ end
1599
+ end
1600
+
1601
+ # @param request_options [Hash]
1602
+ # @param params [Hash]
1603
+ # @option request_options [String] :base_url
1604
+ # @option request_options [Hash{String => Object}] :additional_headers
1605
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1606
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1607
+ # @option request_options [Integer] :timeout_in_seconds
1608
+ # @option params [String] :billing_profile_id
1609
+ #
1610
+ # @example
1611
+ # client.billing.delete_contract_document(billing_profile_id: "billing_profile_id")
1612
+ #
1613
+ # @return [Schematic::Billing::Types::DeleteContractDocumentResponse]
1614
+ def delete_contract_document(request_options: {}, **params)
1615
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1616
+ request = Schematic::Internal::JSON::Request.new(
1617
+ base_url: request_options[:base_url],
1618
+ method: "DELETE",
1619
+ path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}/document",
1620
+ request_options: request_options
1621
+ )
1622
+ begin
1623
+ response = @client.send(request)
1624
+ rescue Net::HTTPRequestTimeout
1625
+ raise Schematic::Errors::TimeoutError
1626
+ end
1627
+ code = response.code.to_i
1628
+ if code.between?(200, 299)
1629
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteContractDocumentResponse.load(response.body))
1630
+ else
1631
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1632
+ error_types = {
1633
+ 400 => Schematic::Types::ApiError,
1634
+ 401 => Schematic::Types::ApiError,
1635
+ 403 => Schematic::Types::ApiError,
1636
+ 404 => Schematic::Types::ApiError,
1637
+ 500 => Schematic::Types::ApiError
1638
+ }
1639
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1640
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1460
1641
  end
1461
1642
  end
1462
1643
 
@@ -1469,14 +1650,249 @@ module Schematic
1469
1650
  # @option request_options [Integer] :timeout_in_seconds
1470
1651
  #
1471
1652
  # @example
1472
- # client.billing.get_billing_settings
1653
+ # client.billing.get_billing_settings
1654
+ #
1655
+ # @return [Schematic::Billing::Types::GetBillingSettingsResponse]
1656
+ def get_billing_settings(request_options: {}, **_params)
1657
+ request = Schematic::Internal::JSON::Request.new(
1658
+ base_url: request_options[:base_url],
1659
+ method: "GET",
1660
+ path: "billing/settings",
1661
+ request_options: request_options
1662
+ )
1663
+ begin
1664
+ response = @client.send(request)
1665
+ rescue Net::HTTPRequestTimeout
1666
+ raise Schematic::Errors::TimeoutError
1667
+ end
1668
+ code = response.code.to_i
1669
+ if code.between?(200, 299)
1670
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetBillingSettingsResponse.load(response.body))
1671
+ else
1672
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1673
+ error_types = {
1674
+ 401 => Schematic::Types::ApiError,
1675
+ 403 => Schematic::Types::ApiError,
1676
+ 404 => Schematic::Types::ApiError,
1677
+ 500 => Schematic::Types::ApiError
1678
+ }
1679
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1680
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1681
+ end
1682
+ end
1683
+
1684
+ # @param request_options [Hash]
1685
+ # @param params [Schematic::Billing::Types::UpdateBillingSettingsRequestBody]
1686
+ # @option request_options [String] :base_url
1687
+ # @option request_options [Hash{String => Object}] :additional_headers
1688
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1689
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1690
+ # @option request_options [Integer] :timeout_in_seconds
1691
+ #
1692
+ # @example
1693
+ # client.billing.update_billing_settings
1694
+ #
1695
+ # @return [Schematic::Billing::Types::UpdateBillingSettingsResponse]
1696
+ def update_billing_settings(request_options: {}, **params)
1697
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1698
+ request = Schematic::Internal::JSON::Request.new(
1699
+ base_url: request_options[:base_url],
1700
+ method: "POST",
1701
+ path: "billing/settings",
1702
+ body: Schematic::Billing::Types::UpdateBillingSettingsRequestBody.new(params).to_h,
1703
+ request_options: request_options
1704
+ )
1705
+ begin
1706
+ response = @client.send(request)
1707
+ rescue Net::HTTPRequestTimeout
1708
+ raise Schematic::Errors::TimeoutError
1709
+ end
1710
+ code = response.code.to_i
1711
+ if code.between?(200, 299)
1712
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpdateBillingSettingsResponse.load(response.body))
1713
+ else
1714
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1715
+ error_types = {
1716
+ 400 => Schematic::Types::ApiError,
1717
+ 401 => Schematic::Types::ApiError,
1718
+ 403 => Schematic::Types::ApiError,
1719
+ 404 => Schematic::Types::ApiError,
1720
+ 500 => Schematic::Types::ApiError
1721
+ }
1722
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1723
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1724
+ end
1725
+ end
1726
+
1727
+ # @param request_options [Hash]
1728
+ # @param params [Schematic::Billing::Types::CreateBillingSubscriptionRequestBody]
1729
+ # @option request_options [String] :base_url
1730
+ # @option request_options [Hash{String => Object}] :additional_headers
1731
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1732
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1733
+ # @option request_options [Integer] :timeout_in_seconds
1734
+ #
1735
+ # @example
1736
+ # client.billing.upsert_billing_subscription(
1737
+ # cancel_at_period_end: true,
1738
+ # currency: "aed",
1739
+ # customer_external_id: "customer_external_id",
1740
+ # discounts: [{
1741
+ # coupon_external_id: "coupon_external_id",
1742
+ # external_id: "external_id",
1743
+ # is_active: true,
1744
+ # started_at: "2024-01-15T09:30:00Z"
1745
+ # }],
1746
+ # expired_at: "2024-01-15T09:30:00Z",
1747
+ # product_external_ids: [{
1748
+ # currency: "aed",
1749
+ # interval: "interval",
1750
+ # price: 1000000,
1751
+ # price_external_id: "price_external_id",
1752
+ # product_external_id: "product_external_id",
1753
+ # quantity: 1000000,
1754
+ # usage_type: "licensed"
1755
+ # }],
1756
+ # subscription_external_id: "subscription_external_id",
1757
+ # total_price: 1000000
1758
+ # )
1759
+ #
1760
+ # @return [Schematic::Billing::Types::UpsertBillingSubscriptionResponse]
1761
+ def upsert_billing_subscription(request_options: {}, **params)
1762
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1763
+ request = Schematic::Internal::JSON::Request.new(
1764
+ base_url: request_options[:base_url],
1765
+ method: "POST",
1766
+ path: "billing/subscription/upsert",
1767
+ body: Schematic::Billing::Types::CreateBillingSubscriptionRequestBody.new(params).to_h,
1768
+ request_options: request_options
1769
+ )
1770
+ begin
1771
+ response = @client.send(request)
1772
+ rescue Net::HTTPRequestTimeout
1773
+ raise Schematic::Errors::TimeoutError
1774
+ end
1775
+ code = response.code.to_i
1776
+ if code.between?(200, 299)
1777
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingSubscriptionResponse.load(response.body))
1778
+ else
1779
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1780
+ error_types = {
1781
+ 400 => Schematic::Types::ApiError,
1782
+ 401 => Schematic::Types::ApiError,
1783
+ 403 => Schematic::Types::ApiError,
1784
+ 404 => Schematic::Types::ApiError,
1785
+ 500 => Schematic::Types::ApiError
1786
+ }
1787
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1788
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1789
+ end
1790
+ end
1791
+
1792
+ # @param request_options [Hash]
1793
+ # @param params [Hash]
1794
+ # @option request_options [String] :base_url
1795
+ # @option request_options [Hash{String => Object}] :additional_headers
1796
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1797
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1798
+ # @option request_options [Integer] :timeout_in_seconds
1799
+ # @option params [String] :company_id
1800
+ #
1801
+ # @example
1802
+ # client.billing.get_company_native_subscription(company_id: "company_id")
1803
+ #
1804
+ # @return [Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse]
1805
+ def get_company_native_subscription(request_options: {}, **params)
1806
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1807
+ request = Schematic::Internal::JSON::Request.new(
1808
+ base_url: request_options[:base_url],
1809
+ method: "GET",
1810
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription",
1811
+ request_options: request_options
1812
+ )
1813
+ begin
1814
+ response = @client.send(request)
1815
+ rescue Net::HTTPRequestTimeout
1816
+ raise Schematic::Errors::TimeoutError
1817
+ end
1818
+ code = response.code.to_i
1819
+ if code.between?(200, 299)
1820
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse.load(response.body))
1821
+ else
1822
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1823
+ error_types = {
1824
+ 401 => Schematic::Types::ApiError,
1825
+ 403 => Schematic::Types::ApiError,
1826
+ 404 => Schematic::Types::ApiError,
1827
+ 500 => Schematic::Types::ApiError
1828
+ }
1829
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1830
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1831
+ end
1832
+ end
1833
+
1834
+ # @param request_options [Hash]
1835
+ # @param params [Hash]
1836
+ # @option request_options [String] :base_url
1837
+ # @option request_options [Hash{String => Object}] :additional_headers
1838
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1839
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1840
+ # @option request_options [Integer] :timeout_in_seconds
1841
+ # @option params [String] :company_id
1842
+ #
1843
+ # @example
1844
+ # client.billing.move_to_default_plan(company_id: "company_id")
1845
+ #
1846
+ # @return [Schematic::Billing::Types::MoveToDefaultPlanResponse]
1847
+ def move_to_default_plan(request_options: {}, **params)
1848
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1849
+ request = Schematic::Internal::JSON::Request.new(
1850
+ base_url: request_options[:base_url],
1851
+ method: "POST",
1852
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription/move-to-default-plan",
1853
+ request_options: request_options
1854
+ )
1855
+ begin
1856
+ response = @client.send(request)
1857
+ rescue Net::HTTPRequestTimeout
1858
+ raise Schematic::Errors::TimeoutError
1859
+ end
1860
+ code = response.code.to_i
1861
+ if code.between?(200, 299)
1862
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::MoveToDefaultPlanResponse.load(response.body))
1863
+ else
1864
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1865
+ error_types = {
1866
+ 400 => Schematic::Types::ApiError,
1867
+ 401 => Schematic::Types::ApiError,
1868
+ 403 => Schematic::Types::ApiError,
1869
+ 404 => Schematic::Types::ApiError,
1870
+ 500 => Schematic::Types::ApiError
1871
+ }
1872
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1873
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1874
+ end
1875
+ end
1876
+
1877
+ # @param request_options [Hash]
1878
+ # @param params [Hash]
1879
+ # @option request_options [String] :base_url
1880
+ # @option request_options [Hash{String => Object}] :additional_headers
1881
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1882
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1883
+ # @option request_options [Integer] :timeout_in_seconds
1884
+ # @option params [String] :company_id
1885
+ #
1886
+ # @example
1887
+ # client.billing.get_company_trial(company_id: "company_id")
1473
1888
  #
1474
- # @return [Schematic::Billing::Types::GetBillingSettingsResponse]
1475
- def get_billing_settings(request_options: {}, **_params)
1889
+ # @return [Schematic::Billing::Types::GetCompanyTrialResponse]
1890
+ def get_company_trial(request_options: {}, **params)
1891
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1476
1892
  request = Schematic::Internal::JSON::Request.new(
1477
1893
  base_url: request_options[:base_url],
1478
1894
  method: "GET",
1479
- path: "billing/settings",
1895
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/trial",
1480
1896
  request_options: request_options
1481
1897
  )
1482
1898
  begin
@@ -1486,7 +1902,7 @@ module Schematic
1486
1902
  end
1487
1903
  code = response.code.to_i
1488
1904
  if code.between?(200, 299)
1489
- (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetBillingSettingsResponse.load(response.body))
1905
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyTrialResponse.load(response.body))
1490
1906
  else
1491
1907
  error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1492
1908
  error_types = {
@@ -1496,29 +1912,38 @@ module Schematic
1496
1912
  500 => Schematic::Types::ApiError
1497
1913
  }
1498
1914
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1499
- raise error_class.new(response.body, code: code, body: error_body)
1915
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1500
1916
  end
1501
1917
  end
1502
1918
 
1503
1919
  # @param request_options [Hash]
1504
- # @param params [Schematic::Billing::Types::UpdateBillingSettingsRequestBody]
1920
+ # @param params [Schematic::Billing::Types::StartCompanyTrialRequestBody]
1505
1921
  # @option request_options [String] :base_url
1506
1922
  # @option request_options [Hash{String => Object}] :additional_headers
1507
1923
  # @option request_options [Hash{String => Object}] :additional_query_parameters
1508
1924
  # @option request_options [Hash{String => Object}] :additional_body_parameters
1509
1925
  # @option request_options [Integer] :timeout_in_seconds
1926
+ # @option params [String] :company_id
1510
1927
  #
1511
1928
  # @example
1512
- # client.billing.update_billing_settings
1929
+ # client.billing.start_company_trial(
1930
+ # company_id: "company_id",
1931
+ # cadence: "day",
1932
+ # plan_id: "plan_id"
1933
+ # )
1513
1934
  #
1514
- # @return [Schematic::Billing::Types::UpdateBillingSettingsResponse]
1515
- def update_billing_settings(request_options: {}, **params)
1935
+ # @return [Schematic::Billing::Types::StartCompanyTrialResponse]
1936
+ def start_company_trial(request_options: {}, **params)
1516
1937
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
1938
+ request_data = Schematic::Billing::Types::StartCompanyTrialRequestBody.new(params).to_h
1939
+ non_body_param_names = %w[company_id]
1940
+ body = request_data.except(*non_body_param_names)
1941
+
1517
1942
  request = Schematic::Internal::JSON::Request.new(
1518
1943
  base_url: request_options[:base_url],
1519
1944
  method: "POST",
1520
- path: "billing/settings",
1521
- body: Schematic::Billing::Types::UpdateBillingSettingsRequestBody.new(params).to_h,
1945
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/trial",
1946
+ body: body,
1522
1947
  request_options: request_options
1523
1948
  )
1524
1949
  begin
@@ -1528,7 +1953,7 @@ module Schematic
1528
1953
  end
1529
1954
  code = response.code.to_i
1530
1955
  if code.between?(200, 299)
1531
- (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpdateBillingSettingsResponse.load(response.body))
1956
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::StartCompanyTrialResponse.load(response.body))
1532
1957
  else
1533
1958
  error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1534
1959
  error_types = {
@@ -1539,51 +1964,77 @@ module Schematic
1539
1964
  500 => Schematic::Types::ApiError
1540
1965
  }
1541
1966
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1542
- raise error_class.new(response.body, code: code, body: error_body)
1967
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1543
1968
  end
1544
1969
  end
1545
1970
 
1546
1971
  # @param request_options [Hash]
1547
- # @param params [Schematic::Billing::Types::CreateBillingSubscriptionRequestBody]
1972
+ # @param params [Schematic::Billing::Types::UpdateCompanyTrialRequestBody]
1548
1973
  # @option request_options [String] :base_url
1549
1974
  # @option request_options [Hash{String => Object}] :additional_headers
1550
1975
  # @option request_options [Hash{String => Object}] :additional_query_parameters
1551
1976
  # @option request_options [Hash{String => Object}] :additional_body_parameters
1552
1977
  # @option request_options [Integer] :timeout_in_seconds
1978
+ # @option params [String] :company_id
1553
1979
  #
1554
1980
  # @example
1555
- # client.billing.upsert_billing_subscription(
1556
- # cancel_at_period_end: true,
1557
- # currency: "aed",
1558
- # customer_external_id: "customer_external_id",
1559
- # discounts: [{
1560
- # coupon_external_id: "coupon_external_id",
1561
- # external_id: "external_id",
1562
- # is_active: true,
1563
- # started_at: "2024-01-15T09:30:00Z"
1564
- # }],
1565
- # expired_at: "2024-01-15T09:30:00Z",
1566
- # product_external_ids: [{
1567
- # currency: "aed",
1568
- # interval: "interval",
1569
- # price: 1000000,
1570
- # price_external_id: "price_external_id",
1571
- # product_external_id: "product_external_id",
1572
- # quantity: 1000000,
1573
- # usage_type: "licensed"
1574
- # }],
1575
- # subscription_external_id: "subscription_external_id",
1576
- # total_price: 1000000
1577
- # )
1981
+ # client.billing.update_company_trial(company_id: "company_id")
1578
1982
  #
1579
- # @return [Schematic::Billing::Types::UpsertBillingSubscriptionResponse]
1580
- def upsert_billing_subscription(request_options: {}, **params)
1983
+ # @return [Schematic::Billing::Types::UpdateCompanyTrialResponse]
1984
+ def update_company_trial(request_options: {}, **params)
1985
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1986
+ request_data = Schematic::Billing::Types::UpdateCompanyTrialRequestBody.new(params).to_h
1987
+ non_body_param_names = %w[company_id]
1988
+ body = request_data.except(*non_body_param_names)
1989
+
1990
+ request = Schematic::Internal::JSON::Request.new(
1991
+ base_url: request_options[:base_url],
1992
+ method: "PUT",
1993
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/trial",
1994
+ body: body,
1995
+ request_options: request_options
1996
+ )
1997
+ begin
1998
+ response = @client.send(request)
1999
+ rescue Net::HTTPRequestTimeout
2000
+ raise Schematic::Errors::TimeoutError
2001
+ end
2002
+ code = response.code.to_i
2003
+ if code.between?(200, 299)
2004
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpdateCompanyTrialResponse.load(response.body))
2005
+ else
2006
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2007
+ error_types = {
2008
+ 400 => Schematic::Types::ApiError,
2009
+ 401 => Schematic::Types::ApiError,
2010
+ 403 => Schematic::Types::ApiError,
2011
+ 404 => Schematic::Types::ApiError,
2012
+ 500 => Schematic::Types::ApiError
2013
+ }
2014
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2015
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2016
+ end
2017
+ end
2018
+
2019
+ # @param request_options [Hash]
2020
+ # @param params [Hash]
2021
+ # @option request_options [String] :base_url
2022
+ # @option request_options [Hash{String => Object}] :additional_headers
2023
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2024
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2025
+ # @option request_options [Integer] :timeout_in_seconds
2026
+ # @option params [String] :company_id
2027
+ #
2028
+ # @example
2029
+ # client.billing.convert_company_trial(company_id: "company_id")
2030
+ #
2031
+ # @return [Schematic::Billing::Types::ConvertCompanyTrialResponse]
2032
+ def convert_company_trial(request_options: {}, **params)
1581
2033
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
1582
2034
  request = Schematic::Internal::JSON::Request.new(
1583
2035
  base_url: request_options[:base_url],
1584
2036
  method: "POST",
1585
- path: "billing/subscription/upsert",
1586
- body: Schematic::Billing::Types::CreateBillingSubscriptionRequestBody.new(params).to_h,
2037
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/trial/convert",
1587
2038
  request_options: request_options
1588
2039
  )
1589
2040
  begin
@@ -1593,7 +2044,7 @@ module Schematic
1593
2044
  end
1594
2045
  code = response.code.to_i
1595
2046
  if code.between?(200, 299)
1596
- (response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingSubscriptionResponse.load(response.body))
2047
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::ConvertCompanyTrialResponse.load(response.body))
1597
2048
  else
1598
2049
  error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1599
2050
  error_types = {
@@ -1604,7 +2055,7 @@ module Schematic
1604
2055
  500 => Schematic::Types::ApiError
1605
2056
  }
1606
2057
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1607
- raise error_class.new(response.body, code: code, body: error_body)
2058
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1608
2059
  end
1609
2060
  end
1610
2061
 
@@ -1618,15 +2069,58 @@ module Schematic
1618
2069
  # @option params [String] :company_id
1619
2070
  #
1620
2071
  # @example
1621
- # client.billing.get_company_native_subscription(company_id: "company_id")
2072
+ # client.billing.end_company_trial(company_id: "company_id")
1622
2073
  #
1623
- # @return [Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse]
1624
- def get_company_native_subscription(request_options: {}, **params)
2074
+ # @return [Schematic::Billing::Types::EndCompanyTrialResponse]
2075
+ def end_company_trial(request_options: {}, **params)
2076
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2077
+ request = Schematic::Internal::JSON::Request.new(
2078
+ base_url: request_options[:base_url],
2079
+ method: "POST",
2080
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/trial/end",
2081
+ request_options: request_options
2082
+ )
2083
+ begin
2084
+ response = @client.send(request)
2085
+ rescue Net::HTTPRequestTimeout
2086
+ raise Schematic::Errors::TimeoutError
2087
+ end
2088
+ code = response.code.to_i
2089
+ if code.between?(200, 299)
2090
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::EndCompanyTrialResponse.load(response.body))
2091
+ else
2092
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2093
+ error_types = {
2094
+ 400 => Schematic::Types::ApiError,
2095
+ 401 => Schematic::Types::ApiError,
2096
+ 403 => Schematic::Types::ApiError,
2097
+ 404 => Schematic::Types::ApiError,
2098
+ 500 => Schematic::Types::ApiError
2099
+ }
2100
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2101
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2102
+ end
2103
+ end
2104
+
2105
+ # @param request_options [Hash]
2106
+ # @param params [Hash]
2107
+ # @option request_options [String] :base_url
2108
+ # @option request_options [Hash{String => Object}] :additional_headers
2109
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2110
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2111
+ # @option request_options [Integer] :timeout_in_seconds
2112
+ # @option params [String] :company_id
2113
+ #
2114
+ # @example
2115
+ # client.billing.get_company_upcoming_invoices(company_id: "company_id")
2116
+ #
2117
+ # @return [Schematic::Billing::Types::GetCompanyUpcomingInvoicesResponse]
2118
+ def get_company_upcoming_invoices(request_options: {}, **params)
1625
2119
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
1626
2120
  request = Schematic::Internal::JSON::Request.new(
1627
2121
  base_url: request_options[:base_url],
1628
2122
  method: "GET",
1629
- path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription",
2123
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/upcoming-invoices",
1630
2124
  request_options: request_options
1631
2125
  )
1632
2126
  begin
@@ -1636,7 +2130,7 @@ module Schematic
1636
2130
  end
1637
2131
  code = response.code.to_i
1638
2132
  if code.between?(200, 299)
1639
- (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse.load(response.body))
2133
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyUpcomingInvoicesResponse.load(response.body))
1640
2134
  else
1641
2135
  error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1642
2136
  error_types = {
@@ -1646,7 +2140,7 @@ module Schematic
1646
2140
  500 => Schematic::Types::ApiError
1647
2141
  }
1648
2142
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1649
- raise error_class.new(response.body, code: code, body: error_body)
2143
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1650
2144
  end
1651
2145
  end
1652
2146
 
@@ -1719,7 +2213,7 @@ module Schematic
1719
2213
  500 => Schematic::Types::ApiError
1720
2214
  }
1721
2215
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1722
- raise error_class.new(response.body, code: code, body: error_body)
2216
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1723
2217
  end
1724
2218
  end
1725
2219
 
@@ -1761,7 +2255,50 @@ module Schematic
1761
2255
  500 => Schematic::Types::ApiError
1762
2256
  }
1763
2257
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1764
- raise error_class.new(response.body, code: code, body: error_body)
2258
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2259
+ end
2260
+ end
2261
+
2262
+ # @param request_options [Hash]
2263
+ # @param params [Hash]
2264
+ # @option request_options [String] :base_url
2265
+ # @option request_options [Hash{String => Object}] :additional_headers
2266
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2267
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2268
+ # @option request_options [Integer] :timeout_in_seconds
2269
+ # @option params [String] :invoice_id
2270
+ #
2271
+ # @example
2272
+ # client.billing.charge_native_invoice(invoice_id: "invoice_id")
2273
+ #
2274
+ # @return [Schematic::Billing::Types::ChargeNativeInvoiceResponse]
2275
+ def charge_native_invoice(request_options: {}, **params)
2276
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2277
+ request = Schematic::Internal::JSON::Request.new(
2278
+ base_url: request_options[:base_url],
2279
+ method: "POST",
2280
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/charge",
2281
+ request_options: request_options
2282
+ )
2283
+ begin
2284
+ response = @client.send(request)
2285
+ rescue Net::HTTPRequestTimeout
2286
+ raise Schematic::Errors::TimeoutError
2287
+ end
2288
+ code = response.code.to_i
2289
+ if code.between?(200, 299)
2290
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::ChargeNativeInvoiceResponse.load(response.body))
2291
+ else
2292
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2293
+ error_types = {
2294
+ 400 => Schematic::Types::ApiError,
2295
+ 401 => Schematic::Types::ApiError,
2296
+ 403 => Schematic::Types::ApiError,
2297
+ 404 => Schematic::Types::ApiError,
2298
+ 500 => Schematic::Types::ApiError
2299
+ }
2300
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2301
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1765
2302
  end
1766
2303
  end
1767
2304
 
@@ -1802,7 +2339,7 @@ module Schematic
1802
2339
  500 => Schematic::Types::ApiError
1803
2340
  }
1804
2341
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1805
- raise error_class.new(response.body, code: code, body: error_body)
2342
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1806
2343
  end
1807
2344
 
1808
2345
  # @param request_options [Hash]
@@ -1844,7 +2381,93 @@ module Schematic
1844
2381
  500 => Schematic::Types::ApiError
1845
2382
  }
1846
2383
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1847
- raise error_class.new(response.body, code: code, body: error_body)
2384
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2385
+ end
2386
+ end
2387
+
2388
+ # @param request_options [Hash]
2389
+ # @param params [Hash]
2390
+ # @option request_options [String] :base_url
2391
+ # @option request_options [Hash{String => Object}] :additional_headers
2392
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2393
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2394
+ # @option request_options [Integer] :timeout_in_seconds
2395
+ # @option params [String] :invoice_id
2396
+ #
2397
+ # @example
2398
+ # client.billing.reissue_native_invoice_link(invoice_id: "invoice_id")
2399
+ #
2400
+ # @return [Schematic::Billing::Types::ReissueNativeInvoiceLinkResponse]
2401
+ def reissue_native_invoice_link(request_options: {}, **params)
2402
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2403
+ request = Schematic::Internal::JSON::Request.new(
2404
+ base_url: request_options[:base_url],
2405
+ method: "POST",
2406
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/link/reissue",
2407
+ request_options: request_options
2408
+ )
2409
+ begin
2410
+ response = @client.send(request)
2411
+ rescue Net::HTTPRequestTimeout
2412
+ raise Schematic::Errors::TimeoutError
2413
+ end
2414
+ code = response.code.to_i
2415
+ if code.between?(200, 299)
2416
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::ReissueNativeInvoiceLinkResponse.load(response.body))
2417
+ else
2418
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2419
+ error_types = {
2420
+ 400 => Schematic::Types::ApiError,
2421
+ 401 => Schematic::Types::ApiError,
2422
+ 403 => Schematic::Types::ApiError,
2423
+ 404 => Schematic::Types::ApiError,
2424
+ 500 => Schematic::Types::ApiError
2425
+ }
2426
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2427
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2428
+ end
2429
+ end
2430
+
2431
+ # @param request_options [Hash]
2432
+ # @param params [Hash]
2433
+ # @option request_options [String] :base_url
2434
+ # @option request_options [Hash{String => Object}] :additional_headers
2435
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2436
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2437
+ # @option request_options [Integer] :timeout_in_seconds
2438
+ # @option params [String] :invoice_id
2439
+ #
2440
+ # @example
2441
+ # client.billing.revoke_native_invoice_link(invoice_id: "invoice_id")
2442
+ #
2443
+ # @return [Schematic::Billing::Types::RevokeNativeInvoiceLinkResponse]
2444
+ def revoke_native_invoice_link(request_options: {}, **params)
2445
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2446
+ request = Schematic::Internal::JSON::Request.new(
2447
+ base_url: request_options[:base_url],
2448
+ method: "POST",
2449
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/link/revoke",
2450
+ request_options: request_options
2451
+ )
2452
+ begin
2453
+ response = @client.send(request)
2454
+ rescue Net::HTTPRequestTimeout
2455
+ raise Schematic::Errors::TimeoutError
2456
+ end
2457
+ code = response.code.to_i
2458
+ if code.between?(200, 299)
2459
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::RevokeNativeInvoiceLinkResponse.load(response.body))
2460
+ else
2461
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2462
+ error_types = {
2463
+ 400 => Schematic::Types::ApiError,
2464
+ 401 => Schematic::Types::ApiError,
2465
+ 403 => Schematic::Types::ApiError,
2466
+ 404 => Schematic::Types::ApiError,
2467
+ 500 => Schematic::Types::ApiError
2468
+ }
2469
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2470
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1848
2471
  end
1849
2472
  end
1850
2473
 
@@ -1895,7 +2518,7 @@ module Schematic
1895
2518
  500 => Schematic::Types::ApiError
1896
2519
  }
1897
2520
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1898
- raise error_class.new(response.body, code: code, body: error_body)
2521
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1899
2522
  end
1900
2523
  end
1901
2524
 
@@ -1936,7 +2559,7 @@ module Schematic
1936
2559
  500 => Schematic::Types::ApiError
1937
2560
  }
1938
2561
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1939
- raise error_class.new(response.body, code: code, body: error_body)
2562
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1940
2563
  end
1941
2564
 
1942
2565
  # @param request_options [Hash]
@@ -1978,7 +2601,7 @@ module Schematic
1978
2601
  500 => Schematic::Types::ApiError
1979
2602
  }
1980
2603
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1981
- raise error_class.new(response.body, code: code, body: error_body)
2604
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1982
2605
  end
1983
2606
  end
1984
2607
 
@@ -2051,7 +2674,7 @@ module Schematic
2051
2674
  500 => Schematic::Types::ApiError
2052
2675
  }
2053
2676
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2054
- raise error_class.new(response.body, code: code, body: error_body)
2677
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
2055
2678
  end
2056
2679
  end
2057
2680
  end