clerk-sdk-ruby 6.0.0 → 8.0.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 (345) hide show
  1. checksums.yaml +4 -4
  2. data/lib/clerk/actortokens.rb +10 -10
  3. data/lib/clerk/admin_portal_link_tokens.rb +10 -10
  4. data/lib/clerk/agenttasks.rb +10 -10
  5. data/lib/clerk/allowlistidentifiers.rb +15 -15
  6. data/lib/clerk/api_keys.rb +40 -40
  7. data/lib/clerk/betafeatures.rb +10 -10
  8. data/lib/clerk/billing.rb +52 -52
  9. data/lib/clerk/blocklistidentifiers.rb +15 -15
  10. data/lib/clerk/clients.rb +15 -15
  11. data/lib/clerk/domains.rb +20 -20
  12. data/lib/clerk/emailaddresses.rb +43 -36
  13. data/lib/clerk/emailandsmstemplates.rb +6 -6
  14. data/lib/clerk/emailsmstemplates.rb +21 -21
  15. data/lib/clerk/enterpriseconnections.rb +35 -35
  16. data/lib/clerk/instancesettings.rb +60 -60
  17. data/lib/clerk/invitations.rb +20 -20
  18. data/lib/clerk/jwks.rb +5 -5
  19. data/lib/clerk/jwttemplates.rb +25 -25
  20. data/lib/clerk/m2m.rb +20 -20
  21. data/lib/clerk/machines.rb +45 -45
  22. data/lib/clerk/miscellaneous.rb +5 -5
  23. data/lib/clerk/models/components/algorithm.rb +19 -0
  24. data/lib/clerk/models/components/{clerkerror_meta.rbi → algorithm.rbi} +2 -2
  25. data/lib/clerk/models/components/billingpaymentattempt_totals.rb +1 -1
  26. data/lib/clerk/models/components/clerkerror.rb +1 -1
  27. data/lib/clerk/models/components/commercecreditledgerresponse.rb +3 -7
  28. data/lib/clerk/models/components/commercecreditledgerresponse.rbi +0 -2
  29. data/lib/clerk/models/components/{schemas_commerceperunittotal.rb → commerceperunittotal_2.rb} +2 -2
  30. data/lib/clerk/models/components/{schemas_commerceperunittotal.rbi → commerceperunittotal_2.rbi} +2 -2
  31. data/lib/clerk/models/components/{schemas_commerceperunittotaltier.rb → commerceperunittotaltier_2.rb} +1 -1
  32. data/lib/clerk/models/components/{schemas_commerceperunittotaltier.rbi → commerceperunittotaltier_2.rbi} +2 -2
  33. data/lib/clerk/models/components/{schemas_commerceplan.rb → commerceplan_2.rb} +6 -6
  34. data/lib/clerk/models/components/{schemas_commerceplan.rbi → commerceplan_2.rbi} +2 -2
  35. data/lib/clerk/models/components/{schemas_commerceplan_fee.rb → commerceplan_2_annual_fee.rb} +1 -1
  36. data/lib/clerk/models/components/{schemas_commerceplan_fee.rbi → commerceplan_2_annual_fee.rbi} +2 -2
  37. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_fee.rb → commerceplan_2_annual_monthly_fee.rb} +1 -1
  38. data/lib/clerk/models/components/{schemas_commerceplan_annual_monthly_fee.rbi → commerceplan_2_annual_monthly_fee.rbi} +2 -2
  39. data/lib/clerk/models/components/{schemas_commerceplan_annual_fee.rb → commerceplan_2_fee.rb} +1 -1
  40. data/lib/clerk/models/components/{schemas_commerceplan_annual_fee.rbi → commerceplan_2_fee.rbi} +2 -2
  41. data/lib/clerk/models/components/{schemas_commerceplan_object.rb → commerceplan_2_object.rb} +2 -2
  42. data/lib/clerk/models/components/{clerkerrors_meta.rbi → commerceplan_2_object.rbi} +2 -2
  43. data/lib/clerk/models/components/commercepricetransitiondetails.rb +1 -1
  44. data/lib/clerk/models/components/commercepricetransitionresponse.rb +1 -1
  45. data/lib/clerk/models/components/{schemas_commercesubscriptionitem.rb → commercesubscriptionitem_2.rb} +7 -7
  46. data/lib/clerk/models/components/{schemas_commercesubscriptionitem.rbi → commercesubscriptionitem_2.rbi} +2 -2
  47. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_amount.rb → commercesubscriptionitem_2_amount.rb} +1 -1
  48. data/lib/clerk/models/components/commercesubscriptionitem_2_amount.rbi +19 -0
  49. data/lib/clerk/models/components/{schemas_commerceplan_annual_monthly_fee.rb → commercesubscriptionitem_2_annual_fee.rb} +1 -1
  50. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_fee.rbi → commercesubscriptionitem_2_annual_fee.rbi} +2 -2
  51. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_annual_fee.rb → commercesubscriptionitem_2_annual_monthly_fee.rb} +1 -1
  52. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_amount.rbi → commercesubscriptionitem_2_annual_monthly_fee.rbi} +2 -2
  53. data/lib/clerk/models/components/commercesubscriptionitem_2_fee.rb +44 -0
  54. data/lib/clerk/models/components/commercesubscriptionitem_2_fee.rbi +19 -0
  55. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment.rb → commercesubscriptionitem_2_next_payment.rb} +3 -3
  56. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment.rbi → commercesubscriptionitem_2_next_payment.rbi} +2 -2
  57. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_amount.rb → commercesubscriptionitem_2_next_payment_amount.rb} +1 -1
  58. data/lib/clerk/models/components/commercesubscriptionitem_2_next_payment_amount.rbi +19 -0
  59. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits.rb → commercesubscriptionitem_2_next_payment_credits.rb} +3 -3
  60. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits.rbi → commercesubscriptionitem_2_next_payment_credits.rbi} +2 -2
  61. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits_proration.rb → commercesubscriptionitem_2_next_payment_credits_proration.rb} +1 -1
  62. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits_proration.rbi → commercesubscriptionitem_2_next_payment_credits_proration.rbi} +2 -2
  63. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts.rb → commercesubscriptionitem_2_next_payment_discounts.rb} +2 -2
  64. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts.rbi → commercesubscriptionitem_2_next_payment_discounts.rbi} +2 -2
  65. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts_proration.rb → commercesubscriptionitem_2_next_payment_discounts_proration.rb} +1 -1
  66. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts_proration.rbi → commercesubscriptionitem_2_next_payment_discounts_proration.rbi} +2 -2
  67. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_payer.rb → commercesubscriptionitem_2_next_payment_payer.rb} +1 -1
  68. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_payer.rbi → commercesubscriptionitem_2_next_payment_payer.rbi} +2 -2
  69. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_totals.rb → commercesubscriptionitem_2_next_payment_totals.rb} +3 -3
  70. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_totals.rbi → commercesubscriptionitem_2_next_payment_totals.rbi} +2 -2
  71. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commercepayer.rb → commercesubscriptionitem_2_object_commercepayer.rb} +2 -2
  72. data/lib/clerk/models/components/commercesubscriptionitem_2_object_commercepayer.rbi +11 -0
  73. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commerceplan.rb → commercesubscriptionitem_2_object_commerceplan.rb} +2 -2
  74. data/lib/clerk/models/components/commercesubscriptionitem_2_object_commerceplan.rbi +11 -0
  75. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commercesubscriptionitem.rb → commercesubscriptionitem_2_object_commercesubscriptionitem.rb} +2 -2
  76. data/lib/clerk/models/components/commercesubscriptionitem_2_object_commercesubscriptionitem.rbi +11 -0
  77. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan.rb → commercesubscriptionitem_2_plan.rb} +6 -6
  78. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan.rbi → commercesubscriptionitem_2_plan.rbi} +2 -2
  79. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan_period.rb → commercesubscriptionitem_2_plan_period.rb} +2 -2
  80. data/lib/clerk/models/components/commercesubscriptionitem_2_plan_period.rbi +11 -0
  81. data/lib/clerk/models/components/{schemas_commercesubscriptionitem_status.rb → commercesubscriptionitem_2_status.rb} +2 -2
  82. data/lib/clerk/models/components/commercesubscriptionitem_2_status.rbi +11 -0
  83. data/lib/clerk/models/components/commercesubscriptionitem_totals.rb +1 -1
  84. data/lib/clerk/models/components/commercesubscriptionnextpayment.rb +1 -1
  85. data/lib/clerk/models/components/commercesubscriptionnextpayment_totals.rb +1 -1
  86. data/lib/clerk/models/components/emailaddress_verification_saml_clerkerror.rb +1 -1
  87. data/lib/clerk/models/components/enrollment_mode.rb +1 -0
  88. data/lib/clerk/models/components/enterpriseaccount_verification_oauth_clerkerror.rb +1 -1
  89. data/lib/clerk/models/components/enterpriseaccount_verification_saml_clerkerror.rb +1 -1
  90. data/lib/clerk/models/components/enterpriseconnection.rb +6 -2
  91. data/lib/clerk/models/components/enterpriseconnection.rbi +2 -0
  92. data/lib/clerk/models/components/{custom_attribute.rb → enterpriseconnection_custom_attribute.rb} +1 -1
  93. data/lib/clerk/models/components/enterpriseconnection_custom_attribute.rbi +21 -0
  94. data/lib/clerk/models/components/enterpriseconnection_mode.rb +21 -0
  95. data/lib/clerk/models/components/enterpriseconnection_mode.rbi +11 -0
  96. data/lib/clerk/models/components/enterpriseconnection_object.rb +19 -0
  97. data/lib/clerk/models/components/enterpriseconnection_object.rbi +11 -0
  98. data/lib/clerk/models/components/enterpriseconnection_saml_connection.rb +5 -1
  99. data/lib/clerk/models/components/enterpriseconnection_saml_connection.rbi +2 -0
  100. data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_clerkerror.rb +1 -1
  101. data/lib/clerk/models/components/{schemas_featureresponse.rb → featureresponse_2.rb} +2 -2
  102. data/lib/clerk/models/components/{schemas_featureresponse.rbi → featureresponse_2.rbi} +2 -2
  103. data/lib/clerk/models/components/{schemas_featureresponse_object.rb → featureresponse_2_object.rb} +2 -2
  104. data/lib/clerk/models/components/featureresponse_2_object.rbi +11 -0
  105. data/lib/clerk/models/components/instanceprotect.rb +5 -1
  106. data/lib/clerk/models/components/instanceprotect.rbi +2 -0
  107. data/lib/clerk/models/components/instancesettings.rb +4 -1
  108. data/lib/clerk/models/components/login_hint.rb +36 -0
  109. data/lib/clerk/models/components/login_hint.rbi +15 -0
  110. data/lib/clerk/models/components/oauthapplicationsettings.rb +17 -1
  111. data/lib/clerk/models/components/oauthapplicationsettings.rbi +8 -0
  112. data/lib/clerk/models/components/organizationmembershippublicuserdata.rb +5 -1
  113. data/lib/clerk/models/components/organizationmembershippublicuserdata.rbi +2 -0
  114. data/lib/clerk/models/components/payer_commercepayer.rb +1 -1
  115. data/lib/clerk/models/components/payment_type.rb +1 -0
  116. data/lib/clerk/models/components/platform.rb +20 -0
  117. data/lib/clerk/models/components/{samlaccount_meta.rbi → platform.rbi} +2 -2
  118. data/lib/clerk/models/components/samlaccount_clerkerror.rb +1 -1
  119. data/lib/clerk/models/components/samlconnection_1.rb +15 -1
  120. data/lib/clerk/models/components/samlconnection_1.rbi +6 -0
  121. data/lib/clerk/models/components/samlconnection_2.rb +15 -1
  122. data/lib/clerk/models/components/samlconnection_2.rbi +6 -0
  123. data/lib/clerk/models/components/samlconnectionloginhint.rb +36 -0
  124. data/lib/clerk/models/components/samlconnectionloginhint.rbi +15 -0
  125. data/lib/clerk/models/components/samlconnectionloginhint_mode.rb +21 -0
  126. data/lib/clerk/models/components/samlconnectionloginhint_mode.rbi +11 -0
  127. data/lib/clerk/models/components/scimdirectory.rb +80 -0
  128. data/lib/clerk/models/components/scimdirectory.rbi +37 -0
  129. data/lib/clerk/models/components/scimdirectory_custom_attribute.rb +48 -0
  130. data/lib/clerk/models/components/{custom_attribute.rbi → scimdirectory_custom_attribute.rbi} +2 -2
  131. data/lib/clerk/models/components/scimdirectory_list.rb +36 -0
  132. data/lib/clerk/models/components/scimdirectory_list.rbi +15 -0
  133. data/lib/clerk/models/components/scimdirectory_object.rb +19 -0
  134. data/lib/clerk/models/components/scimdirectory_object.rbi +11 -0
  135. data/lib/clerk/models/components/scimgrouprolemapping.rb +64 -0
  136. data/lib/clerk/models/components/scimgrouprolemapping.rbi +29 -0
  137. data/lib/clerk/models/components/scimgrouprolemapping_deleted.rb +43 -0
  138. data/lib/clerk/models/components/scimgrouprolemapping_deleted.rbi +17 -0
  139. data/lib/clerk/models/components/scimgrouprolemapping_deleted_object.rb +19 -0
  140. data/lib/clerk/models/components/scimgrouprolemapping_deleted_object.rbi +11 -0
  141. data/lib/clerk/models/components/scimgrouprolemapping_list.rb +36 -0
  142. data/lib/clerk/models/components/scimgrouprolemapping_list.rbi +15 -0
  143. data/lib/clerk/models/components/scimgrouprolemapping_object.rb +19 -0
  144. data/lib/clerk/models/components/scimgrouprolemapping_object.rbi +11 -0
  145. data/lib/clerk/models/components/seats.rb +1 -1
  146. data/lib/clerk/models/components/trusteddevice.rb +72 -0
  147. data/lib/clerk/models/components/trusteddevice.rbi +33 -0
  148. data/lib/clerk/models/components/trusteddevice_list.rb +36 -0
  149. data/lib/clerk/models/components/trusteddevice_list.rbi +15 -0
  150. data/lib/clerk/models/components/trusteddevice_object.rb +19 -0
  151. data/lib/clerk/models/components/trusteddevice_object.rbi +11 -0
  152. data/lib/clerk/models/components/trusteddevice_status.rb +20 -0
  153. data/lib/clerk/models/components/trusteddevice_status.rbi +11 -0
  154. data/lib/clerk/models/components/verification_from_oauth_clerkerror.rb +1 -1
  155. data/lib/clerk/models/components/verification_google_one_tap_clerkerror.rb +1 -1
  156. data/lib/clerk/models/components.rb +49 -38
  157. data/lib/clerk/models/errors/clerkerrors.rb +1 -1
  158. data/lib/clerk/models/operations/createemailaddress_request.rb +7 -1
  159. data/lib/clerk/models/operations/createemailaddress_request.rbi +2 -0
  160. data/lib/clerk/models/operations/createenterpriseconnection_login_hint.rb +36 -0
  161. data/lib/clerk/models/operations/createenterpriseconnection_login_hint.rbi +15 -0
  162. data/lib/clerk/models/operations/createenterpriseconnection_mode.rb +21 -0
  163. data/lib/clerk/models/operations/createenterpriseconnection_mode.rbi +11 -0
  164. data/lib/clerk/models/operations/createenterpriseconnection_saml.rb +5 -1
  165. data/lib/clerk/models/operations/createenterpriseconnection_saml.rbi +2 -0
  166. data/lib/clerk/models/operations/createorganizationdomain_requestbody.rb +1 -1
  167. data/lib/clerk/models/operations/createsamlconnection_login_hint_1.rb +36 -0
  168. data/lib/clerk/models/operations/createsamlconnection_login_hint_1.rbi +15 -0
  169. data/lib/clerk/models/operations/createsamlconnection_login_hint_2.rb +36 -0
  170. data/lib/clerk/models/operations/createsamlconnection_login_hint_2.rbi +15 -0
  171. data/lib/clerk/models/operations/createsamlconnection_mode_1.rb +21 -0
  172. data/lib/clerk/models/operations/createsamlconnection_mode_1.rbi +11 -0
  173. data/lib/clerk/models/operations/createsamlconnection_mode_2.rb +21 -0
  174. data/lib/clerk/models/operations/createsamlconnection_mode_2.rbi +11 -0
  175. data/lib/clerk/models/operations/createsamlconnection_requestbody_1.rb +5 -1
  176. data/lib/clerk/models/operations/createsamlconnection_requestbody_1.rbi +2 -0
  177. data/lib/clerk/models/operations/createsamlconnection_requestbody_2.rb +5 -1
  178. data/lib/clerk/models/operations/createsamlconnection_requestbody_2.rbi +2 -0
  179. data/lib/clerk/models/operations/createscimdirectory_request.rb +44 -0
  180. data/lib/clerk/models/operations/createscimdirectory_request.rbi +19 -0
  181. data/lib/clerk/models/operations/createscimdirectory_response.rb +44 -0
  182. data/lib/clerk/models/operations/createscimdirectory_response.rbi +19 -0
  183. data/lib/clerk/models/operations/createscimgrouprolemapping_request.rb +36 -0
  184. data/lib/clerk/models/operations/createscimgrouprolemapping_request.rbi +15 -0
  185. data/lib/clerk/models/operations/createscimgrouprolemapping_requestbody.rb +42 -0
  186. data/lib/clerk/models/operations/createscimgrouprolemapping_requestbody.rbi +17 -0
  187. data/lib/clerk/models/operations/createscimgrouprolemapping_response.rb +44 -0
  188. data/lib/clerk/models/operations/createscimgrouprolemapping_response.rbi +19 -0
  189. data/lib/clerk/models/operations/createsignintoken_request.rb +6 -1
  190. data/lib/clerk/models/operations/createsignintoken_request.rbi +2 -0
  191. data/lib/clerk/models/operations/deletescimdirectory_request.rb +32 -0
  192. data/lib/clerk/models/operations/deletescimdirectory_request.rbi +13 -0
  193. data/lib/clerk/models/operations/deletescimdirectory_response.rb +44 -0
  194. data/lib/clerk/models/operations/deletescimdirectory_response.rbi +19 -0
  195. data/lib/clerk/models/operations/deletescimgrouprolemapping_request.rb +36 -0
  196. data/lib/clerk/models/operations/deletescimgrouprolemapping_request.rbi +15 -0
  197. data/lib/clerk/models/operations/deletescimgrouprolemapping_response.rb +44 -0
  198. data/lib/clerk/models/operations/deletescimgrouprolemapping_response.rbi +19 -0
  199. data/lib/clerk/models/operations/enrollment_mode.rb +5 -0
  200. data/lib/clerk/models/operations/extendbillingsubscriptionitemfreetrial_response.rb +4 -4
  201. data/lib/clerk/models/operations/extendbillingsubscriptionitemfreetrial_response.rbi +2 -2
  202. data/lib/clerk/models/operations/getscimdirectory_request.rb +32 -0
  203. data/lib/clerk/models/operations/getscimdirectory_request.rbi +13 -0
  204. data/lib/clerk/models/operations/getscimdirectory_response.rb +44 -0
  205. data/lib/clerk/models/operations/getscimdirectory_response.rbi +19 -0
  206. data/lib/clerk/models/operations/group_role_mapping.rb +44 -0
  207. data/lib/clerk/models/operations/group_role_mapping.rbi +19 -0
  208. data/lib/clerk/models/operations/listallorganizationdomains_request.rb +2 -1
  209. data/lib/clerk/models/operations/listorganizationdomains_request.rb +2 -1
  210. data/lib/clerk/models/operations/listscimdirectories_request.rb +39 -0
  211. data/lib/clerk/models/operations/listscimdirectories_request.rbi +15 -0
  212. data/lib/clerk/models/operations/listscimdirectories_response.rb +44 -0
  213. data/lib/clerk/models/operations/listscimdirectories_response.rbi +19 -0
  214. data/lib/clerk/models/operations/listscimgrouprolemappings_request.rb +32 -0
  215. data/lib/clerk/models/operations/listscimgrouprolemappings_request.rbi +13 -0
  216. data/lib/clerk/models/operations/listscimgrouprolemappings_response.rb +44 -0
  217. data/lib/clerk/models/operations/listscimgrouprolemappings_response.rbi +19 -0
  218. data/lib/clerk/models/operations/listusertrusteddevices_request.rb +32 -0
  219. data/lib/clerk/models/operations/listusertrusteddevices_request.rbi +13 -0
  220. data/lib/clerk/models/operations/listusertrusteddevices_response.rb +44 -0
  221. data/lib/clerk/models/operations/listusertrusteddevices_response.rbi +19 -0
  222. data/lib/clerk/models/operations/mapping.rb +36 -0
  223. data/lib/clerk/models/operations/mapping.rbi +15 -0
  224. data/lib/clerk/models/operations/removeuserpassword_request.rb +36 -0
  225. data/lib/clerk/models/operations/removeuserpassword_request.rbi +15 -0
  226. data/lib/clerk/models/operations/removeuserpassword_requestbody.rb +32 -0
  227. data/lib/clerk/models/operations/removeuserpassword_requestbody.rbi +13 -0
  228. data/lib/clerk/models/operations/removeuserpassword_response.rb +44 -0
  229. data/lib/clerk/models/operations/removeuserpassword_response.rbi +19 -0
  230. data/lib/clerk/models/operations/replaceorganizationmetadata_request.rb +36 -0
  231. data/lib/clerk/models/operations/replaceorganizationmetadata_request.rbi +15 -0
  232. data/lib/clerk/models/operations/replaceorganizationmetadata_requestbody.rb +38 -0
  233. data/lib/clerk/models/operations/replaceorganizationmetadata_requestbody.rbi +15 -0
  234. data/lib/clerk/models/operations/replaceorganizationmetadata_response.rb +44 -0
  235. data/lib/clerk/models/operations/replaceorganizationmetadata_response.rbi +19 -0
  236. data/lib/clerk/models/operations/replacescimgrouprolemappings_request.rb +36 -0
  237. data/lib/clerk/models/operations/replacescimgrouprolemappings_request.rbi +15 -0
  238. data/lib/clerk/models/operations/replacescimgrouprolemappings_requestbody.rb +32 -0
  239. data/lib/clerk/models/operations/replacescimgrouprolemappings_requestbody.rbi +13 -0
  240. data/lib/clerk/models/operations/replacescimgrouprolemappings_response.rb +44 -0
  241. data/lib/clerk/models/operations/replacescimgrouprolemappings_response.rbi +19 -0
  242. data/lib/clerk/models/operations/replaceuseremailaddress_identification_status.rb +10 -2
  243. data/lib/clerk/models/operations/replaceuseremailaddress_requestbody.rb +16 -3
  244. data/lib/clerk/models/operations/replaceuseremailaddress_requestbody.rbi +2 -0
  245. data/lib/clerk/models/operations/replaceuserphonenumber_identification_status.rb +10 -2
  246. data/lib/clerk/models/operations/replaceuserphonenumber_requestbody.rb +9 -2
  247. data/lib/clerk/models/operations/revokeoauthapplicationtoken_request.rb +36 -0
  248. data/lib/clerk/models/operations/revokeoauthapplicationtoken_request.rbi +15 -0
  249. data/lib/clerk/models/operations/revokeoauthapplicationtoken_requestbody.rb +32 -0
  250. data/lib/clerk/models/operations/revokeoauthapplicationtoken_requestbody.rbi +13 -0
  251. data/lib/clerk/models/operations/revokeoauthapplicationtoken_response.rb +40 -0
  252. data/lib/clerk/models/operations/revokeoauthapplicationtoken_response.rbi +17 -0
  253. data/lib/clerk/models/operations/revokeusertrusteddevice_request.rb +36 -0
  254. data/lib/clerk/models/operations/revokeusertrusteddevice_request.rbi +15 -0
  255. data/lib/clerk/models/operations/revokeusertrusteddevice_response.rb +44 -0
  256. data/lib/clerk/models/operations/revokeusertrusteddevice_response.rbi +19 -0
  257. data/lib/clerk/models/operations/rotatescimdirectoryapikey_request.rb +32 -0
  258. data/lib/clerk/models/operations/rotatescimdirectoryapikey_request.rbi +13 -0
  259. data/lib/clerk/models/operations/rotatescimdirectoryapikey_response.rb +44 -0
  260. data/lib/clerk/models/operations/rotatescimdirectoryapikey_response.rbi +19 -0
  261. data/lib/clerk/models/operations/updateemailaddress_requestbody.rb +7 -1
  262. data/lib/clerk/models/operations/updateemailaddress_requestbody.rbi +2 -0
  263. data/lib/clerk/models/operations/updateenterpriseconnection_login_hint.rb +36 -0
  264. data/lib/clerk/models/operations/updateenterpriseconnection_login_hint.rbi +15 -0
  265. data/lib/clerk/models/operations/updateenterpriseconnection_mode.rb +21 -0
  266. data/lib/clerk/models/operations/updateenterpriseconnection_mode.rbi +11 -0
  267. data/lib/clerk/models/operations/updateenterpriseconnection_saml.rb +5 -1
  268. data/lib/clerk/models/operations/updateenterpriseconnection_saml.rbi +2 -0
  269. data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rb +17 -1
  270. data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rbi +8 -0
  271. data/lib/clerk/models/operations/updateorganization_requestbody.rb +1 -9
  272. data/lib/clerk/models/operations/updateorganization_requestbody.rbi +0 -4
  273. data/lib/clerk/models/operations/updateorganizationdomain_requestbody.rb +1 -1
  274. data/lib/clerk/models/operations/updatesamlconnection_login_hint.rb +36 -0
  275. data/lib/clerk/models/operations/updatesamlconnection_login_hint.rbi +15 -0
  276. data/lib/clerk/models/operations/updatesamlconnection_mode.rb +21 -0
  277. data/lib/clerk/models/operations/updatesamlconnection_mode.rbi +11 -0
  278. data/lib/clerk/models/operations/updatesamlconnection_requestbody.rb +5 -1
  279. data/lib/clerk/models/operations/updatesamlconnection_requestbody.rbi +2 -0
  280. data/lib/clerk/models/operations/updatescimdirectory_request.rb +36 -0
  281. data/lib/clerk/models/operations/updatescimdirectory_request.rbi +15 -0
  282. data/lib/clerk/models/operations/updatescimdirectory_requestbody.rb +49 -0
  283. data/lib/clerk/models/operations/updatescimdirectory_requestbody.rbi +21 -0
  284. data/lib/clerk/models/operations/updatescimdirectory_response.rb +44 -0
  285. data/lib/clerk/models/operations/updatescimdirectory_response.rbi +19 -0
  286. data/lib/clerk/models/operations/updateuser_requestbody.rb +3 -22
  287. data/lib/clerk/models/operations/updateuser_requestbody.rbi +0 -6
  288. data/lib/clerk/models/operations.rb +48 -0
  289. data/lib/clerk/oauthaccesstokens.rb +5 -5
  290. data/lib/clerk/oauthapplications.rb +185 -35
  291. data/lib/clerk/openapiclient.rb +2 -1
  292. data/lib/clerk/organizationdomains.rb +32 -32
  293. data/lib/clerk/organizationinvitations.rb +35 -35
  294. data/lib/clerk/organizationmemberships.rb +25 -25
  295. data/lib/clerk/organizationpermissions.rb +25 -25
  296. data/lib/clerk/organizationroles.rb +35 -35
  297. data/lib/clerk/organizations.rb +221 -56
  298. data/lib/clerk/phonenumbers.rb +43 -36
  299. data/lib/clerk/proxy.rb +3 -3
  300. data/lib/clerk/proxychecks.rb +5 -5
  301. data/lib/clerk/redirecturls.rb +20 -20
  302. data/lib/clerk/rolesets.rb +35 -35
  303. data/lib/clerk/samlconnections.rb +25 -25
  304. data/lib/clerk/scimdirectories.rb +1531 -0
  305. data/lib/clerk/sdk.rb +23 -5
  306. data/lib/clerk/sdkconfiguration.rb +4 -4
  307. data/lib/clerk/sessions.rb +35 -35
  308. data/lib/clerk/signintokens.rb +11 -11
  309. data/lib/clerk/signups.rb +10 -10
  310. data/lib/clerk/templates.rb +5 -5
  311. data/lib/clerk/testingtokens.rb +5 -5
  312. data/lib/clerk/users.rb +695 -204
  313. data/lib/clerk/utils/retries.rb +43 -1
  314. data/lib/clerk/waitlistentries.rb +30 -30
  315. data/lib/clerk/webhooks.rb +15 -15
  316. data/lib/clerk_sdk_ruby.rb +1 -0
  317. data/test/clerk/jwks_cache_scoping_test.rb +83 -0
  318. data/test/clerk/proxy_test.rb +108 -0
  319. metadata +201 -80
  320. data/lib/clerk/models/components/clerkerror_meta.rb +0 -27
  321. data/lib/clerk/models/components/clerkerrors_meta.rb +0 -27
  322. data/lib/clerk/models/components/emailaddress_verification_saml_meta.rb +0 -27
  323. data/lib/clerk/models/components/emailaddress_verification_saml_meta.rbi +0 -11
  324. data/lib/clerk/models/components/enterpriseaccount_verification_oauth_meta.rb +0 -27
  325. data/lib/clerk/models/components/enterpriseaccount_verification_oauth_meta.rbi +0 -11
  326. data/lib/clerk/models/components/enterpriseaccount_verification_saml_meta.rb +0 -27
  327. data/lib/clerk/models/components/enterpriseaccount_verification_saml_meta.rbi +0 -11
  328. data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_meta.rb +0 -27
  329. data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_meta.rbi +0 -11
  330. data/lib/clerk/models/components/samlaccount_meta.rb +0 -27
  331. data/lib/clerk/models/components/schemas_commerceplan_object.rbi +0 -11
  332. data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_fee.rbi +0 -19
  333. data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_monthly_fee.rb +0 -44
  334. data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_monthly_fee.rbi +0 -19
  335. data/lib/clerk/models/components/schemas_commercesubscriptionitem_next_payment_amount.rbi +0 -19
  336. data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commercepayer.rbi +0 -11
  337. data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commerceplan.rbi +0 -11
  338. data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commercesubscriptionitem.rbi +0 -11
  339. data/lib/clerk/models/components/schemas_commercesubscriptionitem_plan_period.rbi +0 -11
  340. data/lib/clerk/models/components/schemas_commercesubscriptionitem_status.rbi +0 -11
  341. data/lib/clerk/models/components/schemas_featureresponse_object.rbi +0 -11
  342. data/lib/clerk/models/components/verification_from_oauth_meta.rb +0 -27
  343. data/lib/clerk/models/components/verification_from_oauth_meta.rbi +0 -11
  344. data/lib/clerk/models/components/verification_google_one_tap_meta.rb +0 -27
  345. data/lib/clerk/models/components/verification_google_one_tap_meta.rbi +0 -11
