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
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class MarkInvoicePaidRequestBody < Internal::Types::Model
7
+ field :invoice_id, -> { String }, optional: false, nullable: false
8
+
9
+ field :amount, -> { Integer }, optional: true, nullable: false
10
+
11
+ field :idempotency_key, -> { String }, optional: false, nullable: false
12
+
13
+ field :reference, -> { String }, optional: true, nullable: false
14
+
15
+ field :settled_at, -> { String }, optional: true, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class VoidNativeInvoiceResponse < 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
@@ -639,6 +639,88 @@ module Schematic
639
639
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
640
640
  raise error_class.new(response.body, code: code, body: error_body)
641
641
  end
642
+
643
+ # @param request_options [Hash]
644
+ # @param _params [Hash]
645
+ # @option request_options [String] :base_url
646
+ # @option request_options [Hash{String => Object}] :additional_headers
647
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
648
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
649
+ # @option request_options [Integer] :timeout_in_seconds
650
+ #
651
+ # @example
652
+ # client.catalogs.get_public_catalog
653
+ #
654
+ # @return [Schematic::Catalogs::Types::GetPublicCatalogResponse]
655
+ def get_public_catalog(request_options: {}, **_params)
656
+ request = Schematic::Internal::JSON::Request.new(
657
+ base_url: request_options[:base_url],
658
+ method: "GET",
659
+ path: "public/catalog",
660
+ request_options: request_options
661
+ )
662
+ begin
663
+ response = @client.send(request)
664
+ rescue Net::HTTPRequestTimeout
665
+ raise Schematic::Errors::TimeoutError
666
+ end
667
+ code = response.code.to_i
668
+ if code.between?(200, 299)
669
+ (response.body.to_s.empty? ? nil : Schematic::Catalogs::Types::GetPublicCatalogResponse.load(response.body))
670
+ else
671
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
672
+ error_types = {
673
+ 401 => Schematic::Types::ApiError,
674
+ 403 => Schematic::Types::ApiError,
675
+ 404 => Schematic::Types::ApiError,
676
+ 500 => Schematic::Types::ApiError
677
+ }
678
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
679
+ raise error_class.new(response.body, code: code, body: error_body)
680
+ end
681
+ end
682
+
683
+ # @param request_options [Hash]
684
+ # @param params [Hash]
685
+ # @option request_options [String] :base_url
686
+ # @option request_options [Hash{String => Object}] :additional_headers
687
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
688
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
689
+ # @option request_options [Integer] :timeout_in_seconds
690
+ # @option params [String] :catalog_id
691
+ #
692
+ # @example
693
+ # client.catalogs.get_public_catalog_by_id(catalog_id: "catalog_id")
694
+ #
695
+ # @return [Schematic::Catalogs::Types::GetPublicCatalogByIdResponse]
696
+ def get_public_catalog_by_id(request_options: {}, **params)
697
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
698
+ request = Schematic::Internal::JSON::Request.new(
699
+ base_url: request_options[:base_url],
700
+ method: "GET",
701
+ path: "public/catalogs/#{URI.encode_uri_component(params[:catalog_id].to_s)}",
702
+ request_options: request_options
703
+ )
704
+ begin
705
+ response = @client.send(request)
706
+ rescue Net::HTTPRequestTimeout
707
+ raise Schematic::Errors::TimeoutError
708
+ end
709
+ code = response.code.to_i
710
+ if code.between?(200, 299)
711
+ (response.body.to_s.empty? ? nil : Schematic::Catalogs::Types::GetPublicCatalogByIdResponse.load(response.body))
712
+ else
713
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
714
+ error_types = {
715
+ 401 => Schematic::Types::ApiError,
716
+ 403 => Schematic::Types::ApiError,
717
+ 404 => Schematic::Types::ApiError,
718
+ 500 => Schematic::Types::ApiError
719
+ }
720
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
721
+ raise error_class.new(response.body, code: code, body: error_body)
722
+ end
723
+ end
642
724
  end
643
725
  end
644
726
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- module Accounts
4
+ module Catalogs
5
5
  module Types
