kintsugi_sdk 5.5.14 → 5.6.0

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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/lib/crystalline/enum.rbi +17 -0
  3. data/lib/crystalline/metadata_fields.rb +94 -38
  4. data/lib/crystalline/module.rb +103 -13
  5. data/lib/crystalline/types.rb +100 -16
  6. data/lib/crystalline/utils.rb +13 -0
  7. data/lib/kintsugi_sdk/addressvalidation.rb +3 -3
  8. data/lib/kintsugi_sdk/customers.rb +10 -10
  9. data/lib/kintsugi_sdk/exemptions.rb +7 -7
  10. data/lib/kintsugi_sdk/models/errors/backend_src_address_validation_responses_validationerrorresponse.rb +0 -1
  11. data/lib/kintsugi_sdk/models/errors/backend_src_customers_responses_validationerrorresponse.rb +0 -1
  12. data/lib/kintsugi_sdk/models/errors/backend_src_exemptions_responses_validationerrorresponse.rb +0 -1
  13. data/lib/kintsugi_sdk/models/errors/backend_src_products_responses_validationerrorresponse.rb +0 -1
  14. data/lib/kintsugi_sdk/models/errors/backend_src_tax_estimation_responses_validationerrorresponse.rb +0 -1
  15. data/lib/kintsugi_sdk/models/errors/backend_src_transactions_responses_validationerrorresponse.rb +0 -1
  16. data/lib/kintsugi_sdk/models/errors/errorresponse.rb +0 -1
  17. data/lib/kintsugi_sdk/models/errors/httpvalidationerror.rb +0 -1
  18. data/lib/kintsugi_sdk/models/ops/createtransactionbycustomer_request.rb +0 -1
  19. data/lib/kintsugi_sdk/models/ops/estimate_tax_v1_tax_estimate_post_request.rb +2 -3
  20. data/lib/kintsugi_sdk/models/ops/get_customer_by_external_id_v1_customers_external_external_id_get_request.rb +0 -1
  21. data/lib/kintsugi_sdk/models/ops/get_customer_by_id_v1_customers_customer_id_get_request.rb +0 -1
  22. data/lib/kintsugi_sdk/models/ops/get_customers_v1_request.rb +0 -1
  23. data/lib/kintsugi_sdk/models/ops/get_exemption_by_id_v1_exemptions_exemption_id_get_request.rb +0 -1
  24. data/lib/kintsugi_sdk/models/ops/get_exemptions_v1_exemptions_get_request.rb +0 -1
  25. data/lib/kintsugi_sdk/models/ops/get_nexus_for_org_v1_nexus_get_request.rb +6 -3
  26. data/lib/kintsugi_sdk/models/ops/get_nexus_for_org_v1_nexus_get_request.rbi +2 -0
  27. data/lib/kintsugi_sdk/models/ops/get_product_by_id_v1_products_product_id_get_request.rb +0 -1
  28. data/lib/kintsugi_sdk/models/ops/get_transaction_by_id_v1_transactions_transaction_id_get_request.rb +0 -1
  29. data/lib/kintsugi_sdk/models/ops/get_transactions_v1_transactions_get_request.rb +0 -1
  30. data/lib/kintsugi_sdk/models/ops/getexemptionattachments_request.rb +0 -1
  31. data/lib/kintsugi_sdk/models/ops/gettransactionbyexternalid_request.rb +0 -1
  32. data/lib/kintsugi_sdk/models/ops/gettransactionsbycustomer_request.rb +0 -1
  33. data/lib/kintsugi_sdk/models/ops/gettransactionsbyfiling_request.rb +0 -1
  34. data/lib/kintsugi_sdk/models/ops/search_v1_address_validation_search_post_security.rb +0 -1
  35. data/lib/kintsugi_sdk/models/ops/update_customer_v1_customers_customer_id_put_request.rb +0 -1
  36. data/lib/kintsugi_sdk/models/ops/update_product_v1_products_product_id_put_request.rb +0 -1
  37. data/lib/kintsugi_sdk/models/ops/update_transaction_v1_transactions_transaction_id_put_request.rb +0 -1
  38. data/lib/kintsugi_sdk/models/ops/uploadexemptioncert_request.rb +0 -1
  39. data/lib/kintsugi_sdk/models/ops.rb +0 -1
  40. data/lib/kintsugi_sdk/models/shared/addressbase.rb +1 -2
  41. data/lib/kintsugi_sdk/models/shared/addresses.rb +3 -4
  42. data/lib/kintsugi_sdk/models/shared/addressresponsedata.rb +0 -1
  43. data/lib/kintsugi_sdk/models/shared/addresssearchresponse.rb +0 -1
  44. data/lib/kintsugi_sdk/models/shared/addressstatus.rb +0 -3
  45. data/lib/kintsugi_sdk/models/shared/addresssubmittedresponse.rb +0 -1
  46. data/lib/kintsugi_sdk/models/shared/addresstype.rb +0 -3
  47. data/lib/kintsugi_sdk/models/shared/appliedto.rb +0 -3
  48. data/lib/kintsugi_sdk/models/shared/attachmentread.rb +1 -2
  49. data/lib/kintsugi_sdk/models/shared/backend_src_address_validation_responses_validationerroritem.rb +0 -1
  50. data/lib/kintsugi_sdk/models/shared/backend_src_customers_responses_validationerroritem.rb +0 -1
  51. data/lib/kintsugi_sdk/models/shared/backend_src_exemptions_models_exemptionread.rb +4 -5
  52. data/lib/kintsugi_sdk/models/shared/backend_src_exemptions_responses_validationerroritem.rb +0 -1
  53. data/lib/kintsugi_sdk/models/shared/backend_src_exemptions_serializers_exemptionread.rb +4 -5
  54. data/lib/kintsugi_sdk/models/shared/backend_src_products_responses_validationerroritem.rb +0 -1
  55. data/lib/kintsugi_sdk/models/shared/backend_src_tax_estimation_responses_validationerroritem.rb +0 -1
  56. data/lib/kintsugi_sdk/models/shared/backend_src_transactions_responses_validationerroritem.rb +0 -1
  57. data/lib/kintsugi_sdk/models/shared/body_upload_exemption_certificate_v1_exemptions_exemption_id_attachments_post.rb +0 -1
  58. data/lib/kintsugi_sdk/models/shared/countrycodeenum.rb +1 -3
  59. data/lib/kintsugi_sdk/models/shared/currencyenum.rb +0 -3
  60. data/lib/kintsugi_sdk/models/shared/customerbase.rb +4 -5
  61. data/lib/kintsugi_sdk/models/shared/customerbasebase.rb +4 -5
  62. data/lib/kintsugi_sdk/models/shared/customerbasepublic.rb +4 -5
  63. data/lib/kintsugi_sdk/models/shared/customercreate.rb +4 -5
  64. data/lib/kintsugi_sdk/models/shared/customerread.rb +4 -5
  65. data/lib/kintsugi_sdk/models/shared/customertaxregistrationread.rb +2 -3
  66. data/lib/kintsugi_sdk/models/shared/customertaxtypeenum.rb +0 -3
  67. data/lib/kintsugi_sdk/models/shared/customerupdate.rb +4 -5
  68. data/lib/kintsugi_sdk/models/shared/discountbuilder.rb +2 -3
  69. data/lib/kintsugi_sdk/models/shared/exemption.rb +5 -6
  70. data/lib/kintsugi_sdk/models/shared/exemptioncreate.rb +4 -5
  71. data/lib/kintsugi_sdk/models/shared/exemptionrequired.rb +6 -5
  72. data/lib/kintsugi_sdk/models/shared/exemptionstatus.rb +0 -3
  73. data/lib/kintsugi_sdk/models/shared/exemptiontype.rb +0 -3
  74. data/lib/kintsugi_sdk/models/shared/fastapi_pagination_default_page_exemptionread_2.rb +3 -4
  75. data/lib/kintsugi_sdk/models/shared/file.rb +0 -1
  76. data/lib/kintsugi_sdk/models/shared/findthresholdcrossingtransactionstate.rb +56 -0
  77. data/lib/kintsugi_sdk/models/shared/findthresholdcrossingtransactionstate.rbi +25 -0
  78. data/lib/kintsugi_sdk/models/shared/jurisdictiontype.rb +0 -3
  79. data/lib/kintsugi_sdk/models/shared/nexusresponse.rb +41 -22
  80. data/lib/kintsugi_sdk/models/shared/nexusresponse.rbi +10 -0
  81. data/lib/kintsugi_sdk/models/shared/nexusstateenum.rb +0 -3
  82. data/lib/kintsugi_sdk/models/shared/nexusstatusenum.rb +0 -3
  83. data/lib/kintsugi_sdk/models/shared/nexustypeenum.rb +0 -3
  84. data/lib/kintsugi_sdk/models/shared/page_customerread_.rb +3 -4
  85. data/lib/kintsugi_sdk/models/shared/page_nexusresponse_.rb +3 -4
  86. data/lib/kintsugi_sdk/models/shared/page_transactionestimateresponse_.rb +3 -4
  87. data/lib/kintsugi_sdk/models/shared/page_transactionread_.rb +3 -4
  88. data/lib/kintsugi_sdk/models/shared/periodmodelenum.rb +0 -3
  89. data/lib/kintsugi_sdk/models/shared/processingstatusenum.rb +1 -3
  90. data/lib/kintsugi_sdk/models/shared/productread.rb +12 -9
  91. data/lib/kintsugi_sdk/models/shared/productstatusenum.rb +0 -3
  92. data/lib/kintsugi_sdk/models/shared/productupdate.rb +10 -7
  93. data/lib/kintsugi_sdk/models/shared/registration.rb +0 -1
  94. data/lib/kintsugi_sdk/models/shared/registrationsregimeenum.rb +0 -3
  95. data/lib/kintsugi_sdk/models/shared/relatedentitytype.rb +0 -3
  96. data/lib/kintsugi_sdk/models/shared/salesortransactionsenum.rb +0 -3
  97. data/lib/kintsugi_sdk/models/shared/security.rb +0 -1
  98. data/lib/kintsugi_sdk/models/shared/sourceenum.rb +6 -3
  99. data/lib/kintsugi_sdk/models/shared/statusenum.rb +0 -3
  100. data/lib/kintsugi_sdk/models/shared/taxexemptionenum.rb +1 -3
  101. data/lib/kintsugi_sdk/models/shared/taxitembuilder.rb +4 -5
  102. data/lib/kintsugi_sdk/models/shared/taxitemestimate.rb +1 -2
  103. data/lib/kintsugi_sdk/models/shared/taxitemread.rb +4 -5
  104. data/lib/kintsugi_sdk/models/shared/taxitemreturnreasonenum.rb +2 -3
  105. data/lib/kintsugi_sdk/models/shared/taxitemtypeenum.rb +0 -3
  106. data/lib/kintsugi_sdk/models/shared/taxliabilitysourceenum.rb +0 -3
  107. data/lib/kintsugi_sdk/models/shared/transactionaddressbuilder.rb +3 -4
  108. data/lib/kintsugi_sdk/models/shared/transactionaddresspublic.rb +2 -3
  109. data/lib/kintsugi_sdk/models/shared/transactionaddressread_output.rb +3 -4
  110. data/lib/kintsugi_sdk/models/shared/transactioncreate.rb +23 -19
  111. data/lib/kintsugi_sdk/models/shared/transactioncreate.rbi +2 -2
  112. data/lib/kintsugi_sdk/models/shared/transactionestimatepublicrequest.rb +6 -11
  113. data/lib/kintsugi_sdk/models/shared/transactionestimatepublicrequest.rbi +0 -2
  114. data/lib/kintsugi_sdk/models/shared/transactionestimateresponse.rb +7 -12
  115. data/lib/kintsugi_sdk/models/shared/transactionestimateresponse.rbi +0 -2
  116. data/lib/kintsugi_sdk/models/shared/transactionestimateresponse_addresses.rb +3 -4
  117. data/lib/kintsugi_sdk/models/shared/transactionestimateresponse_type.rb +0 -3
  118. data/lib/kintsugi_sdk/models/shared/transactionexemptstatusenum.rb +2 -3
  119. data/lib/kintsugi_sdk/models/shared/transactionitembuilder.rb +8 -7
  120. data/lib/kintsugi_sdk/models/shared/transactionitemcreateupdate.rb +8 -7
  121. data/lib/kintsugi_sdk/models/shared/transactionitemestimatebase.rb +2 -3
  122. data/lib/kintsugi_sdk/models/shared/transactionitemestimateresponse.rb +3 -4
  123. data/lib/kintsugi_sdk/models/shared/transactionitemread.rb +7 -6
  124. data/lib/kintsugi_sdk/models/shared/transactionpublicrequest.rb +21 -17
  125. data/lib/kintsugi_sdk/models/shared/transactionpublicrequest.rbi +2 -2
  126. data/lib/kintsugi_sdk/models/shared/transactionread.rb +24 -20
  127. data/lib/kintsugi_sdk/models/shared/transactionread.rbi +2 -2
  128. data/lib/kintsugi_sdk/models/shared/transactionrefundstatus.rb +0 -3
  129. data/lib/kintsugi_sdk/models/shared/transactionstatusenum.rb +0 -3
  130. data/lib/kintsugi_sdk/models/shared/transactiontypeenum.rb +0 -3
  131. data/lib/kintsugi_sdk/models/shared/transactionupdate.rb +20 -16
  132. data/lib/kintsugi_sdk/models/shared/transactionupdate.rbi +2 -2
  133. data/lib/kintsugi_sdk/models/shared/treatmentenum.rb +0 -3
  134. data/lib/kintsugi_sdk/models/shared/type.rb +0 -3
  135. data/lib/kintsugi_sdk/models/shared/validationaddress.rb +0 -1
  136. data/lib/kintsugi_sdk/models/shared/validationerror.rb +0 -1
  137. data/lib/kintsugi_sdk/models/shared.rb +1 -7
  138. data/lib/kintsugi_sdk/nexus.rb +1 -1
  139. data/lib/kintsugi_sdk/openapisdk.rb +13 -15
  140. data/lib/kintsugi_sdk/products.rb +6 -414
  141. data/lib/kintsugi_sdk/sdk_hooks/hooks.rb +0 -1
  142. data/lib/kintsugi_sdk/sdkconfiguration.rb +5 -10
  143. data/lib/kintsugi_sdk/taxestimation.rb +4 -4
  144. data/lib/kintsugi_sdk/transactions.rb +8 -8
  145. data/lib/kintsugi_sdk/utils/forms.rb +1 -1
  146. data/lib/kintsugi_sdk/utils/query_params.rb +4 -2
  147. data/lib/kintsugi_sdk/utils/request_bodies.rb +11 -6
  148. data/lib/kintsugi_sdk/utils/security.rb +10 -0
  149. data/lib/kintsugi_sdk/utils/url.rb +11 -5
  150. data/lib/kintsugi_sdk/utils/utils.rb +45 -3
  151. metadata +73 -41
  152. data/lib/kintsugi_sdk/models/ops/get_products_v1_products_get_request.rb +0 -61
  153. data/lib/kintsugi_sdk/models/ops/get_products_v1_products_get_request.rbi +0 -27
  154. data/lib/kintsugi_sdk/models/shared/page_productread_.rb +0 -49
  155. data/lib/kintsugi_sdk/models/shared/page_productread_.rbi +0 -21
  156. data/lib/kintsugi_sdk/models/shared/productcategories.rb +0 -38
  157. data/lib/kintsugi_sdk/models/shared/productcategories.rbi +0 -15
  158. data/lib/kintsugi_sdk/models/shared/productcategoryenum.rb +0 -25
  159. data/lib/kintsugi_sdk/models/shared/productcategoryenum.rbi +0 -11
  160. data/lib/kintsugi_sdk/models/shared/productcodeenum.rb +0 -82
  161. data/lib/kintsugi_sdk/models/shared/productcodeenum.rbi +0 -11
  162. data/lib/kintsugi_sdk/models/shared/productcreatemanual.rb +0 -61
  163. data/lib/kintsugi_sdk/models/shared/productcreatemanual.rbi +0 -27
  164. data/lib/kintsugi_sdk/models/shared/productsubcategory.rb +0 -46
  165. data/lib/kintsugi_sdk/models/shared/productsubcategory.rbi +0 -19
  166. data/lib/kintsugi_sdk/models/shared/productsubcategoryenum.rb +0 -83
  167. data/lib/kintsugi_sdk/models/shared/productsubcategoryenum.rbi +0 -11