data/lib/clerk/users.rb CHANGED
@@ -71,10 +71,10 @@ module Clerk
71
71
 
72
72
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
73
73
  timeout ||= @sdk_configuration.timeout
74
-
74
+
75
75
 
76
76
  connection = @sdk_configuration.client.dup
77
- connection.request :retry, retry_options
77
+ connection.use Utils::RetryMiddleware, retry_options
78
78
 
79
79
  hook_ctx = SDKHooks::HookContext.new(
80
80
  config: @sdk_configuration,
@@ -87,7 +87,7 @@ module Clerk
87
87
  error = nil
88
88
  http_response = nil
89
89
 
90
-
90
+
91
91
  begin
92
92
  http_response = connection.get(url) do |req|
93
93
  req.headers.merge!(headers)
@@ -124,13 +124,13 @@ module Clerk
124
124
  response: http_response
125
125
  )
126
126
  end
127
-
127
+
128
128
  if http_response.nil?
129
129
  raise error if !error.nil?
130
130
  raise 'no response'
131
131
  end
132
132
  end
133
-
133
+
134
134
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
135
135
  if Utils.match_status_code(http_response.status, ['200'])
136
136
  if Utils.match_content_type(content_type, 'application/json')
@@ -225,10 +225,10 @@ module Clerk
225
225
 
