schematichq 1.5.4 → 1.5.6

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +4 -4
  3. data/.fern/replay.lock +13 -1
  4. data/WASM_VERSION +1 -1
  5. data/lib/schematic/accounts/client.rb +0 -271
  6. data/lib/schematic/billing/client.rb +447 -0
  7. data/lib/schematic/billing/types/count_billing_invoices_params.rb +28 -0
  8. data/lib/schematic/billing/types/count_billing_invoices_request.rb +27 -0
  9. data/lib/schematic/billing/types/count_billing_invoices_response.rb +13 -0
  10. data/lib/schematic/billing/types/create_payment_method_request_body.rb +2 -0
  11. data/lib/schematic/billing/types/finalize_native_invoice_response.rb +13 -0
  12. data/lib/schematic/{accounts/types/delete_environment_response.rb → billing/types/get_billing_invoice_response.rb} +3 -3
  13. data/lib/schematic/billing/types/get_company_native_subscription_response.rb +13 -0
  14. data/lib/schematic/billing/types/list_billing_invoices_params.rb +28 -0
  15. data/lib/schematic/billing/types/list_billing_invoices_request.rb +27 -0
  16. data/lib/schematic/billing/types/list_billing_invoices_response.rb +13 -0
  17. data/lib/schematic/billing/types/mark_billing_invoice_paid_response.rb +13 -0
  18. data/lib/schematic/billing/types/mark_invoice_paid_request_body.rb +19 -0
  19. data/lib/schematic/billing/types/void_native_invoice_response.rb +13 -0
  20. data/lib/schematic/catalogs/client.rb +82 -0
  21. data/lib/schematic/{accounts/types/create_api_key_response.rb → catalogs/types/get_public_catalog_by_id_response.rb} +3 -3
  22. data/lib/schematic/{accounts/types/delete_api_key_response.rb → catalogs/types/get_public_catalog_response.rb} +3 -3
  23. data/lib/schematic/client.rb +195 -1
  24. data/lib/schematic/credits/client.rb +48 -0
  25. data/lib/schematic/credits/types/count_credit_event_ledger_params.rb +2 -0
  26. data/lib/schematic/credits/types/count_credit_event_ledger_request.rb +2 -0
  27. data/lib/schematic/{accounts/types/create_environment_response.rb → credits/types/get_credit_event_ledger_entry_response.rb} +3 -3
  28. data/lib/schematic/credits/types/list_credit_event_ledger_params.rb +2 -0
  29. data/lib/schematic/credits/types/list_credit_event_ledger_request.rb +2 -0
  30. data/lib/schematic/features/client.rb +0 -2
  31. data/lib/schematic/internal/iterators/cursor_item_iterator.rb +2 -2
  32. data/lib/schematic/internal/iterators/cursor_page_iterator.rb +11 -2
  33. data/lib/schematic/internal/iterators/item_iterator.rb +11 -2
  34. data/lib/schematic/internal/iterators/offset_item_iterator.rb +2 -2
  35. data/lib/schematic/internal/iterators/offset_page_iterator.rb +15 -6
  36. data/lib/schematic/internal/types/model.rb +17 -1
  37. data/lib/schematic/planbundle/types/create_custom_plan_bundle_request_body.rb +2 -0
  38. data/lib/schematic/planbundle/types/create_plan_bundle_request_body.rb +2 -0
  39. data/lib/schematic/planbundle/types/update_plan_bundle_request_body.rb +2 -0
  40. data/lib/schematic/plans/client.rb +61 -5
  41. data/lib/schematic/plans/types/list_custom_plan_billings_params.rb +4 -0
  42. data/lib/schematic/plans/types/list_custom_plan_billings_request.rb +4 -0
  43. data/lib/schematic/plans/types/preview_publish_plan_version_response.rb +13 -0
  44. data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +2 -0
  45. data/lib/schematic/types/amendment_proration_lands_on.rb +13 -0
  46. data/lib/schematic/types/billing_invoice_address_response_data.rb +19 -0
  47. data/lib/schematic/types/billing_invoice_billing_details_response_data.rb +15 -0
  48. data/lib/schematic/types/billing_invoice_detail_response_data.rb +65 -0
  49. data/lib/schematic/types/billing_invoice_line_response_data.rb +31 -0
  50. data/lib/schematic/types/billing_invoice_response_data.rb +51 -0
  51. data/lib/schematic/types/billing_invoice_settlement_response_data.rb +17 -0
  52. data/lib/schematic/types/billing_invoice_tax_id_response_data.rb +11 -0
  53. data/lib/schematic/types/billing_invoice_terms_response_data.rb +21 -0
  54. data/lib/schematic/types/billing_native_subscription_change_response_data.rb +15 -0
  55. data/lib/schematic/types/billing_native_subscription_line_response_data.rb +47 -0
  56. data/lib/schematic/types/billing_native_subscription_response_data.rb +31 -0
  57. data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +2 -0
  58. data/lib/schematic/types/billing_plan_credit_grant_warning_tier_response_data.rb +13 -0
  59. data/lib/schematic/types/billing_statement_line_response_data.rb +21 -0
  60. data/lib/schematic/types/billing_statement_response_data.rb +19 -0
  61. data/lib/schematic/types/catalog_bundle_currency_price_response_data.rb +13 -0
  62. data/lib/schematic/types/catalog_capabilities_response_data.rb +11 -0
  63. data/lib/schematic/types/catalog_credit_bundle_response_data.rb +39 -0
  64. data/lib/schematic/types/catalog_credit_grant_response_data.rb +29 -0
  65. data/lib/schematic/types/catalog_currency_prices_response_data.rb +17 -0
  66. data/lib/schematic/types/catalog_custom_plan_cta_response_data.rb +13 -0
  67. data/lib/schematic/types/catalog_detail_response_data.rb +23 -0
  68. data/lib/schematic/types/catalog_entitlement_response_data.rb +61 -0
  69. data/lib/schematic/types/catalog_plan_entitlement_response_data.rb +63 -0
  70. data/lib/schematic/types/catalog_plan_response_data.rb +41 -0
  71. data/lib/schematic/types/catalog_price_response_data.rb +29 -0
  72. data/lib/schematic/types/catalog_price_tier_response_data.rb +17 -0
  73. data/lib/schematic/types/charge_timing.rb +12 -0
  74. data/lib/schematic/types/checkout_charge_timing.rb +13 -0
  75. data/lib/schematic/types/checkout_problem_code.rb +4 -0
  76. data/lib/schematic/types/collector.rb +13 -0
  77. data/lib/schematic/types/company_billing_profile_response_data.rb +12 -0
  78. data/lib/schematic/types/company_credit_balance.rb +4 -0
  79. data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +2 -0
  80. data/lib/schematic/types/create_flag_request_body.rb +1 -1
  81. data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
  82. data/lib/schematic/types/credit_spend_policy.rb +2 -0
  83. data/lib/schematic/types/credit_spend_window_unit.rb +2 -0
  84. data/lib/schematic/types/custom_plan_billing_response_data.rb +2 -0
  85. data/lib/schematic/types/entitlement_type.rb +1 -0
  86. data/lib/schematic/types/event_body.rb +3 -3
  87. data/lib/schematic/types/event_body_inference.rb +4 -0
  88. data/lib/schematic/types/flag_detail_response_data.rb +1 -1
  89. data/lib/schematic/types/flag_in_plan_response_data.rb +1 -1
  90. data/lib/schematic/types/flag_response_data.rb +1 -1
  91. data/lib/schematic/types/invoice_collection_state.rb +17 -0
  92. data/lib/schematic/types/invoice_document_state.rb +14 -0
  93. data/lib/schematic/types/invoice_line_kind.rb +15 -0
  94. data/lib/schematic/types/line_kind.rb +13 -0
  95. data/lib/schematic/types/payment_gating.rb +12 -0
  96. data/lib/schematic/types/payment_method_billing_details_request_body.rb +13 -0
  97. data/lib/schematic/types/plan_credit_grant_warning_tier_request_body.rb +11 -0
  98. data/lib/schematic/types/plan_version_migration_preview_company_response_data.rb +2 -0
  99. data/lib/schematic/types/plan_version_migration_preview_note_response_data.rb +13 -0
  100. data/lib/schematic/types/plan_version_response_data.rb +2 -0
  101. data/lib/schematic/types/preflight_event_quantities_request_body.rb +13 -0
  102. data/lib/schematic/types/preflight_request_body.rb +2 -0
  103. data/lib/schematic/types/preview_subscription_finance_response_data.rb +6 -0
  104. data/lib/schematic/types/preview_subscription_proration_line_response_data.rb +21 -0
  105. data/lib/schematic/types/preview_subscription_proration_response_data.rb +21 -0
  106. data/lib/schematic/types/proration_line_kind.rb +12 -0
  107. data/lib/schematic/types/public_catalog_response_data.rb +29 -0
  108. data/lib/schematic/types/publish_plan_version_request_body.rb +45 -0
  109. data/lib/schematic/types/publish_preview_pay_in_advance_response_data.rb +15 -0
  110. data/lib/schematic/types/publish_preview_payment_method_response_data.rb +15 -0
  111. data/lib/schematic/types/publish_preview_proration_line_response_data.rb +19 -0
  112. data/lib/schematic/types/publish_preview_response_data.rb +55 -0
  113. data/lib/schematic/types/renewal_policy.rb +13 -0
  114. data/lib/schematic/types/rulesengine_credit_spend_policy.rb +2 -0
  115. data/lib/schematic/types/subscription_change_action.rb +14 -0
  116. data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +2 -0
  117. data/lib/schematic/types/webhook_request_type.rb +1 -0
  118. data/lib/schematic/version.rb +1 -1
  119. data/lib/schematic/wasm/rulesengine.wasm +0 -0
  120. data/lib/schematic.rb +71 -18
  121. data/reference.md +1148 -506
  122. metadata +68 -15
  123. data/lib/schematic/accounts/types/create_api_key_request_body.rb +0 -19
  124. data/lib/schematic/accounts/types/create_environment_request_body.rb +0 -13
  125. data/lib/schematic/accounts/types/update_api_key_request_body.rb +0 -17
  126. data/lib/schematic/accounts/types/update_api_key_response.rb +0 -13
  127. data/lib/schematic/accounts/types/update_environment_request_body.rb +0 -17
  128. data/lib/schematic/accounts/types/update_environment_response.rb +0 -13
  129. data/lib/schematic/plans/types/publish_plan_version_request_body.rb +0 -47
  130. data/lib/schematic/types/api_key_create_response_data.rb +0 -33
  131. data/lib/schematic/types/environment_detail_response_data.rb +0 -21