@@ -39,302 +39,6 @@ module KintsugiSDK
39
39
  end
40
40
 
41
41
 
42
- sig { params(request: Models::Ops::GetProductsV1ProductsGetRequest, timeout_ms: T.nilable(Integer)).returns(Models::Shared::PageProductRead) }
43
- def list(request:, timeout_ms: nil)
44
- # list - Get Products
45
- # Retrieve a paginated list of products based on filters and search query.
46
- url, params = @sdk_configuration.get_server_details
47
- base_url = Utils.template_url(url, params)
48
- url = "#{base_url}/v1/products/"
49
- headers = {}
50
- headers = T.cast(headers, T::Hash[String, String])
51
- query_params = Utils.get_query_params(Models::Ops::GetProductsV1ProductsGetRequest, request, nil)
52
- headers['Accept'] = 'application/json'
53
- headers['user-agent'] = @sdk_configuration.user_agent
54
-
55
- security = @sdk_configuration.security_source&.call
56
-
57
- timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
58
- timeout ||= @sdk_configuration.timeout
59
-
60
-
61
- connection = @sdk_configuration.client
62
-
63
- hook_ctx = SDKHooks::HookContext.new(
64
- config: @sdk_configuration,
65
- base_url: base_url,
66
- oauth2_scopes: [],
67
- operation_id: 'get_products_v1_products__get',
68
- security_source: @sdk_configuration.security_source
69
- )
70
-
71
- error = T.let(nil, T.nilable(StandardError))
72
- http_response = T.let(nil, T.nilable(Faraday::Response))
73
-
74
-
75
- begin
76
- http_response = T.must(connection).get(url) do |req|
77
- req.headers.merge!(headers)
78
- req.options.timeout = timeout unless timeout.nil?
79
- req.params = query_params
80
- Utils.configure_request_security(req, security)
81
-
82
- @sdk_configuration.hooks.before_request(
83
- hook_ctx: SDKHooks::BeforeRequestHookContext.new(
84
- hook_ctx: hook_ctx
85
- ),
86
- request: req
87
- )
88
- end
89
- rescue StandardError => e
90
- error = e
91
- ensure
92
- if http_response.nil? || Utils.error_status?(http_response.status)
93
- http_response = @sdk_configuration.hooks.after_error(
94
- error: error,
95
- hook_ctx: SDKHooks::AfterErrorHookContext.new(
96
- hook_ctx: hook_ctx
97
- ),
98
- response: http_response
99
- )
100
- else
101
- http_response = @sdk_configuration.hooks.after_success(
102
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
103
- hook_ctx: hook_ctx
104
- ),
105
- response: http_response
106
- )
107
- end
108
-
109
- if http_response.nil?
110
- raise error if !error.nil?
111
- raise 'no response'
112
- end
113
- end
114
-
115
- content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
116
- if Utils.match_status_code(http_response.status, ['200'])
117
- if Utils.match_content_type(content_type, 'application/json')
118
- @sdk_configuration.hooks.after_success(
119
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
120
- hook_ctx: hook_ctx
121
- ),
122
- response: http_response
123
- )
124
- response_data = http_response.env.response_body
125
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::PageProductRead)
126
-
127
- return obj
128
- else
129
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
130
- end
131
- elsif Utils.match_status_code(http_response.status, ['401', '404'])
132
- if Utils.match_content_type(content_type, 'application/json')
133
- @sdk_configuration.hooks.after_success(
134
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
135
- hook_ctx: hook_ctx
136
- ),
137
- response: http_response
138
- )
139
- response_data = http_response.env.response_body
140
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ErrorResponse)
141
- raise obj
142
- else
143
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
144
- end
145
- elsif Utils.match_status_code(http_response.status, ['422'])
146
- if Utils.match_content_type(content_type, 'application/json')
147
- @sdk_configuration.hooks.after_success(
148
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
149
- hook_ctx: hook_ctx
150
- ),
151
- response: http_response
152
- )
153
- response_data = http_response.env.response_body
154
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BackendSrcProductsResponsesValidationErrorResponse)
155
- raise obj
156
- else
157
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
158
- end
159
- elsif Utils.match_status_code(http_response.status, ['500'])
160
- if Utils.match_content_type(content_type, 'application/json')
161
- @sdk_configuration.hooks.after_success(
162
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
163
- hook_ctx: hook_ctx
164
- ),
165
- response: http_response
166
- )
167
- response_data = http_response.env.response_body
168
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ErrorResponse)
169
- raise obj
170
- else
171
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
172
- end
173
- elsif Utils.match_status_code(http_response.status, ['4XX'])
174
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
175
- elsif Utils.match_status_code(http_response.status, ['5XX'])
176
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
177
- else
178
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
179
-
180
- end
181
- end
182
-
183
-
184
- sig { params(request: Models::Shared::ProductCreateManual, timeout_ms: T.nilable(Integer)).returns(Models::Shared::ProductRead) }
185
- def create(request:, timeout_ms: nil)
186
- # create - Create Product
187
- # The Create Product API allows users to manually create a new product
188
- # in the system. This includes specifying product details such as category,
189
- # subcategory, and tax exemption status, etc.
190
- url, params = @sdk_configuration.get_server_details
191
- base_url = Utils.template_url(url, params)
192
- url = "#{base_url}/v1/products/"
193
- headers = {}
194
- headers = T.cast(headers, T::Hash[String, String])
195
- req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
196
- headers['content-type'] = req_content_type
197
- raise StandardError, 'request body is required' if data.nil? && form.nil?
198
-
199
- if form
200
- body = Utils.encode_form(form)
201
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
202
- body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
203
- else
204
- body = data
205
- end
206
- headers['Accept'] = 'application/json'
207
- headers['user-agent'] = @sdk_configuration.user_agent
208
-
209
- security = @sdk_configuration.security_source&.call
210
-
211
- timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
212
- timeout ||= @sdk_configuration.timeout
213
-
214
-
215
- connection = @sdk_configuration.client
216
-
217
- hook_ctx = SDKHooks::HookContext.new(
218
- config: @sdk_configuration,
219
- base_url: base_url,
220
- oauth2_scopes: [],
221
- operation_id: 'create_product_v1_products__post',
222
- security_source: @sdk_configuration.security_source
223
- )
224
-
225
- error = T.let(nil, T.nilable(StandardError))
226
- http_response = T.let(nil, T.nilable(Faraday::Response))
227
-
228
-
229
- begin
230
- http_response = T.must(connection).post(url) do |req|
231
- req.body = body
232
- req.headers.merge!(headers)
233
- req.options.timeout = timeout unless timeout.nil?
234
- Utils.configure_request_security(req, security)
235
-
236
- @sdk_configuration.hooks.before_request(
237
- hook_ctx: SDKHooks::BeforeRequestHookContext.new(
238
- hook_ctx: hook_ctx
239
- ),
240
- request: req
241
- )
242
- end
243
- rescue StandardError => e
244
- error = e
245
- ensure
246
- if http_response.nil? || Utils.error_status?(http_response.status)
247
- http_response = @sdk_configuration.hooks.after_error(
248
- error: error,
249
- hook_ctx: SDKHooks::AfterErrorHookContext.new(
250
- hook_ctx: hook_ctx
251
- ),
252
- response: http_response
253
- )
254
- else
255
- http_response = @sdk_configuration.hooks.after_success(
256
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
257
- hook_ctx: hook_ctx
258
- ),
259
- response: http_response
260
- )
261
- end
262
-
263
- if http_response.nil?
264
- raise error if !error.nil?
265
- raise 'no response'
266
- end
267
- end
268
-
269
- content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
270
- if Utils.match_status_code(http_response.status, ['200'])
271
- if Utils.match_content_type(content_type, 'application/json')
272
- @sdk_configuration.hooks.after_success(
273
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
274
- hook_ctx: hook_ctx
275
- ),
276
- response: http_response
277
- )
278
- response_data = http_response.env.response_body
279
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::ProductRead)
280
-
281
- return obj
282
- else
283
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
284
- end
285
- elsif Utils.match_status_code(http_response.status, ['401'])
286
- if Utils.match_content_type(content_type, 'application/json')
287
- @sdk_configuration.hooks.after_success(
288
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
289
- hook_ctx: hook_ctx
290
- ),
291
- response: http_response
292
- )
293
- response_data = http_response.env.response_body
294
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ErrorResponse)
295
- raise obj
296
- else
297
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
298
- end
299
- elsif Utils.match_status_code(http_response.status, ['422'])
300
- if Utils.match_content_type(content_type, 'application/json')
301
- @sdk_configuration.hooks.after_success(
302
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
303
- hook_ctx: hook_ctx
304
- ),
305
- response: http_response
306
- )
307
- response_data = http_response.env.response_body
308
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BackendSrcProductsResponsesValidationErrorResponse)
309
- raise obj
310
- else
311
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
312
- end
313
- elsif Utils.match_status_code(http_response.status, ['500'])
314
- if Utils.match_content_type(content_type, 'application/json')
315
- @sdk_configuration.hooks.after_success(
316
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
317
- hook_ctx: hook_ctx
318
- ),
319
- response: http_response
320
- )
321
- response_data = http_response.env.response_body
322
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ErrorResponse)
323
- raise obj
324
- else
325
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
326
- end
327
- elsif Utils.match_status_code(http_response.status, ['4XX'])
328
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
329
- elsif Utils.match_status_code(http_response.status, ['5XX'])
330
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
331
- else
332
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
333
-
334
- end
335
- end
336
-
337
-
338
42
  sig { params(request: Models::Ops::GetProductByIdV1ProductsProductIdGetRequest, timeout_ms: T.nilable(Integer)).returns(Models::Shared::ProductRead) }
