orb-billing 0.1.0.pre.alpha.33

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 (635) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +169 -0
  3. data/lib/orb/client.rb +129 -0
  4. data/lib/orb/errors.rb +317 -0
  5. data/lib/orb/models/alert.rb +225 -0
  6. data/lib/orb/models/alert_create_for_customer_params.rb +77 -0
  7. data/lib/orb/models/alert_create_for_external_customer_params.rb +77 -0
  8. data/lib/orb/models/alert_create_for_subscription_params.rb +74 -0
  9. data/lib/orb/models/alert_disable_params.rb +26 -0
  10. data/lib/orb/models/alert_enable_params.rb +26 -0
  11. data/lib/orb/models/alert_list_params.rb +97 -0
  12. data/lib/orb/models/alert_retrieve_params.rb +19 -0
  13. data/lib/orb/models/alert_update_params.rb +46 -0
  14. data/lib/orb/models/amount_discount.rb +53 -0
  15. data/lib/orb/models/billable_metric.rb +76 -0
  16. data/lib/orb/models/billing_cycle_relative_date.rb +18 -0
  17. data/lib/orb/models/coupon.rb +86 -0
  18. data/lib/orb/models/coupon_archive_params.rb +19 -0
  19. data/lib/orb/models/coupon_create_params.rb +102 -0
  20. data/lib/orb/models/coupon_fetch_params.rb +19 -0
  21. data/lib/orb/models/coupon_list_params.rb +53 -0
  22. data/lib/orb/models/coupons/subscription_list_params.rb +40 -0
  23. data/lib/orb/models/credit_note.rb +522 -0
  24. data/lib/orb/models/credit_note_create_params.rb +77 -0
  25. data/lib/orb/models/credit_note_fetch_params.rb +19 -0
  26. data/lib/orb/models/credit_note_list_params.rb +73 -0
  27. data/lib/orb/models/customer.rb +872 -0
  28. data/lib/orb/models/customer_create_params.rb +843 -0
  29. data/lib/orb/models/customer_delete_params.rb +19 -0
  30. data/lib/orb/models/customer_fetch_by_external_id_params.rb +19 -0
  31. data/lib/orb/models/customer_fetch_params.rb +19 -0
  32. data/lib/orb/models/customer_list_params.rb +73 -0
  33. data/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rb +19 -0
  34. data/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rb +19 -0
  35. data/lib/orb/models/customer_update_by_external_id_params.rb +848 -0
  36. data/lib/orb/models/customer_update_params.rb +838 -0
  37. data/lib/orb/models/customers/balance_transaction_create_params.rb +53 -0
  38. data/lib/orb/models/customers/balance_transaction_create_response.rb +167 -0
  39. data/lib/orb/models/customers/balance_transaction_list_params.rb +75 -0
  40. data/lib/orb/models/customers/balance_transaction_list_response.rb +167 -0
  41. data/lib/orb/models/customers/cost_list_by_external_id_params.rb +69 -0
  42. data/lib/orb/models/customers/cost_list_by_external_id_response.rb +106 -0
  43. data/lib/orb/models/customers/cost_list_params.rb +69 -0
  44. data/lib/orb/models/customers/cost_list_response.rb +106 -0
  45. data/lib/orb/models/customers/credit_list_by_external_id_params.rb +59 -0
  46. data/lib/orb/models/customers/credit_list_by_external_id_response.rb +72 -0
  47. data/lib/orb/models/customers/credit_list_params.rb +59 -0
  48. data/lib/orb/models/customers/credit_list_response.rb +72 -0
  49. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +215 -0
  50. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +1311 -0
  51. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +214 -0
  52. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +1310 -0
  53. data/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rb +141 -0
  54. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +1310 -0
  55. data/lib/orb/models/customers/credits/ledger_list_params.rb +141 -0
  56. data/lib/orb/models/customers/credits/ledger_list_response.rb +1306 -0
  57. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +159 -0
  58. data/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rb +154 -0
  59. data/lib/orb/models/customers/credits/top_up_create_params.rb +158 -0
  60. data/lib/orb/models/customers/credits/top_up_create_response.rb +153 -0
  61. data/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rb +29 -0
  62. data/lib/orb/models/customers/credits/top_up_delete_params.rb +29 -0
  63. data/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rb +42 -0
  64. data/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rb +154 -0
  65. data/lib/orb/models/customers/credits/top_up_list_params.rb +42 -0
  66. data/lib/orb/models/customers/credits/top_up_list_response.rb +153 -0
  67. data/lib/orb/models/dimensional_price_group.rb +64 -0
  68. data/lib/orb/models/dimensional_price_group_create_params.rb +63 -0
  69. data/lib/orb/models/dimensional_price_group_list_params.rb +38 -0
  70. data/lib/orb/models/dimensional_price_group_retrieve_params.rb +19 -0
  71. data/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rb +21 -0
  72. data/lib/orb/models/dimensional_price_groups.rb +25 -0
  73. data/lib/orb/models/discount.rb +23 -0
  74. data/lib/orb/models/evaluate_price_group.rb +48 -0
  75. data/lib/orb/models/event_deprecate_params.rb +19 -0
  76. data/lib/orb/models/event_deprecate_response.rb +21 -0
  77. data/lib/orb/models/event_ingest_params.rb +100 -0
  78. data/lib/orb/models/event_ingest_response.rb +77 -0
  79. data/lib/orb/models/event_search_params.rb +45 -0
  80. data/lib/orb/models/event_search_response.rb +87 -0
  81. data/lib/orb/models/event_update_params.rb +58 -0
  82. data/lib/orb/models/event_update_response.rb +21 -0
  83. data/lib/orb/models/events/backfill_close_params.rb +21 -0
  84. data/lib/orb/models/events/backfill_close_response.rb +131 -0
  85. data/lib/orb/models/events/backfill_create_params.rb +97 -0
  86. data/lib/orb/models/events/backfill_create_response.rb +131 -0
  87. data/lib/orb/models/events/backfill_fetch_params.rb +21 -0
  88. data/lib/orb/models/events/backfill_fetch_response.rb +131 -0
  89. data/lib/orb/models/events/backfill_list_params.rb +40 -0
  90. data/lib/orb/models/events/backfill_list_response.rb +131 -0
  91. data/lib/orb/models/events/backfill_revert_params.rb +21 -0
  92. data/lib/orb/models/events/backfill_revert_response.rb +131 -0
  93. data/lib/orb/models/events/event_volumes.rb +54 -0
  94. data/lib/orb/models/events/volume_list_params.rb +64 -0
  95. data/lib/orb/models/invoice.rb +2218 -0
  96. data/lib/orb/models/invoice_create_params.rb +200 -0
  97. data/lib/orb/models/invoice_fetch_params.rb +19 -0
  98. data/lib/orb/models/invoice_fetch_upcoming_params.rb +25 -0
  99. data/lib/orb/models/invoice_fetch_upcoming_response.rb +2226 -0
  100. data/lib/orb/models/invoice_issue_params.rb +34 -0
  101. data/lib/orb/models/invoice_level_discount.rb +21 -0
  102. data/lib/orb/models/invoice_line_item_create_params.rb +62 -0
  103. data/lib/orb/models/invoice_line_item_create_response.rb +929 -0
  104. data/lib/orb/models/invoice_list_params.rb +197 -0
  105. data/lib/orb/models/invoice_mark_paid_params.rb +40 -0
  106. data/lib/orb/models/invoice_pay_params.rb +19 -0
  107. data/lib/orb/models/invoice_update_params.rb +28 -0
  108. data/lib/orb/models/invoice_void_params.rb +19 -0
  109. data/lib/orb/models/item.rb +82 -0
  110. data/lib/orb/models/item_create_params.rb +26 -0
  111. data/lib/orb/models/item_fetch_params.rb +19 -0
  112. data/lib/orb/models/item_list_params.rb +38 -0
  113. data/lib/orb/models/item_update_params.rb +73 -0
  114. data/lib/orb/models/metric_create_params.rb +56 -0
  115. data/lib/orb/models/metric_fetch_params.rb +19 -0
  116. data/lib/orb/models/metric_list_params.rb +73 -0
  117. data/lib/orb/models/metric_update_params.rb +28 -0
  118. data/lib/orb/models/pagination_metadata.rb +25 -0
  119. data/lib/orb/models/percentage_discount.rb +54 -0
  120. data/lib/orb/models/plan.rb +894 -0
  121. data/lib/orb/models/plan_create_params.rb +6702 -0
  122. data/lib/orb/models/plan_fetch_params.rb +19 -0
  123. data/lib/orb/models/plan_list_params.rb +100 -0
  124. data/lib/orb/models/plan_update_params.rb +37 -0
  125. data/lib/orb/models/plans/external_plan_id_fetch_params.rb +21 -0
  126. data/lib/orb/models/plans/external_plan_id_update_params.rb +39 -0
  127. data/lib/orb/models/price.rb +12229 -0
  128. data/lib/orb/models/price_create_params.rb +808 -0
  129. data/lib/orb/models/price_evaluate_params.rb +80 -0
  130. data/lib/orb/models/price_evaluate_response.rb +20 -0
  131. data/lib/orb/models/price_fetch_params.rb +19 -0
  132. data/lib/orb/models/price_list_params.rb +38 -0
  133. data/lib/orb/models/price_update_params.rb +28 -0
  134. data/lib/orb/models/prices/external_price_id_fetch_params.rb +21 -0
  135. data/lib/orb/models/prices/external_price_id_update_params.rb +30 -0
  136. data/lib/orb/models/subscription.rb +1233 -0
  137. data/lib/orb/models/subscription_cancel_params.rb +58 -0
  138. data/lib/orb/models/subscription_cancel_response.rb +1217 -0
  139. data/lib/orb/models/subscription_create_params.rb +15065 -0
  140. data/lib/orb/models/subscription_create_response.rb +1217 -0
  141. data/lib/orb/models/subscription_fetch_costs_params.rb +67 -0
  142. data/lib/orb/models/subscription_fetch_costs_response.rb +104 -0
  143. data/lib/orb/models/subscription_fetch_params.rb +19 -0
  144. data/lib/orb/models/subscription_fetch_schedule_params.rb +73 -0
  145. data/lib/orb/models/subscription_fetch_schedule_response.rb +68 -0
  146. data/lib/orb/models/subscription_fetch_usage_params.rb +135 -0
  147. data/lib/orb/models/subscription_list_params.rb +108 -0
  148. data/lib/orb/models/subscription_price_intervals_params.rb +8358 -0
  149. data/lib/orb/models/subscription_price_intervals_response.rb +1224 -0
  150. data/lib/orb/models/subscription_schedule_plan_change_params.rb +15088 -0
  151. data/lib/orb/models/subscription_schedule_plan_change_response.rb +1224 -0
  152. data/lib/orb/models/subscription_trigger_phase_params.rb +36 -0
  153. data/lib/orb/models/subscription_trigger_phase_response.rb +1224 -0
  154. data/lib/orb/models/subscription_unschedule_cancellation_params.rb +19 -0
  155. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +1224 -0
  156. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rb +26 -0
  157. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +1228 -0
  158. data/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rb +19 -0
  159. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +1224 -0
  160. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +90 -0
  161. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +1224 -0
  162. data/lib/orb/models/subscription_update_params.rb +74 -0
  163. data/lib/orb/models/subscription_update_trial_params.rb +59 -0
  164. data/lib/orb/models/subscription_update_trial_response.rb +1222 -0
  165. data/lib/orb/models/subscription_usage.rb +258 -0
  166. data/lib/orb/models/subscriptions.rb +25 -0
  167. data/lib/orb/models/top_level_ping_params.rb +19 -0
  168. data/lib/orb/models/top_level_ping_response.rb +20 -0
  169. data/lib/orb/models/trial_discount.rb +69 -0
  170. data/lib/orb/models/usage_discount.rb +54 -0
  171. data/lib/orb/page.rb +114 -0
  172. data/lib/orb/request_options.rb +75 -0
  173. data/lib/orb/resources/alerts.rb +239 -0
  174. data/lib/orb/resources/coupons/subscriptions.rb +43 -0
  175. data/lib/orb/resources/coupons.rb +115 -0
  176. data/lib/orb/resources/credit_notes.rb +87 -0
  177. data/lib/orb/resources/customers/balance_transactions.rb +96 -0
  178. data/lib/orb/resources/customers/costs.rb +298 -0
  179. data/lib/orb/resources/customers/credits/ledger.rb +527 -0
  180. data/lib/orb/resources/customers/credits/top_ups.rb +192 -0
  181. data/lib/orb/resources/customers/credits.rb +88 -0
  182. data/lib/orb/resources/customers.rb +321 -0
  183. data/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rb +38 -0
  184. data/lib/orb/resources/dimensional_price_groups.rb +93 -0
  185. data/lib/orb/resources/events/backfills.rb +174 -0
  186. data/lib/orb/resources/events/volume.rb +52 -0
  187. data/lib/orb/resources/events.rb +415 -0
  188. data/lib/orb/resources/invoice_line_items.rb +41 -0
  189. data/lib/orb/resources/invoices.rb +266 -0
  190. data/lib/orb/resources/items.rb +95 -0
  191. data/lib/orb/resources/metrics.rb +114 -0
  192. data/lib/orb/resources/plans/external_plan_id.rb +76 -0
  193. data/lib/orb/resources/plans.rb +133 -0
  194. data/lib/orb/resources/prices/external_price_id.rb +61 -0
  195. data/lib/orb/resources/prices.rb +197 -0
  196. data/lib/orb/resources/subscriptions.rb +1278 -0
  197. data/lib/orb/resources/top_level.rb +37 -0
  198. data/lib/orb/transport/base_client.rb +459 -0
  199. data/lib/orb/transport/pooled_net_requester.rb +182 -0
  200. data/lib/orb/type/array_of.rb +112 -0
  201. data/lib/orb/type/base_model.rb +367 -0
  202. data/lib/orb/type/base_page.rb +61 -0
  203. data/lib/orb/type/boolean_model.rb +52 -0
  204. data/lib/orb/type/converter.rb +217 -0
  205. data/lib/orb/type/enum.rb +101 -0
  206. data/lib/orb/type/hash_of.rb +132 -0
  207. data/lib/orb/type/request_parameters.rb +38 -0
  208. data/lib/orb/type/union.rb +225 -0
  209. data/lib/orb/type/unknown.rb +56 -0
  210. data/lib/orb/type.rb +23 -0
  211. data/lib/orb/util.rb +722 -0
  212. data/lib/orb/version.rb +5 -0
  213. data/lib/orb.rb +247 -0
  214. data/manifest.yaml +15 -0
  215. data/rbi/lib/orb/client.rbi +90 -0
  216. data/rbi/lib/orb/errors.rbi +246 -0
  217. data/rbi/lib/orb/models/alert.rbi +239 -0
  218. data/rbi/lib/orb/models/alert_create_for_customer_params.rbi +86 -0
  219. data/rbi/lib/orb/models/alert_create_for_external_customer_params.rbi +88 -0
  220. data/rbi/lib/orb/models/alert_create_for_subscription_params.rbi +83 -0
  221. data/rbi/lib/orb/models/alert_disable_params.rbi +28 -0
  222. data/rbi/lib/orb/models/alert_enable_params.rbi +28 -0
  223. data/rbi/lib/orb/models/alert_list_params.rbi +95 -0
  224. data/rbi/lib/orb/models/alert_retrieve_params.rbi +20 -0
  225. data/rbi/lib/orb/models/alert_update_params.rbi +51 -0
  226. data/rbi/lib/orb/models/amount_discount.rbi +62 -0
  227. data/rbi/lib/orb/models/billable_metric.rbi +83 -0
  228. data/rbi/lib/orb/models/billing_cycle_relative_date.rbi +19 -0
  229. data/rbi/lib/orb/models/coupon.rbi +90 -0
  230. data/rbi/lib/orb/models/coupon_archive_params.rbi +20 -0
  231. data/rbi/lib/orb/models/coupon_create_params.rbi +120 -0
  232. data/rbi/lib/orb/models/coupon_fetch_params.rbi +20 -0
  233. data/rbi/lib/orb/models/coupon_list_params.rbi +59 -0
  234. data/rbi/lib/orb/models/coupons/subscription_list_params.rbi +41 -0
  235. data/rbi/lib/orb/models/credit_note.rbi +546 -0
  236. data/rbi/lib/orb/models/credit_note_create_params.rbi +84 -0
  237. data/rbi/lib/orb/models/credit_note_fetch_params.rbi +20 -0
  238. data/rbi/lib/orb/models/credit_note_list_params.rbi +74 -0
  239. data/rbi/lib/orb/models/customer.rbi +941 -0
  240. data/rbi/lib/orb/models/customer_create_params.rbi +923 -0
  241. data/rbi/lib/orb/models/customer_delete_params.rbi +20 -0
  242. data/rbi/lib/orb/models/customer_fetch_by_external_id_params.rbi +20 -0
  243. data/rbi/lib/orb/models/customer_fetch_params.rbi +20 -0
  244. data/rbi/lib/orb/models/customer_list_params.rbi +74 -0
  245. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbi +20 -0
  246. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rbi +20 -0
  247. data/rbi/lib/orb/models/customer_update_by_external_id_params.rbi +945 -0
  248. data/rbi/lib/orb/models/customer_update_params.rbi +919 -0
  249. data/rbi/lib/orb/models/customers/balance_transaction_create_params.rbi +64 -0
  250. data/rbi/lib/orb/models/customers/balance_transaction_create_response.rbi +199 -0
  251. data/rbi/lib/orb/models/customers/balance_transaction_list_params.rbi +76 -0
  252. data/rbi/lib/orb/models/customers/balance_transaction_list_response.rbi +191 -0
  253. data/rbi/lib/orb/models/customers/cost_list_by_external_id_params.rbi +86 -0
  254. data/rbi/lib/orb/models/customers/cost_list_by_external_id_response.rbi +214 -0
  255. data/rbi/lib/orb/models/customers/cost_list_params.rbi +84 -0
  256. data/rbi/lib/orb/models/customers/cost_list_response.rbi +212 -0
  257. data/rbi/lib/orb/models/customers/credit_list_by_external_id_params.rbi +64 -0
  258. data/rbi/lib/orb/models/customers/credit_list_by_external_id_response.rbi +87 -0
  259. data/rbi/lib/orb/models/customers/credit_list_params.rbi +64 -0
  260. data/rbi/lib/orb/models/customers/credit_list_response.rbi +86 -0
  261. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +270 -0
  262. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +1670 -0
  263. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_params.rbi +238 -0
  264. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_response.rbi +1626 -0
  265. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rbi +181 -0
  266. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +1654 -0
  267. data/rbi/lib/orb/models/customers/credits/ledger_list_params.rbi +144 -0
  268. data/rbi/lib/orb/models/customers/credits/ledger_list_response.rbi +1588 -0
  269. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +196 -0
  270. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rbi +198 -0
  271. data/rbi/lib/orb/models/customers/credits/top_up_create_params.rbi +176 -0
  272. data/rbi/lib/orb/models/customers/credits/top_up_create_response.rbi +175 -0
  273. data/rbi/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rbi +31 -0
  274. data/rbi/lib/orb/models/customers/credits/top_up_delete_params.rbi +28 -0
  275. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rbi +49 -0
  276. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rbi +188 -0
  277. data/rbi/lib/orb/models/customers/credits/top_up_list_params.rbi +49 -0
  278. data/rbi/lib/orb/models/customers/credits/top_up_list_response.rbi +168 -0
  279. data/rbi/lib/orb/models/dimensional_price_group.rbi +75 -0
  280. data/rbi/lib/orb/models/dimensional_price_group_create_params.rbi +66 -0
  281. data/rbi/lib/orb/models/dimensional_price_group_list_params.rbi +39 -0
  282. data/rbi/lib/orb/models/dimensional_price_group_retrieve_params.rbi +20 -0
  283. data/rbi/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbi +22 -0
  284. data/rbi/lib/orb/models/dimensional_price_groups.rbi +35 -0
  285. data/rbi/lib/orb/models/discount.rbi +18 -0
  286. data/rbi/lib/orb/models/evaluate_price_group.rbi +45 -0
  287. data/rbi/lib/orb/models/event_deprecate_params.rbi +20 -0
  288. data/rbi/lib/orb/models/event_deprecate_response.rbi +19 -0
  289. data/rbi/lib/orb/models/event_ingest_params.rbi +120 -0
  290. data/rbi/lib/orb/models/event_ingest_response.rbi +79 -0
  291. data/rbi/lib/orb/models/event_search_params.rbi +53 -0
  292. data/rbi/lib/orb/models/event_search_response.rbi +100 -0
  293. data/rbi/lib/orb/models/event_update_params.rbi +71 -0
  294. data/rbi/lib/orb/models/event_update_response.rbi +19 -0
  295. data/rbi/lib/orb/models/events/backfill_close_params.rbi +22 -0
  296. data/rbi/lib/orb/models/events/backfill_close_response.rbi +127 -0
  297. data/rbi/lib/orb/models/events/backfill_create_params.rbi +97 -0
  298. data/rbi/lib/orb/models/events/backfill_create_response.rbi +128 -0
  299. data/rbi/lib/orb/models/events/backfill_fetch_params.rbi +22 -0
  300. data/rbi/lib/orb/models/events/backfill_fetch_response.rbi +127 -0
  301. data/rbi/lib/orb/models/events/backfill_list_params.rbi +41 -0
  302. data/rbi/lib/orb/models/events/backfill_list_response.rbi +127 -0
  303. data/rbi/lib/orb/models/events/backfill_revert_params.rbi +22 -0
  304. data/rbi/lib/orb/models/events/backfill_revert_response.rbi +128 -0
  305. data/rbi/lib/orb/models/events/event_volumes.rbi +47 -0
  306. data/rbi/lib/orb/models/events/volume_list_params.rbi +69 -0
  307. data/rbi/lib/orb/models/invoice.rbi +2466 -0
  308. data/rbi/lib/orb/models/invoice_create_params.rbi +230 -0
  309. data/rbi/lib/orb/models/invoice_fetch_params.rbi +20 -0
  310. data/rbi/lib/orb/models/invoice_fetch_upcoming_params.rbi +24 -0
  311. data/rbi/lib/orb/models/invoice_fetch_upcoming_response.rbi +2646 -0
  312. data/rbi/lib/orb/models/invoice_issue_params.rbi +32 -0
  313. data/rbi/lib/orb/models/invoice_level_discount.rbi +16 -0
  314. data/rbi/lib/orb/models/invoice_line_item_create_params.rbi +67 -0
  315. data/rbi/lib/orb/models/invoice_line_item_create_response.rbi +1164 -0
  316. data/rbi/lib/orb/models/invoice_list_params.rbi +187 -0
  317. data/rbi/lib/orb/models/invoice_mark_paid_params.rbi +48 -0
  318. data/rbi/lib/orb/models/invoice_pay_params.rbi +20 -0
  319. data/rbi/lib/orb/models/invoice_update_params.rbi +36 -0
  320. data/rbi/lib/orb/models/invoice_void_params.rbi +20 -0
  321. data/rbi/lib/orb/models/item.rbi +101 -0
  322. data/rbi/lib/orb/models/item_create_params.rbi +25 -0
  323. data/rbi/lib/orb/models/item_fetch_params.rbi +20 -0
  324. data/rbi/lib/orb/models/item_list_params.rbi +39 -0
  325. data/rbi/lib/orb/models/item_update_params.rbi +113 -0
  326. data/rbi/lib/orb/models/metric_create_params.rbi +62 -0
  327. data/rbi/lib/orb/models/metric_fetch_params.rbi +20 -0
  328. data/rbi/lib/orb/models/metric_list_params.rbi +74 -0
  329. data/rbi/lib/orb/models/metric_update_params.rbi +36 -0
  330. data/rbi/lib/orb/models/pagination_metadata.rbi +21 -0
  331. data/rbi/lib/orb/models/percentage_discount.rbi +63 -0
  332. data/rbi/lib/orb/models/plan.rbi +1071 -0
  333. data/rbi/lib/orb/models/plan_create_params.rbi +10069 -0
  334. data/rbi/lib/orb/models/plan_fetch_params.rbi +20 -0
  335. data/rbi/lib/orb/models/plan_list_params.rbi +100 -0
  336. data/rbi/lib/orb/models/plan_update_params.rbi +46 -0
  337. data/rbi/lib/orb/models/plans/external_plan_id_fetch_params.rbi +22 -0
  338. data/rbi/lib/orb/models/plans/external_plan_id_update_params.rbi +48 -0
  339. data/rbi/lib/orb/models/price.rbi +15341 -0
  340. data/rbi/lib/orb/models/price_create_params.rbi +885 -0
  341. data/rbi/lib/orb/models/price_evaluate_params.rbi +81 -0
  342. data/rbi/lib/orb/models/price_evaluate_response.rbi +21 -0
  343. data/rbi/lib/orb/models/price_fetch_params.rbi +20 -0
  344. data/rbi/lib/orb/models/price_list_params.rbi +39 -0
  345. data/rbi/lib/orb/models/price_update_params.rbi +36 -0
  346. data/rbi/lib/orb/models/prices/external_price_id_fetch_params.rbi +22 -0
  347. data/rbi/lib/orb/models/prices/external_price_id_update_params.rbi +38 -0
  348. data/rbi/lib/orb/models/subscription.rbi +1381 -0
  349. data/rbi/lib/orb/models/subscription_cancel_params.rbi +75 -0
  350. data/rbi/lib/orb/models/subscription_cancel_response.rbi +1374 -0
  351. data/rbi/lib/orb/models/subscription_create_params.rbi +23422 -0
  352. data/rbi/lib/orb/models/subscription_create_response.rbi +1374 -0
  353. data/rbi/lib/orb/models/subscription_fetch_costs_params.rbi +82 -0
  354. data/rbi/lib/orb/models/subscription_fetch_costs_response.rbi +210 -0
  355. data/rbi/lib/orb/models/subscription_fetch_params.rbi +20 -0
  356. data/rbi/lib/orb/models/subscription_fetch_schedule_params.rbi +74 -0
  357. data/rbi/lib/orb/models/subscription_fetch_schedule_response.rbi +81 -0
  358. data/rbi/lib/orb/models/subscription_fetch_usage_params.rbi +137 -0
  359. data/rbi/lib/orb/models/subscription_list_params.rbi +108 -0
  360. data/rbi/lib/orb/models/subscription_price_intervals_params.rbi +12991 -0
  361. data/rbi/lib/orb/models/subscription_price_intervals_response.rbi +1387 -0
  362. data/rbi/lib/orb/models/subscription_schedule_plan_change_params.rbi +23589 -0
  363. data/rbi/lib/orb/models/subscription_schedule_plan_change_response.rbi +1390 -0
  364. data/rbi/lib/orb/models/subscription_trigger_phase_params.rbi +45 -0
  365. data/rbi/lib/orb/models/subscription_trigger_phase_response.rbi +1381 -0
  366. data/rbi/lib/orb/models/subscription_unschedule_cancellation_params.rbi +20 -0
  367. data/rbi/lib/orb/models/subscription_unschedule_cancellation_response.rbi +1400 -0
  368. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbi +25 -0
  369. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +1451 -0
  370. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rbi +20 -0
  371. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +1410 -0
  372. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_params.rbi +104 -0
  373. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_response.rbi +1400 -0
  374. data/rbi/lib/orb/models/subscription_update_params.rbi +77 -0
  375. data/rbi/lib/orb/models/subscription_update_trial_params.rbi +63 -0
  376. data/rbi/lib/orb/models/subscription_update_trial_response.rbi +1378 -0
  377. data/rbi/lib/orb/models/subscription_usage.rbi +323 -0
  378. data/rbi/lib/orb/models/subscriptions.rbi +33 -0
  379. data/rbi/lib/orb/models/top_level_ping_params.rbi +20 -0
  380. data/rbi/lib/orb/models/top_level_ping_response.rbi +18 -0
  381. data/rbi/lib/orb/models/trial_discount.rbi +73 -0
  382. data/rbi/lib/orb/models/usage_discount.rbi +62 -0
  383. data/rbi/lib/orb/page.rbi +35 -0
  384. data/rbi/lib/orb/request_options.rbi +48 -0
  385. data/rbi/lib/orb/resources/alerts.rbi +216 -0
  386. data/rbi/lib/orb/resources/coupons/subscriptions.rbi +38 -0
  387. data/rbi/lib/orb/resources/coupons.rbi +96 -0
  388. data/rbi/lib/orb/resources/credit_notes.rbi +74 -0
  389. data/rbi/lib/orb/resources/customers/balance_transactions.rbi +92 -0
  390. data/rbi/lib/orb/resources/customers/costs.rbi +304 -0
  391. data/rbi/lib/orb/resources/customers/credits/ledger.rbi +645 -0
  392. data/rbi/lib/orb/resources/customers/credits/top_ups.rbi +180 -0
  393. data/rbi/lib/orb/resources/customers/credits.rbi +88 -0
  394. data/rbi/lib/orb/resources/customers.rbi +714 -0
  395. data/rbi/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbi +25 -0
  396. data/rbi/lib/orb/resources/dimensional_price_groups.rbi +78 -0
  397. data/rbi/lib/orb/resources/events/backfills.rbi +161 -0
  398. data/rbi/lib/orb/resources/events/volume.rbi +57 -0
  399. data/rbi/lib/orb/resources/events.rbi +408 -0
  400. data/rbi/lib/orb/resources/invoice_line_items.rbi +44 -0
  401. data/rbi/lib/orb/resources/invoices.rbi +262 -0
  402. data/rbi/lib/orb/resources/items.rbi +65 -0
  403. data/rbi/lib/orb/resources/metrics.rbi +102 -0
  404. data/rbi/lib/orb/resources/plans/external_plan_id.rbi +67 -0
  405. data/rbi/lib/orb/resources/plans.rbi +170 -0
  406. data/rbi/lib/orb/resources/prices/external_price_id.rbi +110 -0
  407. data/rbi/lib/orb/resources/prices.rbi +371 -0
  408. data/rbi/lib/orb/resources/subscriptions.rbi +1469 -0
  409. data/rbi/lib/orb/resources/top_level.rbi +25 -0
  410. data/rbi/lib/orb/transport/base_client.rbi +205 -0
  411. data/rbi/lib/orb/transport/pooled_net_requester.rbi +64 -0
  412. data/rbi/lib/orb/type/array_of.rbi +82 -0
  413. data/rbi/lib/orb/type/base_model.rbi +197 -0
  414. data/rbi/lib/orb/type/base_page.rbi +38 -0
  415. data/rbi/lib/orb/type/boolean_model.rbi +41 -0
  416. data/rbi/lib/orb/type/converter.rbi +95 -0
  417. data/rbi/lib/orb/type/enum.rbi +58 -0
  418. data/rbi/lib/orb/type/hash_of.rbi +86 -0
  419. data/rbi/lib/orb/type/request_parameters.rbi +20 -0
  420. data/rbi/lib/orb/type/union.rbi +66 -0
  421. data/rbi/lib/orb/type/unknown.rbi +37 -0
  422. data/rbi/lib/orb/type.rbi +23 -0
  423. data/rbi/lib/orb/util.rbi +278 -0
  424. data/rbi/lib/orb/version.rbi +5 -0
  425. data/sig/orb/client.rbs +53 -0
  426. data/sig/orb/errors.rbs +201 -0
  427. data/sig/orb/models/alert.rbs +142 -0
  428. data/sig/orb/models/alert_create_for_customer_params.rbs +56 -0
  429. data/sig/orb/models/alert_create_for_external_customer_params.rbs +56 -0
  430. data/sig/orb/models/alert_create_for_subscription_params.rbs +52 -0
  431. data/sig/orb/models/alert_disable_params.rbs +20 -0
  432. data/sig/orb/models/alert_enable_params.rbs +20 -0
  433. data/sig/orb/models/alert_list_params.rbs +57 -0
  434. data/sig/orb/models/alert_retrieve_params.rbs +14 -0
  435. data/sig/orb/models/alert_update_params.rbs +31 -0
  436. data/sig/orb/models/amount_discount.rbs +40 -0
  437. data/sig/orb/models/billable_metric.rbs +50 -0
  438. data/sig/orb/models/billing_cycle_relative_date.rbs +14 -0
  439. data/sig/orb/models/coupon.rbs +51 -0
  440. data/sig/orb/models/coupon_archive_params.rbs +14 -0
  441. data/sig/orb/models/coupon_create_params.rbs +77 -0
  442. data/sig/orb/models/coupon_fetch_params.rbs +14 -0
  443. data/sig/orb/models/coupon_list_params.rbs +37 -0
  444. data/sig/orb/models/coupons/subscription_list_params.rbs +27 -0
  445. data/sig/orb/models/credit_note.rbs +345 -0
  446. data/sig/orb/models/credit_note_create_params.rbs +57 -0
  447. data/sig/orb/models/credit_note_fetch_params.rbs +14 -0
  448. data/sig/orb/models/credit_note_list_params.rbs +45 -0
  449. data/sig/orb/models/customer.rbs +628 -0
  450. data/sig/orb/models/customer_create_params.rbs +624 -0
  451. data/sig/orb/models/customer_delete_params.rbs +14 -0
  452. data/sig/orb/models/customer_fetch_by_external_id_params.rbs +14 -0
  453. data/sig/orb/models/customer_fetch_params.rbs +14 -0
  454. data/sig/orb/models/customer_list_params.rbs +45 -0
  455. data/sig/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbs +15 -0
  456. data/sig/orb/models/customer_sync_payment_methods_from_gateway_params.rbs +15 -0
  457. data/sig/orb/models/customer_update_by_external_id_params.rbs +620 -0
  458. data/sig/orb/models/customer_update_params.rbs +620 -0
  459. data/sig/orb/models/customers/balance_transaction_create_params.rbs +44 -0
  460. data/sig/orb/models/customers/balance_transaction_create_response.rbs +114 -0
  461. data/sig/orb/models/customers/balance_transaction_list_params.rbs +47 -0
  462. data/sig/orb/models/customers/balance_transaction_list_response.rbs +114 -0
  463. data/sig/orb/models/customers/cost_list_by_external_id_params.rbs +48 -0
  464. data/sig/orb/models/customers/cost_list_by_external_id_response.rbs +82 -0
  465. data/sig/orb/models/customers/cost_list_params.rbs +48 -0
  466. data/sig/orb/models/customers/cost_list_response.rbs +80 -0
  467. data/sig/orb/models/customers/credit_list_by_external_id_params.rbs +41 -0
  468. data/sig/orb/models/customers/credit_list_by_external_id_response.rbs +55 -0
  469. data/sig/orb/models/customers/credit_list_params.rbs +41 -0
  470. data/sig/orb/models/customers/credit_list_response.rbs +55 -0
  471. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +120 -0
  472. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbs +814 -0
  473. data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +120 -0
  474. data/sig/orb/models/customers/credits/ledger_create_entry_response.rbs +814 -0
  475. data/sig/orb/models/customers/credits/ledger_list_by_external_id_params.rbs +99 -0
  476. data/sig/orb/models/customers/credits/ledger_list_by_external_id_response.rbs +814 -0
  477. data/sig/orb/models/customers/credits/ledger_list_params.rbs +99 -0
  478. data/sig/orb/models/customers/credits/ledger_list_response.rbs +814 -0
  479. data/sig/orb/models/customers/credits/top_up_create_by_external_id_params.rbs +95 -0
  480. data/sig/orb/models/customers/credits/top_up_create_by_external_id_response.rbs +90 -0
  481. data/sig/orb/models/customers/credits/top_up_create_params.rbs +95 -0
  482. data/sig/orb/models/customers/credits/top_up_create_response.rbs +90 -0
  483. data/sig/orb/models/customers/credits/top_up_delete_by_external_id_params.rbs +24 -0
  484. data/sig/orb/models/customers/credits/top_up_delete_params.rbs +24 -0
  485. data/sig/orb/models/customers/credits/top_up_list_by_external_id_params.rbs +29 -0
  486. data/sig/orb/models/customers/credits/top_up_list_by_external_id_response.rbs +90 -0
  487. data/sig/orb/models/customers/credits/top_up_list_params.rbs +29 -0
  488. data/sig/orb/models/customers/credits/top_up_list_response.rbs +90 -0
  489. data/sig/orb/models/dimensional_price_group.rbs +38 -0
  490. data/sig/orb/models/dimensional_price_group_create_params.rbs +39 -0
  491. data/sig/orb/models/dimensional_price_group_list_params.rbs +25 -0
  492. data/sig/orb/models/dimensional_price_group_retrieve_params.rbs +15 -0
  493. data/sig/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbs +17 -0
  494. data/sig/orb/models/dimensional_price_groups.rbs +22 -0
  495. data/sig/orb/models/discount.rbs +15 -0
  496. data/sig/orb/models/evaluate_price_group.rbs +34 -0
  497. data/sig/orb/models/event_deprecate_params.rbs +14 -0
  498. data/sig/orb/models/event_deprecate_response.rbs +13 -0
  499. data/sig/orb/models/event_ingest_params.rbs +68 -0
  500. data/sig/orb/models/event_ingest_response.rbs +53 -0
  501. data/sig/orb/models/event_search_params.rbs +31 -0
  502. data/sig/orb/models/event_search_response.rbs +55 -0
  503. data/sig/orb/models/event_update_params.rbs +39 -0
  504. data/sig/orb/models/event_update_response.rbs +13 -0
  505. data/sig/orb/models/events/backfill_close_params.rbs +16 -0
  506. data/sig/orb/models/events/backfill_close_response.rbs +73 -0
  507. data/sig/orb/models/events/backfill_create_params.rbs +51 -0
  508. data/sig/orb/models/events/backfill_create_response.rbs +73 -0
  509. data/sig/orb/models/events/backfill_fetch_params.rbs +16 -0
  510. data/sig/orb/models/events/backfill_fetch_response.rbs +73 -0
  511. data/sig/orb/models/events/backfill_list_params.rbs +27 -0
  512. data/sig/orb/models/events/backfill_list_response.rbs +73 -0
  513. data/sig/orb/models/events/backfill_revert_params.rbs +16 -0
  514. data/sig/orb/models/events/backfill_revert_response.rbs +73 -0
  515. data/sig/orb/models/events/event_volumes.rbs +39 -0
  516. data/sig/orb/models/events/volume_list_params.rbs +41 -0
  517. data/sig/orb/models/invoice.rbs +1430 -0
  518. data/sig/orb/models/invoice_create_params.rbs +120 -0
  519. data/sig/orb/models/invoice_fetch_params.rbs +14 -0
  520. data/sig/orb/models/invoice_fetch_upcoming_params.rbs +20 -0
  521. data/sig/orb/models/invoice_fetch_upcoming_response.rbs +1430 -0
  522. data/sig/orb/models/invoice_issue_params.rbs +21 -0
  523. data/sig/orb/models/invoice_level_discount.rbs +14 -0
  524. data/sig/orb/models/invoice_line_item_create_params.rbs +43 -0
  525. data/sig/orb/models/invoice_line_item_create_response.rbs +546 -0
  526. data/sig/orb/models/invoice_list_params.rbs +122 -0
  527. data/sig/orb/models/invoice_mark_paid_params.rbs +27 -0
  528. data/sig/orb/models/invoice_pay_params.rbs +14 -0
  529. data/sig/orb/models/invoice_update_params.rbs +20 -0
  530. data/sig/orb/models/invoice_void_params.rbs +14 -0
  531. data/sig/orb/models/item.rbs +72 -0
  532. data/sig/orb/models/item_create_params.rbs +19 -0
  533. data/sig/orb/models/item_fetch_params.rbs +14 -0
  534. data/sig/orb/models/item_list_params.rbs +25 -0
  535. data/sig/orb/models/item_update_params.rbs +69 -0
  536. data/sig/orb/models/metric_create_params.rbs +39 -0
  537. data/sig/orb/models/metric_fetch_params.rbs +14 -0
  538. data/sig/orb/models/metric_list_params.rbs +45 -0
  539. data/sig/orb/models/metric_update_params.rbs +20 -0
  540. data/sig/orb/models/pagination_metadata.rbs +15 -0
  541. data/sig/orb/models/percentage_discount.rbs +40 -0
  542. data/sig/orb/models/plan.rbs +529 -0
  543. data/sig/orb/models/plan_create_params.rbs +3991 -0
  544. data/sig/orb/models/plan_fetch_params.rbs +14 -0
  545. data/sig/orb/models/plan_list_params.rbs +65 -0
  546. data/sig/orb/models/plan_update_params.rbs +24 -0
  547. data/sig/orb/models/plans/external_plan_id_fetch_params.rbs +16 -0
  548. data/sig/orb/models/plans/external_plan_id_update_params.rbs +26 -0
  549. data/sig/orb/models/price.rbs +8108 -0
  550. data/sig/orb/models/price_create_params.rbs +520 -0
  551. data/sig/orb/models/price_evaluate_params.rbs +45 -0
  552. data/sig/orb/models/price_evaluate_response.rbs +14 -0
  553. data/sig/orb/models/price_fetch_params.rbs +14 -0
  554. data/sig/orb/models/price_list_params.rbs +25 -0
  555. data/sig/orb/models/price_update_params.rbs +20 -0
  556. data/sig/orb/models/prices/external_price_id_fetch_params.rbs +16 -0
  557. data/sig/orb/models/prices/external_price_id_update_params.rbs +22 -0
  558. data/sig/orb/models/subscription.rbs +687 -0
  559. data/sig/orb/models/subscription_cancel_params.rbs +44 -0
  560. data/sig/orb/models/subscription_cancel_response.rbs +687 -0
  561. data/sig/orb/models/subscription_create_params.rbs +9141 -0
  562. data/sig/orb/models/subscription_create_response.rbs +687 -0
  563. data/sig/orb/models/subscription_fetch_costs_params.rbs +46 -0
  564. data/sig/orb/models/subscription_fetch_costs_response.rbs +78 -0
  565. data/sig/orb/models/subscription_fetch_params.rbs +14 -0
  566. data/sig/orb/models/subscription_fetch_schedule_params.rbs +45 -0
  567. data/sig/orb/models/subscription_fetch_schedule_response.rbs +48 -0
  568. data/sig/orb/models/subscription_fetch_usage_params.rbs +80 -0
  569. data/sig/orb/models/subscription_list_params.rbs +69 -0
  570. data/sig/orb/models/subscription_price_intervals_params.rbs +5117 -0
  571. data/sig/orb/models/subscription_price_intervals_response.rbs +687 -0
  572. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +9133 -0
  573. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +687 -0
  574. data/sig/orb/models/subscription_trigger_phase_params.rbs +24 -0
  575. data/sig/orb/models/subscription_trigger_phase_response.rbs +687 -0
  576. data/sig/orb/models/subscription_unschedule_cancellation_params.rbs +15 -0
  577. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +687 -0
  578. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbs +20 -0
  579. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +687 -0
  580. data/sig/orb/models/subscription_unschedule_pending_plan_changes_params.rbs +15 -0
  581. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +687 -0
  582. data/sig/orb/models/subscription_update_fixed_fee_quantity_params.rbs +55 -0
  583. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +687 -0
  584. data/sig/orb/models/subscription_update_params.rbs +39 -0
  585. data/sig/orb/models/subscription_update_trial_params.rbs +39 -0
  586. data/sig/orb/models/subscription_update_trial_response.rbs +687 -0
  587. data/sig/orb/models/subscription_usage.rbs +196 -0
  588. data/sig/orb/models/subscriptions.rbs +22 -0
  589. data/sig/orb/models/top_level_ping_params.rbs +14 -0
  590. data/sig/orb/models/top_level_ping_response.rbs +13 -0
  591. data/sig/orb/models/trial_discount.rbs +44 -0
  592. data/sig/orb/models/usage_discount.rbs +40 -0
  593. data/sig/orb/page.rbs +22 -0
  594. data/sig/orb/request_options.rbs +32 -0
  595. data/sig/orb/resources/alerts.rbs +67 -0
  596. data/sig/orb/resources/coupons/subscriptions.rbs +16 -0
  597. data/sig/orb/resources/coupons.rbs +35 -0
  598. data/sig/orb/resources/credit_notes.rbs +29 -0
  599. data/sig/orb/resources/customers/balance_transactions.rbs +28 -0
  600. data/sig/orb/resources/customers/costs.rbs +27 -0
  601. data/sig/orb/resources/customers/credits/ledger.rbs +75 -0
  602. data/sig/orb/resources/customers/credits/top_ups.rbs +63 -0
  603. data/sig/orb/resources/customers/credits.rbs +31 -0
  604. data/sig/orb/resources/customers.rbs +114 -0
  605. data/sig/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbs +14 -0
  606. data/sig/orb/resources/dimensional_price_groups.rbs +29 -0
  607. data/sig/orb/resources/events/backfills.rbs +41 -0
  608. data/sig/orb/resources/events/volume.rbs +17 -0
  609. data/sig/orb/resources/events.rbs +40 -0
  610. data/sig/orb/resources/invoice_line_items.rbs +17 -0
  611. data/sig/orb/resources/invoices.rbs +84 -0
  612. data/sig/orb/resources/items.rbs +30 -0
  613. data/sig/orb/resources/metrics.rbs +37 -0
  614. data/sig/orb/resources/plans/external_plan_id.rbs +21 -0
  615. data/sig/orb/resources/plans.rbs +44 -0
  616. data/sig/orb/resources/prices/external_price_id.rbs +20 -0
  617. data/sig/orb/resources/prices.rbs +83 -0
  618. data/sig/orb/resources/subscriptions.rbs +194 -0
  619. data/sig/orb/resources/top_level.rbs +11 -0
  620. data/sig/orb/transport/base_client.rbs +110 -0
  621. data/sig/orb/transport/pooled_net_requester.rbs +39 -0
  622. data/sig/orb/type/array_of.rbs +36 -0
  623. data/sig/orb/type/base_model.rbs +77 -0
  624. data/sig/orb/type/base_page.rbs +22 -0
  625. data/sig/orb/type/boolean_model.rbs +18 -0
  626. data/sig/orb/type/converter.rbs +36 -0
  627. data/sig/orb/type/enum.rbs +22 -0
  628. data/sig/orb/type/hash_of.rbs +36 -0
  629. data/sig/orb/type/request_parameters.rbs +13 -0
  630. data/sig/orb/type/union.rbs +37 -0
  631. data/sig/orb/type/unknown.rbs +15 -0
  632. data/sig/orb/type.rbs +22 -0
  633. data/sig/orb/util.rbs +132 -0
  634. data/sig/orb/version.rbs +3 -0
  635. metadata +692 -0