@@ -1607,6 +1607,453 @@ module Schematic
1607
1607
  raise error_class.new(response.body, code: code, body: error_body)
1608
1608
  end
1609
1609
  end
1610
+
1611
+ # @param request_options [Hash]
1612
+ # @param params [Hash]
1613
+ # @option request_options [String] :base_url
1614
+ # @option request_options [Hash{String => Object}] :additional_headers
1615
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1616
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1617
+ # @option request_options [Integer] :timeout_in_seconds
1618
+ # @option params [String] :company_id
1619
+ #
1620
+ # @example
1621
+ # client.billing.get_company_native_subscription(company_id: "company_id")
1622
+ #
1623
+ # @return [Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse]
1624
+ def get_company_native_subscription(request_options: {}, **params)
1625
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1626
+ request = Schematic::Internal::JSON::Request.new(
1627
+ base_url: request_options[:base_url],
1628
+ method: "GET",
1629
+ path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription",
1630
+ request_options: request_options
1631
+ )
1632
+ begin
1633
+ response = @client.send(request)
1634
+ rescue Net::HTTPRequestTimeout
1635
+ raise Schematic::Errors::TimeoutError
1636
+ end
1637
+ code = response.code.to_i
1638
+ if code.between?(200, 299)
1639
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse.load(response.body))
1640
+ else
1641
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1642
+ error_types = {
1643
+ 401 => Schematic::Types::ApiError,
1644
+ 403 => Schematic::Types::ApiError,
1645
+ 404 => Schematic::Types::ApiError,
1646
+ 500 => Schematic::Types::ApiError
1647
+ }
1648
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1649
+ raise error_class.new(response.body, code: code, body: error_body)
1650
+ end
1651
+ end
1652
+
1653
+ # @param request_options [Hash]
1654
+ # @param params [Hash]
1655
+ # @option request_options [String] :base_url
1656
+ # @option request_options [Hash{String => Object}] :additional_headers
1657
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1658
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1659
+ # @option request_options [Integer] :timeout_in_seconds
1660
+ # @option params [String, nil] :company_id
1661
+ # @option params [String, nil] :contract_id
1662
+ # @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
1663
+ # @option params [Boolean, nil] :past_due
1664
+ # @option params [Schematic::Types::BillingProviderType, nil] :provider_type
1665
+ # @option params [String, nil] :q
1666
+ # @option params [Schematic::Types::InvoiceStatus, nil] :status
1667
+ # @option params [Integer, nil] :limit
1668
+ # @option params [Integer, nil] :offset
1669
+ #
1670
+ # @example
1671
+ # client.billing.list_billing_invoices(
1672
+ # company_id: "company_id",
1673
+ # contract_id: "contract_id",
1674
+ # document_state: "credited",
1675
+ # past_due: true,
1676
+ # provider_type: "metronome",
1677
+ # q: "q",
1678
+ # status: "draft",
1679
+ # limit: 1000000,
1680
+ # offset: 1000000
1681
+ # )
1682
+ #
1683
+ # @return [Schematic::Billing::Types::ListBillingInvoicesResponse]
1684
+ def list_billing_invoices(request_options: {}, **params)
1685
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1686
+ query_params = {}
1687
+ query_params["company_id"] = params[:company_id] if params.key?(:company_id)
1688
+ query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
1689
+ query_params["document_state"] = params[:document_state] if params.key?(:document_state)
1690
+ query_params["past_due"] = params[:past_due] if params.key?(:past_due)
1691
+ query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type)
1692
+ query_params["q"] = params[:q] if params.key?(:q)
1693
+ query_params["status"] = params[:status] if params.key?(:status)
1694
+ query_params["limit"] = params[:limit] if params.key?(:limit)
1695
+ query_params["offset"] = params[:offset] if params.key?(:offset)
1696
+
1697
+ request = Schematic::Internal::JSON::Request.new(
1698
+ base_url: request_options[:base_url],
1699
+ method: "GET",
1700
+ path: "invoices",
1701
+ query: query_params,
1702
+ request_options: request_options
1703
+ )
1704
+ begin
1705
+ response = @client.send(request)
1706
+ rescue Net::HTTPRequestTimeout
1707
+ raise Schematic::Errors::TimeoutError
1708
+ end
1709
+ code = response.code.to_i
1710
+ if code.between?(200, 299)
1711
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListBillingInvoicesResponse.load(response.body))
1712
+ else
1713
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1714
+ error_types = {
1715
+ 400 => Schematic::Types::ApiError,
1716
+ 401 => Schematic::Types::ApiError,
1717
+ 403 => Schematic::Types::ApiError,
1718
+ 404 => Schematic::Types::ApiError,
1719
+ 500 => Schematic::Types::ApiError
1720
+ }
1721
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1722
+ raise error_class.new(response.body, code: code, body: error_body)
1723
+ end
1724
+ end
1725
+
1726
+ # @param request_options [Hash]
1727
+ # @param params [Hash]
1728
+ # @option request_options [String] :base_url
1729
+ # @option request_options [Hash{String => Object}] :additional_headers
1730
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1731
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1732
+ # @option request_options [Integer] :timeout_in_seconds
1733
+ # @option params [String] :invoice_id
1734
+ #
1735
+ # @example
1736
+ # client.billing.get_billing_invoice(invoice_id: "invoice_id")
1737
+ #
1738
+ # @return [Schematic::Billing::Types::GetBillingInvoiceResponse]
1739
+ def get_billing_invoice(request_options: {}, **params)
1740
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1741
+ request = Schematic::Internal::JSON::Request.new(
1742
+ base_url: request_options[:base_url],
1743
+ method: "GET",
1744
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}",
1745
+ request_options: request_options
1746
+ )
1747
+ begin
1748
+ response = @client.send(request)
1749
+ rescue Net::HTTPRequestTimeout
1750
+ raise Schematic::Errors::TimeoutError
1751
+ end
1752
+ code = response.code.to_i
1753
+ if code.between?(200, 299)
1754
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetBillingInvoiceResponse.load(response.body))
1755
+ else
1756
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1757
+ error_types = {
1758
+ 401 => Schematic::Types::ApiError,
1759
+ 403 => Schematic::Types::ApiError,
1760
+ 404 => Schematic::Types::ApiError,
1761
+ 500 => Schematic::Types::ApiError
1762
+ }
1763
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1764
+ raise error_class.new(response.body, code: code, body: error_body)
1765
+ end
1766
+ end
1767
+
1768
+ # @param request_options [Hash]
1769
+ # @param params [Hash]
1770
+ # @option request_options [String] :base_url
1771
+ # @option request_options [Hash{String => Object}] :additional_headers
1772
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1773
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1774
+ # @option request_options [Integer] :timeout_in_seconds
1775
+ # @option params [String] :invoice_id
1776
+ #
1777
+ # @example
1778
+ # client.billing.export_native_invoice(invoice_id: "invoice_id")
1779
+ #
1780
+ # @return [String]
1781
+ def export_native_invoice(request_options: {}, **params)
1782
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1783
+ request = Schematic::Internal::JSON::Request.new(
1784
+ base_url: request_options[:base_url],
1785
+ method: "GET",
1786
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/export",
1787
+ request_options: request_options
1788
+ )
1789
+ begin
1790
+ response = @client.send(request)
1791
+ rescue Net::HTTPRequestTimeout
1792
+ raise Schematic::Errors::TimeoutError
1793
+ end
1794
+ code = response.code.to_i
1795
+ return response.body if code.between?(200, 299)
1796
+
1797
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1798
+ error_types = {
1799
+ 401 => Schematic::Types::ApiError,
1800
+ 403 => Schematic::Types::ApiError,
1801
+ 404 => Schematic::Types::ApiError,
1802
+ 500 => Schematic::Types::ApiError
1803
+ }
1804
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1805
+ raise error_class.new(response.body, code: code, body: error_body)
1806
+ end
1807
+
1808
+ # @param request_options [Hash]
1809
+ # @param params [Hash]
1810
+ # @option request_options [String] :base_url
1811
+ # @option request_options [Hash{String => Object}] :additional_headers
1812
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1813
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1814
+ # @option request_options [Integer] :timeout_in_seconds
1815
+ # @option params [String] :invoice_id
1816
+ #
1817
+ # @example
1818
+ # client.billing.finalize_native_invoice(invoice_id: "invoice_id")
1819
+ #
1820
+ # @return [Schematic::Billing::Types::FinalizeNativeInvoiceResponse]
1821
+ def finalize_native_invoice(request_options: {}, **params)
1822
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1823
+ request = Schematic::Internal::JSON::Request.new(
1824
+ base_url: request_options[:base_url],
1825
+ method: "POST",
1826
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/finalize",
1827
+ request_options: request_options
1828
+ )
1829
+ begin
1830
+ response = @client.send(request)
1831
+ rescue Net::HTTPRequestTimeout
1832
+ raise Schematic::Errors::TimeoutError
1833
+ end
1834
+ code = response.code.to_i
1835
+ if code.between?(200, 299)
1836
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::FinalizeNativeInvoiceResponse.load(response.body))
1837
+ else
1838
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1839
+ error_types = {
1840
+ 400 => Schematic::Types::ApiError,
1841
+ 401 => Schematic::Types::ApiError,
1842
+ 403 => Schematic::Types::ApiError,
1843
+ 404 => Schematic::Types::ApiError,
1844
+ 500 => Schematic::Types::ApiError
1845
+ }
1846
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1847
+ raise error_class.new(response.body, code: code, body: error_body)
1848
+ end
1849
+ end
1850
+
1851
+ # @param request_options [Hash]
1852
+ # @param params [Schematic::Billing::Types::MarkInvoicePaidRequestBody]
1853
+ # @option request_options [String] :base_url
1854
+ # @option request_options [Hash{String => Object}] :additional_headers
1855
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1856
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1857
+ # @option request_options [Integer] :timeout_in_seconds
1858
+ # @option params [String] :invoice_id
1859
+ #
1860
+ # @example
1861
+ # client.billing.mark_billing_invoice_paid(
1862
+ # invoice_id: "invoice_id",
1863
+ # idempotency_key: "idempotency_key"
1864
+ # )
1865
+ #
1866
+ # @return [Schematic::Billing::Types::MarkBillingInvoicePaidResponse]
1867
+ def mark_billing_invoice_paid(request_options: {}, **params)
1868
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1869
+ request_data = Schematic::Billing::Types::MarkInvoicePaidRequestBody.new(params).to_h
1870
+ non_body_param_names = %w[invoice_id]
1871
+ body = request_data.except(*non_body_param_names)
1872
+
1873
+ request = Schematic::Internal::JSON::Request.new(
1874
+ base_url: request_options[:base_url],
1875
+ method: "POST",
1876
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/mark-paid",
1877
+ body: body,
1878
+ request_options: request_options
1879
+ )
1880
+ begin
1881
+ response = @client.send(request)
1882
+ rescue Net::HTTPRequestTimeout
1883
+ raise Schematic::Errors::TimeoutError
1884
+ end
1885
+ code = response.code.to_i
1886
+ if code.between?(200, 299)
1887
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::MarkBillingInvoicePaidResponse.load(response.body))
1888
+ else
1889
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1890
+ error_types = {
1891
+ 400 => Schematic::Types::ApiError,
1892
+ 401 => Schematic::Types::ApiError,
1893
+ 403 => Schematic::Types::ApiError,
1894
+ 404 => Schematic::Types::ApiError,
1895
+ 500 => Schematic::Types::ApiError
1896
+ }
1897
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1898
+ raise error_class.new(response.body, code: code, body: error_body)
1899
+ end
1900
+ end
1901
+
1902
+ # @param request_options [Hash]
1903
+ # @param params [Hash]
1904
+ # @option request_options [String] :base_url
1905
+ # @option request_options [Hash{String => Object}] :additional_headers
1906
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1907
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1908
+ # @option request_options [Integer] :timeout_in_seconds
1909
+ # @option params [String] :invoice_id
1910
+ #
1911
+ # @example
1912
+ # client.billing.download_native_invoice_pdf(invoice_id: "invoice_id")
1913
+ #
1914
+ # @return [String]
1915
+ def download_native_invoice_pdf(request_options: {}, **params)
1916
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1917
+ request = Schematic::Internal::JSON::Request.new(
1918
+ base_url: request_options[:base_url],
1919
+ method: "GET",
1920
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/pdf",
1921
+ request_options: request_options
1922
+ )
1923
+ begin
1924
+ response = @client.send(request)
1925
+ rescue Net::HTTPRequestTimeout
1926
+ raise Schematic::Errors::TimeoutError
1927
+ end
1928
+ code = response.code.to_i
1929
+ return response.body if code.between?(200, 299)
1930
+
1931
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1932
+ error_types = {
1933
+ 401 => Schematic::Types::ApiError,
1934
+ 403 => Schematic::Types::ApiError,
1935
+ 404 => Schematic::Types::ApiError,
1936
+ 500 => Schematic::Types::ApiError
1937
+ }
1938
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1939
+ raise error_class.new(response.body, code: code, body: error_body)
1940
+ end
1941
+
1942
+ # @param request_options [Hash]
1943
+ # @param params [Hash]
1944
+ # @option request_options [String] :base_url
1945
+ # @option request_options [Hash{String => Object}] :additional_headers
1946
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1947
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1948
+ # @option request_options [Integer] :timeout_in_seconds
1949
+ # @option params [String] :invoice_id
1950
+ #
1951
+ # @example
1952
+ # client.billing.void_native_invoice(invoice_id: "invoice_id")
1953
+ #
1954
+ # @return [Schematic::Billing::Types::VoidNativeInvoiceResponse]
1955
+ def void_native_invoice(request_options: {}, **params)
1956
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
1957
+ request = Schematic::Internal::JSON::Request.new(
1958
+ base_url: request_options[:base_url],
1959
+ method: "POST",
1960
+ path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/void",
1961
+ request_options: request_options
1962
+ )
1963
+ begin
1964
+ response = @client.send(request)
1965
+ rescue Net::HTTPRequestTimeout
1966
+ raise Schematic::Errors::TimeoutError
1967
+ end
1968
+ code = response.code.to_i
1969
+ if code.between?(200, 299)
1970
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::VoidNativeInvoiceResponse.load(response.body))
1971
+ else
1972
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
1973
+ error_types = {
1974
+ 400 => Schematic::Types::ApiError,
1975
+ 401 => Schematic::Types::ApiError,
1976
+ 403 => Schematic::Types::ApiError,
1977
+ 404 => Schematic::Types::ApiError,
1978
+ 500 => Schematic::Types::ApiError
1979
+ }
1980
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1981
+ raise error_class.new(response.body, code: code, body: error_body)
1982
+ end
1983
+ end
1984
+
1985
+ # @param request_options [Hash]
1986
+ # @param params [Hash]
1987
+ # @option request_options [String] :base_url
1988
+ # @option request_options [Hash{String => Object}] :additional_headers
1989
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
1990
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
1991
+ # @option request_options [Integer] :timeout_in_seconds
1992
+ # @option params [String, nil] :company_id
1993
+ # @option params [String, nil] :contract_id
1994
+ # @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
1995
+ # @option params [Boolean, nil] :past_due
1996
+ # @option params [Schematic::Types::BillingProviderType, nil] :provider_type
1997
+ # @option params [String, nil] :q
1998
+ # @option params [Schematic::Types::InvoiceStatus, nil] :status
1999
+ # @option params [Integer, nil] :limit
2000
+ # @option params [Integer, nil] :offset
2001
+ #
2002
+ # @example
2003
+ # client.billing.count_billing_invoices(
2004
+ # company_id: "company_id",
2005
+ # contract_id: "contract_id",
2006
+ # document_state: "credited",
2007
+ # past_due: true,
2008
+ # provider_type: "metronome",
2009
+ # q: "q",
2010
+ # status: "draft",
2011
+ # limit: 1000000,
2012
+ # offset: 1000000
2013
+ # )
2014
+ #
2015
+ # @return [Schematic::Billing::Types::CountBillingInvoicesResponse]
2016
+ def count_billing_invoices(request_options: {}, **params)
2017
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2018
+ query_params = {}
2019
+ query_params["company_id"] = params[:company_id] if params.key?(:company_id)
2020
+ query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
2021
+ query_params["document_state"] = params[:document_state] if params.key?(:document_state)
2022
+ query_params["past_due"] = params[:past_due] if params.key?(:past_due)
2023
+ query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type)
2024
+ query_params["q"] = params[:q] if params.key?(:q)
2025
+ query_params["status"] = params[:status] if params.key?(:status)
2026
+ query_params["limit"] = params[:limit] if params.key?(:limit)
2027
+ query_params["offset"] = params[:offset] if params.key?(:offset)
2028
+
2029
+ request = Schematic::Internal::JSON::Request.new(
2030
+ base_url: request_options[:base_url],
2031
+ method: "GET",
2032
+ path: "invoices/count",
2033
+ query: query_params,
2034
+ request_options: request_options
2035
+ )
2036
+ begin
2037
+ response = @client.send(request)
2038
+ rescue Net::HTTPRequestTimeout
2039
+ raise Schematic::Errors::TimeoutError
2040
+ end
2041
+ code = response.code.to_i
2042
+ if code.between?(200, 299)
2043
+ (response.body.to_s.empty? ? nil : Schematic::Billing::Types::CountBillingInvoicesResponse.load(response.body))
2044
+ else
2045
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2046
+ error_types = {
2047
+ 400 => Schematic::Types::ApiError,
2048
+ 401 => Schematic::Types::ApiError,
2049
+ 403 => Schematic::Types::ApiError,
2050
+ 404 => Schematic::Types::ApiError,
2051
+ 500 => Schematic::Types::ApiError
2052
+ }
2053
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2054
+ raise error_class.new(response.body, code: code, body: error_body)
2055
+ end
2056
+ end
1610
2057
  end