339
43
  def get(request:, timeout_ms: nil)
340
44
  # get - Get Product By Id
@@ -365,7 +69,7 @@ module KintsugiSDK
365
69
  hook_ctx = SDKHooks::HookContext.new(
366
70
  config: @sdk_configuration,
367
71
  base_url: base_url,
368
- oauth2_scopes: [],
72
+ oauth2_scopes: nil,
369
73
  operation_id: 'get_product_by_id_v1_products__product_id__get',
370
74
  security_source: @sdk_configuration.security_source
371
75
  )
@@ -486,7 +190,9 @@ module KintsugiSDK
486
190
  def update(request:, timeout_ms: nil)
487
191
  # update - Update Product
488
192
  # The Update Product API allows users to modify the details of
489
- # an existing product identified by its unique product_id
193
+ # an existing product identified by its unique product_id. You can
194
+ # retrieve supported categories and subcategories from
195
+ # [GET /products/categories endpoint](/reference/api/products/get-product-categories)
490
196
  url, params = @sdk_configuration.get_server_details
491
197
  base_url = Utils.template_url(url, params)
492
198
  url = Utils.generate_url(
@@ -501,7 +207,7 @@ module KintsugiSDK
501
207
  headers['content-type'] = req_content_type
502
208
  raise StandardError, 'request body is required' if data.nil? && form.nil?
503
209
 
504
- if form
210
+ if form && !form.empty?
505
211
  body = Utils.encode_form(form)
506
212
  elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
507
213
  body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
@@ -522,7 +228,7 @@ module KintsugiSDK
522
228
  hook_ctx = SDKHooks::HookContext.new(
523
229
  config: @sdk_configuration,
524
230
  base_url: base_url,
525
- oauth2_scopes: [],
231
+ oauth2_scopes: nil,
526
232
  operation_id: 'update_product_v1_products__product_id__put',
527
233
  security_source: @sdk_configuration.security_source
528
234
  )
@@ -638,119 +344,5 @@ module KintsugiSDK
638
344
 
639
345
  end
640
346
  end
641
-
642
-
643
- sig { params(timeout_ms: T.nilable(Integer)).returns(T::Array[Models::Shared::ProductCategories]) }
644
- def list_categories(timeout_ms: nil)
645
- # list_categories - Get Product Categories
646
- # The Get Product Categories API retrieves all
647
- # product categories. This endpoint helps users understand and select the
648
- # appropriate categories for their products.
649
- url, params = @sdk_configuration.get_server_details
650
- base_url = Utils.template_url(url, params)
651
- url = "#{base_url}/v1/products/categories/"
652
- headers = {}
653
- headers = T.cast(headers, T::Hash[String, String])
654
- headers['Accept'] = 'application/json'
655
- headers['user-agent'] = @sdk_configuration.user_agent
656
-
657
- security = @sdk_configuration.security_source&.call
658
-
659
- timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
660
- timeout ||= @sdk_configuration.timeout
661
-
662
-
663
- connection = @sdk_configuration.client
664
-
665
- hook_ctx = SDKHooks::HookContext.new(
666
- config: @sdk_configuration,
667
- base_url: base_url,
668
- oauth2_scopes: [],
669
- operation_id: 'get_product_categories_v1_products_categories__get',
670
- security_source: @sdk_configuration.security_source
671
- )
672
-
673
- error = T.let(nil, T.nilable(StandardError))
674
- http_response = T.let(nil, T.nilable(Faraday::Response))
675
-
676
-
677
- begin
678
- http_response = T.must(connection).get(url) do |req|
679
- req.headers.merge!(headers)
680
- req.options.timeout = timeout unless timeout.nil?
681
- Utils.configure_request_security(req, security)
682
-
683
- @sdk_configuration.hooks.before_request(
684
- hook_ctx: SDKHooks::BeforeRequestHookContext.new(
685
- hook_ctx: hook_ctx
686
- ),
687
- request: req
688
- )
689
- end
690
- rescue StandardError => e
691
- error = e
692
- ensure
693
- if http_response.nil? || Utils.error_status?(http_response.status)
694
- http_response = @sdk_configuration.hooks.after_error(
695
- error: error,
696
- hook_ctx: SDKHooks::AfterErrorHookContext.new(
697
- hook_ctx: hook_ctx
698
- ),
699
- response: http_response
700
- )
701
- else
702
- http_response = @sdk_configuration.hooks.after_success(
703
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
704
- hook_ctx: hook_ctx
705
- ),
706
- response: http_response
707
- )
708
- end
709
-
710
- if http_response.nil?
711
- raise error if !error.nil?
712
- raise 'no response'
713
- end
714
- end
715
-
716
- content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
717
- if Utils.match_status_code(http_response.status, ['200'])
718
- if Utils.match_content_type(content_type, 'application/json')
719
- @sdk_configuration.hooks.after_success(
720
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
721
- hook_ctx: hook_ctx
722
- ),
723
- response: http_response
724
- )
725
- response_data = http_response.env.response_body
726
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Crystalline::Array.new(Models::Shared::ProductCategories))
727
-
728
- return obj
729
- else
730
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
731
- end
732
- elsif Utils.match_status_code(http_response.status, ['422'])
733
- if Utils.match_content_type(content_type, 'application/json')
734
- @sdk_configuration.hooks.after_success(
735
- hook_ctx: SDKHooks::AfterSuccessHookContext.new(
736
- hook_ctx: hook_ctx
737
- ),
738
- response: http_response
739
- )
740
- response_data = http_response.env.response_body
741
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::HTTPValidationError)
742
- raise obj
743
- else
744
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
745
- end
746
- elsif Utils.match_status_code(http_response.status, ['4XX'])
747
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
748
- elsif Utils.match_status_code(http_response.status, ['5XX'])
749
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
750
- else
751
- raise ::KintsugiSDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
752
-
753
- end
754
- end
755
347
  end
