workos 6.1.0 → 7.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 (1353) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -2
  3. data/.github/workflows/ci.yml +7 -10
  4. data/.github/workflows/lint-pr-title.yml +1 -1
  5. data/.github/workflows/lint.yml +25 -0
  6. data/.github/workflows/release-please.yml +2 -2
  7. data/.github/workflows/release.yml +3 -7
  8. data/.oagen-manifest.json +1015 -0
  9. data/.release-please-manifest.json +1 -1
  10. data/.ruby-version +1 -1
  11. data/.standard.yml +1 -0
  12. data/CHANGELOG.md +38 -0
  13. data/Gemfile +1 -1
  14. data/Gemfile.lock +93 -47
  15. data/README.md +162 -14
  16. data/Rakefile +8 -4
  17. data/docs/V7_MIGRATION_GUIDE.md +780 -0
  18. data/lib/workos/actions.rb +93 -0
  19. data/lib/workos/admin_portal/generate_link.rb +34 -0
  20. data/lib/workos/admin_portal/intent_options.rb +18 -0
  21. data/lib/workos/admin_portal/portal_link_response.rb +18 -0
  22. data/lib/workos/admin_portal/sso_intent_options.rb +22 -0
  23. data/lib/workos/admin_portal.rb +51 -0
  24. data/lib/workos/api_keys/api_key.rb +43 -0
  25. data/lib/workos/api_keys/api_key_created.rb +34 -0
  26. data/lib/workos/api_keys/api_key_created_data.rb +43 -0
  27. data/lib/workos/api_keys/api_key_created_data_owner.rb +22 -0
  28. data/lib/workos/api_keys/api_key_owner.rb +7 -0
  29. data/lib/workos/api_keys/api_key_revoked.rb +34 -0
  30. data/lib/workos/api_keys/api_key_revoked_data.rb +7 -0
  31. data/lib/workos/api_keys/api_key_revoked_data_owner.rb +7 -0
  32. data/lib/workos/api_keys/api_key_validation_response.rb +18 -0
  33. data/lib/workos/api_keys/api_key_with_value.rb +46 -0
  34. data/lib/workos/api_keys/api_key_with_value_owner.rb +7 -0
  35. data/lib/workos/api_keys/create_organization_api_key.rb +22 -0
  36. data/lib/workos/api_keys/validate_api_key.rb +18 -0
  37. data/lib/workos/api_keys.rb +128 -0
  38. data/lib/workos/audit_logs/audit_log_action.rb +36 -0
  39. data/lib/workos/audit_logs/audit_log_action_json.rb +31 -0
  40. data/lib/workos/audit_logs/audit_log_event.rb +37 -0
  41. data/lib/workos/audit_logs/audit_log_event_actor.rb +28 -0
  42. data/lib/workos/audit_logs/audit_log_event_context.rb +22 -0
  43. data/lib/workos/audit_logs/audit_log_event_create_response.rb +18 -0
  44. data/lib/workos/audit_logs/audit_log_event_ingestion.rb +22 -0
  45. data/lib/workos/audit_logs/audit_log_event_target.rb +7 -0
  46. data/lib/workos/audit_logs/audit_log_export.rb +39 -0
  47. data/lib/workos/audit_logs/audit_log_export_creation.rb +49 -0
  48. data/lib/workos/audit_logs/audit_log_export_json.rb +34 -0
  49. data/lib/workos/audit_logs/audit_log_schema.rb +25 -0
  50. data/lib/workos/audit_logs/audit_log_schema_actor.rb +18 -0
  51. data/lib/workos/audit_logs/audit_log_schema_json.rb +34 -0
  52. data/lib/workos/audit_logs/audit_log_schema_json_actor.rb +7 -0
  53. data/lib/workos/audit_logs/audit_log_schema_json_target.rb +22 -0
  54. data/lib/workos/audit_logs/audit_log_schema_target.rb +7 -0
  55. data/lib/workos/audit_logs.rb +252 -72
  56. data/lib/workos/authorization/add_role_permission.rb +18 -0
  57. data/lib/workos/authorization/assign_role.rb +28 -0
  58. data/lib/workos/authorization/authorization_check.rb +18 -0
  59. data/lib/workos/authorization/authorization_permission.rb +43 -0
  60. data/lib/workos/authorization/authorization_resource.rb +46 -0
  61. data/lib/workos/authorization/check_authorization.rb +28 -0
  62. data/lib/workos/authorization/create_authorization_permission.rb +28 -0
  63. data/lib/workos/authorization/create_authorization_resource.rb +40 -0
  64. data/lib/workos/authorization/create_organization_role.rb +28 -0
  65. data/lib/workos/authorization/create_role.rb +7 -0
  66. data/lib/workos/authorization/permission.rb +7 -0
  67. data/lib/workos/authorization/permission_created.rb +34 -0
  68. data/lib/workos/authorization/permission_created_data.rb +40 -0
  69. data/lib/workos/authorization/permission_deleted.rb +34 -0
  70. data/lib/workos/authorization/permission_deleted_data.rb +7 -0
  71. data/lib/workos/authorization/permission_updated.rb +34 -0
  72. data/lib/workos/authorization/permission_updated_data.rb +7 -0
  73. data/lib/workos/authorization/remove_role.rb +7 -0
  74. data/lib/workos/authorization/role.rb +46 -0
  75. data/lib/workos/authorization/role_assignment.rb +34 -0
  76. data/lib/workos/authorization/role_assignment_resource.rb +25 -0
  77. data/lib/workos/authorization/role_created.rb +34 -0
  78. data/lib/workos/authorization/role_created_data.rb +34 -0
  79. data/lib/workos/authorization/role_deleted.rb +34 -0
  80. data/lib/workos/authorization/role_deleted_data.rb +7 -0
  81. data/lib/workos/authorization/role_list.rb +22 -0
  82. data/lib/workos/authorization/role_updated.rb +34 -0
  83. data/lib/workos/authorization/role_updated_data.rb +7 -0
  84. data/lib/workos/authorization/set_role_permissions.rb +18 -0
  85. data/lib/workos/authorization/slim_role.rb +7 -0
  86. data/lib/workos/authorization/update_authorization_permission.rb +22 -0
  87. data/lib/workos/authorization/update_authorization_resource.rb +31 -0
  88. data/lib/workos/authorization/update_organization_role.rb +7 -0
  89. data/lib/workos/authorization/update_role.rb +7 -0
  90. data/lib/workos/authorization/user_organization_membership_base_list_data.rb +46 -0
  91. data/lib/workos/authorization.rb +1289 -0
  92. data/lib/workos/base_client.rb +350 -0
  93. data/lib/workos/client.rb +94 -159
  94. data/lib/workos/configuration.rb +56 -5
  95. data/lib/workos/connect/application_credentials_list_item.rb +34 -0
  96. data/lib/workos/connect/connect_application.rb +46 -0
  97. data/lib/workos/connect/create_application_secret.rb +13 -0
  98. data/lib/workos/connect/create_m2m_application.rb +31 -0
  99. data/lib/workos/connect/create_oauth_application.rb +40 -0
  100. data/lib/workos/connect/external_auth_complete_response.rb +18 -0
  101. data/lib/workos/connect/new_connect_application_secret.rb +37 -0
  102. data/lib/workos/connect/redirect_uri_input.rb +22 -0
  103. data/lib/workos/connect/update_oauth_application.rb +28 -0
  104. data/lib/workos/connect/user_consent_option.rb +28 -0
  105. data/lib/workos/connect/user_consent_option_choice.rb +22 -0
  106. data/lib/workos/connect/user_management_login_request.rb +25 -0
  107. data/lib/workos/connect/user_object.rb +31 -0
  108. data/lib/workos/connect.rb +329 -0
  109. data/lib/workos/directory_sync/directory.rb +49 -0
  110. data/lib/workos/directory_sync/directory_group.rb +43 -0
  111. data/lib/workos/directory_sync/directory_metadata.rb +22 -0
  112. data/lib/workos/directory_sync/directory_metadata_user.rb +22 -0
  113. data/lib/workos/directory_sync/directory_user.rb +103 -0
  114. data/lib/workos/directory_sync/directory_user_email.rb +25 -0
  115. data/lib/workos/directory_sync/directory_user_with_groups.rb +106 -0
  116. data/lib/workos/directory_sync/directory_user_with_groups_email.rb +7 -0
  117. data/lib/workos/directory_sync/dsync_activated.rb +34 -0
  118. data/lib/workos/directory_sync/dsync_activated_data.rb +46 -0
  119. data/lib/workos/directory_sync/dsync_activated_data_domain.rb +25 -0
  120. data/lib/workos/directory_sync/dsync_deactivated.rb +34 -0
  121. data/lib/workos/directory_sync/dsync_deactivated_data.rb +46 -0
  122. data/lib/workos/directory_sync/dsync_deactivated_data_domain.rb +7 -0
  123. data/lib/workos/directory_sync/dsync_deleted.rb +34 -0
  124. data/lib/workos/directory_sync/dsync_deleted_data.rb +40 -0
  125. data/lib/workos/directory_sync/dsync_group_created.rb +34 -0
  126. data/lib/workos/directory_sync/dsync_group_deleted.rb +34 -0
  127. data/lib/workos/directory_sync/dsync_group_updated.rb +34 -0
  128. data/lib/workos/directory_sync/dsync_group_updated_data.rb +46 -0
  129. data/lib/workos/directory_sync/dsync_group_user_added.rb +34 -0
  130. data/lib/workos/directory_sync/dsync_group_user_added_data.rb +25 -0
  131. data/lib/workos/directory_sync/dsync_group_user_removed.rb +34 -0
  132. data/lib/workos/directory_sync/dsync_group_user_removed_data.rb +7 -0
  133. data/lib/workos/directory_sync/dsync_user_created.rb +34 -0
  134. data/lib/workos/directory_sync/dsync_user_deleted.rb +34 -0
  135. data/lib/workos/directory_sync/dsync_user_updated.rb +34 -0
  136. data/lib/workos/directory_sync/dsync_user_updated_data.rb +106 -0
  137. data/lib/workos/directory_sync/dsync_user_updated_data_email.rb +7 -0
  138. data/lib/workos/directory_sync.rb +230 -181
  139. data/lib/workos/encryptors/aes_gcm.rb +40 -33
  140. data/lib/workos/encryptors.rb +3 -3
  141. data/lib/workos/errors.rb +17 -75
  142. data/lib/workos/events/event_list_list_metadata.rb +18 -0
  143. data/lib/workos/events/event_schema.rb +34 -0
  144. data/lib/workos/events.rb +64 -38
  145. data/lib/workos/feature_flags/feature_flag.rb +49 -0
  146. data/lib/workos/feature_flags/feature_flag_owner.rb +25 -0
  147. data/lib/workos/feature_flags/flag.rb +7 -0
  148. data/lib/workos/feature_flags/flag_created.rb +34 -0
  149. data/lib/workos/feature_flags/flag_created_context.rb +22 -0
  150. data/lib/workos/feature_flags/flag_created_context_actor.rb +25 -0
  151. data/lib/workos/feature_flags/flag_created_data.rb +52 -0
  152. data/lib/workos/feature_flags/flag_created_data_owner.rb +7 -0
  153. data/lib/workos/feature_flags/flag_deleted.rb +34 -0
  154. data/lib/workos/feature_flags/flag_deleted_context.rb +22 -0
  155. data/lib/workos/feature_flags/flag_deleted_context_actor.rb +25 -0
  156. data/lib/workos/feature_flags/flag_deleted_data.rb +7 -0
  157. data/lib/workos/feature_flags/flag_deleted_data_owner.rb +7 -0
  158. data/lib/workos/feature_flags/flag_owner.rb +7 -0
  159. data/lib/workos/feature_flags/flag_rule_updated.rb +34 -0
  160. data/lib/workos/feature_flags/flag_rule_updated_context.rb +31 -0
  161. data/lib/workos/feature_flags/flag_rule_updated_context_actor.rb +25 -0
  162. data/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb +22 -0
  163. data/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb +22 -0
  164. data/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb +22 -0
  165. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb +22 -0
  166. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb +22 -0
  167. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb +7 -0
  168. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb +7 -0
  169. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb +7 -0
  170. data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb +22 -0
  171. data/lib/workos/feature_flags/flag_rule_updated_data.rb +7 -0
  172. data/lib/workos/feature_flags/flag_rule_updated_data_owner.rb +7 -0
  173. data/lib/workos/feature_flags/flag_updated.rb +34 -0
  174. data/lib/workos/feature_flags/flag_updated_context.rb +25 -0
  175. data/lib/workos/feature_flags/flag_updated_context_actor.rb +25 -0
  176. data/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb +18 -0
  177. data/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb +31 -0
  178. data/lib/workos/feature_flags/flag_updated_data.rb +7 -0
  179. data/lib/workos/feature_flags/flag_updated_data_owner.rb +7 -0
  180. data/lib/workos/feature_flags.rb +246 -0
  181. data/lib/workos/hash_provider.rb +34 -8
  182. data/lib/workos/inflections.rb +64 -0
  183. data/lib/workos/multi_factor_auth/authentication_challenge.rb +37 -0
  184. data/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb +22 -0
  185. data/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb +18 -0
  186. data/lib/workos/multi_factor_auth/authentication_factor.rb +40 -0
  187. data/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb +40 -0
  188. data/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb +18 -0
  189. data/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb +31 -0
  190. data/lib/workos/multi_factor_auth/authentication_factor_sms.rb +7 -0
  191. data/lib/workos/multi_factor_auth/authentication_factor_totp.rb +22 -0
  192. data/lib/workos/multi_factor_auth/authentication_factors_create_request.rb +31 -0
  193. data/lib/workos/multi_factor_auth/challenge_authentication_factor.rb +18 -0
  194. data/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb +28 -0
  195. data/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb +22 -0
  196. data/lib/workos/multi_factor_auth.rb +215 -0
  197. data/lib/workos/organization_domains/create_organization_domain.rb +22 -0
  198. data/lib/workos/organization_domains/organization_domain.rb +46 -0
  199. data/lib/workos/organization_domains/organization_domain_created.rb +34 -0
  200. data/lib/workos/organization_domains/organization_domain_created_data.rb +46 -0
  201. data/lib/workos/organization_domains/organization_domain_deleted.rb +34 -0
  202. data/lib/workos/organization_domains/organization_domain_deleted_data.rb +46 -0
  203. data/lib/workos/organization_domains/organization_domain_stand_alone.rb +46 -0
  204. data/lib/workos/organization_domains/organization_domain_updated.rb +34 -0
  205. data/lib/workos/organization_domains/organization_domain_updated_data.rb +46 -0
  206. data/lib/workos/organization_domains/organization_domain_verification_failed.rb +34 -0
  207. data/lib/workos/organization_domains/organization_domain_verification_failed_data.rb +22 -0
  208. data/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb +46 -0
  209. data/lib/workos/organization_domains/organization_domain_verified.rb +34 -0
  210. data/lib/workos/organization_domains/organization_domain_verified_data.rb +46 -0
  211. data/lib/workos/organization_domains.rb +94 -0
  212. data/lib/workos/organizations/audit_log_configuration.rb +28 -0
  213. data/lib/workos/organizations/audit_log_configuration_log_stream.rb +31 -0
  214. data/lib/workos/organizations/audit_logs_retention.rb +23 -0
  215. data/lib/workos/organizations/audit_logs_retention_json.rb +18 -0
  216. data/lib/workos/organizations/organization.rb +55 -0
  217. data/lib/workos/organizations/organization_created.rb +34 -0
  218. data/lib/workos/organizations/organization_created_data.rb +43 -0
  219. data/lib/workos/organizations/organization_created_data_domain.rb +46 -0
  220. data/lib/workos/organizations/organization_deleted.rb +34 -0
  221. data/lib/workos/organizations/organization_deleted_data.rb +43 -0
  222. data/lib/workos/organizations/organization_deleted_data_domain.rb +46 -0
  223. data/lib/workos/organizations/organization_domain_data.rb +22 -0
  224. data/lib/workos/organizations/organization_input.rb +34 -0
  225. data/lib/workos/organizations/organization_membership_created.rb +34 -0
  226. data/lib/workos/organizations/organization_membership_created_data.rb +49 -0
  227. data/lib/workos/organizations/organization_membership_deleted.rb +34 -0
  228. data/lib/workos/organizations/organization_membership_deleted_data.rb +49 -0
  229. data/lib/workos/organizations/organization_membership_updated.rb +34 -0
  230. data/lib/workos/organizations/organization_membership_updated_data.rb +49 -0
  231. data/lib/workos/organizations/organization_role_created.rb +34 -0
  232. data/lib/workos/organizations/organization_role_created_data.rb +43 -0
  233. data/lib/workos/organizations/organization_role_deleted.rb +34 -0
  234. data/lib/workos/organizations/organization_role_deleted_data.rb +7 -0
  235. data/lib/workos/organizations/organization_role_updated.rb +34 -0
  236. data/lib/workos/organizations/organization_role_updated_data.rb +7 -0
  237. data/lib/workos/organizations/organization_updated.rb +34 -0
  238. data/lib/workos/organizations/organization_updated_data.rb +43 -0
  239. data/lib/workos/organizations/organization_updated_data_domain.rb +46 -0
  240. data/lib/workos/organizations/update_audit_logs_retention.rb +18 -0
  241. data/lib/workos/organizations/update_organization.rb +46 -0
  242. data/lib/workos/organizations.rb +203 -271
  243. data/lib/workos/passwordless.rb +63 -58
  244. data/lib/workos/pipes/connected_account.rb +40 -0
  245. data/lib/workos/pipes/data_integration_access_token_response.rb +25 -0
  246. data/lib/workos/pipes/data_integration_access_token_response_access_token.rb +31 -0
  247. data/lib/workos/pipes/data_integration_authorize_url_response.rb +18 -0
  248. data/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb +25 -0
  249. data/lib/workos/pipes/data_integrations_get_user_token_request.rb +22 -0
  250. data/lib/workos/pipes/data_integrations_list_response.rb +22 -0
  251. data/lib/workos/pipes/data_integrations_list_response_data.rb +52 -0
  252. data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +52 -0
  253. data/lib/workos/pipes.rb +149 -0
  254. data/lib/workos/pkce.rb +42 -0
  255. data/lib/workos/public_client.rb +27 -0
  256. data/lib/workos/radar/radar_list_entry_already_present_response.rb +18 -0
  257. data/lib/workos/radar/radar_standalone_assess_request.rb +37 -0
  258. data/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb +18 -0
  259. data/lib/workos/radar/radar_standalone_response.rb +31 -0
  260. data/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb +22 -0
  261. data/lib/workos/radar/radar_standalone_update_radar_list_request.rb +7 -0
  262. data/lib/workos/radar.rb +132 -0
  263. data/lib/workos/session.rb +108 -160
  264. data/lib/workos/session_manager.rb +196 -0
  265. data/lib/workos/shared/event_context.rb +34 -0
  266. data/lib/workos/shared/event_context_actor.rb +25 -0
  267. data/lib/workos/shared/event_context_google_analytics_session.rb +25 -0
  268. data/lib/workos/shared/group.rb +37 -0
  269. data/lib/workos/shared/group_created.rb +34 -0
  270. data/lib/workos/shared/group_deleted.rb +34 -0
  271. data/lib/workos/shared/group_member_added.rb +34 -0
  272. data/lib/workos/shared/group_member_added_data.rb +22 -0
  273. data/lib/workos/shared/group_member_removed.rb +34 -0
  274. data/lib/workos/shared/group_member_removed_data.rb +7 -0
  275. data/lib/workos/shared/group_updated.rb +34 -0
  276. data/lib/workos/sso/connection.rb +58 -0
  277. data/lib/workos/sso/connection_activated.rb +34 -0
  278. data/lib/workos/sso/connection_activated_data.rb +49 -0
  279. data/lib/workos/sso/connection_activated_data_domain.rb +25 -0
  280. data/lib/workos/sso/connection_deactivated.rb +34 -0
  281. data/lib/workos/sso/connection_deactivated_data.rb +49 -0
  282. data/lib/workos/sso/connection_deactivated_data_domain.rb +7 -0
  283. data/lib/workos/sso/connection_deleted.rb +34 -0
  284. data/lib/workos/sso/connection_deleted_data.rb +40 -0
  285. data/lib/workos/sso/connection_domain.rb +7 -0
  286. data/lib/workos/sso/connection_option.rb +18 -0
  287. data/lib/workos/sso/connection_saml_certificate_renewal_required.rb +34 -0
  288. data/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb +25 -0
  289. data/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb +25 -0
  290. data/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb +22 -0
  291. data/lib/workos/sso/connection_saml_certificate_renewed.rb +34 -0
  292. data/lib/workos/sso/connection_saml_certificate_renewed_data.rb +25 -0
  293. data/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb +22 -0
  294. data/lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb +7 -0
  295. data/lib/workos/sso/profile.rb +58 -0
  296. data/lib/workos/sso/sso_authorize_url_response.rb +18 -0
  297. data/lib/workos/sso/sso_logout_authorize_request.rb +18 -0
  298. data/lib/workos/sso/sso_logout_authorize_response.rb +22 -0
  299. data/lib/workos/sso/sso_token_response.rb +31 -0
  300. data/lib/workos/sso/sso_token_response_oauth_token.rb +7 -0
  301. data/lib/workos/sso/token_query.rb +28 -0
  302. data/lib/workos/sso.rb +231 -212
  303. data/lib/workos/types/api_response.rb +10 -0
  304. data/lib/workos/types/applications_order.rb +14 -0
  305. data/lib/workos/types/audit_log_configuration_log_stream_state.rb +15 -0
  306. data/lib/workos/types/audit_log_configuration_log_stream_type.rb +17 -0
  307. data/lib/workos/types/audit_log_configuration_state.rb +14 -0
  308. data/lib/workos/types/audit_log_export_json_state.rb +14 -0
  309. data/lib/workos/types/audit_log_export_state.rb +14 -0
  310. data/lib/workos/types/audit_logs_order.rb +9 -0
  311. data/lib/workos/types/authenticate_response_authentication_method.rb +33 -0
  312. data/lib/workos/types/authentication_factor_enrolled_type.rb +15 -0
  313. data/lib/workos/types/authentication_factor_type.rb +9 -0
  314. data/lib/workos/types/authentication_factors_create_request_type.rb +14 -0
  315. data/lib/workos/types/authentication_radar_risk_detected_data_action.rb +13 -0
  316. data/lib/workos/types/authorization_assignment.rb +13 -0
  317. data/lib/workos/types/authorization_order.rb +9 -0
  318. data/lib/workos/types/base_model.rb +35 -0
  319. data/lib/workos/types/connected_account_state.rb +14 -0
  320. data/lib/workos/types/connection_activated_data_connection_type.rb +61 -0
  321. data/lib/workos/types/connection_activated_data_state.rb +16 -0
  322. data/lib/workos/types/connection_activated_data_status.rb +13 -0
  323. data/lib/workos/types/connection_deactivated_data_connection_type.rb +9 -0
  324. data/lib/workos/types/connection_deactivated_data_state.rb +9 -0
  325. data/lib/workos/types/connection_deactivated_data_status.rb +9 -0
  326. data/lib/workos/types/connection_deleted_data_connection_type.rb +9 -0
  327. data/lib/workos/types/connection_deleted_data_state.rb +9 -0
  328. data/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb +14 -0
  329. data/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb +9 -0
  330. data/lib/workos/types/connection_state.rb +17 -0
  331. data/lib/workos/types/connection_status.rb +9 -0
  332. data/lib/workos/types/connection_type.rb +62 -0
  333. data/lib/workos/types/connections_connection_type.rb +59 -0
  334. data/lib/workos/types/connections_order.rb +9 -0
  335. data/lib/workos/types/create_user_invite_options_locale.rb +101 -0
  336. data/lib/workos/types/create_user_password_hash_type.rb +17 -0
  337. data/lib/workos/types/create_webhook_endpoint_events.rb +85 -0
  338. data/lib/workos/types/data_integration_access_token_response_error.rb +13 -0
  339. data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +9 -0
  340. data/lib/workos/types/data_integrations_list_response_data_ownership.rb +13 -0
  341. data/lib/workos/types/directories_order.rb +9 -0
  342. data/lib/workos/types/directory_groups_order.rb +9 -0
  343. data/lib/workos/types/directory_state.rb +16 -0
  344. data/lib/workos/types/directory_type.rb +32 -0
  345. data/lib/workos/types/directory_user_state.rb +14 -0
  346. data/lib/workos/types/directory_user_with_groups_state.rb +9 -0
  347. data/lib/workos/types/directory_users_order.rb +9 -0
  348. data/lib/workos/types/dsync_activated_data_state.rb +16 -0
  349. data/lib/workos/types/dsync_activated_data_type.rb +34 -0
  350. data/lib/workos/types/dsync_deactivated_data_state.rb +9 -0
  351. data/lib/workos/types/dsync_deactivated_data_type.rb +9 -0
  352. data/lib/workos/types/dsync_deleted_data_state.rb +9 -0
  353. data/lib/workos/types/dsync_deleted_data_type.rb +9 -0
  354. data/lib/workos/types/dsync_user_updated_data_state.rb +9 -0
  355. data/lib/workos/types/event_context_actor_source.rb +14 -0
  356. data/lib/workos/types/events_order.rb +9 -0
  357. data/lib/workos/types/feature_flags_order.rb +9 -0
  358. data/lib/workos/types/flag_created_context_actor_source.rb +9 -0
  359. data/lib/workos/types/flag_deleted_context_actor_source.rb +9 -0
  360. data/lib/workos/types/flag_rule_updated_context_access_type.rb +14 -0
  361. data/lib/workos/types/flag_rule_updated_context_actor_source.rb +9 -0
  362. data/lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb +9 -0
  363. data/lib/workos/types/flag_updated_context_actor_source.rb +9 -0
  364. data/lib/workos/types/generate_link_intent.rb +18 -0
  365. data/lib/workos/types/invitation_accepted_data_state.rb +15 -0
  366. data/lib/workos/types/invitation_created_data_state.rb +9 -0
  367. data/lib/workos/types/invitation_resent_data_state.rb +9 -0
  368. data/lib/workos/types/invitation_revoked_data_state.rb +9 -0
  369. data/lib/workos/types/invitation_state.rb +9 -0
  370. data/lib/workos/types/list_struct.rb +122 -6
  371. data/lib/workos/types/organization_created_data_domain_state.rb +16 -0
  372. data/lib/workos/types/organization_created_data_domain_verification_strategy.rb +13 -0
  373. data/lib/workos/types/organization_deleted_data_domain_state.rb +9 -0
  374. data/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb +9 -0
  375. data/lib/workos/types/organization_domain_created_data_state.rb +9 -0
  376. data/lib/workos/types/organization_domain_created_data_verification_strategy.rb +9 -0
  377. data/lib/workos/types/organization_domain_data_state.rb +13 -0
  378. data/lib/workos/types/organization_domain_deleted_data_state.rb +9 -0
  379. data/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb +9 -0
  380. data/lib/workos/types/organization_domain_stand_alone_state.rb +9 -0
  381. data/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb +9 -0
  382. data/lib/workos/types/organization_domain_state.rb +9 -0
  383. data/lib/workos/types/organization_domain_updated_data_state.rb +9 -0
  384. data/lib/workos/types/organization_domain_updated_data_verification_strategy.rb +9 -0
  385. data/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb +9 -0
  386. data/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb +9 -0
  387. data/lib/workos/types/organization_domain_verification_failed_data_reason.rb +13 -0
  388. data/lib/workos/types/organization_domain_verification_strategy.rb +9 -0
  389. data/lib/workos/types/organization_domain_verified_data_state.rb +9 -0
  390. data/lib/workos/types/organization_domain_verified_data_verification_strategy.rb +9 -0
  391. data/lib/workos/types/organization_membership_created_data_status.rb +14 -0
  392. data/lib/workos/types/organization_membership_deleted_data_status.rb +9 -0
  393. data/lib/workos/types/organization_membership_status.rb +9 -0
  394. data/lib/workos/types/organization_membership_updated_data_status.rb +9 -0
  395. data/lib/workos/types/organization_updated_data_domain_state.rb +9 -0
  396. data/lib/workos/types/organization_updated_data_domain_verification_strategy.rb +9 -0
  397. data/lib/workos/types/organizations_api_keys_order.rb +9 -0
  398. data/lib/workos/types/organizations_feature_flags_order.rb +9 -0
  399. data/lib/workos/types/organizations_order.rb +9 -0
  400. data/lib/workos/types/permissions_order.rb +9 -0
  401. data/lib/workos/types/profile_connection_type.rb +9 -0
  402. data/lib/workos/types/radar_action.rb +13 -0
  403. data/lib/workos/types/radar_standalone_assess_request_action.rb +19 -0
  404. data/lib/workos/types/radar_standalone_assess_request_auth_method.rb +19 -0
  405. data/lib/workos/types/radar_standalone_response_blocklist_type.rb +18 -0
  406. data/lib/workos/types/radar_standalone_response_control.rb +21 -0
  407. data/lib/workos/types/radar_standalone_response_verdict.rb +14 -0
  408. data/lib/workos/types/radar_type.rb +9 -0
  409. data/lib/workos/types/request_options.rb +33 -0
  410. data/lib/workos/types/resend_user_invite_options_locale.rb +9 -0
  411. data/lib/workos/types/role_type.rb +13 -0
  412. data/lib/workos/types/session_created_data_auth_method.rb +21 -0
  413. data/lib/workos/types/session_created_data_status.rb +14 -0
  414. data/lib/workos/types/session_revoked_data_auth_method.rb +9 -0
  415. data/lib/workos/types/session_revoked_data_status.rb +9 -0
  416. data/lib/workos/types/sso_provider.rb +15 -0
  417. data/lib/workos/types/update_user_password_hash_type.rb +9 -0
  418. data/lib/workos/types/update_webhook_endpoint_events.rb +9 -0
  419. data/lib/workos/types/update_webhook_endpoint_status.rb +13 -0
  420. data/lib/workos/types/user_identities_get_item_provider.rb +25 -0
  421. data/lib/workos/types/user_invite_state.rb +9 -0
  422. data/lib/workos/types/user_management_authentication_provider.rb +16 -0
  423. data/lib/workos/types/user_management_authentication_screen_hint.rb +13 -0
  424. data/lib/workos/types/user_management_invitations_order.rb +9 -0
  425. data/lib/workos/types/user_management_multi_factor_authentication_order.rb +9 -0
  426. data/lib/workos/types/user_management_organization_membership_order.rb +9 -0
  427. data/lib/workos/types/user_management_organization_membership_statuses.rb +9 -0
  428. data/lib/workos/types/user_management_users_authorized_applications_order.rb +9 -0
  429. data/lib/workos/types/user_management_users_feature_flags_order.rb +9 -0
  430. data/lib/workos/types/user_management_users_order.rb +9 -0
  431. data/lib/workos/types/user_organization_membership_base_list_data_status.rb +9 -0
  432. data/lib/workos/types/user_organization_membership_status.rb +9 -0
  433. data/lib/workos/types/user_sessions_auth_method.rb +9 -0
  434. data/lib/workos/types/user_sessions_status.rb +9 -0
  435. data/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb +14 -0
  436. data/lib/workos/types/vault_data_created_data_actor_source.rb +13 -0
  437. data/lib/workos/types/vault_data_deleted_data_actor_source.rb +9 -0
  438. data/lib/workos/types/vault_data_read_data_actor_source.rb +9 -0
  439. data/lib/workos/types/vault_data_updated_data_actor_source.rb +9 -0
  440. data/lib/workos/types/vault_dek_decrypted_data_actor_source.rb +9 -0
  441. data/lib/workos/types/vault_dek_read_data_actor_source.rb +9 -0
  442. data/lib/workos/types/vault_kek_created_data_actor_source.rb +9 -0
  443. data/lib/workos/types/vault_metadata_read_data_actor_source.rb +9 -0
  444. data/lib/workos/types/vault_names_listed_data_actor_source.rb +9 -0
  445. data/lib/workos/types/webhook_endpoint_json_status.rb +9 -0
  446. data/lib/workos/types/webhook_endpoint_status.rb +13 -0
  447. data/lib/workos/types/webhooks_order.rb +9 -0
  448. data/lib/workos/types/widget_session_token_scopes.rb +17 -0
  449. data/lib/workos/user_management/action_authentication_denied.rb +34 -0
  450. data/lib/workos/user_management/action_authentication_denied_data.rb +43 -0
  451. data/lib/workos/user_management/action_user_registration_denied.rb +34 -0
  452. data/lib/workos/user_management/action_user_registration_denied_data.rb +40 -0
  453. data/lib/workos/user_management/authenticate_response.rb +40 -0
  454. data/lib/workos/user_management/authenticate_response_impersonator.rb +22 -0
  455. data/lib/workos/user_management/authenticate_response_oauth_token.rb +31 -0
  456. data/lib/workos/user_management/authentication_email_verification_failed.rb +34 -0
  457. data/lib/workos/user_management/authentication_email_verification_failed_data.rb +37 -0
  458. data/lib/workos/user_management/authentication_email_verification_failed_data_error.rb +22 -0
  459. data/lib/workos/user_management/authentication_email_verification_succeeded.rb +34 -0
  460. data/lib/workos/user_management/authentication_email_verification_succeeded_data.rb +34 -0
  461. data/lib/workos/user_management/authentication_magic_auth_failed.rb +34 -0
  462. data/lib/workos/user_management/authentication_magic_auth_failed_data.rb +37 -0
  463. data/lib/workos/user_management/authentication_magic_auth_failed_data_error.rb +7 -0
  464. data/lib/workos/user_management/authentication_magic_auth_succeeded.rb +34 -0
  465. data/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb +34 -0
  466. data/lib/workos/user_management/authentication_mfa_failed.rb +34 -0
  467. data/lib/workos/user_management/authentication_mfa_failed_data.rb +37 -0
  468. data/lib/workos/user_management/authentication_mfa_failed_data_error.rb +7 -0
  469. data/lib/workos/user_management/authentication_mfa_succeeded.rb +34 -0
  470. data/lib/workos/user_management/authentication_mfa_succeeded_data.rb +34 -0
  471. data/lib/workos/user_management/authentication_oauth_failed.rb +34 -0
  472. data/lib/workos/user_management/authentication_oauth_failed_data.rb +37 -0
  473. data/lib/workos/user_management/authentication_oauth_failed_data_error.rb +7 -0
  474. data/lib/workos/user_management/authentication_oauth_succeeded.rb +34 -0
  475. data/lib/workos/user_management/authentication_oauth_succeeded_data.rb +34 -0
  476. data/lib/workos/user_management/authentication_passkey_failed.rb +34 -0
  477. data/lib/workos/user_management/authentication_passkey_failed_data.rb +37 -0
  478. data/lib/workos/user_management/authentication_passkey_failed_data_error.rb +7 -0
  479. data/lib/workos/user_management/authentication_passkey_succeeded.rb +34 -0
  480. data/lib/workos/user_management/authentication_passkey_succeeded_data.rb +34 -0
  481. data/lib/workos/user_management/authentication_password_failed.rb +34 -0
  482. data/lib/workos/user_management/authentication_password_failed_data.rb +37 -0
  483. data/lib/workos/user_management/authentication_password_failed_data_error.rb +7 -0
  484. data/lib/workos/user_management/authentication_password_succeeded.rb +34 -0
  485. data/lib/workos/user_management/authentication_password_succeeded_data.rb +34 -0
  486. data/lib/workos/user_management/authentication_radar_risk_detected.rb +34 -0
  487. data/lib/workos/user_management/authentication_radar_risk_detected_data.rb +40 -0
  488. data/lib/workos/user_management/authentication_sso_failed.rb +34 -0
  489. data/lib/workos/user_management/authentication_sso_failed_data.rb +40 -0
  490. data/lib/workos/user_management/authentication_sso_failed_data_error.rb +7 -0
  491. data/lib/workos/user_management/authentication_sso_failed_data_sso.rb +25 -0
  492. data/lib/workos/user_management/authentication_sso_started.rb +34 -0
  493. data/lib/workos/user_management/authentication_sso_started_data.rb +37 -0
  494. data/lib/workos/user_management/authentication_sso_started_data_sso.rb +7 -0
  495. data/lib/workos/user_management/authentication_sso_succeeded.rb +34 -0
  496. data/lib/workos/user_management/authentication_sso_succeeded_data.rb +37 -0
  497. data/lib/workos/user_management/authentication_sso_succeeded_data_sso.rb +7 -0
  498. data/lib/workos/user_management/authentication_sso_timed_out.rb +34 -0
  499. data/lib/workos/user_management/authentication_sso_timed_out_data.rb +40 -0
  500. data/lib/workos/user_management/authentication_sso_timed_out_data_error.rb +7 -0
  501. data/lib/workos/user_management/authentication_sso_timed_out_data_sso.rb +7 -0
  502. data/lib/workos/user_management/authorization_code_session_authenticate_request.rb +43 -0
  503. data/lib/workos/user_management/authorized_connect_application_list_data.rb +31 -0
  504. data/lib/workos/user_management/confirm_email_change.rb +7 -0
  505. data/lib/workos/user_management/cors_origin_response.rb +31 -0
  506. data/lib/workos/user_management/create_cors_origin.rb +18 -0
  507. data/lib/workos/user_management/create_magic_code_and_return.rb +22 -0
  508. data/lib/workos/user_management/create_password_reset.rb +22 -0
  509. data/lib/workos/user_management/create_password_reset_token.rb +18 -0
  510. data/lib/workos/user_management/create_redirect_uri.rb +18 -0
  511. data/lib/workos/user_management/create_user.rb +43 -0
  512. data/lib/workos/user_management/create_user_invite_options.rb +34 -0
  513. data/lib/workos/user_management/create_user_organization_membership.rb +28 -0
  514. data/lib/workos/user_management/device_authorization_response.rb +34 -0
  515. data/lib/workos/user_management/device_code_session_authenticate_request.rb +34 -0
  516. data/lib/workos/user_management/email_change.rb +31 -0
  517. data/lib/workos/user_management/email_change_confirmation.rb +22 -0
  518. data/lib/workos/user_management/email_change_confirmation_user.rb +55 -0
  519. data/lib/workos/user_management/email_verification.rb +40 -0
  520. data/lib/workos/user_management/email_verification_code_session_authenticate_request.rb +40 -0
  521. data/lib/workos/user_management/email_verification_created.rb +34 -0
  522. data/lib/workos/user_management/email_verification_created_data.rb +37 -0
  523. data/lib/workos/user_management/invitation.rb +58 -0
  524. data/lib/workos/user_management/invitation_accepted.rb +34 -0
  525. data/lib/workos/user_management/invitation_accepted_data.rb +52 -0
  526. data/lib/workos/user_management/invitation_created.rb +34 -0
  527. data/lib/workos/user_management/invitation_created_data.rb +52 -0
  528. data/lib/workos/user_management/invitation_resent.rb +34 -0
  529. data/lib/workos/user_management/invitation_resent_data.rb +52 -0
  530. data/lib/workos/user_management/invitation_revoked.rb +34 -0
  531. data/lib/workos/user_management/invitation_revoked_data.rb +52 -0
  532. data/lib/workos/user_management/jwks_response.rb +18 -0
  533. data/lib/workos/user_management/jwks_response_keys.rb +40 -0
  534. data/lib/workos/user_management/jwt_template_response.rb +28 -0
  535. data/lib/workos/user_management/magic_auth.rb +40 -0
  536. data/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +43 -0
  537. data/lib/workos/user_management/magic_auth_created.rb +34 -0
  538. data/lib/workos/user_management/magic_auth_created_data.rb +37 -0
  539. data/lib/workos/user_management/mfa_totp_session_authenticate_request.rb +43 -0
  540. data/lib/workos/user_management/organization_membership.rb +49 -0
  541. data/lib/workos/user_management/organization_selection_session_authenticate_request.rb +40 -0
  542. data/lib/workos/user_management/password_reset.rb +40 -0
  543. data/lib/workos/user_management/password_reset_created.rb +34 -0
  544. data/lib/workos/user_management/password_reset_created_data.rb +34 -0
  545. data/lib/workos/user_management/password_reset_succeeded.rb +34 -0
  546. data/lib/workos/user_management/password_reset_succeeded_data.rb +7 -0
  547. data/lib/workos/user_management/password_session_authenticate_request.rb +43 -0
  548. data/lib/workos/user_management/redirect_uri.rb +34 -0
  549. data/lib/workos/user_management/refresh_token_session_authenticate_request.rb +40 -0
  550. data/lib/workos/user_management/resend_user_invite_options.rb +18 -0
  551. data/lib/workos/user_management/reset_password_response.rb +18 -0
  552. data/lib/workos/user_management/revoke_session.rb +22 -0
  553. data/lib/workos/user_management/send_email_change.rb +18 -0
  554. data/lib/workos/user_management/send_verification_email_response.rb +7 -0
  555. data/lib/workos/user_management/session_created.rb +34 -0
  556. data/lib/workos/user_management/session_created_data.rb +55 -0
  557. data/lib/workos/user_management/session_created_data_impersonator.rb +7 -0
  558. data/lib/workos/user_management/session_revoked.rb +34 -0
  559. data/lib/workos/user_management/session_revoked_data.rb +55 -0
  560. data/lib/workos/user_management/session_revoked_data_impersonator.rb +7 -0
  561. data/lib/workos/user_management/sso_device_authorization_request.rb +18 -0
  562. data/lib/workos/user_management/update_jwt_template.rb +18 -0
  563. data/lib/workos/user_management/update_user.rb +46 -0
  564. data/lib/workos/user_management/update_user_organization_membership.rb +22 -0
  565. data/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb +8 -0
  566. data/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb +8 -0
  567. data/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb +8 -0
  568. data/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb +8 -0
  569. data/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb +8 -0
  570. data/lib/workos/user_management/user.rb +7 -0
  571. data/lib/workos/user_management/user_created.rb +34 -0
  572. data/lib/workos/user_management/user_deleted.rb +34 -0
  573. data/lib/workos/user_management/user_identities_get_item.rb +25 -0
  574. data/lib/workos/user_management/user_invite.rb +58 -0
  575. data/lib/workos/user_management/user_organization_membership.rb +49 -0
  576. data/lib/workos/user_management/user_sessions_impersonator.rb +7 -0
  577. data/lib/workos/user_management/user_sessions_list_item.rb +55 -0
  578. data/lib/workos/user_management/user_updated.rb +34 -0
  579. data/lib/workos/user_management/verify_email_address.rb +7 -0
  580. data/lib/workos/user_management/verify_email_response.rb +7 -0
  581. data/lib/workos/user_management.rb +1522 -1154
  582. data/lib/workos/util/signature.rb +55 -0
  583. data/lib/workos/util.rb +16 -0
  584. data/lib/workos/vault/vault_byok_key_verification_completed.rb +34 -0
  585. data/lib/workos/vault/vault_byok_key_verification_completed_data.rb +25 -0
  586. data/lib/workos/vault/vault_data_created.rb +34 -0
  587. data/lib/workos/vault/vault_data_created_data.rb +34 -0
  588. data/lib/workos/vault/vault_data_deleted.rb +34 -0
  589. data/lib/workos/vault/vault_data_deleted_data.rb +28 -0
  590. data/lib/workos/vault/vault_data_read.rb +34 -0
  591. data/lib/workos/vault/vault_data_read_data.rb +31 -0
  592. data/lib/workos/vault/vault_data_updated.rb +34 -0
  593. data/lib/workos/vault/vault_data_updated_data.rb +34 -0
  594. data/lib/workos/vault/vault_dek_decrypted.rb +34 -0
  595. data/lib/workos/vault/vault_dek_decrypted_data.rb +28 -0
  596. data/lib/workos/vault/vault_dek_read.rb +34 -0
  597. data/lib/workos/vault/vault_dek_read_data.rb +31 -0
  598. data/lib/workos/vault/vault_kek_created.rb +34 -0
  599. data/lib/workos/vault/vault_kek_created_data.rb +31 -0
  600. data/lib/workos/vault/vault_metadata_read.rb +34 -0
  601. data/lib/workos/vault/vault_metadata_read_data.rb +28 -0
  602. data/lib/workos/vault/vault_names_listed.rb +34 -0
  603. data/lib/workos/vault/vault_names_listed_data.rb +25 -0
  604. data/lib/workos/vault.rb +241 -0
  605. data/lib/workos/version.rb +2 -1
  606. data/lib/workos/webhook_event.rb +120 -0
  607. data/lib/workos/webhooks/create_webhook_endpoint.rb +22 -0
  608. data/lib/workos/webhooks/update_webhook_endpoint.rb +25 -0
  609. data/lib/workos/webhooks/webhook_endpoint.rb +45 -0
  610. data/lib/workos/webhooks/webhook_endpoint_json.rb +40 -0
  611. data/lib/workos/webhooks.rb +213 -159
  612. data/lib/workos/widgets/widget_session_token.rb +25 -0
  613. data/lib/workos/widgets/widget_session_token_response.rb +18 -0
  614. data/lib/workos/widgets.rb +34 -38
  615. data/lib/workos.rb +30 -96
  616. data/rbi/workos/action_authentication_denied.rbi +54 -0
  617. data/rbi/workos/action_authentication_denied_data.rbi +72 -0
  618. data/rbi/workos/action_user_registration_denied.rbi +54 -0
  619. data/rbi/workos/action_user_registration_denied_data.rbi +66 -0
  620. data/rbi/workos/actions.rbi +48 -0
  621. data/rbi/workos/add_role_permission.rbi +24 -0
  622. data/rbi/workos/admin_portal.rbi +26 -0
  623. data/rbi/workos/api_key.rbi +72 -0
  624. data/rbi/workos/api_key_created.rbi +54 -0
  625. data/rbi/workos/api_key_created_data.rbi +72 -0
  626. data/rbi/workos/api_key_created_data_owner.rbi +30 -0
  627. data/rbi/workos/api_key_owner.rbi +30 -0
  628. data/rbi/workos/api_key_revoked.rbi +54 -0
  629. data/rbi/workos/api_key_revoked_data.rbi +72 -0
  630. data/rbi/workos/api_key_revoked_data_owner.rbi +30 -0
  631. data/rbi/workos/api_key_validation_response.rbi +24 -0
  632. data/rbi/workos/api_key_with_value.rbi +78 -0
  633. data/rbi/workos/api_key_with_value_owner.rbi +30 -0
  634. data/rbi/workos/api_keys.rbi +51 -0
  635. data/rbi/workos/application_credentials_list_item.rbi +54 -0
  636. data/rbi/workos/assign_role.rbi +42 -0
  637. data/rbi/workos/audit_log_action.rbi +47 -0
  638. data/rbi/workos/audit_log_action_json.rbi +48 -0
  639. data/rbi/workos/audit_log_configuration.rbi +42 -0
  640. data/rbi/workos/audit_log_configuration_log_stream.rbi +48 -0
  641. data/rbi/workos/audit_log_event.rbi +60 -0
  642. data/rbi/workos/audit_log_event_actor.rbi +42 -0
  643. data/rbi/workos/audit_log_event_context.rbi +30 -0
  644. data/rbi/workos/audit_log_event_create_response.rbi +24 -0
  645. data/rbi/workos/audit_log_event_ingestion.rbi +30 -0
  646. data/rbi/workos/audit_log_event_target.rbi +42 -0
  647. data/rbi/workos/audit_log_export.rbi +53 -0
  648. data/rbi/workos/audit_log_export_creation.rbi +66 -0
  649. data/rbi/workos/audit_log_export_json.rbi +54 -0
  650. data/rbi/workos/audit_log_schema.rbi +36 -0
  651. data/rbi/workos/audit_log_schema_actor.rbi +24 -0
  652. data/rbi/workos/audit_log_schema_json.rbi +54 -0
  653. data/rbi/workos/audit_log_schema_json_actor.rbi +24 -0
  654. data/rbi/workos/audit_log_schema_json_target.rbi +30 -0
  655. data/rbi/workos/audit_log_schema_target.rbi +30 -0
  656. data/rbi/workos/audit_logs.rbi +96 -0
  657. data/rbi/workos/audit_logs_retention.rbi +23 -0
  658. data/rbi/workos/audit_logs_retention_json.rbi +24 -0
  659. data/rbi/workos/authenticate_response.rbi +66 -0
  660. data/rbi/workos/authenticate_response_impersonator.rbi +30 -0
  661. data/rbi/workos/authenticate_response_oauth_token.rbi +48 -0
  662. data/rbi/workos/authentication_challenge.rbi +60 -0
  663. data/rbi/workos/authentication_challenge_verify_response.rbi +30 -0
  664. data/rbi/workos/authentication_challenges_verify_request.rbi +24 -0
  665. data/rbi/workos/authentication_email_verification_failed.rbi +54 -0
  666. data/rbi/workos/authentication_email_verification_failed_data.rbi +60 -0
  667. data/rbi/workos/authentication_email_verification_failed_data_error.rbi +30 -0
  668. data/rbi/workos/authentication_email_verification_succeeded.rbi +54 -0
  669. data/rbi/workos/authentication_email_verification_succeeded_data.rbi +54 -0
  670. data/rbi/workos/authentication_factor.rbi +66 -0
  671. data/rbi/workos/authentication_factor_enrolled.rbi +66 -0
  672. data/rbi/workos/authentication_factor_enrolled_sms.rbi +24 -0
  673. data/rbi/workos/authentication_factor_enrolled_totp.rbi +48 -0
  674. data/rbi/workos/authentication_factor_sms.rbi +24 -0
  675. data/rbi/workos/authentication_factor_totp.rbi +30 -0
  676. data/rbi/workos/authentication_factors_create_request.rbi +48 -0
  677. data/rbi/workos/authentication_magic_auth_failed.rbi +54 -0
  678. data/rbi/workos/authentication_magic_auth_failed_data.rbi +60 -0
  679. data/rbi/workos/authentication_magic_auth_failed_data_error.rbi +30 -0
  680. data/rbi/workos/authentication_magic_auth_succeeded.rbi +54 -0
  681. data/rbi/workos/authentication_magic_auth_succeeded_data.rbi +54 -0
  682. data/rbi/workos/authentication_mfa_failed.rbi +54 -0
  683. data/rbi/workos/authentication_mfa_failed_data.rbi +60 -0
  684. data/rbi/workos/authentication_mfa_failed_data_error.rbi +30 -0
  685. data/rbi/workos/authentication_mfa_succeeded.rbi +54 -0
  686. data/rbi/workos/authentication_mfa_succeeded_data.rbi +54 -0
  687. data/rbi/workos/authentication_oauth_failed.rbi +54 -0
  688. data/rbi/workos/authentication_oauth_failed_data.rbi +60 -0
  689. data/rbi/workos/authentication_oauth_failed_data_error.rbi +30 -0
  690. data/rbi/workos/authentication_oauth_succeeded.rbi +54 -0
  691. data/rbi/workos/authentication_oauth_succeeded_data.rbi +54 -0
  692. data/rbi/workos/authentication_passkey_failed.rbi +54 -0
  693. data/rbi/workos/authentication_passkey_failed_data.rbi +60 -0
  694. data/rbi/workos/authentication_passkey_failed_data_error.rbi +30 -0
  695. data/rbi/workos/authentication_passkey_succeeded.rbi +54 -0
  696. data/rbi/workos/authentication_passkey_succeeded_data.rbi +54 -0
  697. data/rbi/workos/authentication_password_failed.rbi +54 -0
  698. data/rbi/workos/authentication_password_failed_data.rbi +60 -0
  699. data/rbi/workos/authentication_password_failed_data_error.rbi +30 -0
  700. data/rbi/workos/authentication_password_succeeded.rbi +54 -0
  701. data/rbi/workos/authentication_password_succeeded_data.rbi +54 -0
  702. data/rbi/workos/authentication_radar_risk_detected.rbi +54 -0
  703. data/rbi/workos/authentication_radar_risk_detected_data.rbi +66 -0
  704. data/rbi/workos/authentication_sso_failed.rbi +54 -0
  705. data/rbi/workos/authentication_sso_failed_data.rbi +66 -0
  706. data/rbi/workos/authentication_sso_failed_data_error.rbi +30 -0
  707. data/rbi/workos/authentication_sso_failed_data_sso.rbi +36 -0
  708. data/rbi/workos/authentication_sso_started.rbi +54 -0
  709. data/rbi/workos/authentication_sso_started_data.rbi +60 -0
  710. data/rbi/workos/authentication_sso_started_data_sso.rbi +36 -0
  711. data/rbi/workos/authentication_sso_succeeded.rbi +54 -0
  712. data/rbi/workos/authentication_sso_succeeded_data.rbi +60 -0
  713. data/rbi/workos/authentication_sso_succeeded_data_sso.rbi +36 -0
  714. data/rbi/workos/authentication_sso_timed_out.rbi +54 -0
  715. data/rbi/workos/authentication_sso_timed_out_data.rbi +66 -0
  716. data/rbi/workos/authentication_sso_timed_out_data_error.rbi +30 -0
  717. data/rbi/workos/authentication_sso_timed_out_data_sso.rbi +36 -0
  718. data/rbi/workos/authorization.rbi +414 -0
  719. data/rbi/workos/authorization_check.rbi +24 -0
  720. data/rbi/workos/authorization_code_session_authenticate_request.rbi +72 -0
  721. data/rbi/workos/authorization_permission.rbi +72 -0
  722. data/rbi/workos/authorization_resource.rbi +78 -0
  723. data/rbi/workos/authorized_connect_application_list_data.rbi +48 -0
  724. data/rbi/workos/base_client.rbi +132 -0
  725. data/rbi/workos/challenge_authentication_factor.rbi +24 -0
  726. data/rbi/workos/check_authorization.rbi +42 -0
  727. data/rbi/workos/client.rbi +61 -0
  728. data/rbi/workos/configuration.rbi +68 -0
  729. data/rbi/workos/confirm_email_change.rbi +24 -0
  730. data/rbi/workos/connect.rbi +102 -0
  731. data/rbi/workos/connect_application.rbi +78 -0
  732. data/rbi/workos/connected_account.rbi +66 -0
  733. data/rbi/workos/connection.rbi +84 -0
  734. data/rbi/workos/connection_activated.rbi +54 -0
  735. data/rbi/workos/connection_activated_data.rbi +84 -0
  736. data/rbi/workos/connection_activated_data_domain.rbi +36 -0
  737. data/rbi/workos/connection_deactivated.rbi +54 -0
  738. data/rbi/workos/connection_deactivated_data.rbi +84 -0
  739. data/rbi/workos/connection_deactivated_data_domain.rbi +36 -0
  740. data/rbi/workos/connection_deleted.rbi +54 -0
  741. data/rbi/workos/connection_deleted_data.rbi +66 -0
  742. data/rbi/workos/connection_domain.rbi +36 -0
  743. data/rbi/workos/connection_option.rbi +24 -0
  744. data/rbi/workos/connection_saml_certificate_renewal_required.rbi +54 -0
  745. data/rbi/workos/connection_saml_certificate_renewal_required_data.rbi +36 -0
  746. data/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi +36 -0
  747. data/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi +30 -0
  748. data/rbi/workos/connection_saml_certificate_renewed.rbi +54 -0
  749. data/rbi/workos/connection_saml_certificate_renewed_data.rbi +36 -0
  750. data/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi +30 -0
  751. data/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi +30 -0
  752. data/rbi/workos/cors_origin_response.rbi +48 -0
  753. data/rbi/workos/create_application_secret.rbi +18 -0
  754. data/rbi/workos/create_authorization_permission.rbi +42 -0
  755. data/rbi/workos/create_authorization_resource.rbi +66 -0
  756. data/rbi/workos/create_cors_origin.rbi +24 -0
  757. data/rbi/workos/create_m2m_application.rbi +48 -0
  758. data/rbi/workos/create_magic_code_and_return.rbi +30 -0
  759. data/rbi/workos/create_oauth_application.rbi +66 -0
  760. data/rbi/workos/create_organization_api_key.rbi +30 -0
  761. data/rbi/workos/create_organization_domain.rbi +30 -0
  762. data/rbi/workos/create_organization_role.rbi +42 -0
  763. data/rbi/workos/create_password_reset.rbi +30 -0
  764. data/rbi/workos/create_password_reset_token.rbi +24 -0
  765. data/rbi/workos/create_redirect_uri.rbi +24 -0
  766. data/rbi/workos/create_role.rbi +42 -0
  767. data/rbi/workos/create_user.rbi +72 -0
  768. data/rbi/workos/create_user_invite_options.rbi +54 -0
  769. data/rbi/workos/create_user_organization_membership.rbi +42 -0
  770. data/rbi/workos/create_webhook_endpoint.rbi +30 -0
  771. data/rbi/workos/data_integration_access_token_response.rbi +36 -0
  772. data/rbi/workos/data_integration_access_token_response_access_token.rbi +48 -0
  773. data/rbi/workos/data_integration_authorize_url_response.rbi +24 -0
  774. data/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi +36 -0
  775. data/rbi/workos/data_integrations_get_user_token_request.rbi +30 -0
  776. data/rbi/workos/data_integrations_list_response.rbi +30 -0
  777. data/rbi/workos/data_integrations_list_response_data.rbi +90 -0
  778. data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +72 -0
  779. data/rbi/workos/device_authorization_response.rbi +54 -0
  780. data/rbi/workos/device_code_session_authenticate_request.rbi +54 -0
  781. data/rbi/workos/directory.rbi +84 -0
  782. data/rbi/workos/directory_group.rbi +72 -0
  783. data/rbi/workos/directory_metadata.rbi +30 -0
  784. data/rbi/workos/directory_metadata_user.rbi +30 -0
  785. data/rbi/workos/directory_sync.rbi +85 -0
  786. data/rbi/workos/directory_user.rbi +126 -0
  787. data/rbi/workos/directory_user_email.rbi +36 -0
  788. data/rbi/workos/directory_user_with_groups.rbi +132 -0
  789. data/rbi/workos/directory_user_with_groups_email.rbi +36 -0
  790. data/rbi/workos/dsync_activated.rbi +54 -0
  791. data/rbi/workos/dsync_activated_data.rbi +78 -0
  792. data/rbi/workos/dsync_activated_data_domain.rbi +36 -0
  793. data/rbi/workos/dsync_deactivated.rbi +54 -0
  794. data/rbi/workos/dsync_deactivated_data.rbi +78 -0
  795. data/rbi/workos/dsync_deactivated_data_domain.rbi +36 -0
  796. data/rbi/workos/dsync_deleted.rbi +54 -0
  797. data/rbi/workos/dsync_deleted_data.rbi +66 -0
  798. data/rbi/workos/dsync_group_created.rbi +54 -0
  799. data/rbi/workos/dsync_group_deleted.rbi +54 -0
  800. data/rbi/workos/dsync_group_updated.rbi +54 -0
  801. data/rbi/workos/dsync_group_updated_data.rbi +78 -0
  802. data/rbi/workos/dsync_group_user_added.rbi +54 -0
  803. data/rbi/workos/dsync_group_user_added_data.rbi +36 -0
  804. data/rbi/workos/dsync_group_user_removed.rbi +54 -0
  805. data/rbi/workos/dsync_group_user_removed_data.rbi +36 -0
  806. data/rbi/workos/dsync_user_created.rbi +54 -0
  807. data/rbi/workos/dsync_user_deleted.rbi +54 -0
  808. data/rbi/workos/dsync_user_updated.rbi +54 -0
  809. data/rbi/workos/dsync_user_updated_data.rbi +132 -0
  810. data/rbi/workos/dsync_user_updated_data_email.rbi +36 -0
  811. data/rbi/workos/email_change.rbi +48 -0
  812. data/rbi/workos/email_change_confirmation.rbi +30 -0
  813. data/rbi/workos/email_change_confirmation_user.rbi +96 -0
  814. data/rbi/workos/email_verification.rbi +66 -0
  815. data/rbi/workos/email_verification_code_session_authenticate_request.rbi +66 -0
  816. data/rbi/workos/email_verification_created.rbi +54 -0
  817. data/rbi/workos/email_verification_created_data.rbi +60 -0
  818. data/rbi/workos/encryptors/aes_gcm.rbi +19 -0
  819. data/rbi/workos/enroll_user_authentication_factor.rbi +42 -0
  820. data/rbi/workos/errors.rbi +43 -0
  821. data/rbi/workos/event_context.rbi +54 -0
  822. data/rbi/workos/event_context_actor.rbi +36 -0
  823. data/rbi/workos/event_context_google_analytics_session.rbi +36 -0
  824. data/rbi/workos/event_list_list_metadata.rbi +24 -0
  825. data/rbi/workos/event_schema.rbi +54 -0
  826. data/rbi/workos/events.rbi +28 -0
  827. data/rbi/workos/external_auth_complete_response.rbi +24 -0
  828. data/rbi/workos/feature_flag.rbi +84 -0
  829. data/rbi/workos/feature_flag_owner.rbi +36 -0
  830. data/rbi/workos/feature_flags.rbi +90 -0
  831. data/rbi/workos/flag.rbi +84 -0
  832. data/rbi/workos/flag_created.rbi +54 -0
  833. data/rbi/workos/flag_created_context.rbi +30 -0
  834. data/rbi/workos/flag_created_context_actor.rbi +36 -0
  835. data/rbi/workos/flag_created_data.rbi +90 -0
  836. data/rbi/workos/flag_created_data_owner.rbi +36 -0
  837. data/rbi/workos/flag_deleted.rbi +54 -0
  838. data/rbi/workos/flag_deleted_context.rbi +30 -0
  839. data/rbi/workos/flag_deleted_context_actor.rbi +36 -0
  840. data/rbi/workos/flag_deleted_data.rbi +90 -0
  841. data/rbi/workos/flag_deleted_data_owner.rbi +36 -0
  842. data/rbi/workos/flag_owner.rbi +36 -0
  843. data/rbi/workos/flag_rule_updated.rbi +54 -0
  844. data/rbi/workos/flag_rule_updated_context.rbi +48 -0
  845. data/rbi/workos/flag_rule_updated_context_actor.rbi +36 -0
  846. data/rbi/workos/flag_rule_updated_context_configured_target.rbi +30 -0
  847. data/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi +30 -0
  848. data/rbi/workos/flag_rule_updated_context_configured_target_user.rbi +30 -0
  849. data/rbi/workos/flag_rule_updated_context_previous_attribute.rbi +30 -0
  850. data/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi +30 -0
  851. data/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi +30 -0
  852. data/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi +30 -0
  853. data/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi +30 -0
  854. data/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi +30 -0
  855. data/rbi/workos/flag_rule_updated_data.rbi +90 -0
  856. data/rbi/workos/flag_rule_updated_data_owner.rbi +36 -0
  857. data/rbi/workos/flag_updated.rbi +54 -0
  858. data/rbi/workos/flag_updated_context.rbi +36 -0
  859. data/rbi/workos/flag_updated_context_actor.rbi +36 -0
  860. data/rbi/workos/flag_updated_context_previous_attribute.rbi +24 -0
  861. data/rbi/workos/flag_updated_context_previous_attribute_data.rbi +48 -0
  862. data/rbi/workos/flag_updated_data.rbi +90 -0
  863. data/rbi/workos/flag_updated_data_owner.rbi +36 -0
  864. data/rbi/workos/generate_link.rbi +54 -0
  865. data/rbi/workos/group.rbi +60 -0
  866. data/rbi/workos/group_created.rbi +54 -0
  867. data/rbi/workos/group_deleted.rbi +54 -0
  868. data/rbi/workos/group_member_added.rbi +54 -0
  869. data/rbi/workos/group_member_added_data.rbi +30 -0
  870. data/rbi/workos/group_member_removed.rbi +54 -0
  871. data/rbi/workos/group_member_removed_data.rbi +30 -0
  872. data/rbi/workos/group_updated.rbi +54 -0
  873. data/rbi/workos/hash_provider.rbi +18 -0
  874. data/rbi/workos/intent_options.rbi +24 -0
  875. data/rbi/workos/invitation.rbi +102 -0
  876. data/rbi/workos/invitation_accepted.rbi +54 -0
  877. data/rbi/workos/invitation_accepted_data.rbi +90 -0
  878. data/rbi/workos/invitation_created.rbi +54 -0
  879. data/rbi/workos/invitation_created_data.rbi +90 -0
  880. data/rbi/workos/invitation_resent.rbi +54 -0
  881. data/rbi/workos/invitation_resent_data.rbi +90 -0
  882. data/rbi/workos/invitation_revoked.rbi +54 -0
  883. data/rbi/workos/invitation_revoked_data.rbi +90 -0
  884. data/rbi/workos/jwks_response.rbi +24 -0
  885. data/rbi/workos/jwks_response_keys.rbi +66 -0
  886. data/rbi/workos/jwt_template_response.rbi +42 -0
  887. data/rbi/workos/magic_auth.rbi +66 -0
  888. data/rbi/workos/magic_auth_code_session_authenticate_request.rbi +72 -0
  889. data/rbi/workos/magic_auth_created.rbi +54 -0
  890. data/rbi/workos/magic_auth_created_data.rbi +60 -0
  891. data/rbi/workos/mfa_totp_session_authenticate_request.rbi +72 -0
  892. data/rbi/workos/multi_factor_auth.rbi +83 -0
  893. data/rbi/workos/new_connect_application_secret.rbi +60 -0
  894. data/rbi/workos/organization.rbi +78 -0
  895. data/rbi/workos/organization_created.rbi +54 -0
  896. data/rbi/workos/organization_created_data.rbi +72 -0
  897. data/rbi/workos/organization_created_data_domain.rbi +78 -0
  898. data/rbi/workos/organization_deleted.rbi +54 -0
  899. data/rbi/workos/organization_deleted_data.rbi +72 -0
  900. data/rbi/workos/organization_deleted_data_domain.rbi +78 -0
  901. data/rbi/workos/organization_domain.rbi +78 -0
  902. data/rbi/workos/organization_domain_created.rbi +54 -0
  903. data/rbi/workos/organization_domain_created_data.rbi +78 -0
  904. data/rbi/workos/organization_domain_data.rbi +30 -0
  905. data/rbi/workos/organization_domain_deleted.rbi +54 -0
  906. data/rbi/workos/organization_domain_deleted_data.rbi +78 -0
  907. data/rbi/workos/organization_domain_stand_alone.rbi +78 -0
  908. data/rbi/workos/organization_domain_updated.rbi +54 -0
  909. data/rbi/workos/organization_domain_updated_data.rbi +78 -0
  910. data/rbi/workos/organization_domain_verification_failed.rbi +54 -0
  911. data/rbi/workos/organization_domain_verification_failed_data.rbi +30 -0
  912. data/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi +78 -0
  913. data/rbi/workos/organization_domain_verified.rbi +54 -0
  914. data/rbi/workos/organization_domain_verified_data.rbi +78 -0
  915. data/rbi/workos/organization_domains.rbi +46 -0
  916. data/rbi/workos/organization_input.rbi +54 -0
  917. data/rbi/workos/organization_membership.rbi +84 -0
  918. data/rbi/workos/organization_membership_created.rbi +54 -0
  919. data/rbi/workos/organization_membership_created_data.rbi +84 -0
  920. data/rbi/workos/organization_membership_deleted.rbi +54 -0
  921. data/rbi/workos/organization_membership_deleted_data.rbi +84 -0
  922. data/rbi/workos/organization_membership_updated.rbi +54 -0
  923. data/rbi/workos/organization_membership_updated_data.rbi +84 -0
  924. data/rbi/workos/organization_role_created.rbi +54 -0
  925. data/rbi/workos/organization_role_created_data.rbi +72 -0
  926. data/rbi/workos/organization_role_deleted.rbi +54 -0
  927. data/rbi/workos/organization_role_deleted_data.rbi +72 -0
  928. data/rbi/workos/organization_role_updated.rbi +54 -0
  929. data/rbi/workos/organization_role_updated_data.rbi +72 -0
  930. data/rbi/workos/organization_selection_session_authenticate_request.rbi +66 -0
  931. data/rbi/workos/organization_updated.rbi +54 -0
  932. data/rbi/workos/organization_updated_data.rbi +72 -0
  933. data/rbi/workos/organization_updated_data_domain.rbi +78 -0
  934. data/rbi/workos/organizations.rbi +86 -0
  935. data/rbi/workos/password_reset.rbi +66 -0
  936. data/rbi/workos/password_reset_created.rbi +54 -0
  937. data/rbi/workos/password_reset_created_data.rbi +54 -0
  938. data/rbi/workos/password_reset_succeeded.rbi +54 -0
  939. data/rbi/workos/password_reset_succeeded_data.rbi +54 -0
  940. data/rbi/workos/password_session_authenticate_request.rbi +72 -0
  941. data/rbi/workos/passwordless.rbi +47 -0
  942. data/rbi/workos/permission.rbi +72 -0
  943. data/rbi/workos/permission_created.rbi +54 -0
  944. data/rbi/workos/permission_created_data.rbi +66 -0
  945. data/rbi/workos/permission_deleted.rbi +54 -0
  946. data/rbi/workos/permission_deleted_data.rbi +66 -0
  947. data/rbi/workos/permission_updated.rbi +54 -0
  948. data/rbi/workos/permission_updated_data.rbi +66 -0
  949. data/rbi/workos/pipes.rbi +63 -0
  950. data/rbi/workos/portal_link_response.rbi +24 -0
  951. data/rbi/workos/profile.rbi +102 -0
  952. data/rbi/workos/public_client.rbi +12 -0
  953. data/rbi/workos/radar.rbi +57 -0
  954. data/rbi/workos/radar_list_entry_already_present_response.rbi +24 -0
  955. data/rbi/workos/radar_standalone_assess_request.rbi +60 -0
  956. data/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi +24 -0
  957. data/rbi/workos/radar_standalone_response.rbi +48 -0
  958. data/rbi/workos/radar_standalone_update_radar_attempt_request.rbi +30 -0
  959. data/rbi/workos/radar_standalone_update_radar_list_request.rbi +24 -0
  960. data/rbi/workos/redirect_uri.rbi +54 -0
  961. data/rbi/workos/redirect_uri_input.rbi +30 -0
  962. data/rbi/workos/refresh_token_session_authenticate_request.rbi +66 -0
  963. data/rbi/workos/remove_role.rbi +42 -0
  964. data/rbi/workos/resend_user_invite_options.rbi +24 -0
  965. data/rbi/workos/reset_password_response.rbi +24 -0
  966. data/rbi/workos/revoke_session.rbi +30 -0
  967. data/rbi/workos/role.rbi +78 -0
  968. data/rbi/workos/role_assignment.rbi +54 -0
  969. data/rbi/workos/role_assignment_resource.rbi +36 -0
  970. data/rbi/workos/role_created.rbi +54 -0
  971. data/rbi/workos/role_created_data.rbi +54 -0
  972. data/rbi/workos/role_deleted.rbi +54 -0
  973. data/rbi/workos/role_deleted_data.rbi +54 -0
  974. data/rbi/workos/role_list.rbi +30 -0
  975. data/rbi/workos/role_updated.rbi +54 -0
  976. data/rbi/workos/role_updated_data.rbi +54 -0
  977. data/rbi/workos/send_email_change.rbi +24 -0
  978. data/rbi/workos/send_verification_email_response.rbi +24 -0
  979. data/rbi/workos/session.rbi +43 -0
  980. data/rbi/workos/session_created.rbi +54 -0
  981. data/rbi/workos/session_created_data.rbi +96 -0
  982. data/rbi/workos/session_created_data_impersonator.rbi +30 -0
  983. data/rbi/workos/session_manager.rbi +154 -0
  984. data/rbi/workos/session_revoked.rbi +54 -0
  985. data/rbi/workos/session_revoked_data.rbi +96 -0
  986. data/rbi/workos/session_revoked_data_impersonator.rbi +30 -0
  987. data/rbi/workos/set_role_permissions.rbi +24 -0
  988. data/rbi/workos/slim_role.rbi +24 -0
  989. data/rbi/workos/sso.rbi +67 -0
  990. data/rbi/workos/sso_authorize_url_response.rbi +24 -0
  991. data/rbi/workos/sso_device_authorization_request.rbi +24 -0
  992. data/rbi/workos/sso_intent_options.rbi +30 -0
  993. data/rbi/workos/sso_logout_authorize_request.rbi +24 -0
  994. data/rbi/workos/sso_logout_authorize_response.rbi +30 -0
  995. data/rbi/workos/sso_token_response.rbi +48 -0
  996. data/rbi/workos/sso_token_response_oauth_token.rbi +48 -0
  997. data/rbi/workos/token_query.rbi +42 -0
  998. data/rbi/workos/types/api_response.rbi +29 -0
  999. data/rbi/workos/types/base_model.rbi +22 -0
  1000. data/rbi/workos/types/list_struct.rbi +89 -0
  1001. data/rbi/workos/types/request_options.rbi +12 -0
  1002. data/rbi/workos/update_audit_logs_retention.rbi +24 -0
  1003. data/rbi/workos/update_authorization_permission.rbi +30 -0
  1004. data/rbi/workos/update_authorization_resource.rbi +48 -0
  1005. data/rbi/workos/update_jwt_template.rbi +24 -0
  1006. data/rbi/workos/update_oauth_application.rbi +42 -0
  1007. data/rbi/workos/update_organization.rbi +60 -0
  1008. data/rbi/workos/update_organization_role.rbi +30 -0
  1009. data/rbi/workos/update_role.rbi +30 -0
  1010. data/rbi/workos/update_user.rbi +78 -0
  1011. data/rbi/workos/update_user_organization_membership.rbi +30 -0
  1012. data/rbi/workos/update_webhook_endpoint.rbi +36 -0
  1013. data/rbi/workos/user.rbi +96 -0
  1014. data/rbi/workos/user_authentication_factor_enroll_response.rbi +30 -0
  1015. data/rbi/workos/user_consent_option.rbi +42 -0
  1016. data/rbi/workos/user_consent_option_choice.rbi +30 -0
  1017. data/rbi/workos/user_created.rbi +54 -0
  1018. data/rbi/workos/user_deleted.rbi +54 -0
  1019. data/rbi/workos/user_identities_get_item.rbi +36 -0
  1020. data/rbi/workos/user_invite.rbi +102 -0
  1021. data/rbi/workos/user_management.rbi +410 -0
  1022. data/rbi/workos/user_management_login_request.rbi +36 -0
  1023. data/rbi/workos/user_object.rbi +48 -0
  1024. data/rbi/workos/user_organization_membership.rbi +84 -0
  1025. data/rbi/workos/user_organization_membership_base_list_data.rbi +78 -0
  1026. data/rbi/workos/user_sessions_impersonator.rbi +30 -0
  1027. data/rbi/workos/user_sessions_list_item.rbi +96 -0
  1028. data/rbi/workos/user_updated.rbi +54 -0
  1029. data/rbi/workos/util.rbi +12 -0
  1030. data/rbi/workos/validate_api_key.rbi +24 -0
  1031. data/rbi/workos/vault.rbi +137 -0
  1032. data/rbi/workos/vault_byok_key_verification_completed.rbi +54 -0
  1033. data/rbi/workos/vault_byok_key_verification_completed_data.rbi +36 -0
  1034. data/rbi/workos/vault_data_created.rbi +54 -0
  1035. data/rbi/workos/vault_data_created_data.rbi +54 -0
  1036. data/rbi/workos/vault_data_deleted.rbi +54 -0
  1037. data/rbi/workos/vault_data_deleted_data.rbi +42 -0
  1038. data/rbi/workos/vault_data_read.rbi +54 -0
  1039. data/rbi/workos/vault_data_read_data.rbi +48 -0
  1040. data/rbi/workos/vault_data_updated.rbi +54 -0
  1041. data/rbi/workos/vault_data_updated_data.rbi +54 -0
  1042. data/rbi/workos/vault_dek_decrypted.rbi +54 -0
  1043. data/rbi/workos/vault_dek_decrypted_data.rbi +42 -0
  1044. data/rbi/workos/vault_dek_read.rbi +54 -0
  1045. data/rbi/workos/vault_dek_read_data.rbi +48 -0
  1046. data/rbi/workos/vault_kek_created.rbi +54 -0
  1047. data/rbi/workos/vault_kek_created_data.rbi +48 -0
  1048. data/rbi/workos/vault_metadata_read.rbi +54 -0
  1049. data/rbi/workos/vault_metadata_read_data.rbi +42 -0
  1050. data/rbi/workos/vault_names_listed.rbi +54 -0
  1051. data/rbi/workos/vault_names_listed_data.rbi +36 -0
  1052. data/rbi/workos/verify_email_address.rbi +24 -0
  1053. data/rbi/workos/verify_email_response.rbi +24 -0
  1054. data/rbi/workos/webhook_endpoint.rbi +65 -0
  1055. data/rbi/workos/webhook_endpoint_json.rbi +66 -0
  1056. data/rbi/workos/webhooks.rbi +52 -0
  1057. data/rbi/workos/widget_session_token.rbi +36 -0
  1058. data/rbi/workos/widget_session_token_response.rbi +24 -0
  1059. data/rbi/workos/widgets.rbi +23 -0
  1060. data/renovate.json +66 -0
  1061. data/script/ci +16 -0
  1062. data/test/test_helper.rb +20 -0
  1063. data/test/workos/test_actions.rb +78 -0
  1064. data/test/workos/test_admin_portal.rb +33 -0
  1065. data/test/workos/test_api_keys.rb +57 -0
  1066. data/test/workos/test_audit_logs.rb +89 -0
  1067. data/test/workos/test_authkit_helpers.rb +109 -0
  1068. data/test/workos/test_authorization.rb +321 -0
  1069. data/test/workos/test_base_client.rb +173 -0
  1070. data/test/workos/test_connect.rb +127 -0
  1071. data/test/workos/test_directory_sync.rb +81 -0
  1072. data/test/workos/test_encryptors_aes_gcm.rb +54 -0
  1073. data/test/workos/test_events.rb +33 -0
  1074. data/test/workos/test_feature_flags.rb +89 -0
  1075. data/test/workos/test_list_struct.rb +39 -0
  1076. data/test/workos/test_model_round_trip.rb +7013 -0
  1077. data/test/workos/test_multi_factor_auth.rb +81 -0
  1078. data/test/workos/test_organization_domains.rb +57 -0
  1079. data/test/workos/test_organizations.rb +81 -0
  1080. data/test/workos/test_passwordless.rb +59 -0
  1081. data/test/workos/test_pipes.rb +65 -0
  1082. data/test/workos/test_pkce.rb +40 -0
  1083. data/test/workos/test_public_client.rb +38 -0
  1084. data/test/workos/test_radar.rb +57 -0
  1085. data/test/workos/test_session.rb +261 -0
  1086. data/test/workos/test_sso.rb +73 -0
  1087. data/test/workos/test_sso_helpers.rb +80 -0
  1088. data/test/workos/test_sso_runtime.rb +45 -0
  1089. data/test/workos/test_user_management.rb +473 -0
  1090. data/test/workos/test_vault.rb +151 -0
  1091. data/test/workos/test_webhook_verify.rb +84 -0
  1092. data/test/workos/test_webhooks.rb +57 -0
  1093. data/test/workos/test_widgets.rb +33 -0
  1094. data/workos.gemspec +22 -21
  1095. metadata +1097 -509
  1096. data/.github/renovate.json +0 -5
  1097. data/.rspec +0 -1
  1098. data/.rubocop.yml +0 -34
  1099. data/.rubocop_todo.yml +0 -94
  1100. data/lib/workos/audit_log_export.rb +0 -32
  1101. data/lib/workos/authentication_factor_and_challenge.rb +0 -28
  1102. data/lib/workos/authentication_response.rb +0 -62
  1103. data/lib/workos/cache.rb +0 -94
  1104. data/lib/workos/challenge.rb +0 -36
  1105. data/lib/workos/connection.rb +0 -42
  1106. data/lib/workos/deprecated_hash_wrapper.rb +0 -76
  1107. data/lib/workos/deprecation.rb +0 -16
  1108. data/lib/workos/directory.rb +0 -38
  1109. data/lib/workos/directory_group.rb +0 -41
  1110. data/lib/workos/directory_user.rb +0 -93
  1111. data/lib/workos/email_verification.rb +0 -37
  1112. data/lib/workos/event.rb +0 -30
  1113. data/lib/workos/factor.rb +0 -35
  1114. data/lib/workos/feature_flag.rb +0 -34
  1115. data/lib/workos/impersonator.rb +0 -23
  1116. data/lib/workos/invitation.rb +0 -49
  1117. data/lib/workos/magic_auth.rb +0 -37
  1118. data/lib/workos/mfa.rb +0 -136
  1119. data/lib/workos/oauth_tokens.rb +0 -29
  1120. data/lib/workos/organization.rb +0 -47
  1121. data/lib/workos/organization_membership.rb +0 -40
  1122. data/lib/workos/password_reset.rb +0 -37
  1123. data/lib/workos/portal.rb +0 -54
  1124. data/lib/workos/profile.rb +0 -57
  1125. data/lib/workos/profile_and_token.rb +0 -26
  1126. data/lib/workos/refresh_authentication_response.rb +0 -51
  1127. data/lib/workos/role.rb +0 -38
  1128. data/lib/workos/types/intent.rb +0 -18
  1129. data/lib/workos/types/passwordless_session_struct.rb +0 -18
  1130. data/lib/workos/types/provider.rb +0 -16
  1131. data/lib/workos/types/widget_scope.rb +0 -15
  1132. data/lib/workos/types.rb +0 -12
  1133. data/lib/workos/user.rb +0 -45
  1134. data/lib/workos/user_and_token.rb +0 -26
  1135. data/lib/workos/user_management/session.rb +0 -57
  1136. data/lib/workos/user_response.rb +0 -22
  1137. data/lib/workos/verify_challenge.rb +0 -25
  1138. data/lib/workos/webhook.rb +0 -30
  1139. data/spec/lib/workos/audit_logs_spec.rb +0 -150
  1140. data/spec/lib/workos/cache_spec.rb +0 -94
  1141. data/spec/lib/workos/client.rb +0 -67
  1142. data/spec/lib/workos/configuration_spec.rb +0 -60
  1143. data/spec/lib/workos/directory_sync_spec.rb +0 -483
  1144. data/spec/lib/workos/directory_user_spec.rb +0 -61
  1145. data/spec/lib/workos/encryptors/aes_gcm_spec.rb +0 -41
  1146. data/spec/lib/workos/event_spec.rb +0 -109
  1147. data/spec/lib/workos/mfa_spec.rb +0 -285
  1148. data/spec/lib/workos/organizations_spec.rb +0 -569
  1149. data/spec/lib/workos/passwordless_spec.rb +0 -76
  1150. data/spec/lib/workos/portal_spec.rb +0 -116
  1151. data/spec/lib/workos/role_spec.rb +0 -142
  1152. data/spec/lib/workos/session_spec.rb +0 -475
  1153. data/spec/lib/workos/sso_spec.rb +0 -756
  1154. data/spec/lib/workos/user_management_spec.rb +0 -1924
  1155. data/spec/lib/workos/webhooks_spec.rb +0 -235
  1156. data/spec/lib/workos/widgets_spec.rb +0 -73
  1157. data/spec/spec_helper.rb +0 -53
  1158. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml +0 -59
  1159. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml +0 -60
  1160. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml +0 -59
  1161. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml +0 -76
  1162. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml +0 -77
  1163. data/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml +0 -73
  1164. data/spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml +0 -65
  1165. data/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml +0 -67
  1166. data/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml +0 -68
  1167. data/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml +0 -131
  1168. data/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml +0 -134
  1169. data/spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml +0 -61
  1170. data/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml +0 -66
  1171. data/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml +0 -72
  1172. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml +0 -83
  1173. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml +0 -84
  1174. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml +0 -80
  1175. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml +0 -62
  1176. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +0 -83
  1177. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml +0 -62
  1178. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml +0 -87
  1179. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml +0 -89
  1180. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml +0 -84
  1181. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml +0 -85
  1182. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml +0 -93
  1183. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +0 -85
  1184. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +0 -90
  1185. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +0 -90
  1186. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +0 -90
  1187. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +0 -84
  1188. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml +0 -84
  1189. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +0 -82
  1190. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +0 -186
  1191. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +0 -88
  1192. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +0 -194
  1193. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +0 -186
  1194. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +0 -189
  1195. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml +0 -75
  1196. data/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml +0 -80
  1197. data/spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml +0 -80
  1198. data/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml +0 -81
  1199. data/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml +0 -80
  1200. data/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml +0 -80
  1201. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml +0 -82
  1202. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml +0 -82
  1203. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml +0 -82
  1204. data/spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml +0 -80
  1205. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml +0 -82
  1206. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml +0 -82
  1207. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml +0 -82
  1208. data/spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml +0 -82
  1209. data/spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml +0 -82
  1210. data/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml +0 -84
  1211. data/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml +0 -84
  1212. data/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml +0 -82
  1213. data/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml +0 -82
  1214. data/spec/support/fixtures/vcr_cassettes/organization/create.yml +0 -84
  1215. data/spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml +0 -72
  1216. data/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml +0 -82
  1217. data/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml +0 -81
  1218. data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml +0 -155
  1219. data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml +0 -154
  1220. data/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml +0 -83
  1221. data/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml +0 -79
  1222. data/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml +0 -86
  1223. data/spec/support/fixtures/vcr_cassettes/organization/delete.yml +0 -72
  1224. data/spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml +0 -72
  1225. data/spec/support/fixtures/vcr_cassettes/organization/get.yml +0 -84
  1226. data/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml +0 -72
  1227. data/spec/support/fixtures/vcr_cassettes/organization/list.yml +0 -87
  1228. data/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml +0 -78
  1229. data/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml +0 -82
  1230. data/spec/support/fixtures/vcr_cassettes/organization/update.yml +0 -84
  1231. data/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml +0 -78
  1232. data/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml +0 -78
  1233. data/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml +0 -78
  1234. data/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml +0 -85
  1235. data/spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml +0 -72
  1236. data/spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml +0 -73
  1237. data/spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml +0 -72
  1238. data/spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml +0 -73
  1239. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml +0 -72
  1240. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml +0 -72
  1241. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml +0 -72
  1242. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml +0 -72
  1243. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml +0 -72
  1244. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml +0 -72
  1245. data/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml +0 -72
  1246. data/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml +0 -70
  1247. data/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml +0 -72
  1248. data/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml +0 -86
  1249. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +0 -83
  1250. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +0 -86
  1251. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +0 -90
  1252. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml +0 -86
  1253. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +0 -83
  1254. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +0 -89
  1255. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml +0 -86
  1256. data/spec/support/fixtures/vcr_cassettes/sso/profile.yml +0 -74
  1257. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml +0 -84
  1258. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml +0 -82
  1259. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml +0 -80
  1260. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml +0 -82
  1261. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml +0 -83
  1262. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml +0 -81
  1263. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml +0 -82
  1264. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml +0 -82
  1265. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml +0 -81
  1266. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml +0 -82
  1267. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml +0 -82
  1268. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml +0 -82
  1269. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml +0 -82
  1270. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml +0 -81
  1271. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml +0 -82
  1272. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml +0 -83
  1273. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml +0 -81
  1274. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml +0 -82
  1275. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml +0 -82
  1276. data/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml +0 -80
  1277. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml +0 -83
  1278. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +0 -82
  1279. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml +0 -76
  1280. data/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml +0 -80
  1281. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml +0 -83
  1282. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml +0 -82
  1283. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml +0 -77
  1284. data/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml +0 -64
  1285. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml +0 -82
  1286. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml +0 -78
  1287. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml +0 -82
  1288. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml +0 -78
  1289. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml +0 -82
  1290. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml +0 -82
  1291. data/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml +0 -80
  1292. data/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml +0 -80
  1293. data/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml +0 -80
  1294. data/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml +0 -80
  1295. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml +0 -82
  1296. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml +0 -82
  1297. data/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml +0 -80
  1298. data/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml +0 -80
  1299. data/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +0 -82
  1300. data/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml +0 -80
  1301. data/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml +0 -80
  1302. data/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml +0 -82
  1303. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml +0 -82
  1304. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml +0 -82
  1305. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +0 -83
  1306. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +0 -83
  1307. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +0 -83
  1308. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +0 -83
  1309. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +0 -83
  1310. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +0 -82
  1311. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +0 -82
  1312. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml +0 -64
  1313. data/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml +0 -38
  1314. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml +0 -82
  1315. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml +0 -82
  1316. data/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml +0 -64
  1317. data/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml +0 -83
  1318. data/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml +0 -83
  1319. data/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml +0 -83
  1320. data/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml +0 -83
  1321. data/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml +0 -83
  1322. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml +0 -82
  1323. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml +0 -82
  1324. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml +0 -82
  1325. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml +0 -82
  1326. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml +0 -80
  1327. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml +0 -76
  1328. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml +0 -82
  1329. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml +0 -82
  1330. data/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml +0 -82
  1331. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml +0 -83
  1332. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml +0 -82
  1333. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml +0 -82
  1334. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml +0 -82
  1335. data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml +0 -82
  1336. data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml +0 -83
  1337. data/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml +0 -76
  1338. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml +0 -82
  1339. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml +0 -82
  1340. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml +0 -76
  1341. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml +0 -82
  1342. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml +0 -77
  1343. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml +0 -82
  1344. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml +0 -82
  1345. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml +0 -83
  1346. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml +0 -82
  1347. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml +0 -82
  1348. data/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml +0 -82
  1349. data/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml +0 -74
  1350. data/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml +0 -74
  1351. data/spec/support/profile.txt +0 -1
  1352. data/spec/support/shared_examples/client.rb +0 -29
  1353. data/spec/support/webhook_payload.txt +0 -1