1611
2058
  end
1612
2059
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ # Input parameters
7
+ class CountBillingInvoicesParams < Internal::Types::Model
8
+ field :company_id, -> { String }, optional: true, nullable: false
9
+
10
+ field :contract_id, -> { String }, optional: true, nullable: false
11
+
12
+ field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
13
+
14
+ field :limit, -> { Integer }, optional: true, nullable: false
15
+
16
+ field :offset, -> { Integer }, optional: true, nullable: false
17
+
18
+ field :past_due, -> { Internal::Types::Boolean }, optional: true, nullable: false
19
+
20
+ field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
21
+
22
+ field :q, -> { String }, optional: true, nullable: false
23
+
24
+ field :status, -> { Schematic::Types::InvoiceStatus }, optional: true, nullable: false
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class CountBillingInvoicesRequest < Internal::Types::Model
7
+ field :company_id, -> { String }, optional: true, nullable: false
8
+
9
+ field :contract_id, -> { String }, optional: true, nullable: false
10
+
11
+ field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
12
+
13
+ field :past_due, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+
15
+ field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
16
+
17
+ field :q, -> { String }, optional: true, nullable: false
18
+
19
+ field :status, -> { Schematic::Types::InvoiceStatus }, optional: true, nullable: false
20
+
21
+ field :limit, -> { Integer }, optional: true, nullable: false
22
+
23
+ field :offset, -> { Integer }, optional: true, nullable: false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class CountBillingInvoicesResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::CountResponse }, optional: false, nullable: false
8
+
9
+ field :params, -> { Schematic::Billing::Types::CountBillingInvoicesParams }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -22,6 +22,8 @@ module Schematic
22
22
 