756
348
  end
@@ -5,7 +5,6 @@
5
5
 
6
6
  require_relative './types'
7
7
 
8
-
9
8
  module KintsugiSDK
10
9
  module SDKHooks
11
10
  class Hooks
@@ -34,9 +34,6 @@ module KintsugiSDK
34
34
  sig { returns(T.nilable(Float)) }
35
35
  attr_accessor :timeout
36
36
 
37
- sig { returns(T.nilable(T::Boolean)) }
38
- attr_accessor :debug_logging
39
-
40
37
 
41
38
  sig { returns(T.nilable(T.proc.returns(T.nilable(Models::Shared::Security)))) }
42
39
  attr_accessor :security_source
@@ -74,11 +71,10 @@ module KintsugiSDK
74
71
  security: T.nilable(Models::Shared::Security),
75
72
  security_source: T.nilable(T.proc.returns(Models::Shared::Security)),
76
73
  server_url: T.nilable(String),
77
- server_idx: T.nilable(Integer),
78
- debug_logging: T.nilable(T::Boolean)
74
+ server_idx: T.nilable(Integer)
79
75
  ).void
80
76
  end
81
- def initialize(client, hooks, retry_config, timeout_ms, security, security_source, server_url, server_idx, debug_logging = nil)
77
+ def initialize(client, hooks, retry_config, timeout_ms, security, security_source, server_url, server_idx)
82
78
  @client = client