6
- class CreateApiKeyResponse < Internal::Types::Model
7
- field :data, -> { Schematic::Types::ApiKeyCreateResponseData }, optional: false, nullable: false
6
+ class GetPublicCatalogByIdResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::PublicCatalogResponseData }, optional: false, nullable: false
8
8
 
9
9
  field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
10
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- module Accounts
4
+ module Catalogs
5
5
  module Types
6
- class DeleteApiKeyResponse < Internal::Types::Model
7
- field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
6
+ class GetPublicCatalogResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::PublicCatalogResponseData }, optional: false, nullable: false
8
8
 
9
9
  field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
10
  end
@@ -2,6 +2,200 @@
2
2
 
3
3
  module Schematic
4
4
  class Client
5
+ # @param request_options [Hash]
6
+ # @param _params [Hash]
7
+ # @option request_options [String] :base_url
8
+ # @option request_options [Hash{String => Object}] :additional_headers
9
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
10
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
11
+ # @option request_options [Integer] :timeout_in_seconds
12
+ #
13
+ # @example
14
+ # client.post_api_keys
15
+ #
16
+ # @return [untyped]
17
+ def post_api_keys(request_options: {}, **_params)
18
+ request = Schematic::Internal::JSON::Request.new(
19
+ base_url: request_options[:base_url],
20
+ method: "POST",
21
+ path: "api-keys",
22
+ request_options: request_options
23
+ )
24
+ begin
25
+ response = @client.send(request)
26
+ rescue Net::HTTPRequestTimeout
27
+ raise Schematic::Errors::TimeoutError
28
+ end
29
+ code = response.code.to_i
30
+ return if code.between?(200, 299)
31
+
32
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
33
+ raise error_class.new(response.body, code: code)
34
+ end
35
+
36
+ # @param request_options [Hash]
37
+ # @param params [Hash]
38
+ # @option request_options [String] :base_url
39
+ # @option request_options [Hash{String => Object}] :additional_headers
40
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
41
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
42
+ # @option request_options [Integer] :timeout_in_seconds
43
+ # @option params [String] :api_key_id
44
+ #
45
+ # @example
46
+ # client.put_api_keys_api_key_id(api_key_id: "api_key_id")
47
+ #
48
+ # @return [untyped]
49
+ def put_api_keys_api_key_id(request_options: {}, **params)
50
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
51
+ request = Schematic::Internal::JSON::Request.new(
52
+ base_url: request_options[:base_url],
53
+ method: "PUT",
54
+ path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}",
55
+ request_options: request_options
56
+ )
57
+ begin
58
+ response = @client.send(request)
59
+ rescue Net::HTTPRequestTimeout
60
+ raise Schematic::Errors::TimeoutError
61
+ end
62
+ code = response.code.to_i
63
+ return if code.between?(200, 299)
64
+
65
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
66
+ raise error_class.new(response.body, code: code)
67
+ end
68
+
69
+ # @param request_options [Hash]
70
+ # @param params [Hash]
71
+ # @option request_options [String] :base_url
72
+ # @option request_options [Hash{String => Object}] :additional_headers
73
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
74
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
75
+ # @option request_options [Integer] :timeout_in_seconds
76
+ # @option params [String] :api_key_id
77
+ #
78
+ # @example
79
+ # client.delete_api_keys_api_key_id(api_key_id: "api_key_id")
80
+ #
81
+ # @return [untyped]
82
+ def delete_api_keys_api_key_id(request_options: {}, **params)
83
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
84
+ request = Schematic::Internal::JSON::Request.new(
85
+ base_url: request_options[:base_url],
86
+ method: "DELETE",
87
+ path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}",
88
+ request_options: request_options
89
+ )
90
+ begin
91
+ response = @client.send(request)
92
+ rescue Net::HTTPRequestTimeout
93
+ raise Schematic::Errors::TimeoutError
94
+ end
95
+ code = response.code.to_i
96
+ return if code.between?(200, 299)
97
+
98
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
99
+ raise error_class.new(response.body, code: code)
100
+ end
101
+
102
+ # @param request_options [Hash]
103
+ # @param _params [Hash]
104
+ # @option request_options [String] :base_url
105
+ # @option request_options [Hash{String => Object}] :additional_headers
106
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
107
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
108
+ # @option request_options [Integer] :timeout_in_seconds
109
+ #
110
+ # @example
111
+ # client.post_environments
112
+ #
113
+ # @return [untyped]
114
+ def post_environments(request_options: {}, **_params)
115
+ request = Schematic::Internal::JSON::Request.new(
116
+ base_url: request_options[:base_url],
117
+ method: "POST",
118
+ path: "environments",
119
+ request_options: request_options
120
+ )
121
+ begin
122
+ response = @client.send(request)
123
+ rescue Net::HTTPRequestTimeout
124
+ raise Schematic::Errors::TimeoutError
125
+ end
126
+ code = response.code.to_i
127
+ return if code.between?(200, 299)
128
+
129
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
130
+ raise error_class.new(response.body, code: code)
131
+ end
132
+
133
+ # @param request_options [Hash]
134
+ # @param params [Hash]
135
+ # @option request_options [String] :base_url
136
+ # @option request_options [Hash{String => Object}] :additional_headers
137
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
138
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
139
+ # @option request_options [Integer] :timeout_in_seconds
140
+ # @option params [String] :environment_id
141
+ #
142
+ # @example
143
+ # client.put_environments_environment_id(environment_id: "environment_id")
144
+ #
145
+ # @return [untyped]
146
+ def put_environments_environment_id(request_options: {}, **params)
147
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
148
+ request = Schematic::Internal::JSON::Request.new(
149
+ base_url: request_options[:base_url],
150
+ method: "PUT",
151
+ path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}",
152
+ request_options: request_options
153
+ )
154
+ begin
155
+ response = @client.send(request)
156
+ rescue Net::HTTPRequestTimeout
157
+ raise Schematic::Errors::TimeoutError
158
+ end
159
+ code = response.code.to_i
160
+ return if code.between?(200, 299)
161
+
162
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
163
+ raise error_class.new(response.body, code: code)
164
+ end
165
+
166
+ # @param request_options [Hash]
167
+ # @param params [Hash]
168
+ # @option request_options [String] :base_url
169
+ # @option request_options [Hash{String => Object}] :additional_headers
170
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
171
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
172
+ # @option request_options [Integer] :timeout_in_seconds
173
+ # @option params [String] :environment_id
174
+ #
175
+ # @example
176
+ # client.delete_environments_environment_id(environment_id: "environment_id")
177
+ #
178
+ # @return [untyped]
179
+ def delete_environments_environment_id(request_options: {}, **params)
180
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
181
+ request = Schematic::Internal::JSON::Request.new(
182
+ base_url: request_options[:base_url],
183
+ method: "DELETE",
184
+ path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}",
185
+ request_options: request_options
186
+ )
187
+ begin
188
+ response = @client.send(request)
189
+ rescue Net::HTTPRequestTimeout
190
+ raise Schematic::Errors::TimeoutError
191
+ end
192
+ code = response.code.to_i
193
+ return if code.between?(200, 299)
194
+
195
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
196
+ raise error_class.new(response.body, code: code)
197
+ end
198
+
5
199
  # @param request_options [Hash]