226
226
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
227
227
  timeout ||= @sdk_configuration.timeout
228
-
228
+
229
229
 
230
230
  connection = @sdk_configuration.client.dup
231
- connection.request :retry, retry_options
231
+ connection.use Utils::RetryMiddleware, retry_options
232
232
 
233
233
  hook_ctx = SDKHooks::HookContext.new(
234
234
  config: @sdk_configuration,
@@ -241,7 +241,7 @@ module Clerk
241
241
  error = nil
242
242
  http_response = nil
243
243
 
244
-
244
+
245
245
  begin
246
246
  http_response = connection.post(url) do |req|
247
247
  req.body = body
@@ -278,13 +278,13 @@ module Clerk
278
278
  response: http_response
279
279
  )
280
280
  end
281
-
281
+
282
282
  if http_response.nil?
283
283
  raise error if !error.nil?
284
284
  raise 'no response'
285
285
  end
286
286
  end
287
-
287
+
288
288
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
289
289
  if Utils.match_status_code(http_response.status, ['200'])
290
290
  if Utils.match_content_type(content_type, 'application/json')
@@ -363,10 +363,10 @@ module Clerk
363
363
 
364
364
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
365
365
  timeout ||= @sdk_configuration.timeout
366
-
366
+
367
367
 
368
368
  connection = @sdk_configuration.client.dup
369
- connection.request :retry, retry_options
369
+ connection.use Utils::RetryMiddleware, retry_options
370
370
 
371
371
  hook_ctx = SDKHooks::HookContext.new(
372
372
  config: @sdk_configuration,
@@ -379,7 +379,7 @@ module Clerk
379
379
  error = nil
380
380
  http_response = nil
381
381
 
382
-
382
+
383
383
  begin
384
384
  http_response = connection.get(url) do |req|
385
385
  req.headers.merge!(headers)
@@ -416,13 +416,13 @@ module Clerk
416
416
  response: http_response
417
417
  )
418
418
  end
419
-
419
+
420
420
  if http_response.nil?
421
421
  raise error if !error.nil?
422
422
  raise 'no response'
423
423
  end
424
424
  end
425
-
425
+
426
426
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
427
427
  if Utils.match_status_code(http_response.status, ['200'])
428
428
  if Utils.match_content_type(content_type, 'application/json')
@@ -508,10 +508,10 @@ module Clerk
508
508
 
509
509
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
510
510
  timeout ||= @sdk_configuration.timeout
511
-
511
+
512
512
 
513
513
  connection = @sdk_configuration.client.dup
514
- connection.request :retry, retry_options
514
+ connection.use Utils::RetryMiddleware, retry_options
515
515
 
516
516
  hook_ctx = SDKHooks::HookContext.new(
517
517
  config: @sdk_configuration,
@@ -524,7 +524,7 @@ module Clerk
524
524
  error = nil
525
525
  http_response = nil
526
526
 
527
-
527
+
528
528
  begin
529
529
  http_response = connection.get(url) do |req|
530
530
  req.headers.merge!(headers)
@@ -560,13 +560,13 @@ module Clerk
560
560
  response: http_response
561
561
  )
562
562
  end
563
-
563
+
564
564
  if http_response.nil?
565
565
  raise error if !error.nil?
566
566
  raise 'no response'
567
567
  end
568
568
  end
569
-
569
+
570
570
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
571
571
  if Utils.match_status_code(http_response.status, ['200'])
572
572
  if Utils.match_content_type(content_type, 'application/json')
@@ -624,12 +624,9 @@ module Clerk
624
624
  # Both IDs should correspond to verified identifications that belong to the user.
625
625
  #
626
626
  # You can remove a user's username by setting the username attribute to null or the blank string "".
627
- # This is a destructive action; the identification will be deleted forever.
628
- # Usernames can be removed only if they are optional in your instance settings and there's at least one other identifier which can be used for authentication.
629
627
  #