83
79
  @hooks = hooks
84
80
  @retry_config = retry_config
@@ -93,10 +89,9 @@ module KintsugiSDK
93
89
  end
94
90
  @language = 'ruby'
95
91
  @openapi_doc_version = '1.0.0'
96
- @sdk_version = '5.5.14'
97
- @gen_version = '2.716.10'
98
- @user_agent = 'speakeasy-sdk/ruby 5.5.14 2.716.10 1.0.0 kintsugi_sdk'
99
- @debug_logging = debug_logging.nil? ? (ENV['KINTSUGI_DEBUG'] == 'true') : debug_logging
92
+ @sdk_version = '5.6.0'
93
+ @gen_version = '2.845.15'
94
+ @user_agent = 'speakeasy-sdk/ruby 5.6.0 2.845.15 1.0.0 kintsugi_sdk'
100
95
  end
101
96
 
102
97
  sig { returns([String, T::Hash[Symbol, String]]) }
@@ -39,7 +39,7 @@ module KintsugiSDK
39
39
  end
40
40
 
41
41
 
42
- sig { params(request: Models::Ops::EstimateTaxV1TaxEstimatePostRequest, timeout_ms: T.nilable(Integer)).returns(Models::Shared::TransactionEstimateResponse) }
42
+ sig { params(request: Models::Ops::EstimateTaxV1TaxEstimatePostRequest, timeout_ms: T.nilable(Integer)).returns(Models::Shared::PageTransactionEstimateResponse) }
43
43
  def estimate_tax(request:, timeout_ms: nil)