6
200
  # @param _params [Hash]
7
201
  # @option request_options [String] :base_url
@@ -43,7 +237,7 @@ module Schematic
43
237
  @raw_client = Schematic::Internal::Http::RawClient.new(
44
238
  base_url: base_url || Schematic::Environment::DEFAULT,
45
239
  headers: {
46
- "User-Agent" => "schematichq/1.5.4",
240
+ "User-Agent" => "schematichq/1.5.6",
47
241
  "X-Fern-Language" => "Ruby",
48
242
  "X-Schematic-Api-Key" => api_key.to_s
49
243
  },
@@ -2005,6 +2005,7 @@ module Schematic
2005
2005
  # @option params [String, nil] :end_time
2006
2006
  # @option params [Schematic::Types::CreditEventType, nil] :event_type
2007
2007
  # @option params [String, nil] :feature_id
2008
+ # @option params [String, nil] :source_event_id
2008
2009
  # @option params [String, nil] :start_time
2009
2010
  # @option params [Integer, nil] :limit
2010
2011
  # @option params [Integer, nil] :offset
@@ -2016,6 +2017,7 @@ module Schematic
2016
2017
  # end_time: "end_time",
2017
2018
  # event_type: "adjustment",
2018
2019
  # feature_id: "feature_id",
2020
+ # source_event_id: "source_event_id",
2019
2021
  # start_time: "start_time",
2020
2022
  # limit: 1000000,
2021
2023
  # offset: 1000000
@@ -2030,6 +2032,7 @@ module Schematic
2030
2032
  query_params["end_time"] = params[:end_time] if params.key?(:end_time)
2031
2033
  query_params["event_type"] = params[:event_type] if params.key?(:event_type)
2032
2034
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
2035
+ query_params["source_event_id"] = params[:source_event_id] if params.key?(:source_event_id)
2033
2036
  query_params["start_time"] = params[:start_time] if params.key?(:start_time)
2034
2037
  query_params["limit"] = params[:limit] if params.key?(:limit)
2035
2038
  query_params["offset"] = params[:offset] if params.key?(:offset)
@@ -2063,6 +2066,48 @@ module Schematic
2063
2066
  end
2064
2067
  end
2065
2068
 
2069
+ # @param request_options [Hash]
2070
+ # @param params [Hash]
2071
+ # @option request_options [String] :base_url
2072
+ # @option request_options [Hash{String => Object}] :additional_headers
2073
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
2074
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
2075
+ # @option request_options [Integer] :timeout_in_seconds
2076
+ # @option params [String] :ledger_entry_id
2077
+ #
2078
+ # @example
2079
+ # client.credits.get_credit_event_ledger_entry(ledger_entry_id: "ledger_entry_id")
2080
+ #
2081
+ # @return [Schematic::Credits::Types::GetCreditEventLedgerEntryResponse]
2082
+ def get_credit_event_ledger_entry(request_options: {}, **params)
2083
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
2084
+ request = Schematic::Internal::JSON::Request.new(
2085
+ base_url: request_options[:base_url],
2086
+ method: "GET",
2087
+ path: "v2/billing/credits/ledger/#{URI.encode_uri_component(params[:ledger_entry_id].to_s)}",
2088
+ request_options: request_options
2089
+ )
2090
+ begin
2091
+ response = @client.send(request)
2092
+ rescue Net::HTTPRequestTimeout
2093
+ raise Schematic::Errors::TimeoutError
2094
+ end
2095
+ code = response.code.to_i
2096
+ if code.between?(200, 299)
2097
+ (response.body.to_s.empty? ? nil : Schematic::Credits::Types::GetCreditEventLedgerEntryResponse.load(response.body))
2098
+ else
2099
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
2100
+ error_types = {
2101
+ 401 => Schematic::Types::ApiError,
2102
+ 403 => Schematic::Types::ApiError,
2103
+ 404 => Schematic::Types::ApiError,
2104
+ 500 => Schematic::Types::ApiError
2105
+ }
2106
+ error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
2107
+ raise error_class.new(response.body, code: code, body: error_body)
2108
+ end
2109
+ end
2110
+
2066
2111
  # @param request_options [Hash]
2067
2112
  # @param params [Hash]
2068
2113
  # @option request_options [String] :base_url
@@ -2075,6 +2120,7 @@ module Schematic
2075
2120
  # @option params [String, nil] :end_time
2076
2121
  # @option params [Schematic::Types::CreditEventType, nil] :event_type
2077
2122
  # @option params [String, nil] :feature_id
2123
+ # @option params [String, nil] :source_event_id
2078
2124
  # @option params [String, nil] :start_time
2079
2125
  # @option params [Integer, nil] :limit
2080
2126
  # @option params [Integer, nil] :offset
@@ -2086,6 +2132,7 @@ module Schematic
2086
2132
  # end_time: "end_time",
2087
2133
  # event_type: "adjustment",
2088
2134
  # feature_id: "feature_id",
2135
+ # source_event_id: "source_event_id",
2089
2136
  # start_time: "start_time",
2090
2137
  # limit: 1000000,
2091
2138
  # offset: 1000000
@@ -2100,6 +2147,7 @@ module Schematic
2100
2147
  query_params["end_time"] = params[:end_time] if params.key?(:end_time)
2101
2148
  query_params["event_type"] = params[:event_type] if params.key?(:event_type)
2102
2149
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
2150
+ query_params["source_event_id"] = params[:source_event_id] if params.key?(:source_event_id)
2103
2151
  query_params["start_time"] = params[:start_time] if params.key?(:start_time)
2104
2152
  query_params["limit"] = params[:limit] if params.key?(:limit)
2105
2153
  query_params["offset"] = params[:offset] if params.key?(:offset)
@@ -19,6 +19,8 @@ module Schematic
19
19
 
20
20
  field :offset, -> { Integer }, optional: true, nullable: false
21
21
 
22
+ field :source_event_id, -> { String }, optional: true, nullable: false
23
+
22
24
  field :start_time, -> { String }, optional: true, nullable: false
23
25
  end
24
26
  end
@@ -14,6 +14,8 @@ module Schematic
14
14
 
15
15
  field :feature_id, -> { String }, optional: true, nullable: false
16
16
 
17
+ field :source_event_id, -> { String }, optional: true, nullable: false
18
+
17
19
  field :start_time, -> { String }, optional: true, nullable: false
18
20
 
19
21
  field :limit, -> { Integer }, optional: true, nullable: false
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- module Accounts
4
+ module Credits
5
5
  module Types
6
- class CreateEnvironmentResponse < Internal::Types::Model
7
- field :data, -> { Schematic::Types::EnvironmentDetailResponseData }, optional: false, nullable: false
6
+ class GetCreditEventLedgerEntryResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::CreditEventLedgerResponseData }, optional: false, nullable: false
8
8
 