630
- # This endpoint allows changing a user's password. When passing the `password` parameter directly you have two further options.
631
- # You can ignore the password policy checks for your instance by setting the `skip_password_checks` parameter to `true`.
632
- # You can also choose to sign the user out of all their active sessions on any device once the password is updated. Just set `sign_out_of_other_sessions` to `true`.
628
+ # As of API version 2026-05-12, this endpoint no longer accepts `public_metadata`, `private_metadata`, or `unsafe_metadata`.
629
+ # Use `PATCH /v1/users/{user_id}/metadata` to merge updates into existing metadata, or `PUT /v1/users/{user_id}/metadata` to replace a metadata field entirely.
633
630
  request = Models::Operations::UpdateUserRequest.new(
634
631
  user_id: user_id,
635
632
  body: body
@@ -675,10 +672,10 @@ module Clerk
675
672
 
676
673
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
677
674
  timeout ||= @sdk_configuration.timeout
678
-
675
+
679
676
 
680
677
  connection = @sdk_configuration.client.dup
681
- connection.request :retry, retry_options
678
+ connection.use Utils::RetryMiddleware, retry_options
682
679
 
683
680
  hook_ctx = SDKHooks::HookContext.new(
684
681
  config: @sdk_configuration,
@@ -691,7 +688,7 @@ module Clerk
691
688
  error = nil
692
689
  http_response = nil
693
690
 
694
-
691
+
695
692
  begin
696
693
  http_response = connection.patch(url) do |req|
697
694
  req.body = body
@@ -728,13 +725,13 @@ module Clerk
728
725
  response: http_response
729
726
  )
730
727
  end
731
-
728
+
732
729
  if http_response.nil?
733
730
  raise error if !error.nil?
734
731
  raise 'no response'
735
732
  end
736
733
  end
737
-
734
+
738
735
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
739
736
  if Utils.match_status_code(http_response.status, ['200'])
740
737
  if Utils.match_content_type(content_type, 'application/json')
@@ -820,10 +817,10 @@ module Clerk
820
817
 
821
818
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
822
819
  timeout ||= @sdk_configuration.timeout
823
-
820
+
824
821
 
825
822
  connection = @sdk_configuration.client.dup
826
- connection.request :retry, retry_options
823
+ connection.use Utils::RetryMiddleware, retry_options
827
824
 
828
825
  hook_ctx = SDKHooks::HookContext.new(
829
826
  config: @sdk_configuration,
@@ -836,7 +833,7 @@ module Clerk
836
833
  error = nil
837
834
  http_response = nil
838
835
 
839
-
836
+
840
837
  begin
841
838
  http_response = connection.delete(url) do |req|
842
839
  req.headers.merge!(headers)
@@ -872,13 +869,13 @@ module Clerk
872
869
  response: http_response
873
870
  )
874
871
  end
875
-
872
+
876
873
  if http_response.nil?
877
874
  raise error if !error.nil?
878
875
  raise 'no response'
879
876
  end
880
877
  end
881
-
878
+
882
879
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
883
880
  if Utils.match_status_code(http_response.status, ['200'])
884
881
  if Utils.match_content_type(content_type, 'application/json')
@@ -964,10 +961,10 @@ module Clerk
964
961
 
965
962
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
966
963
  timeout ||= @sdk_configuration.timeout
967
-
964
+
968
965
 
969
966
  connection = @sdk_configuration.client.dup
970
- connection.request :retry, retry_options
967
+ connection.use Utils::RetryMiddleware, retry_options
971
968
 
972
969
  hook_ctx = SDKHooks::HookContext.new(
973
970
  config: @sdk_configuration,
@@ -980,7 +977,7 @@ module Clerk
980
977
  error = nil
981
978
  http_response = nil
982
979
 
983
-
980
+
984
981
  begin
985
982
  http_response = connection.post(url) do |req|
986
983
  req.headers.merge!(headers)
@@ -1016,13 +1013,13 @@ module Clerk
1016
1013
  response: http_response
1017
1014
  )
1018
1015
  end
1019
-
1016
+
1020
1017
  if http_response.nil?
1021
1018
  raise error if !error.nil?
1022
1019
  raise 'no response'
1023
1020
  end
1024
1021
  end
1025
-
1022
+
1026
1023
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1027
1024
  if Utils.match_status_code(http_response.status, ['200'])
1028
1025
  if Utils.match_content_type(content_type, 'application/json')
@@ -1108,10 +1105,10 @@ module Clerk
1108
1105
 
1109
1106
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1110
1107
  timeout ||= @sdk_configuration.timeout
1111
-
1108
+
1112
1109
 
1113
1110
  connection = @sdk_configuration.client.dup
1114
- connection.request :retry, retry_options
1111
+ connection.use Utils::RetryMiddleware, retry_options
1115
1112
 
1116
1113
  hook_ctx = SDKHooks::HookContext.new(
1117
1114
  config: @sdk_configuration,
@@ -1124,7 +1121,7 @@ module Clerk
1124
1121
  error = nil
1125
1122
  http_response = nil
1126
1123
 
1127
-
1124
+
1128
1125
  begin
1129
1126
  http_response = connection.post(url) do |req|
1130
1127
  req.headers.merge!(headers)
@@ -1160,13 +1157,13 @@ module Clerk
1160
1157
  response: http_response
1161
1158
  )
1162
1159
  end
1163
-
1160
+
1164
1161
  if http_response.nil?
1165
1162
  raise error if !error.nil?
1166
1163
  raise 'no response'
1167
1164
  end
1168
1165
  end
1169
-
1166
+
1170
1167
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1171
1168
  if Utils.match_status_code(http_response.status, ['200'])
1172
1169
  if Utils.match_content_type(content_type, 'application/json')
@@ -1255,10 +1252,10 @@ module Clerk
1255
1252
 
1256
1253
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1257
1254
  timeout ||= @sdk_configuration.timeout
1258
-
1255
+
1259
1256
 
1260
1257
  connection = @sdk_configuration.client.dup
1261
- connection.request :retry, retry_options
1258
+ connection.use Utils::RetryMiddleware, retry_options
1262
1259
 
1263
1260
  hook_ctx = SDKHooks::HookContext.new(
1264
1261
  config: @sdk_configuration,
@@ -1271,7 +1268,7 @@ module Clerk
1271
1268
  error = nil
1272
1269
  http_response = nil
1273
1270
 
1274
-
1271
+
1275
1272
  begin
1276
1273
  http_response = connection.post(url) do |req|
1277
1274
  req.body = body
@@ -1308,13 +1305,13 @@ module Clerk
1308
1305
  response: http_response
1309
1306
  )
1310
1307
  end
1311
-
1308
+
1312
1309
  if http_response.nil?
1313
1310
  raise error if !error.nil?
1314
1311
  raise 'no response'
1315
1312
  end
1316
1313
  end
1317
-
1314
+
1318
1315
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1319
1316
  if Utils.match_status_code(http_response.status, ['200'])
1320
1317
  if Utils.match_content_type(content_type, 'application/json')
@@ -1403,10 +1400,10 @@ module Clerk
1403
1400
 
1404
1401
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1405
1402
  timeout ||= @sdk_configuration.timeout
1406
-
1403
+
1407
1404
 
1408
1405
  connection = @sdk_configuration.client.dup
1409
- connection.request :retry, retry_options
1406
+ connection.use Utils::RetryMiddleware, retry_options
1410
1407
 
1411
1408
  hook_ctx = SDKHooks::HookContext.new(
1412
1409
  config: @sdk_configuration,
@@ -1419,7 +1416,7 @@ module Clerk
1419
1416
  error = nil
1420
1417
  http_response = nil
1421
1418
 
1422
-
1419
+
1423
1420
  begin
1424
1421
  http_response = connection.post(url) do |req|
1425
1422
  req.body = body
@@ -1456,13 +1453,13 @@ module Clerk
1456
1453
  response: http_response
1457
1454
  )
1458
1455
  end
1459
-
1456
+
1460
1457
  if http_response.nil?
1461
1458
  raise error if !error.nil?
1462
1459
  raise 'no response'
1463
1460
  end
1464
1461
  end
1465
-
1462
+
1466
1463
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1467
1464
  if Utils.match_status_code(http_response.status, ['200'])
1468
1465
  if Utils.match_content_type(content_type, 'application/json')
@@ -1549,10 +1546,10 @@ module Clerk
1549
1546
 
1550
1547
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1551
1548
  timeout ||= @sdk_configuration.timeout
1552
-
1549
+
1553
1550
 
1554
1551
  connection = @sdk_configuration.client.dup
1555
- connection.request :retry, retry_options
1552
+ connection.use Utils::RetryMiddleware, retry_options
1556
1553
 
1557
1554
  hook_ctx = SDKHooks::HookContext.new(
1558
1555
  config: @sdk_configuration,
@@ -1565,7 +1562,7 @@ module Clerk
1565
1562
  error = nil
1566
1563
  http_response = nil
1567
1564
 
1568
-
1565
+
1569
1566
  begin
1570
1567
  http_response = connection.post(url) do |req|
1571
1568
  req.headers.merge!(headers)
@@ -1601,13 +1598,13 @@ module Clerk
1601
1598
  response: http_response
1602
1599
  )
1603
1600
  end
1604
-
1601
+
1605
1602
  if http_response.nil?
1606
1603
  raise error if !error.nil?
1607
1604
  raise 'no response'
1608
1605
  end
1609
1606
  end
1610
-
1607
+
1611
1608
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1612
1609
  if Utils.match_status_code(http_response.status, ['200'])
1613
1610
  if Utils.match_content_type(content_type, 'application/json')
@@ -1693,10 +1690,10 @@ module Clerk
1693
1690
 
1694
1691
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1695
1692
  timeout ||= @sdk_configuration.timeout
1696
-
1693
+
1697
1694
 
1698
1695
  connection = @sdk_configuration.client.dup
1699
- connection.request :retry, retry_options
1696
+ connection.use Utils::RetryMiddleware, retry_options
1700
1697
 
1701
1698
  hook_ctx = SDKHooks::HookContext.new(
1702
1699
  config: @sdk_configuration,
@@ -1709,7 +1706,7 @@ module Clerk
1709
1706
  error = nil
1710
1707
  http_response = nil
1711
1708
 
1712
-
1709
+
1713
1710
  begin
1714
1711
  http_response = connection.post(url) do |req|
1715
1712
  req.headers.merge!(headers)
@@ -1745,13 +1742,13 @@ module Clerk
1745
1742
  response: http_response
1746
1743
  )
1747
1744
  end
1748
-
1745
+
1749
1746
  if http_response.nil?
1750
1747
  raise error if !error.nil?
1751
1748
  raise 'no response'
1752
1749
  end
1753
1750
  end
1754
-
1751
+
1755
1752
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1756
1753
  if Utils.match_status_code(http_response.status, ['200'])
1757
1754
  if Utils.match_content_type(content_type, 'application/json')
@@ -1849,10 +1846,10 @@ module Clerk
1849
1846
 
1850
1847
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1851
1848
  timeout ||= @sdk_configuration.timeout
1852
-
1849
+
1853
1850
 
1854
1851
  connection = @sdk_configuration.client.dup
1855
- connection.request :retry, retry_options
1852
+ connection.use Utils::RetryMiddleware, retry_options
1856
1853
 
1857
1854
  hook_ctx = SDKHooks::HookContext.new(
1858
1855
  config: @sdk_configuration,
@@ -1865,7 +1862,7 @@ module Clerk
1865
1862
  error = nil
1866
1863
  http_response = nil
1867
1864
 
1868
-
1865
+
1869
1866
  begin
1870
1867
  http_response = connection.post(url) do |req|
1871
1868
  req.body = body
@@ -1902,13 +1899,13 @@ module Clerk
1902
1899
  response: http_response
1903
1900
  )
1904
1901
  end
1905
-
1902
+
1906
1903
  if http_response.nil?
1907
1904
  raise error if !error.nil?
1908
1905
  raise 'no response'
1909
1906
  end
1910
1907
  end
1911
-
1908
+
1912
1909
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
1913
1910
  if Utils.match_status_code(http_response.status, ['200'])
1914
1911
  if Utils.match_content_type(content_type, 'application/json')
@@ -1994,10 +1991,10 @@ module Clerk
1994
1991
 
1995
1992
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1996
1993
  timeout ||= @sdk_configuration.timeout
1997
-
1994
+
1998
1995
 
1999
1996
  connection = @sdk_configuration.client.dup
2000
- connection.request :retry, retry_options
1997
+ connection.use Utils::RetryMiddleware, retry_options
2001
1998
 
2002
1999
  hook_ctx = SDKHooks::HookContext.new(
2003
2000
  config: @sdk_configuration,
@@ -2010,7 +2007,7 @@ module Clerk
2010
2007
  error = nil
2011
2008
  http_response = nil
2012
2009
 
2013
-
2010
+
2014
2011
  begin
2015
2012
  http_response = connection.delete(url) do |req|
2016
2013
  req.headers.merge!(headers)
@@ -2046,13 +2043,13 @@ module Clerk
2046
2043
  response: http_response
2047
2044
  )
2048
2045
  end
2049
-
2046
+
2050
2047
  if http_response.nil?
2051
2048
  raise error if !error.nil?
2052
2049
  raise 'no response'
2053
2050
  end
2054
2051
  end
2055
-
2052
+
2056
2053
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2057
2054
  if Utils.match_status_code(http_response.status, ['200'])
2058
2055
  if Utils.match_content_type(content_type, 'application/json')
@@ -2156,10 +2153,10 @@ module Clerk
2156
2153
 
2157
2154
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2158
2155
  timeout ||= @sdk_configuration.timeout
2159
-
2156
+
2160
2157
 
2161
2158
  connection = @sdk_configuration.client.dup
2162
- connection.request :retry, retry_options
2159
+ connection.use Utils::RetryMiddleware, retry_options
2163
2160
 
2164
2161
  hook_ctx = SDKHooks::HookContext.new(
2165
2162
  config: @sdk_configuration,
@@ -2172,7 +2169,7 @@ module Clerk
2172
2169
  error = nil
2173
2170
  http_response = nil
2174
2171
 
2175
-
2172
+
2176
2173
  begin
2177
2174
  http_response = connection.patch(url) do |req|
2178
2175
  req.body = body
@@ -2209,13 +2206,13 @@ module Clerk
2209
2206
  response: http_response
2210
2207
  )
2211
2208
  end
2212
-
2209
+
2213
2210
  if http_response.nil?
2214
2211
  raise error if !error.nil?
2215
2212
  raise 'no response'
2216
2213
  end
2217
2214
  end
2218
-
2215
+
2219
2216
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2220
2217
  if Utils.match_status_code(http_response.status, ['200'])
2221
2218
  if Utils.match_content_type(content_type, 'application/json')
@@ -2270,12 +2267,12 @@ module Clerk
2270
2267
  # Replace a user's metadata attributes with the provided values.
2271
2268
  #
2272
2269
  # Unlike `PATCH /v1/users/{user_id}/metadata` (merge semantics), this endpoint
2273
- # replaces the supplied metadata columns entirely — the prior contents of each
2274
- # supplied column are discarded. Columns omitted from the request body are
2270
+ # replaces the supplied metadata fields entirely — the prior contents of each
2271
+ # supplied field are discarded. Fields omitted from the request body are
2275
2272
  # left unchanged.
2276
2273
  #
2277
2274
  # Prefer the `PATCH` endpoint for partial updates. Use `PUT` only when you
2278
- # explicitly intend to overwrite a metadata column wholesale.
2275
+ # explicitly intend to overwrite a metadata field wholesale.
2279
2276
  request = Models::Operations::ReplaceUserMetadataRequest.new(
2280
2277
  user_id: user_id,
2281
2278
  body: body
@@ -2320,10 +2317,10 @@ module Clerk
2320
2317
 
2321
2318
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2322
2319
  timeout ||= @sdk_configuration.timeout
2323
-
2320
+
2324
2321
 
2325
2322
  connection = @sdk_configuration.client.dup
2326
- connection.request :retry, retry_options
2323
+ connection.use Utils::RetryMiddleware, retry_options
2327
2324
 
2328
2325
  hook_ctx = SDKHooks::HookContext.new(
2329
2326
  config: @sdk_configuration,
@@ -2336,7 +2333,7 @@ module Clerk
2336
2333
  error = nil
2337
2334
  http_response = nil
2338
2335
 
2339
-
2336
+
2340
2337
  begin
2341
2338
  http_response = connection.put(url) do |req|
2342
2339
  req.body = body
@@ -2373,13 +2370,13 @@ module Clerk
2373
2370
  response: http_response
2374
2371
  )
2375
2372
  end
2376
-
2373
+
2377
2374
  if http_response.nil?
2378
2375
  raise error if !error.nil?
2379
2376
  raise 'no response'
2380
2377
  end
2381
2378
  end
2382
-
2379
+
2383
2380
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2384
2381
  if Utils.match_status_code(http_response.status, ['200'])
2385
2382
  if Utils.match_content_type(content_type, 'application/json')
@@ -2467,10 +2464,10 @@ module Clerk
2467
2464
 
2468
2465
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2469
2466
  timeout ||= @sdk_configuration.timeout
2470
-
2467
+
2471
2468
 
2472
2469
  connection = @sdk_configuration.client.dup
2473
- connection.request :retry, retry_options
2470
+ connection.use Utils::RetryMiddleware, retry_options
2474
2471
 
2475
2472
  hook_ctx = SDKHooks::HookContext.new(
2476
2473
  config: @sdk_configuration,
@@ -2483,7 +2480,7 @@ module Clerk
2483
2480
  error = nil
2484
2481
  http_response = nil
2485
2482
 
2486
-
2483
+
2487
2484
  begin
2488
2485
  http_response = connection.get(url) do |req|
2489
2486
  req.headers.merge!(headers)
@@ -2519,13 +2516,13 @@ module Clerk
2519
2516
  response: http_response
2520
2517
  )
2521
2518
  end
2522
-
2519
+
2523
2520
  if http_response.nil?
2524
2521
  raise error if !error.nil?
2525
2522
  raise 'no response'
2526
2523
  end
2527
2524
  end
2528
-
2525
+
2529
2526
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2530
2527
  if Utils.match_status_code(http_response.status, ['200'])
2531
2528
  if Utils.match_content_type(content_type, 'application/json')
@@ -2627,10 +2624,10 @@ module Clerk
2627
2624
 
2628
2625
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2629
2626
  timeout ||= @sdk_configuration.timeout
2630
-
2627
+
2631
2628
 
2632
2629
  connection = @sdk_configuration.client.dup
2633
- connection.request :retry, retry_options
2630
+ connection.use Utils::RetryMiddleware, retry_options
2634
2631
 
2635
2632
  hook_ctx = SDKHooks::HookContext.new(
2636
2633
  config: @sdk_configuration,
@@ -2643,7 +2640,7 @@ module Clerk
2643
2640
  error = nil
2644
2641
  http_response = nil
2645
2642
 
2646
-
2643
+
2647
2644
  begin
2648
2645
  http_response = connection.get(url) do |req|
2649
2646
  req.headers.merge!(headers)
@@ -2679,13 +2676,13 @@ module Clerk
2679
2676
  response: http_response
2680
2677
  )
2681
2678
  end
2682
-
2679
+
2683
2680
  if http_response.nil?
2684
2681
  raise error if !error.nil?
2685
2682
  raise 'no response'
2686
2683
  end
2687
2684
  end
2688
-
2685
+
2689
2686
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2690
2687
  if Utils.match_status_code(http_response.status, ['200'])
2691
2688
  if Utils.match_content_type(content_type, 'application/json')
@@ -2800,10 +2797,10 @@ module Clerk
2800
2797
 
2801
2798
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2802
2799
  timeout ||= @sdk_configuration.timeout
2803
-
2800
+
2804
2801
 
2805
2802
  connection = @sdk_configuration.client.dup
2806
- connection.request :retry, retry_options
2803
+ connection.use Utils::RetryMiddleware, retry_options
2807
2804
 
2808
2805
  hook_ctx = SDKHooks::HookContext.new(
2809
2806
  config: @sdk_configuration,
@@ -2816,7 +2813,7 @@ module Clerk
2816
2813
  error = nil
2817
2814
  http_response = nil
2818
2815
 
2819
-
2816
+
2820
2817
  begin
2821
2818
  http_response = connection.post(url) do |req|
2822
2819
  req.body = body
@@ -2853,13 +2850,13 @@ module Clerk
2853
2850
  response: http_response
2854
2851
  )
2855
2852
  end
2856
-
2853
+
2857
2854
  if http_response.nil?
2858
2855
  raise error if !error.nil?
2859
2856
  raise 'no response'
2860
2857
  end
2861
2858
  end
2862
-
2859
+
2863
2860
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
2864
2861
  if Utils.match_status_code(http_response.status, ['200'])
2865
2862
  if Utils.match_content_type(content_type, 'application/json')
@@ -2959,10 +2956,10 @@ module Clerk
2959
2956
 
2960
2957
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2961
2958
  timeout ||= @sdk_configuration.timeout
2962
-
2959
+
2963
2960
 
2964
2961
  connection = @sdk_configuration.client.dup
2965
- connection.request :retry, retry_options
2962
+ connection.use Utils::RetryMiddleware, retry_options
2966
2963
 
2967
2964
  hook_ctx = SDKHooks::HookContext.new(
2968
2965
  config: @sdk_configuration,
@@ -2975,7 +2972,7 @@ module Clerk
2975
2972
  error = nil
2976
2973
  http_response = nil
2977
2974
 
2978
-
2975
+
2979
2976
  begin
2980
2977
  http_response = connection.get(url) do |req|
2981
2978
  req.headers.merge!(headers)
@@ -3012,13 +3009,13 @@ module Clerk
3012
3009
  response: http_response
3013
3010
  )
3014
3011
  end
3015
-
3012
+
3016
3013
  if http_response.nil?
3017
3014
  raise error if !error.nil?
3018
3015
  raise 'no response'
3019
3016
  end
3020
3017
  end
3021
-
3018
+
3022
3019
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3023
3020
  if Utils.match_status_code(http_response.status, ['200'])
3024
3021
  if Utils.match_content_type(content_type, 'application/json')
@@ -3107,10 +3104,10 @@ module Clerk
3107
3104
 
3108
3105
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3109
3106
  timeout ||= @sdk_configuration.timeout
3110
-
3107
+
3111
3108
 
3112
3109
  connection = @sdk_configuration.client.dup
3113
- connection.request :retry, retry_options
3110
+ connection.use Utils::RetryMiddleware, retry_options
3114
3111
 
3115
3112
  hook_ctx = SDKHooks::HookContext.new(
3116
3113
  config: @sdk_configuration,
@@ -3123,7 +3120,7 @@ module Clerk
3123
3120
  error = nil
3124
3121
  http_response = nil
3125
3122
 
3126
-
3123
+
3127
3124
  begin
3128
3125
  http_response = connection.get(url) do |req|
3129
3126
  req.headers.merge!(headers)
@@ -3160,13 +3157,13 @@ module Clerk
3160
3157
  response: http_response
3161
3158
  )
3162
3159
  end
3163
-
3160
+
3164
3161
  if http_response.nil?
3165
3162
  raise error if !error.nil?
3166
3163
  raise 'no response'
3167
3164
  end
3168
3165
  end
3169
-
3166
+
3170
3167
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3171
3168
  if Utils.match_status_code(http_response.status, ['200'])
3172
3169
  if Utils.match_content_type(content_type, 'application/json')
@@ -3256,10 +3253,10 @@ module Clerk
3256
3253
 
3257
3254
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3258
3255
  timeout ||= @sdk_configuration.timeout
3259
-
3256
+
3260
3257
 
3261
3258
  connection = @sdk_configuration.client.dup
3262
- connection.request :retry, retry_options
3259
+ connection.use Utils::RetryMiddleware, retry_options
3263
3260
 
3264
3261
  hook_ctx = SDKHooks::HookContext.new(
3265
3262
  config: @sdk_configuration,
@@ -3272,7 +3269,7 @@ module Clerk
3272
3269
  error = nil
3273
3270
  http_response = nil
3274
3271
 
3275
-
3272
+
3276
3273
  begin
3277
3274
  http_response = connection.get(url) do |req|
3278
3275
  req.headers.merge!(headers)
@@ -3309,13 +3306,13 @@ module Clerk
3309
3306
  response: http_response
3310
3307
  )
3311
3308
  end
3312
-
3309
+
3313
3310
  if http_response.nil?
3314
3311
  raise error if !error.nil?
3315
3312
  raise 'no response'
3316
3313
  end
3317
3314
  end
3318
-
3315
+
3319
3316
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3320
3317
  if Utils.match_status_code(http_response.status, ['200'])
3321
3318
  if Utils.match_content_type(content_type, 'application/json')
@@ -3365,20 +3362,21 @@ module Clerk
3365
3362
 
3366
3363
 
3367
3364
 
3368
- def verify_password(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
3369
- # verify_password - Verify the password of a user
3370
- # Check that the user's password matches the supplied input.
3371
- # Useful for custom auth flows and re-verification.
3372
- request = Models::Operations::VerifyPasswordRequest.new(
3365
+ def remove_password(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
3366
+ # remove_password - Remove a user's password
3367
+ # Removes the password credential from the given user. This is a privileged operation and does not require the user's current password. Password removal is allowed even when the user has no other sign-in method configured.
3368
+ #
3369
+ # If the user does not have a password, the user is returned unchanged and no password-deletion or user-update event is emitted. By default, existing sessions remain active. Set `sign_out_of_other_sessions` to `true` to revoke sessions active when the request is processed.
3370
+ request = Models::Operations::RemoveUserPasswordRequest.new(
3373
3371
  user_id: user_id,
3374
3372
  body: body
3375
3373
  )
3376
3374
  url, params = @sdk_configuration.get_server_details
3377
3375
  base_url = Utils.template_url(url, params)
3378
3376
  url = Utils.generate_url(
3379
- Models::Operations::VerifyPasswordRequest,
3377
+ Models::Operations::RemoveUserPasswordRequest,
3380
3378
  base_url,
3381
- '/users/{user_id}/verify_password',
3379
+ '/users/{user_id}/remove_password',
3382
3380
  request
3383
3381
  )
3384
3382
  headers = {}
@@ -3413,23 +3411,23 @@ module Clerk
3413
3411
 
3414
3412
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3415
3413
  timeout ||= @sdk_configuration.timeout
3416
-
3414
+
3417
3415
 
3418
3416
  connection = @sdk_configuration.client.dup
3419
- connection.request :retry, retry_options
3417
+ connection.use Utils::RetryMiddleware, retry_options
3420
3418
 
3421
3419
  hook_ctx = SDKHooks::HookContext.new(
3422
3420
  config: @sdk_configuration,
3423
3421
  base_url: base_url,
3424
3422
  oauth2_scopes: nil,
3425
- operation_id: 'VerifyPassword',
3423
+ operation_id: 'RemoveUserPassword',
3426
3424
  security_source: @sdk_configuration.security_source
3427
3425
  )
3428
3426
 
3429
3427
  error = nil
3430
3428
  http_response = nil
3431
3429
 
3432
-
3430
+
3433
3431
  begin
3434
3432
  http_response = connection.post(url) do |req|
3435
3433
  req.body = body
@@ -3466,13 +3464,13 @@ module Clerk
3466
3464
  response: http_response
3467
3465
  )
3468
3466
  end
3469
-
3467
+
3470
3468
  if http_response.nil?
3471
3469
  raise error if !error.nil?
3472
3470
  raise 'no response'
3473
3471
  end
3474
3472
  end
3475
-
3473
+
3476
3474
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3477
3475
  if Utils.match_status_code(http_response.status, ['200'])
3478
3476
  if Utils.match_content_type(content_type, 'application/json')
@@ -3483,18 +3481,33 @@ module Clerk
3483
3481
  response: http_response
3484
3482
  )
3485
3483
  response_data = http_response.env.response_body
3486
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::VerifyPasswordResponseBody)
3487
- response = Models::Operations::VerifyPasswordResponse.new(
3484
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::User)
3485
+ response = Models::Operations::RemoveUserPasswordResponse.new(
3488
3486
  status_code: http_response.status,
3489
3487
  content_type: content_type,
3490
3488
  raw_response: http_response,
3491
- object: obj
3489
+ user: obj
3492
3490
  )
3493
3491
 
3494
3492
  return response
3495
3493
  else
3496
3494
  raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
3497
3495
  end
3496
+ elsif Utils.match_status_code(http_response.status, ['400', '401', '403', '404'])
3497
+ if Utils.match_content_type(content_type, 'application/json')
3498
+ http_response = @sdk_configuration.hooks.after_success(
3499
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
3500
+ hook_ctx: hook_ctx
3501
+ ),
3502
+ response: http_response
3503
+ )
3504
+ response_data = http_response.env.response_body
3505
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
3506
+ obj.raw_response = http_response
3507
+ raise obj
3508
+ else
3509
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
3510
+ end
3498
3511
  elsif Utils.match_status_code(http_response.status, ['500'])
3499
3512
  if Utils.match_content_type(content_type, 'application/json')
3500
3513
  http_response = @sdk_configuration.hooks.after_success(
@@ -3510,7 +3523,7 @@ module Clerk
3510
3523
  else
3511
3524
  raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
3512
3525
  end
3513
- elsif Utils.match_status_code(http_response.status, ['400', '404', '422', '4XX'])
3526
+ elsif Utils.match_status_code(http_response.status, ['4XX'])
3514
3527
  raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
3515
3528
  elsif Utils.match_status_code(http_response.status, ['5XX'])
3516
3529
  raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
@@ -3522,22 +3535,20 @@ module Clerk
3522
3535
 
3523
3536
 
3524
3537
 
3525
- def verify_totp(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
3526
- # verify_totp - Verify a TOTP or backup code for a user
3527
- # Verify that the provided TOTP or backup code is valid for the user.
3528
- # Verifying a backup code will result it in being consumed (i.e. it will
3529
- # become invalid).
3538
+ def verify_password(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
3539
+ # verify_password - Verify the password of a user
3540
+ # Check that the user's password matches the supplied input.
3530
3541
  # Useful for custom auth flows and re-verification.
3531
- request = Models::Operations::VerifyTOTPRequest.new(
3542
+ request = Models::Operations::VerifyPasswordRequest.new(
3532
3543
  user_id: user_id,
3533
3544
  body: body
3534
3545
  )
3535
3546
  url, params = @sdk_configuration.get_server_details
3536
3547
  base_url = Utils.template_url(url, params)
3537
3548
  url = Utils.generate_url(
3538
- Models::Operations::VerifyTOTPRequest,
3549
+ Models::Operations::VerifyPasswordRequest,
3539
3550
  base_url,
3540
- '/users/{user_id}/verify_totp',
3551
+ '/users/{user_id}/verify_password',
3541
3552
  request
3542
3553
  )
3543
3554
  headers = {}
@@ -3572,23 +3583,23 @@ module Clerk
3572
3583
 
3573
3584
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3574
3585
  timeout ||= @sdk_configuration.timeout
3575
-
3586
+
3576
3587
 
3577
3588
  connection = @sdk_configuration.client.dup
3578
- connection.request :retry, retry_options
3589
+ connection.use Utils::RetryMiddleware, retry_options
3579
3590
 
3580
3591
  hook_ctx = SDKHooks::HookContext.new(
3581
3592
  config: @sdk_configuration,
3582
3593
  base_url: base_url,
3583
3594
  oauth2_scopes: nil,
3584
- operation_id: 'VerifyTOTP',
3595
+ operation_id: 'VerifyPassword',
3585
3596
  security_source: @sdk_configuration.security_source
3586
3597
  )
3587
3598
 
3588
3599
  error = nil
3589
3600
  http_response = nil
3590
3601
 
3591
-
3602
+
3592
3603
  begin
3593
3604
  http_response = connection.post(url) do |req|
3594
3605
  req.body = body
@@ -3625,13 +3636,13 @@ module Clerk
3625
3636
  response: http_response
3626
3637
  )
3627
3638
  end
3628
-
3639
+
3629
3640
  if http_response.nil?
3630
3641
  raise error if !error.nil?
3631
3642
  raise 'no response'
3632
3643
  end
3633
3644
  end
3634
-
3645
+
3635
3646
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3636
3647
  if Utils.match_status_code(http_response.status, ['200'])
3637
3648
  if Utils.match_content_type(content_type, 'application/json')
@@ -3642,8 +3653,8 @@ module Clerk
3642
3653
  response: http_response
3643
3654
  )
3644
3655
  response_data = http_response.env.response_body
3645
- obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::VerifyTOTPResponseBody)
3646
- response = Models::Operations::VerifyTOTPResponse.new(
3656
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::VerifyPasswordResponseBody)
3657
+ response = Models::Operations::VerifyPasswordResponse.new(
3647
3658
  status_code: http_response.status,
3648
3659
  content_type: content_type,
3649
3660
  raw_response: http_response,
@@ -3681,22 +3692,36 @@ module Clerk
3681
3692
 
3682
3693
 
3683
3694
 
3684
- def disable_mfa(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
3685
- # disable_mfa - Disable a user's MFA methods
3686
- # Disable all of a user's MFA methods (e.g. OTP sent via SMS, TOTP on their authenticator app) at once.
3687
- request = Models::Operations::DisableMFARequest.new(
3688
- user_id: user_id
3695
+ def verify_totp(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
3696
+ # verify_totp - Verify a TOTP or backup code for a user
3697
+ # Verify that the provided TOTP or backup code is valid for the user.
3698
+ # Verifying a backup code will result it in being consumed (i.e. it will
3699
+ # become invalid).
3700
+ # Useful for custom auth flows and re-verification.
3701
+ request = Models::Operations::VerifyTOTPRequest.new(
3702
+ user_id: user_id,
3703
+ body: body
3689
3704
  )
3690
3705
  url, params = @sdk_configuration.get_server_details
3691
3706
  base_url = Utils.template_url(url, params)
3692
3707
  url = Utils.generate_url(
3693
- Models::Operations::DisableMFARequest,
3708
+ Models::Operations::VerifyTOTPRequest,
3694
3709
  base_url,
3695
- '/users/{user_id}/mfa',
3710
+ '/users/{user_id}/verify_totp',
3696
3711
  request
3697
3712
  )
3698
3713
  headers = {}
3699
3714
 
3715
+ req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
3716
+ headers['content-type'] = req_content_type
3717
+
3718
+ if form && !form.empty?
3719
+ body = Utils.encode_form(form)
3720
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
3721
+ body = URI.encode_www_form(data)
3722
+ else
3723
+ body = data
3724
+ end
3700
3725
  headers['Accept'] = 'application/json'
3701
3726
  headers['user-agent'] = @sdk_configuration.user_agent
3702
3727
  retries ||= @sdk_configuration.retry_config
@@ -3717,25 +3742,26 @@ module Clerk
3717
3742
 
3718
3743
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3719
3744
  timeout ||= @sdk_configuration.timeout
3720
-
3745
+
3721
3746
 
3722
3747
  connection = @sdk_configuration.client.dup
3723
- connection.request :retry, retry_options
3748
+ connection.use Utils::RetryMiddleware, retry_options
3724
3749
 
3725
3750
  hook_ctx = SDKHooks::HookContext.new(
3726
3751
  config: @sdk_configuration,
3727
3752
  base_url: base_url,
3728
3753
  oauth2_scopes: nil,
3729
- operation_id: 'DisableMFA',
3754
+ operation_id: 'VerifyTOTP',
3730
3755
  security_source: @sdk_configuration.security_source
3731
3756
  )
3732
3757
 
3733
3758
  error = nil
3734
3759
  http_response = nil
3735
3760
 
3736
-
3761
+
3737
3762
  begin
3738
- http_response = connection.delete(url) do |req|
3763
+ http_response = connection.post(url) do |req|
3764
+ req.body = body
3739
3765
  req.headers.merge!(headers)
3740
3766
  req.options.timeout = timeout unless timeout.nil?
3741
3767
  Utils.configure_request_security(req, security)
@@ -3769,13 +3795,157 @@ module Clerk
3769
3795
  response: http_response
3770
3796
  )
3771
3797
  end
3772
-
3798
+
3773
3799
  if http_response.nil?
3774
3800
  raise error if !error.nil?
3775
3801
  raise 'no response'
3776
3802
  end
3777
3803
  end
3804
+
3805
+ content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3806
+ if Utils.match_status_code(http_response.status, ['200'])
3807
+ if Utils.match_content_type(content_type, 'application/json')
3808
+ http_response = @sdk_configuration.hooks.after_success(
3809
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
3810
+ hook_ctx: hook_ctx
3811
+ ),
3812
+ response: http_response
3813
+ )
3814
+ response_data = http_response.env.response_body
3815
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::VerifyTOTPResponseBody)
3816
+ response = Models::Operations::VerifyTOTPResponse.new(
3817
+ status_code: http_response.status,
3818
+ content_type: content_type,
3819
+ raw_response: http_response,
3820
+ object: obj
3821
+ )
3822
+
3823
+ return response
3824
+ else
3825
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
3826
+ end
3827
+ elsif Utils.match_status_code(http_response.status, ['500'])
3828
+ if Utils.match_content_type(content_type, 'application/json')
3829
+ http_response = @sdk_configuration.hooks.after_success(
3830
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
3831
+ hook_ctx: hook_ctx
3832
+ ),
3833
+ response: http_response
3834
+ )
3835
+ response_data = http_response.env.response_body
3836
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
3837
+ obj.raw_response = http_response
3838
+ raise obj
3839
+ else
3840
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
3841
+ end
3842
+ elsif Utils.match_status_code(http_response.status, ['400', '404', '422', '4XX'])
3843
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
3844
+ elsif Utils.match_status_code(http_response.status, ['5XX'])
3845
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
3846
+ else
3847
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
3848
+
3849
+ end
3850
+ end
3851
+
3852
+
3853
+
3854
+ def disable_mfa(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
3855
+ # disable_mfa - Disable a user's MFA methods
3856
+ # Disable all of a user's MFA methods (e.g. OTP sent via SMS, TOTP on their authenticator app) at once.
3857
+ request = Models::Operations::DisableMFARequest.new(
3858
+ user_id: user_id
3859
+ )
3860
+ url, params = @sdk_configuration.get_server_details
3861
+ base_url = Utils.template_url(url, params)
3862
+ url = Utils.generate_url(
3863
+ Models::Operations::DisableMFARequest,
3864
+ base_url,
3865
+ '/users/{user_id}/mfa',
3866
+ request
3867
+ )
3868
+ headers = {}
3869
+
3870
+ headers['Accept'] = 'application/json'
3871
+ headers['user-agent'] = @sdk_configuration.user_agent
3872
+ retries ||= @sdk_configuration.retry_config
3873
+ retries ||= Utils::RetryConfig.new(
3874
+ backoff: Utils::BackoffStrategy.new(
3875
+ exponent: 1.5,
3876
+ initial_interval: 500,
3877
+ max_elapsed_time: 3_600_000,
3878
+ max_interval: 60_000
3879
+ ),
3880
+ retry_connection_errors: true,
3881
+ strategy: 'backoff'
3882
+ )
3883
+ retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
3884
+ retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
3885
+
3886
+ security = @sdk_configuration.security_source&.call
3887
+
3888
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3889
+ timeout ||= @sdk_configuration.timeout
3890
+
3891
+
3892
+ connection = @sdk_configuration.client.dup
3893
+ connection.use Utils::RetryMiddleware, retry_options
3894
+
3895
+ hook_ctx = SDKHooks::HookContext.new(
3896
+ config: @sdk_configuration,
3897
+ base_url: base_url,
3898
+ oauth2_scopes: nil,
3899
+ operation_id: 'DisableMFA',
3900
+ security_source: @sdk_configuration.security_source
3901
+ )
3902
+
3903
+ error = nil
3904
+ http_response = nil
3778
3905
 
3906
+
3907
+ begin
3908
+ http_response = connection.delete(url) do |req|
3909
+ req.headers.merge!(headers)
3910
+ req.options.timeout = timeout unless timeout.nil?
3911
+ Utils.configure_request_security(req, security)
3912
+ http_headers&.each do |key, value|
3913
+ req.headers[key.to_s] = value
3914
+ end
3915
+
3916
+ @sdk_configuration.hooks.before_request(
3917
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
3918
+ hook_ctx: hook_ctx
3919
+ ),
3920
+ request: req
3921
+ )
3922
+ end
3923
+ rescue StandardError => e
3924
+ error = e
3925
+ ensure
3926
+ if http_response.nil? || Utils.error_status?(http_response.status)
3927
+ http_response = @sdk_configuration.hooks.after_error(
3928
+ error: error,
3929
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
3930
+ hook_ctx: hook_ctx
3931
+ ),
3932
+ response: http_response
3933
+ )
3934
+ else
3935
+ http_response = @sdk_configuration.hooks.after_success(
3936
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
3937
+ hook_ctx: hook_ctx
3938
+ ),
3939
+ response: http_response
3940
+ )
3941
+ end
3942
+
3943
+ if http_response.nil?
3944
+ raise error if !error.nil?
3945
+ raise 'no response'
3946
+ end
3947
+ end
3948
+
3779
3949
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3780
3950
  if Utils.match_status_code(http_response.status, ['200'])