@@ -1,1242 +1,1610 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http'
4
- require 'uri'
3
+ # This file is auto-generated by oagen. Do not edit.
5
4
 
6
- module WorkOS
7
- # The UserManagement module provides convenience methods for working with the
8
- # WorkOS User platform. You'll need a valid API key.
9
- module UserManagement
10
- autoload :Session, 'workos/user_management/session'
11
-
12
- module Types
13
- # The ProviderEnum is a declaration of a
14
- # fixed set of values for User Management Providers.
15
- class Provider
16
- Apple = 'AppleOAuth'
17
- GitHub = 'GitHubOAuth'
18
- Google = 'GoogleOAuth'
19
- Microsoft = 'MicrosoftOAuth'
20
- AuthKit = 'authkit'
21
-
22
- ALL = [Apple, GitHub, Google, Microsoft, AuthKit].freeze
23
- end
24
-
25
- # The AuthFactorType is a declaration of a
26
- # fixed set of factor values to enroll
27
- class AuthFactorType
28
- Totp = 'totp'
5
+ require "json"
29
6
 
30
- ALL = [Totp].freeze
31
- end
7
+ module WorkOS
8
+ class UserManagement
9
+ def initialize(client)
10
+ @client = client
32
11
  end
33
12
 
34
- class << self
35
- include Client, Deprecation
36
-
37
- PROVIDERS = WorkOS::UserManagement::Types::Provider::ALL
38
- AUTH_FACTOR_TYPES = WorkOS::UserManagement::Types::AuthFactorType::ALL
39
-
40
- # Load a sealed session
41
- #
42
- # @param [String] client_id The WorkOS client ID for the environment
43
- # @param [String] session_data The sealed session data
44
- # @param [String] cookie_password The password used to seal the session
45
- # @param [Object] encryptor Optional custom encryptor that responds to #seal and #unseal
46
- #
47
- # @return WorkOS::Session
48
- def load_sealed_session(client_id:, session_data:, cookie_password:, encryptor: nil)
49
- WorkOS::Session.new(
50
- user_management: self,
51
- client_id: client_id,
52
- session_data: session_data,
53
- cookie_password: cookie_password,
54
- encryptor: encryptor,
55
- )
56
- end
57
-
58
- # Generate an OAuth 2.0 authorization URL that automatically directs a user
59
- # to their Identity Provider.
60
- #
61
- # @param [String] redirect_uri The URI where users are directed
62
- # after completing the authentication step. Must match a
63
- # configured redirect URI on your WorkOS dashboard.
64
- # @param [String] client_id This value can be obtained from the API Keys page in the WorkOS dashboard.
65
- # @param [String] provider A provider name is used to initiate SSO using an
66
- # OAuth-compatible provider. Only 'authkit', 'AppleOAuth', 'GitHubOAuth', 'GoogleOAuth',
67
- # and 'MicrosoftOAuth' are supported.
68
- # @param [String] connection_id The ID for a Connection configured on
69
- # WorkOS.
70
- # @param [String] organization_id The organization_id selector is used to
71
- # initiate SSO for an Organization.
72
- # @param [String] state An arbitrary state object
73
- # that is preserved and available to the client in the response.
74
- # @param [String] login_hint Can be used to pre-fill the username/email address
75
- # field of the IdP sign-in page for the user, if you know their username ahead of time.
76
- # @param [String] screen_hint Specify which AuthKit screen users should land on upon redirection
77
- # (Only applicable when provider is 'authkit').
78
- # @param [String] domain_hint Can be used to pre-fill the domain field when
79
- # initiating authentication with Microsoft OAuth, or with a GoogleSAML connection type.
80
- # @param [Array<String>] provider_scopes An array of additional OAuth scopes to request from the provider.
81
- # @example
82
- # WorkOS::UserManagement.authorization_url(
83
- # connection_id: 'conn_123',
84
- # client_id: 'project_01DG5TGK363GRVXP3ZS40WNGEZ',
85
- # redirect_uri: 'https://your-app.com/callback',
86
- # state: {
87
- # next_page: '/docs'
88
- # }.to_s
89
- # )
90
- #
91
- # => "https://api.workos.com/user_management/authorize?connection_id=conn_123" \
92
- # "&client_id=project_01DG5TGK363GRVXP3ZS40WNGEZ" \
93
- # "&redirect_uri=https%3A%2F%2Fyour-app.com%2Fcallback&" \
94
- # "response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdocs%22%7D"
95
- #
96
- # @return [String]
97
- # rubocop:disable Metrics/ParameterLists
98
- def authorization_url(
99
- redirect_uri:,
100
- client_id: nil,
101
- domain_hint: nil,
102
- login_hint: nil,
103
- screen_hint: nil,
104
- provider: nil,
105
- connection_id: nil,
106
- organization_id: nil,
107
- state: '',
108
- provider_scopes: nil
13
+ # Get JWKS
14
+ # @param client_id [String] Identifies the application making the request to the WorkOS server. You can obtain your client ID from the [API Keys](https://dashboard.workos.com/api-keys) page in the dashboard.
15
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
16
+ # @return [WorkOS::JwksResponse]
17
+ def get_jwks(
18
+ client_id:,
19
+ request_options: {}
20
+ )
21
+ response = @client.request(
22
+ method: :get,
23
+ path: "/sso/jwks/#{WorkOS::Util.encode_path(client_id)}",
24
+ auth: true,
25
+ request_options: request_options
109
26
  )
27
+ result = WorkOS::JwksResponse.new(response.body)
28
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
29
+ result
30
+ end
110
31
 
111
- validate_authorization_url_arguments(
112
- provider: provider,
113
- connection_id: connection_id,
114
- organization_id: organization_id,
115
- )
116
-
117
- query = URI.encode_www_form({
118
- client_id: client_id,
119
- redirect_uri: redirect_uri,
120
- response_type: 'code',
121
- state: state,
122
- domain_hint: domain_hint,
123
- login_hint: login_hint,
124
- screen_hint: screen_hint,
125
- provider: provider,
126
- connection_id: connection_id,
127
- organization_id: organization_id,
128
- provider_scopes: provider_scopes,
129
- }.compact)
130
-
131
- "https://#{WorkOS.config.api_hostname}/user_management/authorize?#{query}"
132
- end
133
- # rubocop:enable Metrics/ParameterLists
134
-
135
- # Get a User
136
- #
137
- # @param [String] id The unique ID of the User.
138
- #
139
- # @return WorkOS::User
140
- def get_user(id:)
141
- response = execute_request(
142
- request: get_request(
143
- path: "/user_management/users/#{id}",
144
- auth: true,
145
- ),
146
- )
147
-
148
- WorkOS::User.new(response.body)
149
- end
150
-
151
- # Retrieve a list of users.
152
- #
153
- # @param [Hash] options
154
- # @option options [String] email Filter Users by their email.
155
- # @option options [String] organization_id Filter Users by the organization they are members of.
156
- # @option options [String] limit Maximum number of records to return.
157
- # @option options [String] order The order in which to paginate records
158
- # @option options [String] before Pagination cursor to receive records
159
- # before a provided User ID.
160
- # @option options [String] after Pagination cursor to receive records
161
- # before a provided User ID.
162
- #
163
- # @return [WorkOS::User]
164
- def list_users(options = {})
165
- options[:order] ||= 'desc'
166
- response = execute_request(
167
- request: get_request(
168
- path: '/user_management/users',
169
- auth: true,
170
- params: options,
171
- ),
172
- )
173
-
174
- parsed_response = JSON.parse(response.body)
175
-
176
- users = parsed_response['data'].map do |user|
177
- ::WorkOS::User.new(user.to_json)
178
- end
179
-
180
- WorkOS::Types::ListStruct.new(
181
- data: users,
182
- list_metadata: parsed_response['list_metadata'],
183
- )
184
- end
185
-
186
- # Create a user
187
- #
188
- # @param [String] email The email address of the user.
189
- # @param [String] password The password to set for the user.
190
- # @param [String] first_name The user's first name.
191
- # @param [String] last_name The user's last name.
192
- # @param [Boolean] email_verified Whether the user's email address was previously verified.
193
- # @param [String] external_id The user's external ID.
194
- # @param [String] password_hash The user's hashed password.
195
- # @option [String] password_hash_type The algorithm originally used to hash the password.
196
- #
197
- # @return [WorkOS::User]
198
- # rubocop:disable Metrics/ParameterLists
199
- def create_user(
200
- email:,
201
- password: nil,
202
- first_name: nil,
203
- last_name: nil,
204
- email_verified: nil,
205
- external_id: nil,
206
- password_hash: nil,
207
- password_hash_type: nil
32
+ # Authenticate
33
+ # @param client_id [String] The client ID of the application.
34
+ # @param client_secret [String, nil] The client secret of the application.
35
+ # @param grant_type [String]
36
+ # @param code [String, nil] The authorization code received from the redirect.
37
+ # @param code_verifier [String, nil] The PKCE code verifier used to derive the code challenge passed to the authorization URL.
38
+ # @param invitation_token [String, nil] An invitation token to accept during authentication.
39
+ # @param ip_address [String, nil] The IP address of the user's request.
40
+ # @param device_id [String, nil] A unique identifier for the device.
41
+ # @param user_agent [String, nil] The user agent string from the user's browser.
42
+ # @param email [String, nil] The user's email address.
43
+ # @param password [String, nil] The user's password.
44
+ # @param refresh_token [String, nil] The refresh token to exchange for new tokens.
45
+ # @param organization_id [String, nil] The ID of the organization to scope the session to.
46
+ # @param pending_authentication_token [String, nil] The pending authentication token from a previous authentication attempt.
47
+ # @param authentication_challenge_id [String, nil] The ID of the MFA authentication challenge.
48
+ # @param device_code [String, nil] The device verification code.
49
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
50
+ # @return [WorkOS::AuthenticateResponse]
51
+ def create_authenticate(
52
+ client_id:,
53
+ grant_type:,
54
+ client_secret: nil,
55
+ code: nil,
56
+ code_verifier: nil,
57
+ invitation_token: nil,
58
+ ip_address: nil,
59
+ device_id: nil,
60
+ user_agent: nil,
61
+ email: nil,
62
+ password: nil,
63
+ refresh_token: nil,
64
+ organization_id: nil,
65
+ pending_authentication_token: nil,
66
+ authentication_challenge_id: nil,
67
+ device_code: nil,
68
+ request_options: {}
69
+ )
70
+ body = {
71
+ "client_id" => client_id,
72
+ "client_secret" => client_secret,
73
+ "grant_type" => grant_type,
74
+ "code" => code,
75
+ "code_verifier" => code_verifier,
76
+ "invitation_token" => invitation_token,
77
+ "ip_address" => ip_address,
78
+ "device_id" => device_id,
79
+ "user_agent" => user_agent,
80
+ "email" => email,
81
+ "password" => password,
82
+ "refresh_token" => refresh_token,
83
+ "organization_id" => organization_id,
84
+ "pending_authentication_token" => pending_authentication_token,
85
+ "authentication_challenge_id" => authentication_challenge_id,
86
+ "device_code" => device_code
87
+ }.compact
88
+ response = @client.request(
89
+ method: :post,
90
+ path: "/user_management/authenticate",
91
+ auth: true,
92
+ body: body,
93
+ request_options: request_options
208
94
  )
209
- request = post_request(
210
- path: '/user_management/users',
211
- body: {
212
- email: email,
213
- password: password,
214
- first_name: first_name,
215
- last_name: last_name,
216
- email_verified: email_verified,
217
- external_id: external_id,
218
- password_hash: password_hash,
219
- password_hash_type: password_hash_type,
220
- }.compact,
221
- auth: true,
222
- )
223
-
224
- response = execute_request(request: request)
225
-
226
- WorkOS::User.new(response.body)
227
- end
95
+ result = WorkOS::AuthenticateResponse.new(response.body)
96
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
97
+ result
98
+ end
228
99
 
229
- # Update a user
230
- #
231
- # @param [String] id of the user.
232
- # @param [String] email of the user.
233
- # @param [String] first_name The user's first name.
234
- # @param [String] last_name The user's last name.
235
- # @param [Boolean] email_verified Whether the user's email address was previously verified.
236
- # @param [String] external_id The users's external ID
237
- # @param [String] locale The user's locale.
238
- # @param [String] password The user's password.
239
- # @param [String] password_hash The user's hashed password.
240
- # @option [String] password_hash_type The algorithm originally used to hash the password.
241
- # Valid values are bcrypt.
242
- #
243
- # @return [WorkOS::User]
244
- def update_user(
245
- id:,
246
- email: :not_set,
247
- first_name: :not_set,
248
- last_name: :not_set,
249
- email_verified: :not_set,
250
- external_id: :not_set,
251
- locale: :not_set,
252
- password: :not_set,
253
- password_hash: :not_set,
254
- password_hash_type: :not_set
100
+ # Authenticate with password.
101
+ # @param email [String]
102
+ # @param password [String]
103
+ # @param invitation_token [String, nil]
104
+ # @param ip_address [String, nil]
105
+ # @param device_id [String, nil]
106
+ # @param user_agent [String, nil]
107
+ # @param request_options [Hash] Per-request overrides.
108
+ # @return [WorkOS::AuthenticateResponse]
109
+ def authenticate_with_password(
110
+ email:,
111
+ password:,
112
+ invitation_token: nil,
113
+ ip_address: nil,
114
+ device_id: nil,
115
+ user_agent: nil,
116
+ request_options: {}
117
+ )
118
+ body = {
119
+ "grant_type" => "password",
120
+ "client_id" => @client.client_id,
121
+ "client_secret" => @client.api_key,
122
+ "email" => email,
123
+ "password" => password,
124
+ "invitation_token" => invitation_token,
125
+ "ip_address" => ip_address,
126
+ "device_id" => device_id,
127
+ "user_agent" => user_agent
128
+ }.compact
129
+ response = @client.request(
130
+ method: :post,
131
+ path: "/user_management/authenticate",
132
+ auth: true,
133
+ body: body,
134
+ request_options: request_options
255
135
  )
256
- request = put_request(
257
- path: "/user_management/users/#{id}",
258
- body: {
259
- email: email,
260
- first_name: first_name,
261
- last_name: last_name,
262
- email_verified: email_verified,
263
- external_id: external_id,
264
- locale: locale,
265
- password: password,
266
- password_hash: password_hash,
267
- password_hash_type: password_hash_type,
268
- }.reject { |_, v| v == :not_set },
269
- auth: true,
270
- )
271
-
272
- response = execute_request(request: request)
273
-
274
- WorkOS::User.new(response.body)
275
- end
276
- # rubocop:enable Metrics/ParameterLists
277
-
278
- # Delete a User
279
- #
280
- # @param [String] id The unique ID of the User.
281
- #
282
- # @return [Bool] - returns `true` if successful
283
- def delete_user(id:)
284
- response = execute_request(
285
- request: delete_request(
286
- path: "/user_management/users/#{id}",
287
- auth: true,
288
- ),
289
- )
290
-
291
- response.is_a? Net::HTTPSuccess
292
- end
136
+ WorkOS::AuthenticateResponse.new(response.body)
137
+ end
293
138
 
294
- # Authenticates user by email and password.
295
- #
296
- # @param [String] email The email address of the user.
297
- # @param [String] password The password for the user.
298
- # @param [String] client_id The WorkOS client ID for the environment
299
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
300
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
301
- # @param [String] invitation_token The token of an Invitation, if required.
302
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
303
- # the optional cookie password.
304
- #
305
- # @return WorkOS::AuthenticationResponse
306
- # rubocop:disable Metrics/ParameterLists
307
- def authenticate_with_password(
308
- email:,
309
- password:,
310
- client_id:,
311
- ip_address: nil,
312
- user_agent: nil,
313
- invitation_token: nil,
314
- session: nil
139
+ # Authenticate with code.
140
+ # @param code [String]
141
+ # @param code_verifier [String, nil]
142
+ # @param invitation_token [String, nil]
143
+ # @param ip_address [String, nil]
144
+ # @param device_id [String, nil]
145
+ # @param user_agent [String, nil]
146
+ # @param request_options [Hash] Per-request overrides.
147
+ # @return [WorkOS::AuthenticateResponse]
148
+ def authenticate_with_code(
149
+ code:,
150
+ code_verifier: nil,
151
+ invitation_token: nil,
152
+ ip_address: nil,
153
+ device_id: nil,
154
+ user_agent: nil,
155
+ request_options: {}
156
+ )
157
+ body = {
158
+ "grant_type" => "authorization_code",
159
+ "client_id" => @client.client_id,
160
+ "client_secret" => @client.api_key,
161
+ "code" => code,
162
+ "code_verifier" => code_verifier,
163
+ "invitation_token" => invitation_token,
164
+ "ip_address" => ip_address,
165
+ "device_id" => device_id,
166
+ "user_agent" => user_agent
167
+ }.compact
168
+ response = @client.request(
169
+ method: :post,
170
+ path: "/user_management/authenticate",
171
+ auth: true,
172
+ body: body,
173
+ request_options: request_options
315
174
  )
316
- validate_session(session)
317
-
318
- response = execute_request(
319
- request: post_request(
320
- path: '/user_management/authenticate',
321
- body: {
322
- client_id: client_id,
323
- client_secret: WorkOS.config.key!,
324
- email: email,
325
- password: password,
326
- ip_address: ip_address,
327
- user_agent: user_agent,
328
- invitation_token: invitation_token,
329
- grant_type: 'password',
330
- },
331
- ),
332
- )
333
-
334
- WorkOS::AuthenticationResponse.new(response.body, session)
335
- end
336
- # rubocop:enable Metrics/ParameterLists
175
+ WorkOS::AuthenticateResponse.new(response.body)
176
+ end
337
177
 
338
- # Authenticate a user using OAuth or an organization's SSO connection.
339
- #
340
- # @param [String] code The authorization value which was passed back as a
341
- # query parameter in the callback to the Redirect URI.
342
- # @param [String] client_id The WorkOS client ID for the environment
343
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
344
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
345
- # @param [String] invitation_token The token of an Invitation, if required.
346
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
347
- # the optional cookie password.
348
- #
349
- # @return WorkOS::AuthenticationResponse
350
- def authenticate_with_code(
351
- code:,
352
- client_id:,
353
- ip_address: nil,
354
- user_agent: nil,
355
- invitation_token: nil,
356
- session: nil
178
+ # Authenticate with refresh token.
179
+ # @param refresh_token [String]
180
+ # @param organization_id [String, nil]
181
+ # @param ip_address [String, nil]
182
+ # @param device_id [String, nil]
183
+ # @param user_agent [String, nil]
184
+ # @param request_options [Hash] Per-request overrides.
185
+ # @return [WorkOS::AuthenticateResponse]
186
+ def authenticate_with_refresh_token(
187
+ refresh_token:,
188
+ organization_id: nil,
189
+ ip_address: nil,
190
+ device_id: nil,
191
+ user_agent: nil,
192
+ request_options: {}
193
+ )
194
+ body = {
195
+ "grant_type" => "refresh_token",
196
+ "client_id" => @client.client_id,
197
+ "client_secret" => @client.api_key,
198
+ "refresh_token" => refresh_token,
199
+ "organization_id" => organization_id,
200
+ "ip_address" => ip_address,
201
+ "device_id" => device_id,
202
+ "user_agent" => user_agent
203
+ }.compact
204
+ response = @client.request(
205
+ method: :post,
206
+ path: "/user_management/authenticate",
207
+ auth: true,
208
+ body: body,
209
+ request_options: request_options
357
210
  )
358
- validate_session(session)
359
-
360
- response = execute_request(
361
- request: post_request(
362
- path: '/user_management/authenticate',
363
- body: {
364
- code: code,
365
- client_id: client_id,
366
- client_secret: WorkOS.config.key!,
367
- ip_address: ip_address,
368
- user_agent: user_agent,
369
- invitation_token: invitation_token,
370
- grant_type: 'authorization_code',
371
- },
372
- ),
373
- )
374
-
375
- WorkOS::AuthenticationResponse.new(response.body, session)
376
- end
211
+ WorkOS::AuthenticateResponse.new(response.body)
212
+ end
377
213
 
378
- # Authenticate a user using a refresh token.
379
- #
380
- # @param [String] refresh_token The refresh token previously obtained from a successful authentication call
381
- # @param [String] client_id The WorkOS client ID for the environment
382
- # @param [String] organization_id The organization to issue the new access token for. (Optional)
383
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
384
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
385
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
386
- # the optional cookie password.
387
- #
388
- # @return WorkOS::RefreshAuthenticationResponse
389
- def authenticate_with_refresh_token(
390
- refresh_token:,
391
- client_id:,
392
- organization_id: nil,
393
- ip_address: nil,
394
- user_agent: nil,
395
- session: nil
214
+ # Authenticate with magic auth.
215
+ # @param code [String]
216
+ # @param email [String]
217
+ # @param invitation_token [String, nil]
218
+ # @param ip_address [String, nil]
219
+ # @param device_id [String, nil]
220
+ # @param user_agent [String, nil]
221
+ # @param request_options [Hash] Per-request overrides.
222
+ # @return [WorkOS::AuthenticateResponse]
223
+ def authenticate_with_magic_auth(
224
+ code:,
225
+ email:,
226
+ invitation_token: nil,
227
+ ip_address: nil,
228
+ device_id: nil,
229
+ user_agent: nil,
230
+ request_options: {}
231
+ )
232
+ body = {
233
+ "grant_type" => "urn:workos:oauth:grant-type:magic-auth:code",
234
+ "client_id" => @client.client_id,
235
+ "client_secret" => @client.api_key,
236
+ "code" => code,
237
+ "email" => email,
238
+ "invitation_token" => invitation_token,
239
+ "ip_address" => ip_address,
240
+ "device_id" => device_id,
241
+ "user_agent" => user_agent
242
+ }.compact
243
+ response = @client.request(
244
+ method: :post,
245
+ path: "/user_management/authenticate",
246
+ auth: true,
247
+ body: body,
248
+ request_options: request_options
396
249
  )
397
- validate_session(session)
398
-
399
- response = execute_request(
400
- request: post_request(
401
- path: '/user_management/authenticate',
402
- body: {
403
- refresh_token: refresh_token,
404
- client_id: client_id,
405
- client_secret: WorkOS.config.key!,
406
- ip_address: ip_address,
407
- user_agent: user_agent,
408
- grant_type: 'refresh_token',
409
- organization_id: organization_id,
410
- },
411
- ),
412
- )
413
-
414
- WorkOS::RefreshAuthenticationResponse.new(response.body, session)
415
- end
250
+ WorkOS::AuthenticateResponse.new(response.body)
251
+ end
416
252
 
417
- # Authenticate user by Magic Auth Code.
418
- #
419
- # @param [String] code The one-time code that was emailed to the user.
420
- # @param [String] email The email address of the user.
421
- # @param [String] client_id The WorkOS client ID for the environment.
422
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
423
- # @param [String] link_authorization_code Used to link an OAuth profile to an existing user,
424
- # after having completed a Magic Code challenge.
425
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
426
- # @param [String] invitation_token The token of an Invitation, if required.
427
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
428
- # the optional cookie password.
429
- #
430
- # @return WorkOS::AuthenticationResponse
431
- # rubocop:disable Metrics/ParameterLists
432
- def authenticate_with_magic_auth(
433
- code:,
434
- email:,
435
- client_id:,
436
- ip_address: nil,
437
- user_agent: nil,
438
- link_authorization_code: nil,
439
- invitation_token: nil,
440
- session: nil
253
+ # Authenticate with email verification.
254
+ # @param code [String]
255
+ # @param pending_authentication_token [String]
256
+ # @param ip_address [String, nil]
257
+ # @param device_id [String, nil]
258
+ # @param user_agent [String, nil]
259
+ # @param request_options [Hash] Per-request overrides.
260
+ # @return [WorkOS::AuthenticateResponse]
261
+ def authenticate_with_email_verification(
262
+ code:,
263
+ pending_authentication_token:,
264
+ ip_address: nil,
265
+ device_id: nil,
266
+ user_agent: nil,
267
+ request_options: {}
268
+ )
269
+ body = {
270
+ "grant_type" => "urn:workos:oauth:grant-type:email-verification:code",
271
+ "client_id" => @client.client_id,
272
+ "client_secret" => @client.api_key,
273
+ "code" => code,
274
+ "pending_authentication_token" => pending_authentication_token,
275
+ "ip_address" => ip_address,
276
+ "device_id" => device_id,
277
+ "user_agent" => user_agent
278
+ }.compact
279
+ response = @client.request(
280
+ method: :post,
281
+ path: "/user_management/authenticate",
282
+ auth: true,
283
+ body: body,
284
+ request_options: request_options
441
285
  )
442
- validate_session(session)
443
-
444
- response = execute_request(
445
- request: post_request(
446
- path: '/user_management/authenticate',
447
- body: {
448
- code: code,
449
- email: email,
450
- client_id: client_id,
451
- client_secret: WorkOS.config.key!,
452
- ip_address: ip_address,
453
- user_agent: user_agent,
454
- grant_type: 'urn:workos:oauth:grant-type:magic-auth:code',
455
- link_authorization_code: link_authorization_code,
456
- invitation_token: invitation_token,
457
- },
458
- ),
459
- )
460
-
461
- WorkOS::AuthenticationResponse.new(response.body, session)
462
- end
463
- # rubocop:enable Metrics/ParameterLists
286
+ WorkOS::AuthenticateResponse.new(response.body)
287
+ end
464
288
 
465
- # Authenticate a user into an organization they are a member of.
466
- #
467
- # @param [String] client_id The WorkOS client ID for the environment.
468
- # @param [String] organization_id The organization ID the user selected to sign in to.
469
- # @param [String] pending_authentication_token The pending authentication token
470
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
471
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
472
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
473
- # the optional cookie password.
474
- #
475
- # @return WorkOS::AuthenticationResponse
476
- def authenticate_with_organization_selection(
477
- client_id:,
478
- organization_id:,
479
- pending_authentication_token:,
480
- ip_address: nil,
481
- user_agent: nil,
482
- session: nil
289
+ # Authenticate with totp.
290
+ # @param code [String]
291
+ # @param pending_authentication_token [String]
292
+ # @param authentication_challenge_id [String]
293
+ # @param ip_address [String, nil]
294
+ # @param device_id [String, nil]
295
+ # @param user_agent [String, nil]
296
+ # @param request_options [Hash] Per-request overrides.
297
+ # @return [WorkOS::AuthenticateResponse]
298
+ def authenticate_with_totp(
299
+ code:,
300
+ pending_authentication_token:,
301
+ authentication_challenge_id:,
302
+ ip_address: nil,
303
+ device_id: nil,
304
+ user_agent: nil,
305
+ request_options: {}
306
+ )
307
+ body = {
308
+ "grant_type" => "urn:workos:oauth:grant-type:mfa-totp",
309
+ "client_id" => @client.client_id,
310
+ "client_secret" => @client.api_key,
311
+ "code" => code,
312
+ "pending_authentication_token" => pending_authentication_token,
313
+ "authentication_challenge_id" => authentication_challenge_id,
314
+ "ip_address" => ip_address,
315
+ "device_id" => device_id,
316
+ "user_agent" => user_agent
317
+ }.compact
318
+ response = @client.request(
319
+ method: :post,
320
+ path: "/user_management/authenticate",
321
+ auth: true,
322
+ body: body,
323
+ request_options: request_options
483
324
  )
484
- validate_session(session)
485
-
486
- response = execute_request(
487
- request: post_request(
488
- path: '/user_management/authenticate',
489
- body: {
490
- client_id: client_id,
491
- client_secret: WorkOS.config.key!,
492
- ip_address: ip_address,
493
- user_agent: user_agent,
494
- grant_type: 'urn:workos:oauth:grant-type:organization-selection',
495
- organization_id: organization_id,
496
- pending_authentication_token: pending_authentication_token,
497
- },
498
- ),
499
- )
500
-
501
- WorkOS::AuthenticationResponse.new(response.body, session)
502
- end
325
+ WorkOS::AuthenticateResponse.new(response.body)
326
+ end
503
327
 
504
- # Authenticate a user using TOTP.
505
- #
506
- # @param [String] code The one-time code that was emailed to the user.
507
- # @param [String] client_id The WorkOS client ID for the environment
508
- # @param [String] pending_authentication_token The pending authentication token
509
- # from the initial authentication request.
510
- # @param [String] authentication_challenge_id The authentication challenge ID for the
511
- # authentication request.
512
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
513
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
514
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
515
- # the optional cookie password.
516
- #
517
- # @return WorkOS::AuthenticationResponse
518
- # rubocop:disable Metrics/ParameterLists
519
- def authenticate_with_totp(
520
- code:,
521
- client_id:,
522
- pending_authentication_token:,
523
- authentication_challenge_id:,
524
- ip_address: nil,
525
- user_agent: nil,
526
- session: nil
328
+ # Authenticate with organization selection.
329
+ # @param pending_authentication_token [String]
330
+ # @param organization_id [String]
331
+ # @param ip_address [String, nil]
332
+ # @param device_id [String, nil]
333
+ # @param user_agent [String, nil]
334
+ # @param request_options [Hash] Per-request overrides.
335
+ # @return [WorkOS::AuthenticateResponse]
336
+ def authenticate_with_organization_selection(
337
+ pending_authentication_token:,
338
+ organization_id:,
339
+ ip_address: nil,
340
+ device_id: nil,
341
+ user_agent: nil,
342
+ request_options: {}
343
+ )
344
+ body = {
345
+ "grant_type" => "urn:workos:oauth:grant-type:organization-selection",
346
+ "client_id" => @client.client_id,
347
+ "client_secret" => @client.api_key,
348
+ "pending_authentication_token" => pending_authentication_token,
349
+ "organization_id" => organization_id,
350
+ "ip_address" => ip_address,
351
+ "device_id" => device_id,
352
+ "user_agent" => user_agent
353
+ }.compact
354
+ response = @client.request(
355
+ method: :post,
356
+ path: "/user_management/authenticate",
357
+ auth: true,
358
+ body: body,
359
+ request_options: request_options
527
360
  )
528
- validate_session(session)
529
-
530
- response = execute_request(
531
- request: post_request(
532
- path: '/user_management/authenticate',
533
- body: {
534
- code: code,
535
- client_id: client_id,
536
- client_secret: WorkOS.config.key!,
537
- pending_authentication_token: pending_authentication_token,
538
- grant_type: 'urn:workos:oauth:grant-type:mfa-totp',
539
- authentication_challenge_id: authentication_challenge_id,
540
- ip_address: ip_address,
541
- user_agent: user_agent,
542
- },
543
- ),
544
- )
545
-
546
- WorkOS::AuthenticationResponse.new(response.body, session)
547
- end
548
- # rubocop:enable Metrics/ParameterLists
361
+ WorkOS::AuthenticateResponse.new(response.body)
362
+ end
549
363
 
550
- # Authenticate a user using Email Verification Code.
551
- #
552
- # @param [String] code The one-time code that was emailed to the user.
553
- # @param [String] client_id The WorkOS client ID for the environment
554
- # @param [String] pending_authentication_token The token returned from a failed email/password or OAuth
555
- # authentication attempt due to an unverified email address.
556
- # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
557
- # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
558
- # @param [Hash] session An optional hash that determines whether the session should be sealed and
559
- # the optional cookie password.
560
- #
561
- # @return WorkOS::AuthenticationResponse
562
- def authenticate_with_email_verification(
563
- code:,
564
- client_id:,
565
- pending_authentication_token:,
566
- ip_address: nil,
567
- user_agent: nil,
568
- session: nil
364
+ # Authenticate with device code.
365
+ # @param device_code [String]
366
+ # @param ip_address [String, nil]
367
+ # @param device_id [String, nil]
368
+ # @param user_agent [String, nil]
369
+ # @param request_options [Hash] Per-request overrides.
370
+ # @return [WorkOS::AuthenticateResponse]
371
+ def authenticate_with_device_code(
372
+ device_code:,
373
+ ip_address: nil,
374
+ device_id: nil,
375
+ user_agent: nil,
376
+ request_options: {}
377
+ )
378
+ body = {
379
+ "grant_type" => "urn:ietf:params:oauth:grant-type:device_code",
380
+ "client_id" => @client.client_id,
381
+ "device_code" => device_code,
382
+ "ip_address" => ip_address,
383
+ "device_id" => device_id,
384
+ "user_agent" => user_agent
385
+ }.compact
386
+ response = @client.request(
387
+ method: :post,
388
+ path: "/user_management/authenticate",
389
+ auth: true,
390
+ body: body,
391
+ request_options: request_options
569
392
  )
570
- validate_session(session)
571
-
572
- response = execute_request(
573
- request: post_request(
574
- path: '/user_management/authenticate',
575
- body: {
576
- code: code,
577
- client_id: client_id,
578
- pending_authentication_token: pending_authentication_token,
579
- client_secret: WorkOS.config.key!,
580
- grant_type: 'urn:workos:oauth:grant-type:email-verification:code',
581
- ip_address: ip_address,
582
- user_agent: user_agent,
583
- },
584
- ),
585
- )
586
-
587
- WorkOS::AuthenticationResponse.new(response.body, session)
588
- end
589
-
590
- # Get the logout URL for a session
591
- #
592
- # The user's browser should be navigated to this URL
593
- #
594
- # @param [String] session_id The session ID can be found in the `sid`
595
- # claim of the access token
596
- # @param [String] return_to The URL to redirect the user to after logging out
597
- #
598
- # @return String
599
- def get_logout_url(session_id:, return_to: nil)
600
- params = { session_id: session_id }
601
- params[:return_to] = return_to if return_to
602
-
603
- URI::HTTPS.build(
604
- host: WorkOS.config.api_hostname,
605
- path: '/user_management/sessions/logout',
606
- query: URI.encode_www_form(params),
607
- ).to_s
608
- end
609
-
610
- # Revokes a session
611
- #
612
- # @param [String] session_id The session ID can be found in the `sid`
613
- # claim of the access token
614
- def revoke_session(session_id:)
615
- response = execute_request(
616
- request: post_request(
617
- path: '/user_management/sessions/revoke',
618
- body: {
619
- session_id: session_id,
620
- },
621
- auth: true,
622
- ),
623
- )
624
-
625
- response.is_a? Net::HTTPSuccess
626
- end
627
-
628
- # Get the JWKS URL
629
- #
630
- # The JWKS can be used to validate the access token returned upon successful authentication
631
- #
632
- # @param [String] client_id The WorkOS client ID for the environment
633
- #
634
- # @return String
635
- def get_jwks_url(client_id)
636
- URI::HTTPS.build(
637
- host: WorkOS.config.api_hostname,
638
- path: "/sso/jwks/#{client_id}",
639
- ).to_s
640
- end
641
-
642
- # Gets a Magic Auth object
643
- #
644
- # @param [String] id The unique ID of the MagicAuth object.
645
- #
646
- # @return WorkOS::MagicAuth
647
- def get_magic_auth(id:)
648
- response = execute_request(
649
- request: get_request(
650
- path: "/user_management/magic_auth/#{id}",
651
- auth: true,
652
- ),
653
- )
654
-
655
- WorkOS::MagicAuth.new(response.body)
656
- end
657
-
658
- # Creates a MagicAuth code
659
- #
660
- # @param [String] email The email address of the recipient.
661
- # @param [String] invitation_token The token of an Invitation, if required.
662
- #
663
- # @return WorkOS::MagicAuth
664
- def create_magic_auth(email:, invitation_token: nil)
665
- response = execute_request(
666
- request: post_request(
667
- path: '/user_management/magic_auth',
668
- body: {
669
- email: email,
670
- invitation_token: invitation_token,
671
- }.compact,
672
- auth: true,
673
- ),
674
- )
393
+ WorkOS::AuthenticateResponse.new(response.body)
394
+ end
675
395
 
676
- WorkOS::MagicAuth.new(response.body)
677
- end
396
+ # Get device authorization URL
397
+ # @param client_id [String] The WorkOS client ID for your application.
398
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
399
+ # @return [WorkOS::DeviceAuthorizationResponse]
400
+ def create_device(
401
+ client_id:,
402
+ request_options: {}
403
+ )
404
+ body = {
405
+ "client_id" => client_id
406
+ }.compact
407
+ response = @client.request(
408
+ method: :post,
409
+ path: "/user_management/authorize/device",
410
+ auth: true,
411
+ body: body,
412
+ request_options: request_options
413
+ )
414
+ result = WorkOS::DeviceAuthorizationResponse.new(response.body)
415
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
416
+ result
417
+ end
678
418
 
679
- # Create a one-time Magic Auth code and emails it to the user.
680
- #
681
- # @param [String] email The email address the one-time code will be sent to.
682
- #
683
- # @return Boolean
684
- def send_magic_auth_code(email:)
685
- warn_deprecation '`send_magic_auth_code` is deprecated.
686
- Please use `create_magic_auth` instead. This method will be removed in a future major version.'
419
+ # Revoke Session
420
+ # @param session_id [String] The ID of the session to revoke. This can be extracted from the `sid` claim of the access token.
421
+ # @param return_to [String, nil] The URL to redirect the user to after session revocation.
422
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
423
+ # @return [void]
424
+ def revoke_session(
425
+ session_id:,
426
+ return_to: nil,
427
+ request_options: {}
428
+ )
429
+ body = {
430
+ "session_id" => session_id,
431
+ "return_to" => return_to
432
+ }.compact
433
+ @client.request(
434
+ method: :post,
435
+ path: "/user_management/sessions/revoke",
436
+ auth: true,
437
+ body: body,
438
+ request_options: request_options
439
+ )
440
+ nil
441
+ end
687
442
 
688
- response = execute_request(
689
- request: post_request(
690
- path: '/user_management/magic_auth/send',
691
- body: {
692
- email: email,
693
- },
694
- auth: true,
695
- ),
696
- )
443
+ # Create a CORS origin
444
+ # @param origin [String] The origin URL to allow for CORS requests.
445
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
446
+ # @return [WorkOS::CORSOriginResponse]
447
+ def create_cors_origin(
448
+ origin:,
449
+ request_options: {}
450
+ )
451
+ body = {
452
+ "origin" => origin
453
+ }.compact
454
+ response = @client.request(
455
+ method: :post,
456
+ path: "/user_management/cors_origins",
457
+ auth: true,
458
+ body: body,
459
+ request_options: request_options
460
+ )
461
+ result = WorkOS::CORSOriginResponse.new(response.body)
462
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
463
+ result
464
+ end
697
465
 
698
- response.is_a? Net::HTTPSuccess
699
- end
466
+ # Get an email verification code
467
+ # @param id [String] The ID of the email verification code.
468
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
469
+ # @return [WorkOS::EmailVerification]
470
+ def get_email_verification(
471
+ id:,
472
+ request_options: {}
473
+ )
474
+ response = @client.request(
475
+ method: :get,
476
+ path: "/user_management/email_verification/#{WorkOS::Util.encode_path(id)}",
477
+ auth: true,
478
+ request_options: request_options
479
+ )
480
+ result = WorkOS::EmailVerification.new(response.body)
481
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
482
+ result
483
+ end
700
484
 
701
- # Enroll a user into an authentication factor.
702
- #
703
- # @param [String] user_id The id for the user.
704
- # @param [String] type The type of the factor to enroll. Only option available is totp.
705
- # @param [String] totp_issuer For totp factors. Typically your application
706
- # or company name, this helps users distinguish between factors in authenticator apps.
707
- # @param [String] totp_user For totp factors. Used as the account name in authenticator apps.
708
- # @param [String] totp_secret For totp factors. The Base32 encdoded secret key for the
709
- # factor. Generated if not provided. (Optional)
710
- #
711
- # @return WorkOS::AuthenticationFactorAndChallenge
712
- def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_secret: nil)
713
- validate_auth_factor_type(
714
- type: type,
715
- )
485
+ # Create a password reset token
486
+ # @param email [String] The email address of the user requesting a password reset.
487
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
488
+ # @return [WorkOS::PasswordReset]
489
+ def reset_password(
490
+ email:,
491
+ request_options: {}
492
+ )
493
+ body = {
494
+ "email" => email
495
+ }.compact
496
+ response = @client.request(
497
+ method: :post,
498
+ path: "/user_management/password_reset",
499
+ auth: true,
500
+ body: body,
501
+ request_options: request_options
502
+ )
503
+ result = WorkOS::PasswordReset.new(response.body)
504
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
505
+ result
506
+ end
716
507
 
717
- response = execute_request(
718
- request: post_request(
719
- path: "/user_management/users/#{user_id}/auth_factors",
720
- body: {
721
- type: type,
722
- totp_issuer: totp_issuer,
723
- totp_user: totp_user,
724
- totp_secret: totp_secret,
725
- }.compact,
726
- auth: true,
727
- ),
728
- )
508
+ # Reset the password
509
+ # @param token [String] The password reset token.
510
+ # @param new_password [String] The new password to set for the user.
511
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
512
+ # @return [WorkOS::ResetPasswordResponse]
513
+ def confirm_password_reset(
514
+ token:,
515
+ new_password:,
516
+ request_options: {}
517
+ )
518
+ body = {
519
+ "token" => token,
520
+ "new_password" => new_password
521
+ }.compact
522
+ response = @client.request(
523
+ method: :post,
524
+ path: "/user_management/password_reset/confirm",
525
+ auth: true,
526
+ body: body,
527
+ request_options: request_options
528
+ )
529
+ result = WorkOS::ResetPasswordResponse.new(response.body)
530
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
531
+ result
532
+ end
729
533
 
730
- WorkOS::AuthenticationFactorAndChallenge.new(response.body)
731
- end
534
+ # Get a password reset token
535
+ # @param id [String] The ID of the password reset token.
536
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
537
+ # @return [WorkOS::PasswordReset]
538
+ def get_password_reset(
539
+ id:,
540
+ request_options: {}
541
+ )
542
+ response = @client.request(
543
+ method: :get,
544
+ path: "/user_management/password_reset/#{WorkOS::Util.encode_path(id)}",
545
+ auth: true,
546
+ request_options: request_options
547
+ )
548
+ result = WorkOS::PasswordReset.new(response.body)
549
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
550
+ result
551
+ end
732
552
 
733
- # Get all auth factors for a user
734
- #
735
- # @param [String] user_id The id for the user.
736
- #
737
- # @return WorkOS::ListStruct
738
- def list_auth_factors(user_id:)
739
- response = execute_request(
740
- request: get_request(
741
- path: "/user_management/users/#{user_id}/auth_factors",
742
- auth: true,
743
- ),
553
+ # List users
554
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
555
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
556
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
557
+ # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
558
+ # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`.
559
+ # @param organization_id [String, nil] Filter users by the organization they are a member of.
560
+ # @param email [String, nil] Filter users by their email address.
561
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
562
+ # @return [WorkOS::Types::ListStruct<WorkOS::User>]
563
+ def list_users(
564
+ before: nil,
565
+ after: nil,
566
+ limit: nil,
567
+ order: "desc",
568
+ organization: nil,
569
+ organization_id: nil,
570
+ email: nil,
571
+ request_options: {}
572
+ )
573
+ params = {
574
+ "before" => before,
575
+ "after" => after,
576
+ "limit" => limit,
577
+ "order" => order,
578
+ "organization" => organization,
579
+ "organization_id" => organization_id,
580
+ "email" => email
581
+ }.compact
582
+ response = @client.request(
583
+ method: :get,
584
+ path: "/user_management/users",
585
+ auth: true,
586
+ params: params,
587
+ request_options: request_options
588
+ )
589
+ fetch_next = ->(cursor) {
590
+ list_users(
591
+ before: before,
592
+ after: cursor,
593
+ limit: limit,
594
+ order: order,
595
+ organization: organization,
596
+ organization_id: organization_id,
597
+ email: email,
598
+ request_options: request_options
744
599
  )
600
+ }
601
+ WorkOS::Types::ListStruct.from_response(
602
+ response,
603
+ model: WorkOS::User,
604
+ filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email},
605
+ fetch_next: fetch_next
606
+ )
607
+ end
745
608
 
746
- parsed_response = JSON.parse(response.body)
747
-
748
- auth_factors = parsed_response['data'].map do |auth_factor|
749
- ::WorkOS::Factor.new(auth_factor.to_json)
609
+ # Create a user
610
+ # @param email [String] The email address of the user.
611
+ # @param first_name [String, nil] The first name of the user.
612
+ # @param last_name [String, nil] The last name of the user.
613
+ # @param email_verified [Boolean, nil] Whether the user's email has been verified.
614
+ # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
615
+ # @param external_id [String, nil] The external ID of the user.
616
+ # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.
617
+ # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
618
+ # @param password_hash_type [WorkOS::Types::CreateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
619
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
620
+ # @return [WorkOS::User]
621
+ def create_user(
622
+ email:,
623
+ first_name: nil,
624
+ last_name: nil,
625
+ email_verified: nil,
626
+ metadata: nil,
627
+ external_id: nil,
628
+ password: nil,
629
+ password_hash: nil,
630
+ password_hash_type: nil,
631
+ request_options: {}
632
+ )
633
+ params = {}.compact
634
+ if password
635
+ case password[:type]
636
+ when "plaintext"
637
+ params["password"] = password[:password]
638
+ when "hashed"
639
+ params["password_hash"] = password[:password_hash]
640
+ params["password_hash_type"] = password[:password_hash_type]
750
641
  end
751
-
752
- WorkOS::Types::ListStruct.new(
753
- data: auth_factors,
754
- list_metadata: parsed_response['list_metadata'],
755
- )
756
642
  end
643
+ body = {
644
+ "email" => email,
645
+ "first_name" => first_name,
646
+ "last_name" => last_name,
647
+ "email_verified" => email_verified,
648
+ "metadata" => metadata,
649
+ "external_id" => external_id,
650
+ "password" => password,
651
+ "password_hash" => password_hash,
652
+ "password_hash_type" => password_hash_type
653
+ }.compact
654
+ response = @client.request(
655
+ method: :post,
656
+ path: "/user_management/users",
657
+ auth: true,
658
+ params: params,
659
+ body: body,
660
+ request_options: request_options
661
+ )
662
+ result = WorkOS::User.new(response.body)
663
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
664
+ result
665
+ end
757
666
 
758
- # Get all sessions for a user
759
- #
760
- # @param [String] user_id The id for the user.
761
- # @param [Hash] options
762
- # @option options [String] limit Maximum number of records to return.
763
- # @option options [String] order The order in which to paginate records
764
- # @option options [String] before Pagination cursor to receive records
765
- # before a provided Session ID.
766
- # @option options [String] after Pagination cursor to receive records
767
- # after a provided Session ID.
768
- #
769
- # @return [WorkOS::Types::ListStruct<WorkOS::UserManagement::Session>]
770
- def list_sessions(user_id:, options: {})
771
- options[:order] ||= 'desc'
772
- response = execute_request(
773
- request: get_request(
774
- path: "/user_management/users/#{user_id}/sessions",
775
- auth: true,
776
- params: options,
777
- ),
778
- )
667
+ # Get a user by external ID
668
+ # @param external_id [String] The external ID of the user.
669
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
670
+ # @return [WorkOS::User]
671
+ def get_user_by_external_id(
672
+ external_id:,
673
+ request_options: {}
674
+ )
675
+ response = @client.request(
676
+ method: :get,
677
+ path: "/user_management/users/external_id/#{WorkOS::Util.encode_path(external_id)}",
678
+ auth: true,
679
+ request_options: request_options
680
+ )
681
+ result = WorkOS::User.new(response.body)
682
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
683
+ result
684
+ end
779
685
 
780
- parsed_response = JSON.parse(response.body)
686
+ # Get a user
687
+ # @param id [String] The unique ID of the user.
688
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
689
+ # @return [WorkOS::User]
690
+ def get_user(
691
+ id:,
692
+ request_options: {}
693
+ )
694
+ response = @client.request(
695
+ method: :get,
696
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}",
697
+ auth: true,
698
+ request_options: request_options
699
+ )
700
+ result = WorkOS::User.new(response.body)
701
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
702
+ result
703
+ end
781
704
 
782
- sessions = parsed_response['data'].map do |session|
783
- ::WorkOS::UserManagement::Session.new(session.to_json)
705
+ # Update a user
706
+ # @param id [String] The unique ID of the user.
707
+ # @param email [String, nil] The email address of the user.
708
+ # @param first_name [String, nil] The first name of the user.
709
+ # @param last_name [String, nil] The last name of the user.
710
+ # @param email_verified [Boolean, nil] Whether the user's email has been verified.
711
+ # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
712
+ # @param external_id [String, nil] The external ID of the user.
713
+ # @param locale [String, nil] The user's preferred locale.
714
+ # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.
715
+ # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
716
+ # @param password_hash_type [WorkOS::Types::UpdateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
717
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
718
+ # @return [WorkOS::User]
719
+ def update_user(
720
+ id:,
721
+ email: nil,
722
+ first_name: nil,
723
+ last_name: nil,
724
+ email_verified: nil,
725
+ metadata: nil,
726
+ external_id: nil,
727
+ locale: nil,
728
+ password: nil,
729
+ password_hash: nil,
730
+ password_hash_type: nil,
731
+ request_options: {}
732
+ )
733
+ params = {}.compact
734
+ if password
735
+ case password[:type]
736
+ when "plaintext"
737
+ params["password"] = password[:password]
738
+ when "hashed"
739
+ params["password_hash"] = password[:password_hash]
740
+ params["password_hash_type"] = password[:password_hash_type]
784
741
  end
785
-
786
- WorkOS::Types::ListStruct.new(
787
- data: sessions,
788
- list_metadata: parsed_response['list_metadata'],
789
- )
790
- end
791
-
792
- # Gets an email verification object
793
- #
794
- # @param [String] id The unique ID of the EmailVerification object.
795
- #
796
- # @return WorkOS::EmailVerification
797
- def get_email_verification(id:)
798
- response = execute_request(
799
- request: get_request(
800
- path: "/user_management/email_verification/#{id}",
801
- auth: true,
802
- ),
803
- )
804
-
805
- WorkOS::EmailVerification.new(response.body)
806
- end
807
-
808
- # Sends a verification email to the provided user.
809
- #
810
- # @param [String] user_id The unique ID of the User whose email address will be verified.
811
- #
812
- # @return WorkOS::UserResponse
813
- def send_verification_email(user_id:)
814
- response = execute_request(
815
- request: post_request(
816
- path: "/user_management/users/#{user_id}/email_verification/send",
817
- auth: true,
818
- ),
819
- )
820
-
821
- WorkOS::UserResponse.new(response.body)
822
- end
823
-
824
- # Verifiy user email using one-time code that was sent to the user.
825
- #
826
- # @param [String] user_id The unique ID of the User whose email address will be verified.
827
- # @param [String] code The one-time code emailed to the user.
828
- #
829
- # @return WorkOS::UserResponse
830
- def verify_email(user_id:, code:)
831
- response = execute_request(
832
- request: post_request(
833
- path: "/user_management/users/#{user_id}/email_verification/confirm",
834
- body: {
835
- code: code,
836
- },
837
- auth: true,
838
- ),
839
- )
840
-
841
- WorkOS::UserResponse.new(response.body)
842
- end
843
-
844
- # Gets a password reset object
845
- #
846
- # @param [String] id The unique ID of the PasswordReset object.
847
- #
848
- # @return WorkOS::PasswordReset
849
- def get_password_reset(id:)
850
- response = execute_request(
851
- request: get_request(
852
- path: "/user_management/password_reset/#{id}",
853
- auth: true,
854
- ),
855
- )
856
-
857
- WorkOS::PasswordReset.new(response.body)
858
- end
859
-
860
- # Creates a password reset token
861
- #
862
- # @param [String] email The email address of the user.
863
- #
864
- # @return WorkOS::PasswordReset
865
- def create_password_reset(email:)
866
- response = execute_request(
867
- request: post_request(
868
- path: '/user_management/password_reset',
869
- body: {
870
- email: email,
871
- },
872
- auth: true,
873
- ),
874
- )
875
-
876
- WorkOS::PasswordReset.new(response.body)
877
742
  end
743
+ body = {
744
+ "email" => email,
745
+ "first_name" => first_name,
746
+ "last_name" => last_name,
747
+ "email_verified" => email_verified,
748
+ "metadata" => metadata,
749
+ "external_id" => external_id,
750
+ "locale" => locale,
751
+ "password" => password,
752
+ "password_hash" => password_hash,
753
+ "password_hash_type" => password_hash_type
754
+ }.compact
755
+ response = @client.request(
756
+ method: :put,
757
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}",
758
+ auth: true,
759
+ params: params,
760
+ body: body,
761
+ request_options: request_options
762
+ )
763
+ result = WorkOS::User.new(response.body)
764
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
765
+ result
766
+ end
878
767
 
879
- # Create a password reset challenge and emails a password reset link to a user.
880
- #
881
- # @param [String] email The email of the user that wishes to reset their password.
882
- # @param [String] password_reset_url The URL that will be linked to in the email.
883
- #
884
- # @return [Bool] - returns `true` if successful
885
- def send_password_reset_email(email:, password_reset_url:)
886
- warn_deprecation '`send_password_reset_email` is deprecated.
887
- Please use `create_password_reset` instead. This method will be removed in a future major version.'
888
-
889
- request = post_request(
890
- path: '/user_management/password_reset/send',
891
- body: {
892
- email: email,
893
- password_reset_url: password_reset_url,
894
- },
895
- auth: true,
896
- )
897
-
898
- response = execute_request(request: request)
899
-
900
- response.is_a? Net::HTTPSuccess
901
- end
902
-
903
- # Reset user password using token that was sent to the user.
904
- #
905
- # @param [String] token The token that was sent to the user.
906
- # @param [String] new_password The new password to set for the user.
907
- #
908
- # @return WorkOS::User
909
- def reset_password(token:, new_password:)
910
- response = execute_request(
911
- request: post_request(
912
- path: '/user_management/password_reset/confirm',
913
- body: {
914
- token: token,
915
- new_password: new_password,
916
- },
917
- auth: true,
918
- ),
919
- )
920
-
921
- WorkOS::UserResponse.new(response.body).user
922
- end
768
+ # Delete a user
769
+ # @param id [String] The unique ID of the user.
770
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
771
+ # @return [void]
772
+ def delete_user(
773
+ id:,
774
+ request_options: {}
775
+ )
776
+ @client.request(
777
+ method: :delete,
778
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}",
779
+ auth: true,
780
+ request_options: request_options
781
+ )
782
+ nil
783
+ end
923
784
 
924
- # Get an Organization Membership
925
- #
926
- # @param [String] id The unique ID of the Organization Membership.
927
- #
928
- # @return WorkOS::OrganizationMembership
929
- def get_organization_membership(id:)
930
- response = execute_request(
931
- request: get_request(
932
- path: "/user_management/organization_memberships/#{id}",
933
- auth: true,
934
- ),
935
- )
785
+ # Confirm email change
786
+ # @param id [String] The unique ID of the user.
787
+ # @param code [String] The one-time code used to confirm the email change.
788
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
789
+ # @return [WorkOS::EmailChangeConfirmation]
790
+ def confirm_email_change(
791
+ id:,
792
+ code:,
793
+ request_options: {}
794
+ )
795
+ body = {
796
+ "code" => code
797
+ }.compact
798
+ response = @client.request(
799
+ method: :post,
800
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm",
801
+ auth: true,
802
+ body: body,
803
+ request_options: request_options
804
+ )
805
+ result = WorkOS::EmailChangeConfirmation.new(response.body)
806
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
807
+ result
808
+ end
936
809
 
937
- WorkOS::OrganizationMembership.new(response.body)
938
- end
810
+ # Send email change code
811
+ # @param id [String] The unique ID of the user.
812
+ # @param new_email [String] The new email address to change to.
813
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
814
+ # @return [WorkOS::EmailChange]
815
+ def send_email_change(
816
+ id:,
817
+ new_email:,
818
+ request_options: {}
819
+ )
820
+ body = {
821
+ "new_email" => new_email
822
+ }.compact
823
+ response = @client.request(
824
+ method: :post,
825
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send",
826
+ auth: true,
827
+ body: body,
828
+ request_options: request_options
829
+ )
830
+ result = WorkOS::EmailChange.new(response.body)
831
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
832
+ result
833
+ end
939
834
 
940
- # Retrieve a list of Organization Memberships.
941
- #
942
- # @param [Hash] options
943
- # @option options [String] user_id The ID of the User.
944
- # @option options [String] organization_id Filter memberships by the organization they are members of.
945
- # @option options [Array<String>] statuses Filter memberships by status.
946
- # @option options [String] limit Maximum number of records to return.
947
- # @option options [String] order The order in which to paginate records
948
- # @option options [String] before Pagination cursor to receive records
949
- # before a provided User ID.
950
- # @option options [String] after Pagination cursor to receive records
951
- # before a provided User ID.
952
- #
953
- # @return [WorkOS::OrganizationMembership]
954
- def list_organization_memberships(options = {})
955
- options[:order] ||= 'desc'
956
- response = execute_request(
957
- request: get_request(
958
- path: '/user_management/organization_memberships',
959
- auth: true,
960
- params: options,
961
- ),
962
- )
835
+ # Verify email
836
+ # @param id [String] The ID of the user.
837
+ # @param code [String] The one-time email verification code.
838
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
839
+ # @return [WorkOS::VerifyEmailResponse]
840
+ def verify_email(
841
+ id:,
842
+ code:,
843
+ request_options: {}
844
+ )
845
+ body = {
846
+ "code" => code
847
+ }.compact
848
+ response = @client.request(
849
+ method: :post,
850
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm",
851
+ auth: true,
852
+ body: body,
853
+ request_options: request_options
854
+ )
855
+ result = WorkOS::VerifyEmailResponse.new(response.body)
856
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
857
+ result
858
+ end
963
859
 
964
- parsed_response = JSON.parse(response.body)
860
+ # Send verification email
861
+ # @param id [String] The ID of the user.
862
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
863
+ # @return [WorkOS::SendVerificationEmailResponse]
864
+ def send_verification_email(
865
+ id:,
866
+ request_options: {}
867
+ )
868
+ response = @client.request(
869
+ method: :post,
870
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/send",
871
+ auth: true,
872
+ request_options: request_options
873
+ )
874
+ result = WorkOS::SendVerificationEmailResponse.new(response.body)
875
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
876
+ result
877
+ end
965
878
 
966
- organization_memberships = parsed_response['data'].map do |organization_membership|
967
- ::WorkOS::OrganizationMembership.new(organization_membership.to_json)
968
- end
879
+ # Get user identities
880
+ # @param id [String] The unique ID of the user.
881
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
882
+ # @return [Array<WorkOS::UserIdentitiesGetItem>]
883
+ def get_user_identities(
884
+ id:,
885
+ request_options: {}
886
+ )
887
+ response = @client.request(
888
+ method: :get,
889
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/identities",
890
+ auth: true,
891
+ request_options: request_options
892
+ )
893
+ parsed = JSON.parse(response.body)
894
+ (parsed || []).map { |item| WorkOS::UserIdentitiesGetItem.new(item) }
895
+ end
969
896
 
970
- WorkOS::Types::ListStruct.new(
971
- data: organization_memberships,
972
- list_metadata: parsed_response['list_metadata'],
897
+ # List sessions
898
+ # @param id [String] The ID of the user.
899
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
900
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
901
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
902
+ # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
903
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
904
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserSessionsListItem>]
905
+ def list_sessions(
906
+ id:,
907
+ before: nil,
908
+ after: nil,
909
+ limit: nil,
910
+ order: "desc",
911
+ request_options: {}
912
+ )
913
+ params = {
914
+ "before" => before,
915
+ "after" => after,
916
+ "limit" => limit,
917
+ "order" => order
918
+ }.compact
919
+ response = @client.request(
920
+ method: :get,
921
+ path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/sessions",
922
+ auth: true,
923
+ params: params,
924
+ request_options: request_options
925
+ )
926
+ fetch_next = ->(cursor) {
927
+ list_sessions(
928
+ id: id,
929
+ before: before,
930
+ after: cursor,
931
+ limit: limit,
932
+ order: order,
933
+ request_options: request_options
973
934
  )
974
- end
975
-
976
- # Create an Organization Membership
977
- #
978
- # @param [String] user_id The ID of the User.
979
- # @param [String] organization_id The ID of the Organization to which the user belongs to.
980
- # @param [String] role_slug The slug of the role to grant to this membership. (Optional)
981
- # @param [Array<String>] role_slugs Array of role slugs to assign to this membership. (Optional)
982
- #
983
- # @return [WorkOS::OrganizationMembership]
984
- def create_organization_membership(user_id:, organization_id:, role_slug: nil, role_slugs: nil)
985
- raise ArgumentError, 'Cannot specify both role_slug and role_slugs' if role_slug && role_slugs
935
+ }
936
+ WorkOS::Types::ListStruct.from_response(
937
+ response,
938
+ model: WorkOS::UserSessionsListItem,
939
+ filters: {id: id, before: before, limit: limit, order: order},
940
+ fetch_next: fetch_next
941
+ )
942
+ end
986
943
 
987
- body = {
988
- user_id: user_id,
944
+ # List invitations
945
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
946
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
947
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
948
+ # @param order [WorkOS::Types::UserManagementInvitationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
949
+ # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.
950
+ # @param email [String, nil] The email address of the recipient.
951
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
952
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserInvite>]
953
+ def list_invitations(
954
+ before: nil,
955
+ after: nil,
956
+ limit: nil,
957
+ order: "desc",
958
+ organization_id: nil,
959
+ email: nil,
960
+ request_options: {}
961
+ )
962
+ params = {
963
+ "before" => before,
964
+ "after" => after,
965
+ "limit" => limit,
966
+ "order" => order,
967
+ "organization_id" => organization_id,
968
+ "email" => email
969
+ }.compact
970
+ response = @client.request(
971
+ method: :get,
972
+ path: "/user_management/invitations",
973
+ auth: true,
974
+ params: params,
975
+ request_options: request_options
976
+ )
977
+ fetch_next = ->(cursor) {
978
+ list_invitations(
979
+ before: before,
980
+ after: cursor,
981
+ limit: limit,
982
+ order: order,
989
983
  organization_id: organization_id,
990
- }
991
-
992
- body[:role_slugs] = role_slugs if role_slugs
993
- body[:role_slug] = role_slug if role_slug
994
-
995
- request = post_request(
996
- path: '/user_management/organization_memberships',
997
- body: body.compact,
998
- auth: true,
999
- )
1000
-
1001
- response = execute_request(request: request)
1002
-
1003
- WorkOS::OrganizationMembership.new(response.body)
1004
- end
1005
-
1006
- # Update an Organization Membership
1007
- #
1008
- # @param [String] id The ID of the Organization Membership.
1009
- # @param [String] role_slug The slug of the role to grant to this membership. (Optional)
1010
- # @param [Array<String>] role_slugs Array of role slugs to assign to this membership. (Optional)
1011
- #
1012
- # @return [WorkOS::OrganizationMembership]
1013
- def update_organization_membership(id:, role_slug: nil, role_slugs: nil)
1014
- raise ArgumentError, 'Cannot specify both role_slug and role_slugs' if role_slug && role_slugs
1015
-
1016
- body = { id: id }
1017
-
1018
- body[:role_slugs] = role_slugs if role_slugs
1019
- body[:role_slug] = role_slug if role_slug
1020
-
1021
- request = put_request(
1022
- path: "/user_management/organization_memberships/#{id}",
1023
- body: body.compact,
1024
- auth: true,
984
+ email: email,
985
+ request_options: request_options
1025
986
  )
987
+ }
988
+ WorkOS::Types::ListStruct.from_response(
989
+ response,
990
+ model: WorkOS::UserInvite,
991
+ filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email},
992
+ fetch_next: fetch_next
993
+ )
994
+ end
1026
995
 
1027
- response = execute_request(request: request)
1028
-
1029
- WorkOS::OrganizationMembership.new(response.body)
1030
- end
996
+ # Send an invitation
997
+ # @param email [String] The email address of the recipient.
998
+ # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.
999
+ # @param role_slug [String, nil] The [role](https://workos.com/docs/authkit/roles) that the recipient will receive when they join the organization in the invitation.
1000
+ # @param expires_in_days [Integer, nil] How many days the invitations will be valid for. Must be between 1 and 30 days. Defaults to 7 days if not specified.
1001
+ # @param inviter_user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user) who invites the recipient. The invitation email will mention the name of this user.
1002
+ # @param locale [WorkOS::Types::CreateUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization).
1003
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1004
+ # @return [WorkOS::UserInvite]
1005
+ def send_invitation(
1006
+ email:,
1007
+ organization_id: nil,
1008
+ role_slug: nil,
1009
+ expires_in_days: nil,
1010
+ inviter_user_id: nil,
1011
+ locale: nil,
1012
+ request_options: {}
1013
+ )
1014
+ body = {
1015
+ "email" => email,
1016
+ "organization_id" => organization_id,
1017
+ "role_slug" => role_slug,
1018
+ "expires_in_days" => expires_in_days,
1019
+ "inviter_user_id" => inviter_user_id,
1020
+ "locale" => locale
1021
+ }.compact
1022
+ response = @client.request(
1023
+ method: :post,
1024
+ path: "/user_management/invitations",
1025
+ auth: true,
1026
+ body: body,
1027
+ request_options: request_options
1028
+ )
1029
+ result = WorkOS::UserInvite.new(response.body)
1030
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1031
+ result
1032
+ end
1031
1033
 
1032
- # Delete an Organization Membership
1033
- #
1034
- # @param [String] id The unique ID of the Organization Membership.
1035
- #
1036
- # @return [Bool] - returns `true` if successful
1037
- def delete_organization_membership(id:)
1038
- response = execute_request(
1039
- request: delete_request(
1040
- path: "/user_management/organization_memberships/#{id}",
1041
- auth: true,
1042
- ),
1043
- )
1034
+ # Find an invitation by token
1035
+ # @param token [String] The token used to accept the invitation.
1036
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1037
+ # @return [WorkOS::UserInvite]
1038
+ def find_invitation_by_token(
1039
+ token:,
1040
+ request_options: {}
1041
+ )
1042
+ response = @client.request(
1043
+ method: :get,
1044
+ path: "/user_management/invitations/by_token/#{WorkOS::Util.encode_path(token)}",
1045
+ auth: true,
1046
+ request_options: request_options
1047
+ )
1048
+ result = WorkOS::UserInvite.new(response.body)
1049
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1050
+ result
1051
+ end
1044
1052
 
1045
- response.is_a? Net::HTTPSuccess
1046
- end
1053
+ # Get an invitation
1054
+ # @param id [String] The unique ID of the invitation.
1055
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1056
+ # @return [WorkOS::UserInvite]
1057
+ def get_invitation(
1058
+ id:,
1059
+ request_options: {}
1060
+ )
1061
+ response = @client.request(
1062
+ method: :get,
1063
+ path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}",
1064
+ auth: true,
1065
+ request_options: request_options
1066
+ )
1067
+ result = WorkOS::UserInvite.new(response.body)
1068
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1069
+ result
1070
+ end
1047
1071
 
1048
- # Deactivate an Organization Membership
1049
- #
1050
- # @param [String] id The unique ID of the Organization Membership.
1051
- #
1052
- # @return WorkOS::OrganizationMembership
1053
- def deactivate_organization_membership(id:)
1054
- response = execute_request(
1055
- request: put_request(
1056
- path: "/user_management/organization_memberships/#{id}/deactivate",
1057
- auth: true,
1058
- ),
1059
- )
1072
+ # Accept an invitation
1073
+ # @param id [String] The unique ID of the invitation.
1074
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1075
+ # @return [WorkOS::Invitation]
1076
+ def accept_invitation(
1077
+ id:,
1078
+ request_options: {}
1079
+ )
1080
+ response = @client.request(
1081
+ method: :post,
1082
+ path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/accept",
1083
+ auth: true,
1084
+ request_options: request_options
1085
+ )
1086
+ result = WorkOS::Invitation.new(response.body)
1087
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1088
+ result
1089
+ end
1060
1090
 
1061
- WorkOS::OrganizationMembership.new(response.body)
1062
- end
1091
+ # Resend an invitation
1092
+ # @param id [String] The unique ID of the invitation.
1093
+ # @param locale [WorkOS::Types::ResendUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization).
1094
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1095
+ # @return [WorkOS::UserInvite]
1096
+ def resend_invitation(
1097
+ id:,
1098
+ locale: nil,
1099
+ request_options: {}
1100
+ )
1101
+ body = {
1102
+ "locale" => locale
1103
+ }.compact
1104
+ response = @client.request(
1105
+ method: :post,
1106
+ path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/resend",
1107
+ auth: true,
1108
+ body: body,
1109
+ request_options: request_options
1110
+ )
1111
+ result = WorkOS::UserInvite.new(response.body)
1112
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1113
+ result
1114
+ end
1063
1115
 
1064
- # Reactivate an Organization Membership
1065
- #
1066
- # @param [String] id The unique ID of the Organization Membership.
1067
- #
1068
- # @return WorkOS::OrganizationMembership
1069
- def reactivate_organization_membership(id:)
1070
- response = execute_request(
1071
- request: put_request(
1072
- path: "/user_management/organization_memberships/#{id}/reactivate",
1073
- auth: true,
1074
- ),
1075
- )
1116
+ # Revoke an invitation
1117
+ # @param id [String] The unique ID of the invitation.
1118
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1119
+ # @return [WorkOS::Invitation]
1120
+ def revoke_invitation(
1121
+ id:,
1122
+ request_options: {}
1123
+ )
1124
+ response = @client.request(
1125
+ method: :post,
1126
+ path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/revoke",
1127
+ auth: true,
1128
+ request_options: request_options
1129
+ )
1130
+ result = WorkOS::Invitation.new(response.body)
1131
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1132
+ result
1133
+ end
1076
1134
 
1077
- WorkOS::OrganizationMembership.new(response.body)
1078
- end
1135
+ # Update JWT template
1136
+ # @param content [String] The JWT template content as a Liquid template string.
1137
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1138
+ # @return [WorkOS::JWTTemplateResponse]
1139
+ def update_jwt_template(
1140
+ content:,
1141
+ request_options: {}
1142
+ )
1143
+ body = {
1144
+ "content" => content
1145
+ }.compact
1146
+ response = @client.request(
1147
+ method: :put,
1148
+ path: "/user_management/jwt_template",
1149
+ auth: true,
1150
+ body: body,
1151
+ request_options: request_options
1152
+ )
1153
+ result = WorkOS::JWTTemplateResponse.new(response.body)
1154
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1155
+ result
1156
+ end
1079
1157
 
1080
- # Gets an Invitation
1081
- #
1082
- # @param [String] id The unique ID of the Invitation.
1083
- #
1084
- # @return WorkOS::Invitation
1085
- def get_invitation(id:)
1086
- response = execute_request(
1087
- request: get_request(
1088
- path: "/user_management/invitations/#{id}",
1089
- auth: true,
1090
- ),
1091
- )
1158
+ # Create a Magic Auth code
1159
+ # @param email [String] The email address to send the magic code to.
1160
+ # @param invitation_token [String, nil] The invitation token to associate with this magic code.
1161
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1162
+ # @return [WorkOS::MagicAuth]
1163
+ def create_magic_auth(
1164
+ email:,
1165
+ invitation_token: nil,
1166
+ request_options: {}
1167
+ )
1168
+ body = {
1169
+ "email" => email,
1170
+ "invitation_token" => invitation_token
1171
+ }.compact
1172
+ response = @client.request(
1173
+ method: :post,
1174
+ path: "/user_management/magic_auth",
1175
+ auth: true,
1176
+ body: body,
1177
+ request_options: request_options
1178
+ )
1179
+ result = WorkOS::MagicAuth.new(response.body)
1180
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1181
+ result
1182
+ end
1092
1183
 
1093
- WorkOS::Invitation.new(response.body)
1094
- end
1184
+ # Get Magic Auth code details
1185
+ # @param id [String] The unique ID of the Magic Auth code.
1186
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1187
+ # @return [WorkOS::MagicAuth]
1188
+ def get_magic_auth(
1189
+ id:,
1190
+ request_options: {}
1191
+ )
1192
+ response = @client.request(
1193
+ method: :get,
1194
+ path: "/user_management/magic_auth/#{WorkOS::Util.encode_path(id)}",
1195
+ auth: true,
1196
+ request_options: request_options
1197
+ )
1198
+ result = WorkOS::MagicAuth.new(response.body)
1199
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1200
+ result
1201
+ end
1095
1202
 
1096
- # Finds an Invitation by Token
1097
- #
1098
- # @param [String] token The token of the Invitation.
1099
- #
1100
- # @return WorkOS::Invitation
1101
- def find_invitation_by_token(token:)
1102
- response = execute_request(
1103
- request: get_request(
1104
- path: "/user_management/invitations/by_token/#{token}",
1105
- auth: true,
1106
- ),
1203
+ # List organization memberships
1204
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
1205
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
1206
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1207
+ # @param order [WorkOS::Types::UserManagementOrganizationMembershipOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
1208
+ # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
1209
+ # @param statuses [Array<WorkOS::Types::UserManagementOrganizationMembershipStatuses>, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`.
1210
+ # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user).
1211
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1212
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserOrganizationMembership>]
1213
+ def list_organization_memberships(
1214
+ before: nil,
1215
+ after: nil,
1216
+ limit: nil,
1217
+ order: "desc",
1218
+ organization_id: nil,
1219
+ statuses: nil,
1220
+ user_id: nil,
1221
+ request_options: {}
1222
+ )
1223
+ params = {
1224
+ "before" => before,
1225
+ "after" => after,
1226
+ "limit" => limit,
1227
+ "order" => order,
1228
+ "organization_id" => organization_id,
1229
+ "statuses" => statuses,
1230
+ "user_id" => user_id
1231
+ }.compact
1232
+ response = @client.request(
1233
+ method: :get,
1234
+ path: "/user_management/organization_memberships",
1235
+ auth: true,
1236
+ params: params,
1237
+ request_options: request_options
1238
+ )
1239
+ fetch_next = ->(cursor) {
1240
+ list_organization_memberships(
1241
+ before: before,
1242
+ after: cursor,
1243
+ limit: limit,
1244
+ order: order,
1245
+ organization_id: organization_id,
1246
+ statuses: statuses,
1247
+ user_id: user_id,
1248
+ request_options: request_options
1107
1249
  )
1250
+ }
1251
+ WorkOS::Types::ListStruct.from_response(
1252
+ response,
1253
+ model: WorkOS::UserOrganizationMembership,
1254
+ filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id},
1255
+ fetch_next: fetch_next
1256
+ )
1257
+ end
1108
1258
 
1109
- WorkOS::Invitation.new(response.body)
1259
+ # Create an organization membership
1260
+ # @param user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user).
1261
+ # @param organization_id [String] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
1262
+ # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`.
1263
+ # @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
1264
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1265
+ # @return [WorkOS::OrganizationMembership]
1266
+ def create_organization_membership(
1267
+ user_id:,
1268
+ organization_id:,
1269
+ role_slug: nil,
1270
+ role_slugs: nil,
1271
+ role: nil,
1272
+ request_options: {}
1273
+ )
1274
+ params = {}.compact
1275
+ if role
1276
+ case role[:type]
1277
+ when "single"
1278
+ params["role_slug"] = role[:role_slug]
1279
+ when "multiple"
1280
+ params["role_slugs"] = role[:role_slugs]
1281
+ end
1110
1282
  end
1283
+ body = {
1284
+ "user_id" => user_id,
1285
+ "organization_id" => organization_id,
1286
+ "role_slug" => role_slug,
1287
+ "role_slugs" => role_slugs
1288
+ }.compact
1289
+ response = @client.request(
1290
+ method: :post,
1291
+ path: "/user_management/organization_memberships",
1292
+ auth: true,
1293
+ params: params,
1294
+ body: body,
1295
+ request_options: request_options
1296
+ )
1297
+ result = WorkOS::OrganizationMembership.new(response.body)
1298
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1299
+ result
1300
+ end
1111
1301
 
1112
- # Retrieve a list of invitations.
1113
- #
1114
- # @param [Hash] options
1115
- # @option options [String] email The email address of a recipient.
1116
- # @option options [String] organization_id The ID of the Organization that the recipient was invited to join.
1117
- # @option options [String] limit Maximum number of records to return.
1118
- # @option options [String] order The order in which to paginate records
1119
- # @option options [String] before Pagination cursor to receive records
1120
- # before a provided User ID.
1121
- # @option options [String] after Pagination cursor to receive records
1122
- # before a provided User ID.
1123
- #
1124
- # @return [WorkOS::Invitation]
1125
- def list_invitations(options = {})
1126
- options[:order] ||= 'desc'
1127
- response = execute_request(
1128
- request: get_request(
1129
- path: '/user_management/invitations',
1130
- auth: true,
1131
- params: options,
1132
- ),
1133
- )
1134
-
1135
- parsed_response = JSON.parse(response.body)
1302
+ # Get an organization membership
1303
+ # @param id [String] The unique ID of the organization membership.
1304
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1305
+ # @return [WorkOS::UserOrganizationMembership]
1306
+ def get_organization_membership(
1307
+ id:,
1308
+ request_options: {}
1309
+ )
1310
+ response = @client.request(
1311
+ method: :get,
1312
+ path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}",
1313
+ auth: true,
1314
+ request_options: request_options
1315
+ )
1316
+ result = WorkOS::UserOrganizationMembership.new(response.body)
1317
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1318
+ result
1319
+ end
1136
1320
 
1137
- invitations = parsed_response['data'].map do |invitation|
1138
- ::WorkOS::Invitation.new(invitation.to_json)
1321
+ # Update an organization membership
1322
+ # @param id [String] The unique ID of the organization membership.
1323
+ # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`.
1324
+ # @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
1325
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1326
+ # @return [WorkOS::UserOrganizationMembership]
1327
+ def update_organization_membership(
1328
+ id:,
1329
+ role_slug: nil,
1330
+ role_slugs: nil,
1331
+ role: nil,
1332
+ request_options: {}
1333
+ )
1334
+ params = {}.compact
1335
+ if role
1336
+ case role[:type]
1337
+ when "single"
1338
+ params["role_slug"] = role[:role_slug]
1339
+ when "multiple"
1340
+ params["role_slugs"] = role[:role_slugs]
1139
1341
  end
1140
-
1141
- WorkOS::Types::ListStruct.new(
1142
- data: invitations,
1143
- list_metadata: parsed_response['list_metadata'],
1144
- )
1145
1342
  end
1343
+ body = {
1344
+ "role_slug" => role_slug,
1345
+ "role_slugs" => role_slugs
1346
+ }.compact
1347
+ response = @client.request(
1348
+ method: :put,
1349
+ path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}",
1350
+ auth: true,
1351
+ params: params,
1352
+ body: body,
1353
+ request_options: request_options
1354
+ )
1355
+ result = WorkOS::UserOrganizationMembership.new(response.body)
1356
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1357
+ result
1358
+ end
1146
1359
 
1147
- # Sends an Invitation to a recipient.
1148
- #
1149
- # @param [String] email The email address of the recipient.
1150
- # @param [String] organization_id The ID of the Organization to which the recipient is being invited.
1151
- # @param [Integer] expires_in_days The number of days the invitations will be valid for.
1152
- # Must be between 1 and 30, defaults to 7 if not specified.
1153
- # @param [String] inviter_user_id The ID of the User sending the invitation.
1154
- # @param [String] role_slug The slug of the role to assign to the user upon invitation.
1155
- #
1156
- # @return WorkOS::Invitation
1157
- def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_user_id: nil, role_slug: nil)
1158
- response = execute_request(
1159
- request: post_request(
1160
- path: '/user_management/invitations',
1161
- body: {
1162
- email: email,
1163
- organization_id: organization_id,
1164
- expires_in_days: expires_in_days,
1165
- inviter_user_id: inviter_user_id,
1166
- role_slug: role_slug,
1167
- }.compact,
1168
- auth: true,
1169
- ),
1170
- )
1171
-
1172
- WorkOS::Invitation.new(response.body)
1173
- end
1360
+ # Delete an organization membership
1361
+ # @param id [String] The unique ID of the organization membership.
1362
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1363
+ # @return [void]
1364
+ def delete_organization_membership(
1365
+ id:,
1366
+ request_options: {}
1367
+ )
1368
+ @client.request(
1369
+ method: :delete,
1370
+ path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}",
1371
+ auth: true,
1372
+ request_options: request_options
1373
+ )
1374
+ nil
1375
+ end
1174
1376
 