9
9
  field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
10
10
  end
@@ -19,6 +19,8 @@ module Schematic
19
19
 
20
20
  field :offset, -> { Integer }, optional: true, nullable: false
21
21
 
22
+ field :source_event_id, -> { String }, optional: true, nullable: false
23
+
22
24
  field :start_time, -> { String }, optional: true, nullable: false
23
25
  end
24
26
  end
@@ -14,6 +14,8 @@ module Schematic
14
14
 
15
15
  field :feature_id, -> { String }, optional: true, nullable: false
16
16
 
17
+ field :source_event_id, -> { String }, optional: true, nullable: false
18
+
17
19
  field :start_time, -> { String }, optional: true, nullable: false
18
20
 
19
21
  field :limit, -> { Integer }, optional: true, nullable: false
@@ -462,7 +462,6 @@ module Schematic
462
462
  #
463
463
  # @example
464
464
  # client.features.create_flag(
465
- # default_value: true,
466
465
  # description: "description",
467
466
  # flag_type: "boolean",
468
467
  # key: "key",
@@ -555,7 +554,6 @@ module Schematic
555
554
  # @example
556
555
  # client.features.update_flag(
557
556
  # flag_id: "flag_id",
558
- # default_value: true,
559
557
  # description: "description",
560
558
  # flag_type: "boolean",