44
44
  # estimate_tax - Estimate Tax
45
45
  # The Estimate Tax API calculates the estimated tax for a specific
@@ -54,7 +54,7 @@ module KintsugiSDK
54
54
  headers['content-type'] = req_content_type
55
55
  raise StandardError, 'request body is required' if data.nil? && form.nil?
56
56
 
57
- if form
57
+ if form && !form.empty?
58
58
  body = Utils.encode_form(form)
59
59
  elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
60
60
  body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
@@ -76,7 +76,7 @@ module KintsugiSDK
76
76
  hook_ctx = SDKHooks::HookContext.new(
77
77
  config: @sdk_configuration,
78
78
  base_url: base_url,
79
- oauth2_scopes: [],
79
+ oauth2_scopes: nil,
80
80
  operation_id: 'estimate_tax_v1_tax_estimate_post',
81
81
  security_source: @sdk_configuration.security_source
82
82
  )
@@ -136,7 +136,7 @@ module KintsugiSDK
136
136
  response: http_response
137
137
  )
138
138
  response_data = http_response.env.response_body
139
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::TransactionEstimateResponse)
139
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::PageTransactionEstimateResponse)
140
140
 
141
141
  return obj
142
142
  else
@@ -64,7 +64,7 @@ module KintsugiSDK
64
64
  hook_ctx = SDKHooks::HookContext.new(
65
65
  config: @sdk_configuration,
66
66
  base_url: base_url,
67
- oauth2_scopes: [],
67
+ oauth2_scopes: nil,
68
68
  operation_id: 'get_transactions_v1_transactions_get',
69
69
  security_source: @sdk_configuration.security_source
70
70
  )