1175
- # Revokes an existing Invitation.
1176
- #
1177
- # @param [String] id The unique ID of the Invitation.
1178
- #
1179
- # @return WorkOS::Invitation
1180
- def revoke_invitation(id:)
1181
- request = post_request(
1182
- path: "/user_management/invitations/#{id}/revoke",
1183
- auth: true,
1184
- )
1377
+ # Deactivate an organization membership
1378
+ # @param id [String] The unique ID of the organization membership.
1379
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1380
+ # @return [WorkOS::OrganizationMembership]
1381
+ def deactivate_organization_membership(
1382
+ id:,
1383
+ request_options: {}
1384
+ )
1385
+ response = @client.request(
1386
+ method: :put,
1387
+ path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/deactivate",
1388
+ auth: true,
1389
+ request_options: request_options
1390
+ )
1391
+ result = WorkOS::OrganizationMembership.new(response.body)
1392
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1393
+ result
1394
+ end
1185
1395
 
1186
- response = execute_request(request: request)
1396
+ # Reactivate an organization membership
1397
+ # @param id [String] The unique ID of the organization membership.
1398
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1399
+ # @return [WorkOS::UserOrganizationMembership]
1400
+ def reactivate_organization_membership(
1401
+ id:,
1402
+ request_options: {}
1403
+ )
1404
+ response = @client.request(
1405
+ method: :put,
1406
+ path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/reactivate",
1407
+ auth: true,
1408
+ request_options: request_options
1409
+ )
1410
+ result = WorkOS::UserOrganizationMembership.new(response.body)
1411
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1412
+ result
1413
+ end
1187
1414
 