561
559
  # key: "key",
@@ -6,8 +6,8 @@ module Schematic
6
6
  # Instantiates a CursorItemIterator, an Enumerable class which wraps calls to a cursor-based paginated API and yields individual items from it.
7
7
  #
8
8
  # @param initial_cursor [String] The initial cursor to use when iterating, if any.
9
- # @param cursor_field [Symbol] The field in API responses to extract the next cursor from.
10
- # @param item_field [Symbol] The field in API responses to extract the items to iterate over.
9
+ # @param cursor_field [Symbol, Array<Symbol>] The field (or nested path) in API responses to extract the next cursor from.
10
+ # @param item_field [Symbol, Array<Symbol>] The field (or nested path) in API responses to extract the items to iterate over.
11
11
  # @param block [Proc] A block which is responsible for receiving a cursor to use and returning the given page from the API.
12
12
  # @return [Schematic::Internal::CursorItemIterator]
13
13
  def initialize(initial_cursor:, cursor_field:, item_field:, &block)
@@ -12,7 +12,7 @@ module Schematic
12
12
  # Instantiates a CursorPageIterator, an Enumerable class which wraps calls to a cursor-based paginated API and yields pages of items.
13
13
  #
14
14
  # @param initial_cursor [String] The initial cursor to use when iterating, if any.