3781
3951
  if Utils.match_content_type(content_type, 'application/json')
@@ -3876,10 +4046,10 @@ module Clerk
3876
4046
 
3877
4047
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
3878
4048
  timeout ||= @sdk_configuration.timeout
3879
-
4049
+
3880
4050
 
3881
4051
  connection = @sdk_configuration.client.dup
3882
- connection.request :retry, retry_options
4052
+ connection.use Utils::RetryMiddleware, retry_options
3883
4053
 
3884
4054
  hook_ctx = SDKHooks::HookContext.new(
3885
4055
  config: @sdk_configuration,
@@ -3892,7 +4062,7 @@ module Clerk
3892
4062
  error = nil
3893
4063
  http_response = nil
3894
4064
 
3895
-
4065
+
3896
4066
  begin
3897
4067
  http_response = connection.delete(url) do |req|
3898
4068
  req.headers.merge!(headers)
@@ -3928,13 +4098,13 @@ module Clerk
3928
4098
  response: http_response
3929
4099
  )
3930
4100
  end
3931
-
4101
+
3932
4102
  if http_response.nil?
3933
4103
  raise error if !error.nil?
3934
4104
  raise 'no response'
3935
4105
  end
3936
4106
  end
3937
-
4107
+
3938
4108
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
3939
4109
  if Utils.match_status_code(http_response.status, ['200'])