23
23
  field :card_last_4, -> { String }, optional: true, nullable: false, api_name: "card_last4"
24
24
 
25
+ field :customer_billing_details, -> { Schematic::Types::PaymentMethodBillingDetailsRequestBody }, optional: true, nullable: false
26
+
25
27
  field :customer_external_id, -> { String }, optional: false, nullable: false
26
28
 
27
29
  field :external_id, -> { String }, optional: false, nullable: false
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class FinalizeNativeInvoiceResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
8
+
9
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- module Accounts
4
+ module Billing
5
5
  module Types
6
- class DeleteEnvironmentResponse < Internal::Types::Model
7
- field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
6
+ class GetBillingInvoiceResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
8
8
 
9
9
  field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
10
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class GetCompanyNativeSubscriptionResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::BillingNativeSubscriptionResponseData }, optional: false, nullable: false
8
+
9
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ # Input parameters
7
+ class ListBillingInvoicesParams < Internal::Types::Model
8
+ field :company_id, -> { String }, optional: true, nullable: false
9
+
10
+ field :contract_id, -> { String }, optional: true, nullable: false
11
+
12
+ field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
13
+
14
+ field :limit, -> { Integer }, optional: true, nullable: false
15
+
16
+ field :offset, -> { Integer }, optional: true, nullable: false
17
+
18
+ field :past_due, -> { Internal::Types::Boolean }, optional: true, nullable: false
19
+
20
+ field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
21
+
22
+ field :q, -> { String }, optional: true, nullable: false
23
+
24
+ field :status, -> { Schematic::Types::InvoiceStatus }, optional: true, nullable: false
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class ListBillingInvoicesRequest < Internal::Types::Model
7
+ field :company_id, -> { String }, optional: true, nullable: false
8
+
9
+ field :contract_id, -> { String }, optional: true, nullable: false
10
+
11
+ field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
12
+
13
+ field :past_due, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+
15
+ field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
16
+
17
+ field :q, -> { String }, optional: true, nullable: false
18
+
19
+ field :status, -> { Schematic::Types::InvoiceStatus }, optional: true, nullable: false
20
+
21
+ field :limit, -> { Integer }, optional: true, nullable: false
22
+
23
+ field :offset, -> { Integer }, optional: true, nullable: false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class ListBillingInvoicesResponse < Internal::Types::Model
7
+ field :data, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceResponseData] }, optional: false, nullable: false
8
+
9
+ field :params, -> { Schematic::Billing::Types::ListBillingInvoicesParams }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class MarkBillingInvoicePaidResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
8
+
9
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end