15
- # @param cursor_field [Symbol] The name of the field in API responses to extract the next cursor from.
15
+ # @param cursor_field [Symbol, Array<Symbol>] The name (or nested path) of the field in API responses to extract the next cursor from.
16
16
  # @param block [Proc] A block which is responsible for receiving a cursor to use and returning the given page from the API.
17
17
  # The block should return a two-element array: [parsed_page, raw_http_response].
18
18
  # @return [Schematic::Internal::CursorPageIterator]
@@ -93,7 +93,7 @@ module Schematic
93
93
  end
94
94
  @at_first_page = false
95
95
  @need_initial_load = false
96
- @cursor = page.send(@cursor_field)
96
+ @cursor = read_field(page, @cursor_field)
97
97
  page
98
98
  end
99
99
 
@@ -112,6 +112,15 @@ module Schematic
112
112
  @http_response = raw_response
113
113
  fetched_page
114
114
  end
115
+
116
+ # Reads a field from an API response, walking through enclosing objects when the field is nested.
117
+ #
118
+ # @param value [Object, nil] The API response.
119
+ # @param field [Symbol, Array<Symbol>] The field name, or the path of field names for a nested field.
120
+ # @return [Object, nil]
121
+ def read_field(value, field)
122
+ Array(field).reduce(value) { |object, name| object&.send(name) }
123
+ end
115
124
  end
116
125
  end
117
126
  end
@@ -21,7 +21,7 @@ module Schematic
21
21
  # share a position with each other or with `next_element`.
22
22
  pass = @item_pages.dup.tap(&:rewind)
23
23
  while (page = pass.next_page)
24
- (page.send(@item_field) || []).each(&)
24
+ (read_field(page, @item_field) || []).each(&)
25
25
  end
26
26
  nil
27
27
  end
@@ -86,7 +86,7 @@ module Schematic
86
86
  def cached_page_items
87
87
  return [] unless @page
88
88
 
89
- @page.send(@item_field) || []
89
+ read_field(@page, @item_field) || []
90
90
  end
91
91
 
92
92
  def next_item_from_cached_page
@@ -106,6 +106,15 @@ module Schematic
106
106
  @page = @item_pages.next_page
107
107
  @item_index = 0
108
108
  end
109
+
110
+ # Reads a field from an API response, walking through enclosing objects when the field is nested.
111
+ #
112
+ # @param value [Object, nil] The API response.
113
+ # @param field [Symbol, Array<Symbol>] The field name, or the path of field names for a nested field.
114
+ # @return [Object, nil]
115
+ def read_field(value, field)
116
+ Array(field).reduce(value) { |object, name| object&.send(name) }
117
+ end
109
118
  end
110
119
  end
111
120
  end
@@ -6,8 +6,8 @@ module Schematic
6
6
  # Instantiates an OffsetItemIterator, an Enumerable class which wraps calls to an offset-based paginated API and yields the individual items from it.
7
7
  #
8
8
  # @param initial_page [Integer] The initial page or offset to start from when iterating.
9
- # @param item_field [Symbol] The name of the field in API responses to extract the items to iterate over.
10
- # @param has_next_field [Symbol] The name of the field in API responses containing a boolean of whether another page exists.
9
+ # @param item_field [Symbol, Array<Symbol>] The name (or nested path) of the field in API responses to extract the items to iterate over.
10
+ # @param has_next_field [Symbol, Array<Symbol>] The name (or nested path) of the field in API responses containing a boolean of whether another page exists.
11
11
  # @param step [Boolean] If true, treats the page number as a true offset (i.e. increments the page number by the number of items returned from each call rather than just 1)
12
12
  # @param block [Proc] A block which is responsible for receiving a page number to use and returning the given page from the API.
13
13
  #