3940
4110
  if Utils.match_content_type(content_type, 'application/json')
@@ -4036,10 +4206,10 @@ module Clerk
4036
4206
 
4037
4207
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4038
4208
  timeout ||= @sdk_configuration.timeout
4039
-
4209
+
4040
4210
 
4041
4211
  connection = @sdk_configuration.client.dup
4042
- connection.request :retry, retry_options
4212
+ connection.use Utils::RetryMiddleware, retry_options
4043
4213
 
4044
4214
  hook_ctx = SDKHooks::HookContext.new(
4045
4215
  config: @sdk_configuration,
@@ -4052,7 +4222,7 @@ module Clerk
4052
4222
  error = nil
4053
4223
  http_response = nil
4054
4224
 
4055
-
4225
+
4056
4226
  begin
4057
4227
  http_response = connection.delete(url) do |req|
4058
4228
  req.headers.merge!(headers)
@@ -4088,13 +4258,13 @@ module Clerk
4088
4258
  response: http_response
4089
4259
  )
4090
4260
  end
4091
-
4261
+
4092
4262
  if http_response.nil?
4093
4263
  raise error if !error.nil?
4094
4264
  raise 'no response'
4095
4265
  end
4096
4266
  end
4097
-
4267
+
4098
4268
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4099
4269
  if Utils.match_status_code(http_response.status, ['200'])