1188
- WorkOS::Invitation.new(response.body)
1189
- end
1415
+ # Create a redirect URI
1416
+ # @param uri [String] The redirect URI to create.
1417
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1418
+ # @return [WorkOS::RedirectUri]
1419
+ def create_redirect_uri(
1420
+ uri:,
1421
+ request_options: {}
1422
+ )
1423
+ body = {
1424
+ "uri" => uri
1425
+ }.compact
1426
+ response = @client.request(
1427
+ method: :post,
1428
+ path: "/user_management/redirect_uris",
1429
+ auth: true,
1430
+ body: body,
1431
+ request_options: request_options
1432
+ )
1433
+ result = WorkOS::RedirectUri.new(response.body)
1434
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
1435
+ result
1436
+ end
1190
1437
 
1191
- # Resends an existing Invitation.
1192
- #
1193
- # @param [String] id The unique ID of the Invitation.
1194
- #
1195
- # @return WorkOS::Invitation
1196
- def resend_invitation(id:)
1197
- request = post_request(
1198
- path: "/user_management/invitations/#{id}/resend",
1199
- auth: true,
1438
+ # List authorized applications
1439
+ # @param user_id [String] The ID of the user.
1440
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
1441
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
1442
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1443
+ # @param order [WorkOS::Types::UserManagementUsersAuthorizedApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
1444
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1445
+ # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizedConnectApplicationListData>]
1446
+ def list_user_authorized_applications(
1447
+ user_id:,
1448
+ before: nil,
1449
+ after: nil,
1450
+ limit: nil,
1451
+ order: "desc",
1452
+ request_options: {}
1453
+ )
1454
+ params = {
1455
+ "before" => before,
1456
+ "after" => after,
1457
+ "limit" => limit,
1458
+ "order" => order
1459
+ }.compact
1460
+ response = @client.request(
1461
+ method: :get,
1462
+ path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications",
1463
+ auth: true,
1464
+ params: params,
1465
+ request_options: request_options
1466
+ )
1467
+ fetch_next = ->(cursor) {
1468
+ list_user_authorized_applications(
1469
+ user_id: user_id,
1470
+ before: before,
1471
+ after: cursor,
1472
+ limit: limit,
1473
+ order: order,
1474
+ request_options: request_options
1200
1475
  )
1476
+ }
1477
+ WorkOS::Types::ListStruct.from_response(
1478
+ response,
1479
+ model: WorkOS::AuthorizedConnectApplicationListData,
1480
+ filters: {user_id: user_id, before: before, limit: limit, order: order},
1481
+ fetch_next: fetch_next
1482
+ )
1483
+ end
1201
1484
 
1202
- response = execute_request(request: request)
1203
-
1204
- WorkOS::Invitation.new(response.body)
1205
- end
1206
-
1207
- private
1485
+ # Delete an authorized application
1486
+ # @param application_id [String] The ID or client ID of the application.
1487
+ # @param user_id [String] The ID of the user.
1488
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1489
+ # @return [void]
1490
+ def delete_user_authorized_application(
1491
+ application_id:,
1492
+ user_id:,
1493
+ request_options: {}
1494
+ )
1495
+ @client.request(
1496
+ method: :delete,
1497
+ path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications/#{WorkOS::Util.encode_path(application_id)}",
1498
+ auth: true,
1499
+ request_options: request_options
1500
+ )
1501
+ nil
1502
+ end
1208
1503
 
1209
- def validate_session(session)
1210
- return unless session && (session[:seal_session] == true) && session[:cookie_password].nil?
1504
+ # @oagen-ignore-start — non-spec helpers (hand-maintained)
1505
+ # H13 Build the JWKS URL for a given client_id (no HTTP call).
1506
+ # Pair with #get_jwks (generated) to fetch the keyset.
1507
+ def get_jwks_url(client_id: nil)
1508
+ cid = client_id || @client.client_id
1509
+ raise ArgumentError, "client_id is required" if cid.nil? || cid.empty?
1510
+ base = @client.base_url
1511
+ URI.join(base, "/sso/jwks/#{WorkOS::Util.encode_path(cid)}").to_s
1512
+ end
1211
1513
 
1212
- raise ArgumentError, 'cookie_password is required when sealing session'
1213
- end
1514
+ # H09 Build an AuthKit authorization URL (client-side, no HTTP call).
1515
+ # Overrides the generated get_authorization_url which hits the API.
1516
+ def get_authorization_url(redirect_uri:, client_id: nil, provider: nil, connection_id: nil,
1517
+ organization_id: nil, domain_hint: nil, login_hint: nil,
1518
+ state: nil, screen_hint: nil, code_challenge: nil,
1519
+ code_challenge_method: nil, prompt: nil, **)
1520
+ cid = client_id || @client.client_id
1521
+ raise ArgumentError, "client_id is required (set on Client or pass explicitly)" if cid.nil? || cid.empty?
1522
+ raise ArgumentError, "provider, connection_id, or organization_id required" if provider.nil? && connection_id.nil? && organization_id.nil?
1523
+ params = {
1524
+ "client_id" => cid,
1525
+ "redirect_uri" => redirect_uri,
1526
+ "response_type" => "code",
1527
+ "provider" => provider,
1528
+ "connection_id" => connection_id,
1529
+ "organization_id" => organization_id,
1530
+ "domain_hint" => domain_hint,
1531
+ "login_hint" => login_hint,
1532
+ "state" => state,
1533
+ "screen_hint" => screen_hint,
1534
+ "code_challenge" => code_challenge,
1535
+ "code_challenge_method" => code_challenge_method,
1536
+ "prompt" => prompt
1537
+ }.compact
1538
+ build_url("/user_management/authorize", params)
1539
+ end
1214
1540
 
1215
- def validate_authorization_url_arguments(
1216
- provider:,
1217
- connection_id:,
1218
- organization_id:
1541
+ # H10 — AuthKit authorization URL with auto-generated PKCE + state.
1542
+ # Returns [url, code_verifier, state].
1543
+ def get_authorization_url_with_pkce(redirect_uri:, client_id: nil, **opts)
1544
+ pair = WorkOS::PKCE.generate_pair
1545
+ state = opts.delete(:state) || WorkOS::PKCE.generate_code_verifier
1546
+ url = get_authorization_url(
1547
+ redirect_uri: redirect_uri,
1548
+ client_id: client_id,
1549
+ state: state,
1550
+ code_challenge: pair[:code_challenge],
1551
+ code_challenge_method: "S256",
1552
+ **opts
1219
1553
  )
1220
- if [provider, connection_id, organization_id].all?(&:nil?)
1221
- raise ArgumentError, 'Either connection ID, organization ID,' \
1222
- ' or provider is required.'
1223
- end
1554
+ [url, pair[:code_verifier], state]
1555
+ end
1224
1556
 
1225
- return unless provider && !PROVIDERS.include?(provider)
1557
+ # H11 Exchange a code for tokens with PKCE support (public client; no secret).
1558
+ # NOTE: Unlike the other authenticate_with_* helpers, this does NOT delegate to
1559
+ # create_authenticate because PKCE is a public-client flow that requires
1560
+ # auth: false (no Bearer token / API key in the Authorization header).
1561
+ def authenticate_with_code_pkce(code:, code_verifier:, client_id: nil, ip_address: nil, user_agent: nil, request_options: {})
1562
+ cid = client_id || @client.client_id
1563
+ raise ArgumentError, "client_id is required" if cid.nil? || cid.empty?
1564
+ body = {
1565
+ "grant_type" => "authorization_code",
1566
+ "client_id" => cid,
1567
+ "code" => code,
1568
+ "code_verifier" => code_verifier,
1569
+ "ip_address" => ip_address,
1570
+ "user_agent" => user_agent
1571
+ }.compact
1572
+ response = @client.request(method: :post, path: "/user_management/authenticate", auth: false, body: body, request_options: request_options)
1573
+ WorkOS::AuthenticateResponse.new(response.body)
1574
+ end
1226
1575
 
1227
- raise ArgumentError, "#{provider} is not a valid value." \
1228
- " `provider` must be in #{PROVIDERS}"
1229
- end
1576
+ # H12 Initiate the OAuth 2.0 device authorization flow.
1577
+ # @return [WorkOS::DeviceAuthorizationResponse]
1578
+ def authorize_device(client_id: nil, request_options: {})
1579
+ cid = client_id || @client.client_id
1580
+ raise ArgumentError, "client_id is required" if cid.nil? || cid.empty?
1581
+ body = {"client_id" => cid}
1582
+ response = @client.request(method: :post, path: "/oauth2/device_authorization", auth: false, body: body, request_options: request_options)
1583
+ WorkOS::DeviceAuthorizationResponse.new(response.body)
1584
+ end
1230
1585
 
1231
- def validate_auth_factor_type(
1232
- type:
1233
- )
1234
- return if AUTH_FACTOR_TYPES.include?(type)
1586
+ # H12 device-code → token exchange is provided by the generated
1587
+ # `authenticate_with_device_code` method (wraps /user_management/authenticate);
1588
+ # no hand-maintained override is needed here.
1589
+
1590
+ # Build the AuthKit logout redirect URL (client-side, no HTTP call).
1591
+ # @param session_id [String] The session ID (from the `sid` claim of the access token).
1592
+ # @param return_to [String, nil] URL to redirect the user to after session revocation.
1593
+ # @return [String]
1594
+ def get_logout_url(session_id:, return_to: nil)
1595
+ params = {"session_id" => session_id}
1596
+ params["return_to"] = return_to if return_to
1597
+ build_url("/user_management/sessions/logout", params)
1598
+ end
1235
1599
 
1236
- raise ArgumentError, "#{type} is not a valid value." \
1237
- " `type` must be in #{AUTH_FACTOR_TYPES}"
1238
- end
1600
+ private
1601
+
1602
+ def build_url(path, params)
1603
+ base = @client.base_url
1604
+ uri = URI.join(base, path)
1605
+ uri.query = URI.encode_www_form(params)
1606
+ uri.to_s
1239
1607
  end
1608
+ # @oagen-ignore-end
1240
1609
  end
1241
- # rubocop:enable Metrics/ModuleLength
1242
1610
  end