@@ -195,7 +195,7 @@ module KintsugiSDK
195
195
  headers['content-type'] = req_content_type
196
196
  raise StandardError, 'request body is required' if data.nil? && form.nil?
197
197
 
198
- if form
198
+ if form && !form.empty?
199
199
  body = Utils.encode_form(form)
200
200
  elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
201
201
  body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
@@ -216,7 +216,7 @@ module KintsugiSDK
216
216
  hook_ctx = SDKHooks::HookContext.new(
217
217
  config: @sdk_configuration,
218
218
  base_url: base_url,
219
- oauth2_scopes: [],
219
+ oauth2_scopes: nil,
220
220
  operation_id: 'create_transaction_v1_transactions_post',
221
221
  security_source: @sdk_configuration.security_source
222
222
  )
@@ -363,7 +363,7 @@ module KintsugiSDK
363
363
  hook_ctx = SDKHooks::HookContext.new(
364
364
  config: @sdk_configuration,
365
365
  base_url: base_url,
366
- oauth2_scopes: [],
366
+ oauth2_scopes: nil,
367
367
  operation_id: 'getTransactionByExternalId',
368
368
  security_source: @sdk_configuration.security_source
369
369
  )
@@ -498,7 +498,7 @@ module KintsugiSDK
498
498
  headers['content-type'] = req_content_type
