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