4100
4270
  if Utils.match_content_type(content_type, 'application/json')
@@ -4159,6 +4329,325 @@ module Clerk
4159
4329
 
4160
4330
 
4161
4331
 
4332
+ def list_trusted_devices(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
4333
+ # list_trusted_devices - List a user's trusted devices
4334
+ # Returns the active trusted devices enrolled by the user.
4335
+ request = Models::Operations::ListUserTrustedDevicesRequest.new(
4336
+ user_id: user_id
4337
+ )
4338
+ url, params = @sdk_configuration.get_server_details
4339
+ base_url = Utils.template_url(url, params)
4340
+ url = Utils.generate_url(
4341
+ Models::Operations::ListUserTrustedDevicesRequest,
4342
+ base_url,
4343
+ '/users/{user_id}/trusted_devices',
4344
+ request
4345
+ )
4346
+ headers = {}
4347
+
4348
+ headers['Accept'] = 'application/json'
4349
+ headers['user-agent'] = @sdk_configuration.user_agent
4350
+ retries ||= @sdk_configuration.retry_config
4351
+ retries ||= Utils::RetryConfig.new(
4352
+ backoff: Utils::BackoffStrategy.new(
4353
+ exponent: 1.5,
4354
+ initial_interval: 500,
4355
+ max_elapsed_time: 3_600_000,
4356
+ max_interval: 60_000
4357
+ ),
4358
+ retry_connection_errors: true,
4359
+ strategy: 'backoff'
4360
+ )
4361
+ retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
4362
+ retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
4363
+
4364
+ security = @sdk_configuration.security_source&.call
4365
+
4366
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4367
+ timeout ||= @sdk_configuration.timeout
4368
+
4369
+
4370
+ connection = @sdk_configuration.client.dup
4371
+ connection.use Utils::RetryMiddleware, retry_options
4372
+
4373
+ hook_ctx = SDKHooks::HookContext.new(
4374
+ config: @sdk_configuration,
4375
+ base_url: base_url,
4376
+ oauth2_scopes: nil,
4377
+ operation_id: 'ListUserTrustedDevices',
4378
+ security_source: @sdk_configuration.security_source
4379
+ )
4380
+
4381
+ error = nil
4382
+ http_response = nil
4383
+
4384
+
4385
+ begin
4386
+ http_response = connection.get(url) do |req|
4387
+ req.headers.merge!(headers)
4388
+ req.options.timeout = timeout unless timeout.nil?
4389
+ Utils.configure_request_security(req, security)
4390
+ http_headers&.each do |key, value|
4391
+ req.headers[key.to_s] = value
4392
+ end
4393
+
4394
+ @sdk_configuration.hooks.before_request(
4395
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
4396
+ hook_ctx: hook_ctx
4397
+ ),
4398
+ request: req
4399
+ )
4400
+ end
4401
+ rescue StandardError => e
4402
+ error = e
4403
+ ensure
4404
+ if http_response.nil? || Utils.error_status?(http_response.status)
4405
+ http_response = @sdk_configuration.hooks.after_error(
4406
+ error: error,
4407
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
4408
+ hook_ctx: hook_ctx
4409
+ ),
4410
+ response: http_response
4411
+ )
4412
+ else
4413
+ http_response = @sdk_configuration.hooks.after_success(
4414
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4415
+ hook_ctx: hook_ctx
4416
+ ),
4417
+ response: http_response
4418
+ )
4419
+ end
4420
+
4421
+ if http_response.nil?
4422
+ raise error if !error.nil?
4423
+ raise 'no response'
4424
+ end
4425
+ end
4426
+
4427
+ content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4428
+ if Utils.match_status_code(http_response.status, ['200'])
4429
+ if Utils.match_content_type(content_type, 'application/json')
4430
+ http_response = @sdk_configuration.hooks.after_success(
4431
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4432
+ hook_ctx: hook_ctx
4433
+ ),
4434
+ response: http_response
4435
+ )
4436
+ response_data = http_response.env.response_body
4437
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::TrustedDeviceList)
4438
+ response = Models::Operations::ListUserTrustedDevicesResponse.new(
4439
+ status_code: http_response.status,
4440
+ content_type: content_type,
4441
+ raw_response: http_response,
4442
+ trusted_device_list: obj
4443
+ )
4444
+
4445
+ return response
4446
+ else
4447
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4448
+ end
4449
+ elsif Utils.match_status_code(http_response.status, ['403', '404'])
4450
+ if Utils.match_content_type(content_type, 'application/json')
4451
+ http_response = @sdk_configuration.hooks.after_success(
4452
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4453
+ hook_ctx: hook_ctx
4454
+ ),
4455
+ response: http_response
4456
+ )
4457
+ response_data = http_response.env.response_body
4458
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
4459
+ obj.raw_response = http_response
4460
+ raise obj
4461
+ else
4462
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4463
+ end
4464
+ elsif Utils.match_status_code(http_response.status, ['500'])
4465
+ if Utils.match_content_type(content_type, 'application/json')
4466
+ http_response = @sdk_configuration.hooks.after_success(
4467
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4468
+ hook_ctx: hook_ctx
4469
+ ),
4470
+ response: http_response
4471
+ )
4472
+ response_data = http_response.env.response_body
4473
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
4474
+ obj.raw_response = http_response
4475
+ raise obj
4476
+ else
4477
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4478
+ end
4479
+ elsif Utils.match_status_code(http_response.status, ['4XX'])
4480
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
4481
+ elsif Utils.match_status_code(http_response.status, ['5XX'])
4482
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
4483
+ else
4484
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
4485
+
4486
+ end
4487
+ end
4488
+
4489
+
4490
+
4491
+ def revoke_trusted_device(user_id:, trusted_device_id:, retries: nil, timeout_ms: nil, http_headers: nil)
4492
+ # revoke_trusted_device - Revoke a user's trusted device
4493
+ # Revokes an active trusted device enrolled by the user.
4494
+ request = Models::Operations::RevokeUserTrustedDeviceRequest.new(
4495
+ user_id: user_id,
4496
+ trusted_device_id: trusted_device_id
4497
+ )
4498
+ url, params = @sdk_configuration.get_server_details
4499
+ base_url = Utils.template_url(url, params)
4500
+ url = Utils.generate_url(
4501
+ Models::Operations::RevokeUserTrustedDeviceRequest,
4502
+ base_url,
4503
+ '/users/{user_id}/trusted_devices/{trusted_device_id}',
4504
+ request
4505
+ )
4506
+ headers = {}
4507
+
4508
+ headers['Accept'] = 'application/json'
4509
+ headers['user-agent'] = @sdk_configuration.user_agent
4510
+ retries ||= @sdk_configuration.retry_config
4511
+ retries ||= Utils::RetryConfig.new(
4512
+ backoff: Utils::BackoffStrategy.new(
4513
+ exponent: 1.5,
4514
+ initial_interval: 500,
4515
+ max_elapsed_time: 3_600_000,
4516
+ max_interval: 60_000
4517
+ ),
4518
+ retry_connection_errors: true,
4519
+ strategy: 'backoff'
4520
+ )
4521
+ retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
4522
+ retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
4523
+
4524
+ security = @sdk_configuration.security_source&.call
4525
+
4526
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4527
+ timeout ||= @sdk_configuration.timeout
4528
+
4529
+
4530
+ connection = @sdk_configuration.client.dup
4531
+ connection.use Utils::RetryMiddleware, retry_options
4532
+
4533
+ hook_ctx = SDKHooks::HookContext.new(
4534
+ config: @sdk_configuration,
4535
+ base_url: base_url,
4536
+ oauth2_scopes: nil,
4537
+ operation_id: 'RevokeUserTrustedDevice',
4538
+ security_source: @sdk_configuration.security_source
4539
+ )
4540
+
4541
+ error = nil
4542
+ http_response = nil
4543
+
4544
+
4545
+ begin
4546
+ http_response = connection.delete(url) do |req|
4547
+ req.headers.merge!(headers)
4548
+ req.options.timeout = timeout unless timeout.nil?
4549
+ Utils.configure_request_security(req, security)
4550
+ http_headers&.each do |key, value|
4551
+ req.headers[key.to_s] = value
4552
+ end
4553
+
4554
+ @sdk_configuration.hooks.before_request(
4555
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
4556
+ hook_ctx: hook_ctx
4557
+ ),
4558
+ request: req
4559
+ )
4560
+ end
4561
+ rescue StandardError => e
4562
+ error = e
4563
+ ensure
4564
+ if http_response.nil? || Utils.error_status?(http_response.status)
4565
+ http_response = @sdk_configuration.hooks.after_error(
4566
+ error: error,
4567
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
4568
+ hook_ctx: hook_ctx
4569
+ ),
4570
+ response: http_response
4571
+ )
4572
+ else
4573
+ http_response = @sdk_configuration.hooks.after_success(
4574
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4575
+ hook_ctx: hook_ctx
4576
+ ),
4577
+ response: http_response
4578
+ )
4579
+ end
4580
+
4581
+ if http_response.nil?
4582
+ raise error if !error.nil?
4583
+ raise 'no response'
4584
+ end
4585
+ end
4586
+
4587
+ content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4588
+ if Utils.match_status_code(http_response.status, ['200'])
4589
+ if Utils.match_content_type(content_type, 'application/json')
4590
+ http_response = @sdk_configuration.hooks.after_success(
4591
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4592
+ hook_ctx: hook_ctx
4593
+ ),
4594
+ response: http_response
4595
+ )
4596
+ response_data = http_response.env.response_body
4597
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::TrustedDevice)
4598
+ response = Models::Operations::RevokeUserTrustedDeviceResponse.new(
4599
+ status_code: http_response.status,
4600
+ content_type: content_type,
4601
+ raw_response: http_response,
4602
+ trusted_device: obj
4603
+ )
4604
+
4605
+ return response
4606
+ else
4607
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4608
+ end
4609
+ elsif Utils.match_status_code(http_response.status, ['403', '404'])
4610
+ if Utils.match_content_type(content_type, 'application/json')
4611
+ http_response = @sdk_configuration.hooks.after_success(
4612
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4613
+ hook_ctx: hook_ctx
4614
+ ),
4615
+ response: http_response
4616
+ )
4617
+ response_data = http_response.env.response_body
4618
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
4619
+ obj.raw_response = http_response
4620
+ raise obj
4621
+ else
4622
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4623
+ end
4624
+ elsif Utils.match_status_code(http_response.status, ['500'])
4625
+ if Utils.match_content_type(content_type, 'application/json')
4626
+ http_response = @sdk_configuration.hooks.after_success(
4627
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
4628
+ hook_ctx: hook_ctx
4629
+ ),
4630
+ response: http_response
4631
+ )
4632
+ response_data = http_response.env.response_body
4633
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
4634
+ obj.raw_response = http_response
4635
+ raise obj
4636
+ else
4637
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
4638
+ end
4639
+ elsif Utils.match_status_code(http_response.status, ['4XX'])
4640
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
4641
+ elsif Utils.match_status_code(http_response.status, ['5XX'])
4642
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
4643
+ else
4644
+ raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
4645
+
4646
+ end
4647
+ end
4648
+
4649
+
4650
+
4162
4651
  def delete_web3_wallet(user_id:, web3_wallet_identification_id:, retries: nil, timeout_ms: nil, http_headers: nil)