@@ -0,0 +1,1469 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Subscriptions
6
+ # A subscription represents the purchase of a plan by a customer. The customer is
7
+ # identified by either the `customer_id` or the `external_customer_id`, and
8
+ # exactly one of these fields must be provided.
9
+ #
10
+ # By default, subscriptions begin on the day that they're created and renew
11
+ # automatically for each billing cycle at the cadence that's configured in the
12
+ # plan definition.
13
+ #
14
+ # The default configuration for subscriptions in Orb is **In-advance billing** and
15
+ # **Beginning of month alignment** (see
16
+ # [Subscription](/core-concepts##subscription) for more details).
17
+ #
18
+ # In order to change the alignment behavior, Orb also supports billing
19
+ # subscriptions on the day of the month they are created. If
20
+ # `align_billing_with_subscription_start_date = true` is specified, subscriptions
21
+ # have billing cycles that are aligned with their `start_date`. For example, a
22
+ # subscription that begins on January 15th will have a billing cycle from January
23
+ # 15th to February 15th. Every subsequent billing cycle will continue to start and
24
+ # invoice on the 15th.
25
+ #
26
+ # If the "day" value is greater than the number of days in the month, the next
27
+ # billing cycle will start at the end of the month. For example, if the start_date
28
+ # is January 31st, the next billing cycle will start on February 28th.
29
+ #
30
+ # If a customer was created with a currency, Orb only allows subscribing the
31
+ # customer to a plan with a matching `invoicing_currency`. If the customer does
32
+ # not have a currency set, on subscription creation, we set the customer's
33
+ # currency to be the `invoicing_currency` of the plan.
34
+ #
35
+ # ## Customize your customer's subscriptions
36
+ #
37
+ # Prices and adjustments in a plan can be added, removed, or replaced for the
38
+ # subscription being created. This is useful when a customer has prices that
39
+ # differ from the default prices for a specific plan.
40
+ #
41
+ # <Note>
42
+ # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
43
+ # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
44
+ # </Note>
45
+ #
46
+ # ### Adding Prices
47
+ #
48
+ # To add prices, provide a list of objects with the key `add_prices`. An object in
49
+ # the list must specify an existing add-on price with a `price_id` or
50
+ # `external_price_id` field, or create a new add-on price by including an object
51
+ # with the key `price`, identical to what would be used in the request body for
52
+ # the [create price endpoint](/api-reference/price/create-price). See the
53
+ # [Price resource](/product-catalog/price-configuration) for the specification of
54
+ # different price model configurations possible in this object.
55
+ #
56
+ # If the plan has phases, each object in the list must include a number with
57
+ # `plan_phase_order` key to indicate which phase the price should be added to.
58
+ #
59
+ # An object in the list can specify an optional `start_date` and optional
60
+ # `end_date`. This is equivalent to creating a price interval with the
61
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
62
+ # If unspecified, the start or end date of the phase or subscription will be used.
63
+ #
64
+ # An object in the list can specify an optional `minimum_amount`,
65
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
66
+ # to this price.
67
+ #
68
+ # Additionally, an object in the list can specify an optional `reference_id`. This
69
+ # ID can be used to reference this price when
70
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
71
+ # is _transient_ and cannot be used to refer to the price in future API calls.
72
+ #
73
+ # ### Removing Prices
74
+ #
75
+ # To remove prices, provide a list of objects with the key `remove_prices`. An
76
+ # object in the list must specify a plan price with either a `price_id` or
77
+ # `external_price_id` field.
78
+ #
79
+ # ### Replacing Prices
80
+ #
81
+ # To replace prices, provide a list of objects with the key `replace_prices`. An
82
+ # object in the list must specify a plan price to replace with the
83
+ # `replaces_price_id` key, and it must specify a price to replace it with by
84
+ # either referencing an existing add-on price with a `price_id` or
85
+ # `external_price_id` field, or by creating a new add-on price by including an
86
+ # object with the key `price`, identical to what would be used in the request body
87
+ # for the [create price endpoint](/api-reference/price/create-price). See the
88
+ # [Price resource](/product-catalog/price-configuration) for the specification of
89
+ # different price model configurations possible in this object.
90
+ #
91
+ # For fixed fees, an object in the list can supply a `fixed_price_quantity`
92
+ # instead of a `price`, `price_id`, or `external_price_id` field. This will update
93
+ # only the quantity for the price, similar to the
94
+ # [Update price quantity](/api-reference/subscription/update-price-quantity)
95
+ # endpoint.
96
+ #
97
+ # The replacement price will have the same phase, if applicable, and the same
98
+ # start and end dates as the price it replaces.
99
+ #
100
+ # An object in the list can specify an optional `minimum_amount`,
101
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
102
+ # to this price.
103
+ #
104
+ # Additionally, an object in the list can specify an optional `reference_id`. This
105
+ # ID can be used to reference the replacement price when
106
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
107
+ # is _transient_ and cannot be used to refer to the price in future API calls.
108
+ #
109
+ # ### Adding adjustments
110
+ #
111
+ # To add adjustments, provide a list of objects with the key `add_adjustments`. An
112
+ # object in the list must include an object with the key `adjustment`, identical
113
+ # to the adjustment object in the
114
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
115
+ #
116
+ # If the plan has phases, each object in the list must include a number with
117
+ # `plan_phase_order` key to indicate which phase the adjustment should be added
118
+ # to.
119
+ #
120
+ # An object in the list can specify an optional `start_date` and optional
121
+ # `end_date`. If unspecified, the start or end date of the phase or subscription
122
+ # will be used.
123
+ #
124
+ # ### Removing adjustments
125
+ #
126
+ # To remove adjustments, provide a list of objects with the key
127
+ # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
128
+ # with the ID of the adjustment to be removed.
129
+ #
130
+ # ### Replacing adjustments
131
+ #
132
+ # To replace adjustments, provide a list of objects with the key
133
+ # `replace_adjustments`. An object in the list must specify a plan adjustment to
134
+ # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
135
+ # to replace it with by including an object with the key `adjustment`, identical
136
+ # to the adjustment object in the
137
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
138
+ #
139
+ # The replacement adjustment will have the same phase, if applicable, and the same
140
+ # start and end dates as the adjustment it replaces.
141
+ #
142
+ # ## Price overrides (DEPRECATED)
143
+ #
144
+ # <Note>
145
+ # Price overrides are being phased out in favor adding/removing/replacing prices. (See
146
+ # [Customize your customer's subscriptions](/api-reference/subscription/create-subscription))
147
+ # </Note>
148
+ #
149
+ # Price overrides are used to update some or all prices in a plan for the specific
150
+ # subscription being created. This is useful when a new customer has negotiated a
151
+ # rate that is unique to the customer.
152
+ #
153
+ # To override prices, provide a list of objects with the key `price_overrides`.
154
+ # The price object in the list of overrides is expected to contain the existing
155
+ # price id, the `model_type` and configuration. (See the
156
+ # [Price resource](/product-catalog/price-configuration) for the specification of
157
+ # different price model configurations.) The numerical values can be updated, but
158
+ # the billable metric, cadence, type, and name of a price can not be overridden.
159
+ #
160
+ # ### Maximums and Minimums
161
+ #
162
+ # Minimums and maximums, much like price overrides, can be useful when a new
163
+ # customer has negotiated a new or different minimum or maximum spend cap than the
164
+ # default for a given price. If one exists for a price and null is provided for
165
+ # the minimum/maximum override on creation, then there will be no minimum/maximum
166
+ # on the new subscription. If no value is provided, then the default price maximum
167
+ # or minimum is used.
168
+ #
169
+ # To add a minimum for a specific price, add `minimum_amount` to the specific
170
+ # price in the `price_overrides` object.
171
+ #
172
+ # To add a maximum for a specific price, add `maximum_amount` to the specific
173
+ # price in the `price_overrides` object.
174
+ #
175
+ # ### Minimum override example
176
+ #
177
+ # Price minimum override example:
178
+ #
179
+ # ```json
180
+ # {
181
+ # ...
182
+ # "id": "price_id",
183
+ # "model_type": "unit",
184
+ # "unit_config": {
185
+ # "unit_amount": "0.50"
186
+ # },
187
+ # "minimum_amount": "100.00"
188
+ # ...
189
+ # }
190
+ # ```
191
+ #
192
+ # Removing an existing minimum example
193
+ #
194
+ # ```json
195
+ # {
196
+ # ...
197
+ # "id": "price_id",
198
+ # "model_type": "unit",
199
+ # "unit_config": {
200
+ # "unit_amount": "0.50"
201
+ # },
202
+ # "minimum_amount": null
203
+ # ...
204
+ # }
205
+ # ```
206
+ #
207
+ # ### Discounts
208
+ #
209
+ # Discounts, like price overrides, can be useful when a new customer has
210
+ # negotiated a new or different discount than the default for a price. If a
211
+ # discount exists for a price and a null discount is provided on creation, then
212
+ # there will be no discount on the new subscription.
213
+ #
214
+ # To add a discount for a specific price, add `discount` to the price in the
215
+ # `price_overrides` object. Discount should be a dictionary of the format:
216
+ #
217
+ # ```ts
218
+ # {
219
+ # "discount_type": "amount" | "percentage" | "usage",
220
+ # "amount_discount": string,
221
+ # "percentage_discount": string,
222
+ # "usage_discount": string
223
+ # }
224
+ # ```
225
+ #
226
+ # where either `amount_discount`, `percentage_discount`, or `usage_discount` is
227
+ # provided.
228
+ #
229
+ # Price discount example
230
+ #
231
+ # ```json
232
+ # {
233
+ # ...
234
+ # "id": "price_id",
235
+ # "model_type": "unit",
236
+ # "unit_config": {
237
+ # "unit_amount": "0.50"
238
+ # },
239
+ # "discount": {"discount_type": "amount", "amount_discount": "175"},
240
+ # }
241
+ # ```
242
+ #
243
+ # Removing an existing discount example
244
+ #
245
+ # ```json
246
+ # {
247
+ # "customer_id": "customer_id",
248
+ # "plan_id": "plan_id",
249
+ # "discount": null,
250
+ # "price_overrides": [ ... ]
251
+ # ...
252
+ # }
253
+ # ```
254
+ #
255
+ # ## Threshold Billing
256
+ #
257
+ # Orb supports invoicing for a subscription when a preconfigured usage threshold
258
+ # is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
259
+ # specified in the subscription's invoicing currency, when creating a
260
+ # subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
261
+ # $10.00 for a subscription that invoices in USD.
262
+ sig do
263
+ params(
264
+ add_adjustments: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::AddAdjustment, Orb::Util::AnyHash)]),
265
+ add_prices: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::AddPrice, Orb::Util::AnyHash)]),
266
+ align_billing_with_subscription_start_date: T::Boolean,
267
+ auto_collection: T.nilable(T::Boolean),
268
+ aws_region: T.nilable(String),
269
+ billing_cycle_anchor_configuration: T.nilable(
270
+ T.any(Orb::Models::SubscriptionCreateParams::BillingCycleAnchorConfiguration, Orb::Util::AnyHash)
271
+ ),
272
+ coupon_redemption_code: T.nilable(String),
273
+ credits_overage_rate: T.nilable(Float),
274
+ customer_id: T.nilable(String),
275
+ default_invoice_memo: T.nilable(String),
276
+ end_date: T.nilable(Time),
277
+ external_customer_id: T.nilable(String),
278
+ external_marketplace: T.nilable(Orb::Models::SubscriptionCreateParams::ExternalMarketplace::OrSymbol),
279
+ external_marketplace_reporting_id: T.nilable(String),
280
+ external_plan_id: T.nilable(String),
281
+ filter: T.nilable(String),
282
+ initial_phase_order: T.nilable(Integer),
283
+ invoicing_threshold: T.nilable(String),
284
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
285
+ net_terms: T.nilable(Integer),
286
+ per_credit_overage_amount: T.nilable(Float),
287
+ plan_id: T.nilable(String),
288
+ plan_version_number: T.nilable(Integer),
289
+ price_overrides: T.nilable(T::Array[T.anything]),
290
+ remove_adjustments: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::RemoveAdjustment, Orb::Util::AnyHash)]),
291
+ remove_prices: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::RemovePrice, Orb::Util::AnyHash)]),
292
+ replace_adjustments: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::ReplaceAdjustment, Orb::Util::AnyHash)]),
293
+ replace_prices: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::ReplacePrice, Orb::Util::AnyHash)]),
294
+ start_date: T.nilable(Time),
295
+ trial_duration_days: T.nilable(Integer),
296
+ usage_customer_ids: T.nilable(T::Array[String]),
297
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
298
+ )
299
+ .returns(Orb::Models::SubscriptionCreateResponse)
300
+ end
301
+ def create(
302
+ # Additional adjustments to be added to the subscription. (Only available for
303
+ # accounts that have migrated off of legacy subscription overrides)
304
+ add_adjustments: nil,
305
+ # Additional prices to be added to the subscription. (Only available for accounts
306
+ # that have migrated off of legacy subscription overrides)
307
+ add_prices: nil,
308
+ align_billing_with_subscription_start_date: nil,
309
+ # Determines whether issued invoices for this subscription will automatically be
310
+ # charged with the saved payment method on the due date. If not specified, this
311
+ # defaults to the behavior configured for this customer.
312
+ auto_collection: nil,
313
+ aws_region: nil,
314
+ billing_cycle_anchor_configuration: nil,
315
+ # Redemption code to be used for this subscription. If the coupon cannot be found
316
+ # by its redemption code, or cannot be redeemed, an error response will be
317
+ # returned and the subscription creation or plan change will not be scheduled.
318
+ coupon_redemption_code: nil,
319
+ credits_overage_rate: nil,
320
+ customer_id: nil,
321
+ # Determines the default memo on this subscription's invoices. Note that if this
322
+ # is not provided, it is determined by the plan configuration.
323
+ default_invoice_memo: nil,
324
+ end_date: nil,
325
+ external_customer_id: nil,
326
+ external_marketplace: nil,
327
+ external_marketplace_reporting_id: nil,
328
+ # The external_plan_id of the plan that the given subscription should be switched
329
+ # to. Note that either this property or `plan_id` must be specified.
330
+ external_plan_id: nil,
331
+ # An additional filter to apply to usage queries. This filter must be expressed as
332
+ # a boolean
333
+ # [computed property](/extensibility/advanced-metrics#computed-properties). If
334
+ # null, usage queries will not include any additional filter.
335
+ filter: nil,
336
+ # The phase of the plan to start with
337
+ initial_phase_order: nil,
338
+ # When this subscription's accrued usage reaches this threshold, an invoice will
339
+ # be issued for the subscription. If not specified, invoices will only be issued
340
+ # at the end of the billing period.
341
+ invoicing_threshold: nil,
342
+ # User-specified key/value pairs for the resource. Individual keys can be removed
343
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
344
+ # by setting `metadata` to `null`.
345
+ metadata: nil,
346
+ # The net terms determines the difference between the invoice date and the issue
347
+ # date for the invoice. If you intend the invoice to be due on issue, set this
348
+ # to 0. If not provided, this defaults to the value specified in the plan.
349
+ net_terms: nil,
350
+ per_credit_overage_amount: nil,
351
+ # The plan that the given subscription should be switched to. Note that either
352
+ # this property or `external_plan_id` must be specified.
353
+ plan_id: nil,
354
+ # Specifies which version of the plan to subscribe to. If null, the default
355
+ # version will be used.
356
+ plan_version_number: nil,
357
+ # Optionally provide a list of overrides for prices on the plan
358
+ price_overrides: nil,
359
+ # Plan adjustments to be removed from the subscription. (Only available for
360
+ # accounts that have migrated off of legacy subscription overrides)
361
+ remove_adjustments: nil,
362
+ # Plan prices to be removed from the subscription. (Only available for accounts
363
+ # that have migrated off of legacy subscription overrides)
364
+ remove_prices: nil,
365
+ # Plan adjustments to be replaced with additional adjustments on the subscription.
366
+ # (Only available for accounts that have migrated off of legacy subscription
367
+ # overrides)
368
+ replace_adjustments: nil,
369
+ # Plan prices to be replaced with additional prices on the subscription. (Only
370
+ # available for accounts that have migrated off of legacy subscription overrides)
371
+ replace_prices: nil,
372
+ start_date: nil,
373
+ # The duration of the trial period in days. If not provided, this defaults to the
374
+ # value specified in the plan. If `0` is provided, the trial on the plan will be
375
+ # skipped.
376
+ trial_duration_days: nil,
377
+ # A list of customer IDs whose usage events will be aggregated and billed under
378
+ # this subscription. By default, a subscription only considers usage events
379
+ # associated with its attached customer's customer_id. When usage_customer_ids is
380
+ # provided, the subscription includes usage events from the specified customers
381
+ # only. Provided usage_customer_ids must be either the customer for this
382
+ # subscription itself, or any of that customer's children.
383
+ usage_customer_ids: nil,
384
+ request_options: {}
385
+ )
386
+ end
387
+
388
+ # This endpoint can be used to update the `metadata`, `net terms`,
389
+ # `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
390
+ # on a subscription.
391
+ sig do
392
+ params(
393
+ subscription_id: String,
394
+ auto_collection: T.nilable(T::Boolean),
395
+ default_invoice_memo: T.nilable(String),
396
+ invoicing_threshold: T.nilable(String),
397
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
398
+ net_terms: T.nilable(Integer),
399
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
400
+ )
401
+ .returns(Orb::Models::Subscription)
402
+ end
403
+ def update(
404
+ subscription_id,
405
+ # Determines whether issued invoices for this subscription will automatically be
406
+ # charged with the saved payment method on the due date. This property defaults to
407
+ # the plan's behavior.
408
+ auto_collection: nil,
409
+ # Determines the default memo on this subscription's invoices. Note that if this
410
+ # is not provided, it is determined by the plan configuration.
411
+ default_invoice_memo: nil,
412
+ # When this subscription's accrued usage reaches this threshold, an invoice will
413
+ # be issued for the subscription. If not specified, invoices will only be issued
414
+ # at the end of the billing period.
415
+ invoicing_threshold: nil,
416
+ # User-specified key/value pairs for the resource. Individual keys can be removed
417
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
418
+ # by setting `metadata` to `null`.
419
+ metadata: nil,
420
+ # Determines the difference between the invoice issue date for subscription
421
+ # invoices as the date that they are due. A value of `0` here represents that the
422
+ # invoice is due on issue, whereas a value of `30` represents that the customer
423
+ # has a month to pay the invoice.
424
+ net_terms: nil,
425
+ request_options: {}
426
+ )
427
+ end
428
+
429
+ # This endpoint returns a list of all subscriptions for an account as a
430
+ # [paginated](/api-reference/pagination) list, ordered starting from the most
431
+ # recently created subscription. For a full discussion of the subscription
432
+ # resource, see [Subscription](/core-concepts##subscription).
433
+ #
434
+ # Subscriptions can be filtered for a specific customer by using either the
435
+ # customer_id or external_customer_id query parameters. To filter subscriptions
436
+ # for multiple customers, use the customer_id[] or external_customer_id[] query
437
+ # parameters.
438
+ sig do
439
+ params(
440
+ created_at_gt: T.nilable(Time),
441
+ created_at_gte: T.nilable(Time),
442
+ created_at_lt: T.nilable(Time),
443
+ created_at_lte: T.nilable(Time),
444
+ cursor: T.nilable(String),
445
+ customer_id: T.nilable(T::Array[String]),
446
+ external_customer_id: T.nilable(T::Array[String]),
447
+ limit: Integer,
448
+ status: T.nilable(Orb::Models::SubscriptionListParams::Status::OrSymbol),
449
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
450
+ )
451
+ .returns(Orb::Page[Orb::Models::Subscription])
452
+ end
453
+ def list(
454
+ created_at_gt: nil,
455
+ created_at_gte: nil,
456
+ created_at_lt: nil,
457
+ created_at_lte: nil,
458
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
459
+ # from the initial request.
460
+ cursor: nil,
461
+ customer_id: nil,
462
+ external_customer_id: nil,
463
+ # The number of items to fetch. Defaults to 20.
464
+ limit: nil,
465
+ status: nil,
466
+ request_options: {}
467
+ )
468
+ end
469
+
470
+ # This endpoint can be used to cancel an existing subscription. It returns the
471
+ # serialized subscription object with an `end_date` parameter that signifies when
472
+ # the subscription will transition to an ended state.
473
+ #
474
+ # The body parameter `cancel_option` determines the cancellation behavior. Orb
475
+ # supports three cancellation options:
476
+ #
477
+ # - `end_of_subscription_term`: stops the subscription from auto-renewing.
478
+ # Subscriptions that have been cancelled with this option can still incur
479
+ # charges for the remainder of their term:
480
+ #
481
+ # - Issuing this cancellation request for a monthly subscription will keep the
482
+ # subscription active until the start of the subsequent month, and potentially
483
+ # issue an invoice for any usage charges incurred in the intervening period.
484
+ # - Issuing this cancellation request for a quarterly subscription will keep the
485
+ # subscription active until the end of the quarter and potentially issue an
486
+ # invoice for any usage charges incurred in the intervening period.
487
+ # - Issuing this cancellation request for a yearly subscription will keep the
488
+ # subscription active for the full year. For example, a yearly subscription
489
+ # starting on 2021-11-01 and cancelled on 2021-12-08 will remain active until
490
+ # 2022-11-01 and potentially issue charges in the intervening months for any
491
+ # recurring monthly usage charges in its plan.
492
+ # - **Note**: If a subscription's plan contains prices with difference cadences,
493
+ # the end of term date will be determined by the largest cadence value. For
494
+ # example, cancelling end of term for a subscription with a quarterly fixed
495
+ # fee with a monthly usage fee will result in the subscription ending at the
496
+ # end of the quarter.
497
+ #
498
+ # - `immediate`: ends the subscription immediately, setting the `end_date` to the
499
+ # current time:
500
+ #
501
+ # - Subscriptions that have been cancelled with this option will be invoiced
502
+ # immediately. This invoice will include any usage fees incurred in the
503
+ # billing period up to the cancellation, along with any prorated recurring
504
+ # fees for the billing period, if applicable.
505
+ # - **Note**: If the subscription has a recurring fee that was paid in-advance,
506
+ # the prorated amount for the remaining time period will be added to the
507
+ # [customer's balance](list-balance-transactions) upon immediate cancellation.
508
+ # However, if the customer is ineligible to use the customer balance, the
509
+ # subscription cannot be cancelled immediately.
510
+ #
511
+ # - `requested_date`: ends the subscription on a specified date, which requires a
512
+ # `cancellation_date` to be passed in. If no timezone is provided, the
513
+ # customer's timezone is used. For example, a subscription starting on January
514
+ # 1st with a monthly price can be set to be cancelled on the first of any month
515
+ # after January 1st (e.g. March 1st, April 1st, May 1st). A subscription with
516
+ # multiple prices with different cadences defines the "term" to be the highest
517
+ # cadence of the prices.
518
+ #
519
+ # Upcoming subscriptions are only eligible for immediate cancellation, which will
520
+ # set the `end_date` equal to the `start_date` upon cancellation.
521
+ #
522
+ # ## Backdated cancellations
523
+ #
524
+ # Orb allows you to cancel a subscription in the past as long as there are no paid
525
+ # invoices between the `requested_date` and the current time. If the cancellation
526
+ # is after the latest issued invoice, Orb will generate a balance refund for the
527
+ # current period. If the cancellation is before the most recently issued invoice,
528
+ # Orb will void the intervening invoice and generate a new one based on the new
529
+ # dates for the subscription. See the section on
530
+ # [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
531
+ sig do
532
+ params(
533
+ subscription_id: String,
534
+ cancel_option: Orb::Models::SubscriptionCancelParams::CancelOption::OrSymbol,
535
+ allow_invoice_credit_or_void: T.nilable(T::Boolean),
536
+ cancellation_date: T.nilable(Time),
537
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
538
+ )
539
+ .returns(Orb::Models::SubscriptionCancelResponse)
540
+ end
541
+ def cancel(
542
+ subscription_id,
543
+ # Determines the timing of subscription cancellation
544
+ cancel_option:,
545
+ # If false, this request will fail if it would void an issued invoice or create a
546
+ # credit note. Consider using this as a safety mechanism if you do not expect
547
+ # existing invoices to be changed.
548
+ allow_invoice_credit_or_void: nil,
549
+ # The date that the cancellation should take effect. This parameter can only be
550
+ # passed if the `cancel_option` is `requested_date`.
551
+ cancellation_date: nil,
552
+ request_options: {}
553
+ )
554
+ end
555
+
556
+ # This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
557
+ # given an identifier.
558
+ sig do
559
+ params(
560
+ subscription_id: String,
561
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
562
+ )
563
+ .returns(Orb::Models::Subscription)
564
+ end
565
+ def fetch(subscription_id, request_options: {})
566
+ end
567
+
568
+ # This endpoint is used to fetch a day-by-day snapshot of a subscription's costs
569
+ # in Orb, calculated by applying pricing information to the underlying usage (see
570
+ # the [subscription usage endpoint](fetch-subscription-usage) to fetch usage per
571
+ # metric, in usage units rather than a currency).
572
+ #
573
+ # The semantics of this endpoint exactly mirror those of
574
+ # [fetching a customer's costs](fetch-customer-costs). Use this endpoint to limit
575
+ # your analysis of costs to a specific subscription for the customer (e.g. to
576
+ # de-aggregate costs when a customer's subscription has started and stopped on the
577
+ # same day).
578
+ sig do
579
+ params(
580
+ subscription_id: String,
581
+ currency: T.nilable(String),
582
+ timeframe_end: T.nilable(Time),
583
+ timeframe_start: T.nilable(Time),
584
+ view_mode: T.nilable(Orb::Models::SubscriptionFetchCostsParams::ViewMode::OrSymbol),
585
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
586
+ )
587
+ .returns(Orb::Models::SubscriptionFetchCostsResponse)
588
+ end
589
+ def fetch_costs(
590
+ subscription_id,
591
+ # The currency or custom pricing unit to use.
592
+ currency: nil,
593
+ # Costs returned are exclusive of `timeframe_end`.
594
+ timeframe_end: nil,
595
+ # Costs returned are inclusive of `timeframe_start`.
596
+ timeframe_start: nil,
597
+ # Controls whether Orb returns cumulative costs since the start of the billing
598
+ # period, or incremental day-by-day costs. If your customer has minimums or
599
+ # discounts, it's strongly recommended that you use the default cumulative
600
+ # behavior.
601
+ view_mode: nil,
602
+ request_options: {}
603
+ )
604
+ end
605
+
606
+ # This endpoint returns a [paginated](/api-reference/pagination) list of all plans
607
+ # associated with a subscription along with their start and end dates. This list
608
+ # contains the subscription's initial plan along with past and future plan
609
+ # changes.
610
+ sig do
611
+ params(
612
+ subscription_id: String,
613
+ cursor: T.nilable(String),
614
+ limit: Integer,
615
+ start_date_gt: T.nilable(Time),
616
+ start_date_gte: T.nilable(Time),
617
+ start_date_lt: T.nilable(Time),
618
+ start_date_lte: T.nilable(Time),
619
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
620
+ )
621
+ .returns(Orb::Page[Orb::Models::SubscriptionFetchScheduleResponse])
622
+ end
623
+ def fetch_schedule(
624
+ subscription_id,
625
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
626
+ # from the initial request.
627
+ cursor: nil,
628
+ # The number of items to fetch. Defaults to 20.
629
+ limit: nil,
630
+ start_date_gt: nil,
631
+ start_date_gte: nil,
632
+ start_date_lt: nil,
633
+ start_date_lte: nil,
634
+ request_options: {}
635
+ )
636
+ end
637
+
638
+ # This endpoint is used to fetch a subscription's usage in Orb. Especially when
639
+ # combined with optional query parameters, this endpoint is a powerful way to
640
+ # build visualizations on top of Orb's event data and metrics.
641
+ #
642
+ # With no query parameters specified, this endpoint returns usage for the
643
+ # subscription's _current billing period_ across each billable metric that
644
+ # participates in the subscription. Usage quantities returned are the result of
645
+ # evaluating the metric definition for the entirety of the customer's billing
646
+ # period.
647
+ #
648
+ # ### Default response shape
649
+ #
650
+ # Orb returns a `data` array with an object corresponding to each billable metric.
651
+ # Nested within this object is a `usage` array which has a `quantity` value and a
652
+ # corresponding `timeframe_start` and `timeframe_end`. The `quantity` value
653
+ # represents the calculated usage value for the billable metric over the specified
654
+ # timeframe (inclusive of the `timeframe_start` timestamp and exclusive of the
655
+ # `timeframe_end` timestamp).
656
+ #
657
+ # Orb will include _every_ window in the response starting from the beginning of
658
+ # the billing period, even when there were no events (and therefore no usage) in
659
+ # the window. This increases the size of the response but prevents the caller from
660
+ # filling in gaps and handling cumbersome time-based logic.
661
+ #
662
+ # The query parameters in this endpoint serve to override this behavior and
663
+ # provide some key functionality, as listed below. Note that this functionality
664
+ # can also be used _in conjunction_ with each other, e.g. to display grouped usage
665
+ # on a custom timeframe.
666
+ #
667
+ # ## Custom timeframe
668
+ #
669
+ # In order to view usage for a custom timeframe rather than the current billing
670
+ # period, specify a `timeframe_start` and `timeframe_end`. This will calculate
671
+ # quantities for usage incurred between timeframe_start (inclusive) and
672
+ # timeframe_end (exclusive), i.e. `[timeframe_start, timeframe_end)`.
673
+ #
674
+ # Note:
675
+ #
676
+ # - These timestamps must be specified in ISO 8601 format and UTC timezone, e.g.
677
+ # `2022-02-01T05:00:00Z`.
678
+ # - Both parameters must be specified if either is specified.
679
+ #
680
+ # ## Grouping by custom attributes
681
+ #
682
+ # In order to view a single metric grouped by a specific _attribute_ that each
683
+ # event is tagged with (e.g. `cluster`), you must additionally specify a
684
+ # `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event
685
+ # property on which to group.
686
+ #
687
+ # When returning grouped usage, only usage for `billable_metric_id` is returned,
688
+ # and a separate object in the `data` array is returned for each value of the
689
+ # `group_by` key present in your events. The `quantity` value is the result of
690
+ # evaluating the billable metric for events filtered to a single value of the
691
+ # `group_by` key.
692
+ #
693
+ # Orb expects that events that match the billable metric will contain values in
694
+ # the `properties` dictionary that correspond to the `group_by` key specified. By
695
+ # default, Orb will not return a `null` group (i.e. events that match the metric
696
+ # but do not have the key set). Currently, it is only possible to view usage
697
+ # grouped by a single attribute at a time.
698
+ #
699
+ # When viewing grouped usage, Orb uses pagination to limit the response size to
700
+ # 1000 groups by default. If there are more groups for a given subscription,
701
+ # pagination metadata in the response can be used to fetch all of the data.
702
+ #
703
+ # The following example shows usage for an "API Requests" billable metric grouped
704
+ # by `region`. Note the extra `metric_group` dictionary in the response, which
705
+ # provides metadata about the group:
706
+ #
707
+ # ```json
708
+ # {
709
+ # "data": [
710
+ # {
711
+ # "usage": [
712
+ # {
713
+ # "quantity": 0.19291,
714
+ # "timeframe_start": "2021-10-01T07:00:00Z",
715
+ # "timeframe_end": "2021-10-02T07:00:00Z",
716
+ # },
717
+ # ...
718
+ # ],
719
+ # "metric_group": {
720
+ # "property_key": "region",
721
+ # "property_value": "asia/pacific"
722
+ # },
723
+ # "billable_metric": {
724
+ # "id": "Fe9pbpMk86xpwdGB",
725
+ # "name": "API Requests"
726
+ # },
727
+ # "view_mode": "periodic"
728
+ # },
729
+ # ...
730
+ # ]
731
+ # }
732
+ # ```
733
+ #
734
+ # ## Windowed usage
735
+ #
736
+ # The `granularity` parameter can be used to _window_ the usage `quantity` value
737
+ # into periods. When not specified, usage is returned for the entirety of the time
738
+ # range.
739
+ #
740
+ # When `granularity = day` is specified with a timeframe longer than a day, Orb
741
+ # will return a `quantity` value for each full day between `timeframe_start` and
742
+ # `timeframe_end`. Note that the days are demarcated by the _customer's local
743
+ # midnight_.
744
+ #
745
+ # For example, with `timeframe_start = 2022-02-01T05:00:00Z`,
746
+ # `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`, the following
747
+ # windows will be returned for a customer in the `America/Los_Angeles` timezone
748
+ # since local midnight is `08:00` UTC:
749
+ #
750
+ # - `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`
751
+ # - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`
752
+ # - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`
753
+ # - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`
754
+ #
755
+ # ```json
756
+ # {
757
+ # "data": [
758
+ # {
759
+ # "billable_metric": {
760
+ # "id": "Q8w89wjTtBdejXKsm",
761
+ # "name": "API Requests"
762
+ # },
763
+ # "usage": [
764
+ # {
765
+ # "quantity": 0,
766
+ # "timeframe_end": "2022-02-01T08:00:00+00:00",
767
+ # "timeframe_start": "2022-02-01T05:00:00+00:00"
768
+ # },
769
+ # {
770
+ #
771
+ # "quantity": 0,
772
+ # "timeframe_end": "2022-02-02T08:00:00+00:00",
773
+ # "timeframe_start": "2022-02-01T08:00:00+00:00"
774
+ # },
775
+ # {
776
+ # "quantity": 0,
777
+ # "timeframe_end": "2022-02-03T08:00:00+00:00",
778
+ # "timeframe_start": "2022-02-02T08:00:00+00:00"
779
+ # },
780
+ # {
781
+ # "quantity": 0,
782
+ # "timeframe_end": "2022-02-04T01:00:00+00:00",
783
+ # "timeframe_start": "2022-02-03T08:00:00+00:00"
784
+ # }
785
+ # ],
786
+ # "view_mode": "periodic"
787
+ # },
788
+ # ...
789
+ # ]
790
+ # }
791
+ # ```
792
+ #
793
+ # ## Decomposable vs. non-decomposable metrics
794
+ #
795
+ # Billable metrics fall into one of two categories: decomposable and
796
+ # non-decomposable. A decomposable billable metric, such as a sum or a count, can
797
+ # be displayed and aggregated across arbitrary timescales. On the other hand, a
798
+ # non-decomposable metric is not meaningful when only a slice of the billing
799
+ # window is considered.
800
+ #
801
+ # As an example, if we have a billable metric that's defined to count unique
802
+ # users, displaying a graph of unique users for each day is not representative of
803
+ # the billable metric value over the month (days could have an overlapping set of
804
+ # 'unique' users). Instead, what's useful for any given day is the number of
805
+ # unique users in the billing period so far, which are the _cumulative_ unique
806
+ # users.
807
+ #
808
+ # Accordingly, this endpoint returns treats these two types of metrics differently
809
+ # when `group_by` is specified:
810
+ #
811
+ # - Decomposable metrics can be grouped by any event property.
812
+ # - Non-decomposable metrics can only be grouped by the corresponding price's
813
+ # invoice grouping key. If no invoice grouping key is present, the metric does
814
+ # not support `group_by`.
815
+ #
816
+ # ## Matrix prices
817
+ #
818
+ # When a billable metric is attached to a price that uses matrix pricing, it's
819
+ # important to view usage grouped by those matrix dimensions. In this case, use
820
+ # the query parameters `first_dimension_key`, `first_dimension_value` and
821
+ # `second_dimension_key`, `second_dimension_value` while filtering to a specific
822
+ # `billable_metric_id`.
823
+ #
824
+ # For example, if your compute metric has a separate unit price (i.e. a matrix
825
+ # pricing model) per `region` and `provider`, your request might provide the
826
+ # following parameters:
827
+ #
828
+ # - `first_dimension_key`: `region`
829
+ # - `first_dimension_value`: `us-east-1`
830
+ # - `second_dimension_key`: `provider`
831
+ # - `second_dimension_value`: `aws`
832
+ sig do
833
+ params(
834
+ subscription_id: String,
835
+ billable_metric_id: T.nilable(String),
836
+ first_dimension_key: T.nilable(String),
837
+ first_dimension_value: T.nilable(String),
838
+ granularity: T.nilable(Orb::Models::SubscriptionFetchUsageParams::Granularity::OrSymbol),
839
+ group_by: T.nilable(String),
840
+ second_dimension_key: T.nilable(String),
841
+ second_dimension_value: T.nilable(String),
842
+ timeframe_end: T.nilable(Time),
843
+ timeframe_start: T.nilable(Time),
844
+ view_mode: T.nilable(Orb::Models::SubscriptionFetchUsageParams::ViewMode::OrSymbol),
845
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
846
+ )
847
+ .returns(
848
+ T.any(
849
+ Orb::Models::SubscriptionUsage::UngroupedSubscriptionUsage,
850
+ Orb::Models::SubscriptionUsage::GroupedSubscriptionUsage
851
+ )
852
+ )
853
+ end
854
+ def fetch_usage(
855
+ subscription_id,
856
+ # When specified in conjunction with `group_by`, this parameter filters usage to a
857
+ # single billable metric. Note that both `group_by` and `billable_metric_id` must
858
+ # be specified together.
859
+ billable_metric_id: nil,
860
+ first_dimension_key: nil,
861
+ first_dimension_value: nil,
862
+ # This determines the windowing of usage reporting.
863
+ granularity: nil,
864
+ # Groups per-price usage by the key provided.
865
+ group_by: nil,
866
+ second_dimension_key: nil,
867
+ second_dimension_value: nil,
868
+ # Usage returned is exclusive of `timeframe_end`.
869
+ timeframe_end: nil,
870
+ # Usage returned is inclusive of `timeframe_start`.
871
+ timeframe_start: nil,
872
+ # Controls whether Orb returns cumulative usage since the start of the billing
873
+ # period, or incremental day-by-day usage. If your customer has minimums or
874
+ # discounts, it's strongly recommended that you use the default cumulative
875
+ # behavior.
876
+ view_mode: nil,
877
+ request_options: {}
878
+ )
879
+ end
880
+
881
+ # This endpoint is used to add and edit subscription
882
+ # [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By
883
+ # making modifications to a subscription’s price intervals, you can
884
+ # [flexibly and atomically control the billing behavior of a subscription](/product-catalog/modifying-subscriptions).
885
+ #
886
+ # ## Adding price intervals
887
+ #
888
+ # Prices can be added as price intervals to a subscription by specifying them in
889
+ # the `add` array. A `price_id` or `external_price_id` from an add-on price or
890
+ # previously removed plan price can be specified to reuse an existing price
891
+ # definition (however, please note that prices from other plans cannot be added to
892
+ # the subscription). Additionally, a new price can be specified using the `price`
893
+ # field — this price will be created automatically.
894
+ #
895
+ # A `start_date` must be specified for the price interval. This is the date when
896
+ # the price will start billing on the subscription, so this will notably result in
897
+ # an immediate charge at this time for any billed in advance fixed fees. The
898
+ # `end_date` will default to null, resulting in a price interval that will bill on
899
+ # a continually recurring basis. Both of these dates can be set in the past or the
900
+ # future and Orb will generate or modify invoices to ensure the subscription’s
901
+ # invoicing behavior is correct.
902
+ #
903
+ # Additionally, a discount, minimum, or maximum can be specified on the price
904
+ # interval. This will only apply to this price interval, not any other price
905
+ # intervals on the subscription.
906
+ #
907
+ # ## Adjustment intervals
908
+ #
909
+ # An adjustment interval represents the time period that a particular adjustment
910
+ # (a discount, minimum, or maximum) applies to the prices on a subscription.
911
+ # Adjustment intervals can be added to a subscription by specifying them in the
912
+ # `add_adjustments` array, or modified via the `edit_adjustments` array. When
913
+ # creating an adjustment interval, you'll need to provide the definition of the
914
+ # new adjustment (the type of adjustment, and which prices it applies to), as well
915
+ # as the start and end dates for the adjustment interval. The start and end dates
916
+ # of an existing adjustment interval can be edited via the `edit_adjustments`
917
+ # field (just like price intervals). (To "change" the amount of a discount,
918
+ # minimum, or maximum, then, you'll need to end the existing interval, and create
919
+ # a new adjustment interval with the new amount and a start date that matches the
920
+ # end date of the previous interval.)
921
+ #
922
+ # ## Editing price intervals
923
+ #
924
+ # Price intervals can be adjusted by specifying edits to make in the `edit` array.
925
+ # A `price_interval_id` to edit must be specified — this can be retrieved from the
926
+ # `price_intervals` field on the subscription.
927
+ #
928
+ # A new `start_date` or `end_date` can be specified to change the range of the
929
+ # price interval, which will modify past or future invoices to ensure correctness.
930
+ # If either of these dates are unspecified, they will default to the existing date
931
+ # on the price interval. To remove a price interval entirely from a subscription,
932
+ # set the `end_date` to be equivalent to the `start_date`.
933
+ #
934
+ # ## Fixed fee quantity transitions
935
+ #
936
+ # The fixed fee quantity transitions for a fixed fee price interval can also be
937
+ # specified when adding or editing by passing an array for
938
+ # `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
939
+ # `quantity` and an `effective_date`, which is the date after which the new
940
+ # quantity will be used for billing. If a fixed fee quantity transition is
941
+ # scheduled at a billing period boundary, the full quantity will be billed on an
942
+ # invoice with the other prices on the subscription. If the fixed fee quantity
943
+ # transition is scheduled mid-billing period, the difference between the existing
944
+ # quantity and quantity specified in the transition will be prorated for the rest
945
+ # of the billing period and billed immediately, which will generate a new invoice.
946
+ #
947
+ # Notably, the list of fixed fee quantity transitions passed will overwrite the
948
+ # existing fixed fee quantity transitions on the price interval, so the entire
949
+ # list of transitions must be specified to add additional transitions. The
950
+ # existing list of transitions can be retrieved using the
951
+ # `fixed_fee_quantity_transitions` property on a subscription’s serialized price
952
+ # intervals.
953
+ sig do
954
+ params(
955
+ subscription_id: String,
956
+ add: T::Array[T.any(Orb::Models::SubscriptionPriceIntervalsParams::Add, Orb::Util::AnyHash)],
957
+ add_adjustments: T::Array[T.any(Orb::Models::SubscriptionPriceIntervalsParams::AddAdjustment, Orb::Util::AnyHash)],
958
+ allow_invoice_credit_or_void: T.nilable(T::Boolean),
959
+ edit: T::Array[T.any(Orb::Models::SubscriptionPriceIntervalsParams::Edit, Orb::Util::AnyHash)],
960
+ edit_adjustments: T::Array[T.any(Orb::Models::SubscriptionPriceIntervalsParams::EditAdjustment, Orb::Util::AnyHash)],
961
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
962
+ )
963
+ .returns(Orb::Models::SubscriptionPriceIntervalsResponse)
964
+ end
965
+ def price_intervals(
966
+ subscription_id,
967
+ # A list of price intervals to add to the subscription.
968
+ add: nil,
969
+ # A list of adjustments to add to the subscription.
970
+ add_adjustments: nil,
971
+ # If false, this request will fail if it would void an issued invoice or create a
972
+ # credit note. Consider using this as a safety mechanism if you do not expect
973
+ # existing invoices to be changed.
974
+ allow_invoice_credit_or_void: nil,
975
+ # A list of price intervals to edit on the subscription.
976
+ edit: nil,
977
+ # A list of adjustments to edit on the subscription.
978
+ edit_adjustments: nil,
979
+ request_options: {}
980
+ )
981
+ end
982
+
983
+ # This endpoint can be used to change an existing subscription's plan. It returns
984
+ # the serialized updated subscription object.
985
+ #
986
+ # The body parameter `change_option` determines when the plan change occurrs. Orb
987
+ # supports three options:
988
+ #
989
+ # - `end_of_subscription_term`: changes the plan at the end of the existing plan's
990
+ # term.
991
+ # - Issuing this plan change request for a monthly subscription will keep the
992
+ # existing plan active until the start of the subsequent month. Issuing this
993
+ # plan change request for a yearly subscription will keep the existing plan
994
+ # active for the full year. Charges incurred in the remaining period will be
995
+ # invoiced as normal.
996
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
997
+ # made on January 15th, so the plan will be changed on February 1st, and
998
+ # invoice will be issued on February 1st for the last month of the original
999
+ # plan.
1000
+ # - `immediate`: changes the plan immediately.
1001
+ # - Subscriptions that have their plan changed with this option will move to the
1002
+ # new plan immediately, and be invoiced immediately.
1003
+ # - This invoice will include any usage fees incurred in the billing period up
1004
+ # to the change, along with any prorated recurring fees for the billing
1005
+ # period, if applicable.
1006
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
1007
+ # made on January 15th, so the plan will be changed on January 15th, and an
1008
+ # invoice will be issued for the partial month, from January 1 to January 15,
1009
+ # on the original plan.
1010
+ # - `requested_date`: changes the plan on the requested date (`change_date`).
1011
+ # - If no timezone is provided, the customer's timezone is used. The
1012
+ # `change_date` body parameter is required if this option is chosen.
1013
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
1014
+ # made on January 15th, with a requested `change_date` of February 15th, so
1015
+ # the plan will be changed on February 15th, and invoices will be issued on
1016
+ # February 1st and February 15th.
1017
+ #
1018
+ # Note that one of `plan_id` or `external_plan_id` is required in the request body
1019
+ # for this operation.
1020
+ #
1021
+ # ## Customize your customer's subscriptions
1022
+ #
1023
+ # Prices and adjustments in a plan can be added, removed, or replaced on the
1024
+ # subscription when you schedule the plan change. This is useful when a customer
1025
+ # has prices that differ from the default prices for a specific plan.
1026
+ #
1027
+ # <Note>
1028
+ # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
1029
+ # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
1030
+ # </Note>
1031
+ #
1032
+ # ### Adding Prices
1033
+ #
1034
+ # To add prices, provide a list of objects with the key `add_prices`. An object in
1035
+ # the list must specify an existing add-on price with a `price_id` or
1036
+ # `external_price_id` field, or create a new add-on price by including an object
1037
+ # with the key `price`, identical to what would be used in the request body for
1038
+ # the [create price endpoint](/api-reference/price/create-price). See the
1039
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1040
+ # different price model configurations possible in this object.
1041
+ #
1042
+ # If the plan has phases, each object in the list must include a number with
1043
+ # `plan_phase_order` key to indicate which phase the price should be added to.
1044
+ #
1045
+ # An object in the list can specify an optional `start_date` and optional
1046
+ # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1047
+ # time will be used. If `end_date` is unspecified, it will finish at the end of
1048
+ # the phase / have no end time.
1049
+ #
1050
+ # An object in the list can specify an optional `minimum_amount`,
1051
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1052
+ # to this price.
1053
+ #
1054
+ # Additionally, an object in the list can specify an optional `reference_id`. This
1055
+ # ID can be used to reference this price when
1056
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1057
+ # is _transient_ and cannot be used to refer to the price in future API calls.
1058
+ #
1059
+ # ### Removing Prices
1060
+ #
1061
+ # To remove prices, provide a list of objects with the key `remove_prices`. An
1062
+ # object in the list must specify a plan price with either a `price_id` or
1063
+ # `external_price_id` field.
1064
+ #
1065
+ # ### Replacing Prices
1066
+ #
1067
+ # To replace prices, provide a list of objects with the key `replace_prices`. An
1068
+ # object in the list must specify a plan price to replace with the
1069
+ # `replaces_price_id` key, and it must specify a price to replace it with by
1070
+ # either referencing an existing add-on price with a `price_id` or
1071
+ # `external_price_id` field, or by creating a new add-on price by including an
1072
+ # object with the key `price`, identical to what would be used in the request body
1073
+ # for the [create price endpoint](/api-reference/price/create-price). See the
1074
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1075
+ # different price model configurations possible in this object.
1076
+ #
1077
+ # For fixed fees, an object in the list can supply a `fixed_price_quantity`
1078
+ # instead of a `price`, `price_id`, or `external_price_id` field. This will update
1079
+ # only the quantity for the price, similar to the
1080
+ # [Update price quantity](/api-reference/subscription/update-price-quantity)
1081
+ # endpoint.
1082
+ #
1083
+ # The replacement price will have the same phase, if applicable, and the same
1084
+ # start and end dates as the price it replaces.
1085
+ #
1086
+ # An object in the list can specify an optional `minimum_amount`,
1087
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1088
+ # to this price.
1089
+ #
1090
+ # Additionally, an object in the list can specify an optional `reference_id`. This
1091
+ # ID can be used to reference the replacement price when
1092
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1093
+ # is _transient_ and cannot be used to refer to the price in future API calls.
1094
+ #
1095
+ # ### Adding adjustments
1096
+ #
1097
+ # To add adjustments, provide a list of objects with the key `add_adjustments`. An
1098
+ # object in the list must include an object with the key `adjustment`, identical
1099
+ # to the adjustment object in the
1100
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1101
+ #
1102
+ # If the plan has phases, each object in the list must include a number with
1103
+ # `plan_phase_order` key to indicate which phase the adjustment should be added
1104
+ # to.
1105
+ #
1106
+ # An object in the list can specify an optional `start_date` and optional
1107
+ # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1108
+ # time will be used. If `end_date` is unspecified, it will finish at the end of
1109
+ # the phase / have no end time.
1110
+ #
1111
+ # ### Removing adjustments
1112
+ #
1113
+ # To remove adjustments, provide a list of objects with the key
1114
+ # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
1115
+ # with the ID of the adjustment to be removed.
1116
+ #
1117
+ # ### Replacing adjustments
1118
+ #
1119
+ # To replace adjustments, provide a list of objects with the key
1120
+ # `replace_adjustments`. An object in the list must specify a plan adjustment to
1121
+ # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
1122
+ # to replace it with by including an object with the key `adjustment`, identical
1123
+ # to the adjustment object in the
1124
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1125
+ #
1126
+ # The replacement adjustment will have the same phase, if applicable, and the same
1127
+ # start and end dates as the adjustment it replaces.
1128
+ #
1129
+ # ## Price overrides (DEPRECATED)
1130
+ #
1131
+ # <Note>
1132
+ # Price overrides are being phased out in favor adding/removing/replacing prices. (See
1133
+ # [Customize your customer's subscriptions](/api-reference/subscription/schedule-plan-change))
1134
+ # </Note>
1135
+ #
1136
+ # Price overrides are used to update some or all prices in a plan for the specific
1137
+ # subscription being created. This is useful when a new customer has negotiated a
1138
+ # rate that is unique to the customer.
1139
+ #
1140
+ # To override prices, provide a list of objects with the key `price_overrides`.
1141
+ # The price object in the list of overrides is expected to contain the existing
1142
+ # price id, the `model_type` and configuration. (See the
1143
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1144
+ # different price model configurations.) The numerical values can be updated, but
1145
+ # the billable metric, cadence, type, and name of a price can not be overridden.
1146
+ #
1147
+ # ### Maximums, and minimums
1148
+ #
1149
+ # Price overrides are used to update some or all prices in the target plan.
1150
+ # Minimums and maximums, much like price overrides, can be useful when a new
1151
+ # customer has negotiated a new or different minimum or maximum spend cap than the
1152
+ # default for the plan. The request format for maximums and minimums is the same
1153
+ # as those in [subscription creation](create-subscription).
1154
+ #
1155
+ # ## Scheduling multiple plan changes
1156
+ #
1157
+ # When scheduling multiple plan changes with the same date, the latest plan change
1158
+ # on that day takes effect.
1159
+ #
1160
+ # ## Prorations for in-advance fees
1161
+ #
1162
+ # By default, Orb calculates the prorated difference in any fixed fees when making
1163
+ # a plan change, adjusting the customer balance as needed. For details on this
1164
+ # behavior, see
1165
+ # [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
1166
+ sig do
1167
+ params(
1168
+ subscription_id: String,
1169
+ change_option: Orb::Models::SubscriptionSchedulePlanChangeParams::ChangeOption::OrSymbol,
1170
+ add_adjustments: T.nilable(
1171
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::AddAdjustment, Orb::Util::AnyHash)]
1172
+ ),
1173
+ add_prices: T.nilable(
1174
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice, Orb::Util::AnyHash)]
1175
+ ),
1176
+ align_billing_with_plan_change_date: T.nilable(T::Boolean),
1177
+ auto_collection: T.nilable(T::Boolean),
1178
+ billing_cycle_alignment: T.nilable(Orb::Models::SubscriptionSchedulePlanChangeParams::BillingCycleAlignment::OrSymbol),
1179
+ billing_cycle_anchor_configuration: T.nilable(
1180
+ T.any(
1181
+ Orb::Models::SubscriptionSchedulePlanChangeParams::BillingCycleAnchorConfiguration,
1182
+ Orb::Util::AnyHash
1183
+ )
1184
+ ),
1185
+ change_date: T.nilable(Time),
1186
+ coupon_redemption_code: T.nilable(String),
1187
+ credits_overage_rate: T.nilable(Float),
1188
+ default_invoice_memo: T.nilable(String),
1189
+ external_plan_id: T.nilable(String),
1190
+ filter: T.nilable(String),
1191
+ initial_phase_order: T.nilable(Integer),
1192
+ invoicing_threshold: T.nilable(String),
1193
+ net_terms: T.nilable(Integer),
1194
+ per_credit_overage_amount: T.nilable(Float),
1195
+ plan_id: T.nilable(String),
1196
+ plan_version_number: T.nilable(Integer),
1197
+ price_overrides: T.nilable(T::Array[T.anything]),
1198
+ remove_adjustments: T.nilable(
1199
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::RemoveAdjustment, Orb::Util::AnyHash)]
1200
+ ),
1201
+ remove_prices: T.nilable(
1202
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::RemovePrice, Orb::Util::AnyHash)]
1203
+ ),
1204
+ replace_adjustments: T.nilable(
1205
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::ReplaceAdjustment, Orb::Util::AnyHash)]
1206
+ ),
1207
+ replace_prices: T.nilable(
1208
+ T::Array[T.any(Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice, Orb::Util::AnyHash)]
1209
+ ),
1210
+ trial_duration_days: T.nilable(Integer),
1211
+ usage_customer_ids: T.nilable(T::Array[String]),
1212
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1213
+ )
1214
+ .returns(Orb::Models::SubscriptionSchedulePlanChangeResponse)
1215
+ end
1216
+ def schedule_plan_change(
1217
+ subscription_id,
1218
+ change_option:,
1219
+ # Additional adjustments to be added to the subscription. (Only available for
1220
+ # accounts that have migrated off of legacy subscription overrides)
1221
+ add_adjustments: nil,
1222
+ # Additional prices to be added to the subscription. (Only available for accounts
1223
+ # that have migrated off of legacy subscription overrides)
1224
+ add_prices: nil,
1225
+ # [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be
1226
+ # aligned with the plan change's effective date.
1227
+ align_billing_with_plan_change_date: nil,
1228
+ # Determines whether issued invoices for this subscription will automatically be
1229
+ # charged with the saved payment method on the due date. If not specified, this
1230
+ # defaults to the behavior configured for this customer.
1231
+ auto_collection: nil,
1232
+ # Reset billing periods to be aligned with the plan change's effective date or
1233
+ # start of the month. Defaults to `unchanged` which keeps subscription's existing
1234
+ # billing cycle alignment.
1235
+ billing_cycle_alignment: nil,
1236
+ billing_cycle_anchor_configuration: nil,
1237
+ # The date that the plan change should take effect. This parameter can only be
1238
+ # passed if the `change_option` is `requested_date`. If a date with no time is
1239
+ # passed, the plan change will happen at midnight in the customer's timezone.
1240
+ change_date: nil,
1241
+ # Redemption code to be used for this subscription. If the coupon cannot be found
1242
+ # by its redemption code, or cannot be redeemed, an error response will be
1243
+ # returned and the subscription creation or plan change will not be scheduled.
1244
+ coupon_redemption_code: nil,
1245
+ credits_overage_rate: nil,
1246
+ # Determines the default memo on this subscription's invoices. Note that if this
1247
+ # is not provided, it is determined by the plan configuration.
1248
+ default_invoice_memo: nil,
1249
+ # The external_plan_id of the plan that the given subscription should be switched
1250
+ # to. Note that either this property or `plan_id` must be specified.
1251
+ external_plan_id: nil,
1252
+ # An additional filter to apply to usage queries. This filter must be expressed as
1253
+ # a boolean
1254
+ # [computed property](/extensibility/advanced-metrics#computed-properties). If
1255
+ # null, usage queries will not include any additional filter.
1256
+ filter: nil,
1257
+ # The phase of the plan to start with
1258
+ initial_phase_order: nil,
1259
+ # When this subscription's accrued usage reaches this threshold, an invoice will
1260
+ # be issued for the subscription. If not specified, invoices will only be issued
1261
+ # at the end of the billing period.
1262
+ invoicing_threshold: nil,
1263
+ # The net terms determines the difference between the invoice date and the issue
1264
+ # date for the invoice. If you intend the invoice to be due on issue, set this
1265
+ # to 0. If not provided, this defaults to the value specified in the plan.
1266
+ net_terms: nil,
1267
+ per_credit_overage_amount: nil,
1268
+ # The plan that the given subscription should be switched to. Note that either
1269
+ # this property or `external_plan_id` must be specified.
1270
+ plan_id: nil,
1271
+ # Specifies which version of the plan to change to. If null, the default version
1272
+ # will be used.
1273
+ plan_version_number: nil,
1274
+ # Optionally provide a list of overrides for prices on the plan
1275
+ price_overrides: nil,
1276
+ # Plan adjustments to be removed from the subscription. (Only available for
1277
+ # accounts that have migrated off of legacy subscription overrides)
1278
+ remove_adjustments: nil,
1279
+ # Plan prices to be removed from the subscription. (Only available for accounts
1280
+ # that have migrated off of legacy subscription overrides)
1281
+ remove_prices: nil,
1282
+ # Plan adjustments to be replaced with additional adjustments on the subscription.
1283
+ # (Only available for accounts that have migrated off of legacy subscription
1284
+ # overrides)
1285
+ replace_adjustments: nil,
1286
+ # Plan prices to be replaced with additional prices on the subscription. (Only
1287
+ # available for accounts that have migrated off of legacy subscription overrides)
1288
+ replace_prices: nil,
1289
+ # The duration of the trial period in days. If not provided, this defaults to the
1290
+ # value specified in the plan. If `0` is provided, the trial on the plan will be
1291
+ # skipped.
1292
+ trial_duration_days: nil,
1293
+ # A list of customer IDs whose usage events will be aggregated and billed under
1294
+ # this subscription. By default, a subscription only considers usage events
1295
+ # associated with its attached customer's customer_id. When usage_customer_ids is
1296
+ # provided, the subscription includes usage events from the specified customers
1297
+ # only. Provided usage_customer_ids must be either the customer for this
1298
+ # subscription itself, or any of that customer's children.
1299
+ usage_customer_ids: nil,
1300
+ request_options: {}
1301
+ )
1302
+ end
1303
+
1304
+ # Manually trigger a phase, effective the given date (or the current time, if not
1305
+ # specified).
1306
+ sig do
1307
+ params(
1308
+ subscription_id: String,
1309
+ allow_invoice_credit_or_void: T.nilable(T::Boolean),
1310
+ effective_date: T.nilable(Date),
1311
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1312
+ )
1313
+ .returns(Orb::Models::SubscriptionTriggerPhaseResponse)
1314
+ end
1315
+ def trigger_phase(
1316
+ subscription_id,
1317
+ # If false, this request will fail if it would void an issued invoice or create a
1318
+ # credit note. Consider using this as a safety mechanism if you do not expect
1319
+ # existing invoices to be changed.
1320
+ allow_invoice_credit_or_void: nil,
1321
+ # The date on which the phase change should take effect. If not provided, defaults
1322
+ # to today in the customer's timezone.
1323
+ effective_date: nil,
1324
+ request_options: {}
1325
+ )
1326
+ end
1327
+
1328
+ # This endpoint can be used to unschedule any pending cancellations for a
1329
+ # subscription.
1330
+ #
1331
+ # To be eligible, the subscription must currently be active and have a future
1332
+ # cancellation. This operation will turn on auto-renew, ensuring that the
1333
+ # subscription does not end at the currently scheduled cancellation time.
1334
+ sig do
1335
+ params(
1336
+ subscription_id: String,
1337
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1338
+ )
1339
+ .returns(Orb::Models::SubscriptionUnscheduleCancellationResponse)
1340
+ end
1341
+ def unschedule_cancellation(subscription_id, request_options: {})
1342
+ end
1343
+
1344
+ # This endpoint can be used to clear scheduled updates to the quantity for a fixed
1345
+ # fee.
1346
+ #
1347
+ # If there are no updates scheduled, a request validation error will be returned
1348
+ # with a 400 status code.
1349
+ sig do
1350
+ params(
1351
+ subscription_id: String,
1352
+ price_id: String,
1353
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1354
+ )
1355
+ .returns(Orb::Models::SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse)
1356
+ end
1357
+ def unschedule_fixed_fee_quantity_updates(
1358
+ subscription_id,
1359
+ # Price for which the updates should be cleared. Must be a fixed fee.
1360
+ price_id:,
1361
+ request_options: {}
1362
+ )
1363
+ end
1364
+
1365
+ # This endpoint can be used to unschedule any pending plan changes on an existing
1366
+ # subscription.
1367
+ sig do
1368
+ params(
1369
+ subscription_id: String,
1370
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1371
+ )
1372
+ .returns(Orb::Models::SubscriptionUnschedulePendingPlanChangesResponse)
1373
+ end
1374
+ def unschedule_pending_plan_changes(subscription_id, request_options: {})
1375
+ end
1376
+
1377
+ # This endpoint can be used to update the quantity for a fixed fee.
1378
+ #
1379
+ # To be eligible, the subscription must currently be active and the price
1380
+ # specified must be a fixed fee (not usage-based). This operation will immediately
1381
+ # update the quantity for the fee, or if a `effective_date` is passed in, will
1382
+ # update the quantity on the requested date at midnight in the customer's
1383
+ # timezone.
1384
+ #
1385
+ # In order to change the fixed fee quantity as of the next draft invoice for this
1386
+ # subscription, pass `change_option=upcoming_invoice` without an `effective_date`
1387
+ # specified.
1388
+ #
1389
+ # If the fee is an in-advance fixed fee, it will also issue an immediate invoice
1390
+ # for the difference for the remainder of the billing period.
1391
+ sig do
1392
+ params(
1393
+ subscription_id: String,
1394
+ price_id: String,
1395
+ quantity: Float,
1396
+ allow_invoice_credit_or_void: T.nilable(T::Boolean),
1397
+ change_option: Orb::Models::SubscriptionUpdateFixedFeeQuantityParams::ChangeOption::OrSymbol,
1398
+ effective_date: T.nilable(Date),
1399
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1400
+ )
1401
+ .returns(Orb::Models::SubscriptionUpdateFixedFeeQuantityResponse)
1402
+ end
1403
+ def update_fixed_fee_quantity(
1404
+ subscription_id,
1405
+ # Price for which the quantity should be updated. Must be a fixed fee.
1406
+ price_id:,
1407
+ quantity:,
1408
+ # If false, this request will fail if it would void an issued invoice or create a
1409
+ # credit note. Consider using this as a safety mechanism if you do not expect
1410
+ # existing invoices to be changed.
1411
+ allow_invoice_credit_or_void: nil,
1412
+ # Determines when the change takes effect. Note that if `effective_date` is
1413
+ # specified, this defaults to `effective_date`. Otherwise, this defaults to
1414
+ # `immediate` unless it's explicitly set to `upcoming_invoice`.
1415
+ change_option: nil,
1416
+ # The date that the quantity change should take effect, localized to the
1417
+ # customer's timezone. Ifthis parameter is not passed in, the quantity change is
1418
+ # effective according to `change_option`.
1419
+ effective_date: nil,
1420
+ request_options: {}
1421
+ )
1422
+ end
1423
+
1424
+ # This endpoint is used to update the trial end date for a subscription. The new
1425
+ # trial end date must be within the time range of the current plan (i.e. the new
1426
+ # trial end date must be on or after the subscription's start date on the current
1427
+ # plan, and on or before the subscription end date).
1428
+ #
1429
+ # In order to retroactively remove a trial completely, the end date can be set to
1430
+ # the transition date of the subscription to this plan (or, if this is the first
1431
+ # plan for this subscription, the subscription's start date). In order to end a
1432
+ # trial immediately, the keyword `immediate` can be provided as the trial end
1433
+ # date.
1434
+ #
1435
+ # By default, Orb will shift only the trial end date (and price intervals that
1436
+ # start or end on the previous trial end date), and leave all other future price
1437
+ # intervals untouched. If the `shift` parameter is set to `true`, Orb will shift
1438
+ # all subsequent price and adjustment intervals by the same amount as the trial
1439
+ # end date shift (so, e.g., if a plan change is scheduled or an add-on price was
1440
+ # added, that change will be pushed back by the same amount of time the trial is
1441
+ # extended).
1442
+ sig do
1443
+ params(
1444
+ subscription_id: String,
1445
+ trial_end_date: T.any(Time, Orb::Models::SubscriptionUpdateTrialParams::TrialEndDate::OrSymbol),
1446
+ shift: T::Boolean,
1447
+ request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
1448
+ )
1449
+ .returns(Orb::Models::SubscriptionUpdateTrialResponse)
1450
+ end
1451
+ def update_trial(
1452
+ subscription_id,
1453
+ # The new date that the trial should end, or the literal string `immediate` to end
1454
+ # the trial immediately.
1455
+ trial_end_date:,
1456
+ # If true, shifts subsequent price and adjustment intervals (preserving their
1457
+ # durations, but adjusting their absolute dates).
1458
+ shift: nil,
1459
+ request_options: {}
1460
+ )
1461
+ end
1462
+
1463
+ # @api private
1464
+ sig { params(client: Orb::Client).returns(T.attached_class) }
1465
+ def self.new(client:)
1466
+ end
1467
+ end
1468
+ end
1469
+ end