499
499
  raise StandardError, 'request body is required' if data.nil? && form.nil?
500
500
 
501
- if form
501
+ if form && !form.empty?
502
502
  body = Utils.encode_form(form)
503
503
  elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
504
504
  body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
@@ -519,7 +519,7 @@ module KintsugiSDK
519
519
  hook_ctx = SDKHooks::HookContext.new(
520
520
  config: @sdk_configuration,
521
521
  base_url: base_url,
522
- oauth2_scopes: [],
522
+ oauth2_scopes: nil,
523
523
  operation_id: 'update_transaction_v1_transactions__transaction_id__put',
524
524
  security_source: @sdk_configuration.security_source
525
525
  )
@@ -638,7 +638,7 @@ module KintsugiSDK
638
638
  hook_ctx = SDKHooks::HookContext.new(
639
639
  config: @sdk_configuration,
640
640
  base_url: base_url,
641
- oauth2_scopes: [],
641
+ oauth2_scopes: nil,
642
642
  operation_id: 'get_transaction_by_id_v1_transactions__transaction_id__get',
643
643
  security_source: @sdk_configuration.security_source
644
644
  )
@@ -783,7 +783,7 @@ module KintsugiSDK
783
783
  hook_ctx = SDKHooks::HookContext.new(
784
784
  config: @sdk_configuration,
785
785
  base_url: base_url,
786
- oauth2_scopes: [],
786
+ oauth2_scopes: nil,
787
787
  operation_id: 'getTransactionsByFiling',
788
788
  security_source: @sdk_configuration.security_source
789
789
  )
@@ -104,7 +104,7 @@ module KintsugiSDK
104
104
  end
105
105
  raise StandardError, 'invalid multipart/form-data file' if T.unsafe(file_name) == '' || T.unsafe(content).nil?
106
106
 
107
- form.append([field_name, [file_name, content]])
107
+ form.append(["#{field_name}[]", [file_name, content]])
108
108
  end
109
109
  else
110
110
  # Handle single file
@@ -3,7 +3,6 @@
3
3
  # typed: true
4
4
  # frozen_string_literal: true
5
5
 
6
- require 'cgi'
7
6
  require 'date'
8
7
  require 'base64'
9
8
  require 'sorbet-runtime'
@@ -17,7 +16,10 @@ module KintsugiSDK
17
16
  parsed_params = T.let({}, T::Hash[T.any(String, Symbol), T::Array[String]])
18
17
  if !url_override.nil?
19
18
  parsed_url = URI.parse url_override
20
- parsed_params = CGI.parse parsed_url.query
19
+ URI.decode_www_form(parsed_url.query.to_s).each do |key, value|
20
+ parsed_params[key] ||= []
21
+ T.must(parsed_params[key]) << value
22
+ end
21
23
  end
22
24
  params = T.let({}, T::Hash[T.any(String, Symbol), T::Array[String]])
23
25
  T.unsafe(clazz).fields.each do |f|
@@ -29,8 +29,6 @@ module KintsugiSDK
29
29
 
30
30
  return serialize_content_type(SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method], request) if !request.respond_to?(:fields) || !request.respond_to?(request_field_name)
31
31
 
32
- request_val = request.send(request_field_name)
33
-
34
32
  request_metadata = T.let(nil, T.nilable(T::Array[T::Array[T.any(T::Array[T.nilable(String)], String)]]))
35
33
  T.unsafe(request).fields.each do |f|
36
34
  if f.name == request_field_name
@@ -38,7 +36,14 @@ module KintsugiSDK
38
36
  break
39
37
  end
40
38
  end
41
- raise StandardError, 'invalid request type' if request_metadata.nil?
39
+ if request_metadata.nil?
40
+ # Field name collision: model has a field matching request_field_name but without :request metadata.
41
+ # Serialize the entire object as the request body.
42
+ return serialize_content_type(SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method], request)
43
+ end
44
+
45
+ request_val = request.send(request_field_name)
46
+ return ['', nil, nil] if request_val.nil?
42
47
 
43
48
  serialize_content_type(
44
49
  request_metadata.fetch(:media_type, 'application/octet-stream'), request_val
@@ -50,9 +55,9 @@ module KintsugiSDK
50
55
  .returns([String, Object, T.nilable(T::Array[T::Array[T.any(T::Array[T.nilable(String)], String)]])])
51
56
  end
52
57
  def self.serialize_content_type(media_type, request)
53
- return media_type, ::Crystalline.to_json(request), nil if media_type.match('(application|text)\/.*?\+*json.*')
54
- return serialize_multipart_form(media_type, request) if media_type.match('multipart\/.*')
55
- return media_type, serialize_form_data(request), nil if media_type.match('application\/x-www-form-urlencoded.*')
58
+ return media_type, ::Crystalline.to_json(request), nil if media_type.match('^(application|text)\/([^+]+\+)*json.*')
59
+ return serialize_multipart_form(media_type, request) if media_type.match('^multipart\/.*')
60
+ return media_type, serialize_form_data(request), nil if media_type.match('^application\/x-www-form-urlencoded.*')
56
61
  return media_type, request, nil if request.is_a?(String) || request.is_a?(Array)
57
62
 
58
63
  raise StandardError, "invalid request body type #{request.class} for mediaType #{media_type}"