4163
4652
  # delete_web3_wallet - Delete a user web3 wallet
4164
4653
  # Delete the web3 wallet identification for a given user.
@@ -4196,10 +4685,10 @@ module Clerk
4196
4685
 
4197
4686
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4198
4687
  timeout ||= @sdk_configuration.timeout
4199
-
4688
+
4200
4689
 
4201
4690
  connection = @sdk_configuration.client.dup
4202
- connection.request :retry, retry_options
4691
+ connection.use Utils::RetryMiddleware, retry_options
4203
4692
 
4204
4693
  hook_ctx = SDKHooks::HookContext.new(
4205
4694
  config: @sdk_configuration,
@@ -4212,7 +4701,7 @@ module Clerk
4212
4701
  error = nil
4213
4702
  http_response = nil
4214
4703
 
4215
-
4704
+
4216
4705
  begin
4217
4706
  http_response = connection.delete(url) do |req|
4218
4707
  req.headers.merge!(headers)
@@ -4248,13 +4737,13 @@ module Clerk
4248
4737
  response: http_response
4249
4738
  )
4250
4739
  end
4251
-
4740
+
4252
4741
  if http_response.nil?
4253
4742
  raise error if !error.nil?
4254
4743
  raise 'no response'
4255
4744
  end
4256
4745
  end
4257
-
4746
+
4258
4747
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4259
4748
  if Utils.match_status_code(http_response.status, ['200'])
4260
4749
  if Utils.match_content_type(content_type, 'application/json')
@@ -4355,10 +4844,10 @@ module Clerk
4355
4844
 
4356
4845
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4357
4846
  timeout ||= @sdk_configuration.timeout
4358
-
4847
+
4359
4848
 
4360
4849
  connection = @sdk_configuration.client.dup
4361
- connection.request :retry, retry_options
4850
+ connection.use Utils::RetryMiddleware, retry_options
4362
4851
 
4363
4852
  hook_ctx = SDKHooks::HookContext.new(
4364
4853
  config: @sdk_configuration,
@@ -4371,7 +4860,7 @@ module Clerk
4371
4860
  error = nil
4372
4861
  http_response = nil
4373
4862
 
4374
-
4863
+
4375
4864
  begin
4376
4865
  http_response = connection.delete(url) do |req|
4377
4866
  req.headers.merge!(headers)
@@ -4407,13 +4896,13 @@ module Clerk
4407
4896
  response: http_response
4408
4897
  )
4409
4898
  end
4410
-
4899
+
4411
4900
  if http_response.nil?
4412
4901
  raise error if !error.nil?
4413
4902
  raise 'no response'
4414
4903
  end
4415
4904
  end
4416
-
4905
+
4417
4906
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4418
4907
  if Utils.match_status_code(http_response.status, ['200'])
4419
4908
  if Utils.match_content_type(content_type, 'application/json')
@@ -4515,10 +5004,10 @@ module Clerk
4515
5004
 
4516
5005
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4517
5006
  timeout ||= @sdk_configuration.timeout
4518
-
5007
+
4519
5008
 
4520
5009
  connection = @sdk_configuration.client.dup
4521
- connection.request :retry, retry_options
5010
+ connection.use Utils::RetryMiddleware, retry_options
4522
5011
 
4523
5012
  hook_ctx = SDKHooks::HookContext.new(
4524
5013
  config: @sdk_configuration,
@@ -4531,7 +5020,7 @@ module Clerk
4531
5020
  error = nil
4532
5021
  http_response = nil
4533
5022
 
4534
-
5023
+
4535
5024
  begin
4536
5025
  http_response = connection.delete(url) do |req|
4537
5026
  req.headers.merge!(headers)
@@ -4567,13 +5056,13 @@ module Clerk
4567
5056
  response: http_response
4568
5057
  )
4569
5058
  end
4570
-
5059
+
4571
5060
  if http_response.nil?
4572
5061
  raise error if !error.nil?
4573
5062
  raise 'no response'
4574
5063
  end
4575
5064
  end
4576
-
5065
+
4577
5066
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4578
5067
  if Utils.match_status_code(http_response.status, ['200'])
4579
5068
  if Utils.match_content_type(content_type, 'application/json')
@@ -4685,10 +5174,10 @@ module Clerk
4685
5174
 
4686
5175
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4687
5176
  timeout ||= @sdk_configuration.timeout
4688
-
5177
+
4689
5178
 
4690
5179
  connection = @sdk_configuration.client.dup
4691
- connection.request :retry, retry_options
5180
+ connection.use Utils::RetryMiddleware, retry_options
4692
5181
 
4693
5182
  hook_ctx = SDKHooks::HookContext.new(
4694
5183
  config: @sdk_configuration,
@@ -4701,7 +5190,7 @@ module Clerk
4701
5190
  error = nil
4702
5191
  http_response = nil
4703
5192
 
4704
-
5193
+
4705
5194
  begin
4706
5195
  http_response = connection.post(url) do |req|
4707
5196
  req.body = body
@@ -4738,13 +5227,13 @@ module Clerk
4738
5227
  response: http_response
4739
5228
  )
4740
5229
  end
4741
-
5230
+
4742
5231
  if http_response.nil?
4743
5232
  raise error if !error.nil?
4744
5233
  raise 'no response'
4745
5234
  end
4746
5235
  end
4747
-
5236
+
4748
5237
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4749
5238
  if Utils.match_status_code(http_response.status, ['200'])
4750
5239
  if Utils.match_content_type(content_type, 'application/json')
@@ -4797,6 +5286,8 @@ module Clerk
4797
5286
  def unset_password_compromised(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
4798
5287
  # unset_password_compromised - Unset a user's password as compromised
4799
5288
  # Sets the given user's password as no longer compromised. The user will no longer be prompted to reset their password on their next sign-in.
5289
+ #
5290
+ # If the user is in reserved-email password quarantine, the quarantine is preserved and the returned user will still have `requires_password_reset` set to `true`. Reserved-email password quarantine can only be cleared by completing a password reset or changing/removing the password.
4800
5291
  request = Models::Operations::UnsetUserPasswordCompromisedRequest.new(
4801
5292
  user_id: user_id
4802
5293
  )
@@ -4830,10 +5321,10 @@ module Clerk
4830
5321
 
4831
5322
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4832
5323
  timeout ||= @sdk_configuration.timeout
4833
-
5324
+
4834
5325
 
4835
5326
  connection = @sdk_configuration.client.dup
4836
- connection.request :retry, retry_options
5327
+ connection.use Utils::RetryMiddleware, retry_options
4837
5328
 
4838
5329
  hook_ctx = SDKHooks::HookContext.new(
4839
5330
  config: @sdk_configuration,
@@ -4846,7 +5337,7 @@ module Clerk
4846
5337
  error = nil
4847
5338
  http_response = nil
4848
5339
 
4849
-
5340
+
4850
5341
  begin
4851
5342
  http_response = connection.post(url) do |req|
4852
5343
  req.headers.merge!(headers)
@@ -4882,13 +5373,13 @@ module Clerk
4882
5373
  response: http_response
4883
5374
  )
4884
5375
  end
4885
-
5376
+
4886
5377
  if http_response.nil?
4887
5378
  raise error if !error.nil?
4888
5379
  raise 'no response'
4889
5380
  end
4890
5381
  end
4891
-
5382
+
4892
5383
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
4893
5384
  if Utils.match_status_code(http_response.status, ['200'])
4894
5385
  if Utils.match_content_type(content_type, 'application/json')
@@ -4972,10 +5463,10 @@ module Clerk
4972
5463
 
4973
5464
  timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
4974
5465
  timeout ||= @sdk_configuration.timeout
4975
-
5466
+
4976
5467
 
4977
5468
  connection = @sdk_configuration.client.dup
4978
- connection.request :retry, retry_options
5469
+ connection.use Utils::RetryMiddleware, retry_options
4979
5470
 
4980
5471
  hook_ctx = SDKHooks::HookContext.new(
4981
5472
  config: @sdk_configuration,
@@ -4988,7 +5479,7 @@ module Clerk
4988
5479
  error = nil
4989
5480
  http_response = nil
4990
5481
 
4991
-
5482
+
4992
5483
  begin
4993
5484
  http_response = connection.get(url) do |req|
4994
5485
  req.headers.merge!(headers)
@@ -5025,13 +5516,13 @@ module Clerk
5025
5516
  response: http_response
5026
5517
  )
5027
5518
  end
5028
-
5519
+
5029
5520
  if http_response.nil?
5030
5521
  raise error if !error.nil?
5031
5522
  raise 'no response'
5032
5523
  end
5033
5524
  end
5034
-
5525
+
5035
5526
  content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
5036
5527
  if Utils.match_status_code(http_response.status, ['200'])
5037
5528
  if Utils.match_content_type(content_type, 'application/json')