From 1a2cac6972f19ae34c6de8ebf5f27c54b682634a Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 01:54:54 +0000 Subject: [PATCH 1/2] feat(generated)!: regenerate from spec (13 changes) --- .last-synced-sha | 2 +- .oagen-manifest.json | 101 +++-- lib/workos/api_keys.rb | 90 ++--- lib/workos/api_keys/api_key.rb | 2 +- lib/workos/api_keys/api_key_created_data.rb | 2 +- lib/workos/api_keys/organization_api_key.rb | 43 +++ .../organization_api_key_owner.rb} | 4 +- .../organization_api_key_with_value.rb | 46 +++ .../organization_api_key_with_value_owner.rb} | 4 +- ...h_value_owner.rb => user_api_key_owner.rb} | 2 +- lib/workos/audit_logs.rb | 4 +- lib/workos/authorization.rb | 124 +++++- ..._organization_membership_base_list_data.rb | 7 +- ..._assignment.rb => user_role_assignment.rb} | 7 +- ...ce.rb => user_role_assignment_resource.rb} | 2 +- lib/workos/client.rb | 8 +- lib/workos/connect.rb | 2 +- lib/workos/directory_sync.rb | 6 +- lib/workos/directory_sync/directory_user.rb | 3 + .../directory_user_with_groups.rb | 5 +- .../directory_sync/dsync_user_updated_data.rb | 3 + lib/workos/events.rb | 2 +- lib/workos/feature_flags.rb | 6 +- lib/workos/groups.rb | 4 +- lib/workos/multi_factor_auth.rb | 2 +- lib/workos/organizations.rb | 2 +- lib/workos/sso.rb | 2 +- lib/workos/sso/profile.rb | 3 + lib/workos/types/authorization_order.rb | 9 - lib/workos/types/connections_order.rb | 9 - lib/workos/types/directories_order.rb | 9 - lib/workos/types/directory_groups_order.rb | 9 - lib/workos/types/directory_users_order.rb | 9 - .../types/event_context_actor_source.rb | 3 +- lib/workos/types/feature_flags_order.rb | 9 - .../types/organizations_api_keys_order.rb | 9 - .../organizations_feature_flags_order.rb | 9 - lib/workos/types/organizations_order.rb | 9 - ...lications_order.rb => pagination_order.rb} | 2 +- lib/workos/types/permissions_order.rb | 9 - .../user_management_invitations_order.rb | 9 - ...ement_multi_factor_authentication_order.rb | 9 - ...nt_organization_membership_groups_order.rb | 9 - ...anagement_organization_membership_order.rb | 9 - ...ent_users_authorized_applications_order.rb | 9 - ...er_management_users_feature_flags_order.rb | 9 - .../types/user_management_users_order.rb | 9 - ...provider.rb => vault_byok_key_provider.rb} | 2 +- lib/workos/user_management.rb | 107 +++++- .../user_management/create_user_api_key.rb | 25 ++ .../organization_membership.rb | 7 +- lib/workos/user_management/user_api_key.rb | 43 +++ .../user_api_key_created_data_owner.rb | 25 ++ .../user_api_key_revoked_data_owner.rb} | 4 +- .../user_api_key_with_value.rb} | 4 +- .../user_api_key_with_value_owner.rb} | 4 +- .../user_organization_membership.rb | 7 +- ...nagement_organization_membership_groups.rb | 2 +- lib/workos/vault/vault_byok_key_deleted.rb | 34 ++ .../vault/vault_byok_key_deleted_data.rb | 22 ++ lib/workos/webhooks.rb | 2 +- rbi/workos/api_key.rbi | 4 +- rbi/workos/api_key_created_data.rbi | 4 +- rbi/workos/api_key_revoked_data.rbi | 4 +- rbi/workos/api_keys.rbi | 34 +- rbi/workos/authorization.rbi | 28 +- rbi/workos/client.rbi | 6 +- rbi/workos/create_user_api_key.rbi | 36 ++ rbi/workos/directory_user.rbi | 6 + rbi/workos/directory_user_with_groups.rbi | 6 + rbi/workos/dsync_user_updated_data.rbi | 6 + rbi/workos/organization_api_key.rbi | 72 ++++ ...ner.rbi => organization_api_key_owner.rbi} | 2 +- .../organization_api_key_with_value.rbi | 78 ++++ .../organization_api_key_with_value_owner.rbi | 30 ++ rbi/workos/organization_membership.rbi | 6 + rbi/workos/profile.rbi | 6 + rbi/workos/user_api_key.rbi | 72 ++++ .../user_api_key_created_data_owner.rbi | 36 ++ rbi/workos/user_api_key_owner.rbi | 36 ++ .../user_api_key_revoked_data_owner.rbi | 36 ++ ..._value.rbi => user_api_key_with_value.rbi} | 6 +- rbi/workos/user_api_key_with_value_owner.rbi | 36 ++ rbi/workos/user_management.rbi | 31 ++ rbi/workos/user_organization_membership.rbi | 6 + ...organization_membership_base_list_data.rbi | 6 + ...ssignment.rbi => user_role_assignment.rbi} | 12 +- ....rbi => user_role_assignment_resource.rbi} | 2 +- rbi/workos/vault_byok_key_deleted.rbi | 54 +++ rbi/workos/vault_byok_key_deleted_data.rbi | 30 ++ test/workos/test_api_keys.rb | 34 +- test/workos/test_authorization.rb | 16 + test/workos/test_model_round_trip.rb | 361 ++++++++++++++---- test/workos/test_user_management.rb | 26 +- 94 files changed, 1619 insertions(+), 443 deletions(-) create mode 100644 lib/workos/api_keys/organization_api_key.rb rename lib/workos/{types/events_order.rb => api_keys/organization_api_key_owner.rb} (64%) create mode 100644 lib/workos/api_keys/organization_api_key_with_value.rb rename lib/workos/{types/audit_logs_order.rb => api_keys/organization_api_key_with_value_owner.rb} (63%) rename lib/workos/api_keys/{api_key_with_value_owner.rb => user_api_key_owner.rb} (68%) rename lib/workos/authorization/{role_assignment.rb => user_role_assignment.rb} (67%) rename lib/workos/authorization/{role_assignment_resource.rb => user_role_assignment_resource.rb} (89%) delete mode 100644 lib/workos/types/authorization_order.rb delete mode 100644 lib/workos/types/connections_order.rb delete mode 100644 lib/workos/types/directories_order.rb delete mode 100644 lib/workos/types/directory_groups_order.rb delete mode 100644 lib/workos/types/directory_users_order.rb delete mode 100644 lib/workos/types/feature_flags_order.rb delete mode 100644 lib/workos/types/organizations_api_keys_order.rb delete mode 100644 lib/workos/types/organizations_feature_flags_order.rb delete mode 100644 lib/workos/types/organizations_order.rb rename lib/workos/types/{applications_order.rb => pagination_order.rb} (89%) delete mode 100644 lib/workos/types/permissions_order.rb delete mode 100644 lib/workos/types/user_management_invitations_order.rb delete mode 100644 lib/workos/types/user_management_multi_factor_authentication_order.rb delete mode 100644 lib/workos/types/user_management_organization_membership_groups_order.rb delete mode 100644 lib/workos/types/user_management_organization_membership_order.rb delete mode 100644 lib/workos/types/user_management_users_authorized_applications_order.rb delete mode 100644 lib/workos/types/user_management_users_feature_flags_order.rb delete mode 100644 lib/workos/types/user_management_users_order.rb rename lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb => vault_byok_key_provider.rb} (82%) create mode 100644 lib/workos/user_management/create_user_api_key.rb create mode 100644 lib/workos/user_management/user_api_key.rb create mode 100644 lib/workos/user_management/user_api_key_created_data_owner.rb rename lib/workos/{types/webhooks_order.rb => user_management/user_api_key_revoked_data_owner.rb} (63%) rename lib/workos/{api_keys/api_key_with_value.rb => user_management/user_api_key_with_value.rb} (87%) rename lib/workos/{types/groups_order.rb => user_management/user_api_key_with_value_owner.rb} (64%) create mode 100644 lib/workos/vault/vault_byok_key_deleted.rb create mode 100644 lib/workos/vault/vault_byok_key_deleted_data.rb create mode 100644 rbi/workos/create_user_api_key.rbi create mode 100644 rbi/workos/organization_api_key.rbi rename rbi/workos/{api_key_with_value_owner.rbi => organization_api_key_owner.rbi} (95%) create mode 100644 rbi/workos/organization_api_key_with_value.rbi create mode 100644 rbi/workos/organization_api_key_with_value_owner.rbi create mode 100644 rbi/workos/user_api_key.rbi create mode 100644 rbi/workos/user_api_key_created_data_owner.rbi create mode 100644 rbi/workos/user_api_key_owner.rbi create mode 100644 rbi/workos/user_api_key_revoked_data_owner.rbi rename rbi/workos/{api_key_with_value.rbi => user_api_key_with_value.rbi} (90%) create mode 100644 rbi/workos/user_api_key_with_value_owner.rbi rename rbi/workos/{role_assignment.rbi => user_role_assignment.rbi} (75%) rename rbi/workos/{role_assignment_resource.rbi => user_role_assignment_resource.rbi} (95%) create mode 100644 rbi/workos/vault_byok_key_deleted.rbi create mode 100644 rbi/workos/vault_byok_key_deleted_data.rbi diff --git a/.last-synced-sha b/.last-synced-sha index f72eb0e2..047fc7ee 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -92db0495807c86fbbc4d45bd266a6c1f5bcbb59c +a10d9ecb766d2dd996aecb19aa9c801d78bb7c26 diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 3dd2b3da..4b5b3e1b 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-04-30T17:41:02.756Z", + "generatedAt": "2026-05-06T01:54:11.909Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -20,9 +20,12 @@ "lib/workos/api_keys/api_key_revoked_data.rb", "lib/workos/api_keys/api_key_revoked_data_owner.rb", "lib/workos/api_keys/api_key_validation_response.rb", - "lib/workos/api_keys/api_key_with_value.rb", - "lib/workos/api_keys/api_key_with_value_owner.rb", "lib/workos/api_keys/create_organization_api_key.rb", + "lib/workos/api_keys/organization_api_key.rb", + "lib/workos/api_keys/organization_api_key_owner.rb", + "lib/workos/api_keys/organization_api_key_with_value.rb", + "lib/workos/api_keys/organization_api_key_with_value_owner.rb", + "lib/workos/api_keys/user_api_key_owner.rb", "lib/workos/api_keys/validate_api_key.rb", "lib/workos/audit_logs.rb", "lib/workos/audit_logs/audit_log_action_json.rb", @@ -60,8 +63,6 @@ "lib/workos/authorization/permission_updated_data.rb", "lib/workos/authorization/remove_role.rb", "lib/workos/authorization/role.rb", - "lib/workos/authorization/role_assignment.rb", - "lib/workos/authorization/role_assignment_resource.rb", "lib/workos/authorization/role_created.rb", "lib/workos/authorization/role_created_data.rb", "lib/workos/authorization/role_deleted.rb", @@ -76,6 +77,8 @@ "lib/workos/authorization/update_organization_role.rb", "lib/workos/authorization/update_role.rb", "lib/workos/authorization/user_organization_membership_base_list_data.rb", + "lib/workos/authorization/user_role_assignment.rb", + "lib/workos/authorization/user_role_assignment_resource.rb", "lib/workos/client.rb", "lib/workos/connect.rb", "lib/workos/connect/application_credentials_list_item.rb", @@ -283,19 +286,16 @@ "lib/workos/sso/sso_token_response.rb", "lib/workos/sso/sso_token_response_oauth_token.rb", "lib/workos/sso/token_query.rb", - "lib/workos/types/applications_order.rb", "lib/workos/types/audit_log_configuration_log_stream_state.rb", "lib/workos/types/audit_log_configuration_log_stream_type.rb", "lib/workos/types/audit_log_configuration_state.rb", "lib/workos/types/audit_log_export_json_state.rb", - "lib/workos/types/audit_logs_order.rb", "lib/workos/types/authenticate_response_authentication_method.rb", "lib/workos/types/authentication_factor_enrolled_type.rb", "lib/workos/types/authentication_factor_type.rb", "lib/workos/types/authentication_factors_create_request_type.rb", "lib/workos/types/authentication_radar_risk_detected_data_action.rb", "lib/workos/types/authorization_assignment.rb", - "lib/workos/types/authorization_order.rb", "lib/workos/types/connected_account_state.rb", "lib/workos/types/connection_activated_data_connection_type.rb", "lib/workos/types/connection_activated_data_state.rb", @@ -311,20 +311,16 @@ "lib/workos/types/connection_status.rb", "lib/workos/types/connection_type.rb", "lib/workos/types/connections_connection_type.rb", - "lib/workos/types/connections_order.rb", "lib/workos/types/create_user_invite_options_locale.rb", "lib/workos/types/create_user_password_hash_type.rb", "lib/workos/types/create_webhook_endpoint_events.rb", "lib/workos/types/data_integration_access_token_response_error.rb", "lib/workos/types/data_integrations_list_response_data_connected_account_state.rb", "lib/workos/types/data_integrations_list_response_data_ownership.rb", - "lib/workos/types/directories_order.rb", - "lib/workos/types/directory_groups_order.rb", "lib/workos/types/directory_state.rb", "lib/workos/types/directory_type.rb", "lib/workos/types/directory_user_state.rb", "lib/workos/types/directory_user_with_groups_state.rb", - "lib/workos/types/directory_users_order.rb", "lib/workos/types/dsync_activated_data_state.rb", "lib/workos/types/dsync_activated_data_type.rb", "lib/workos/types/dsync_deactivated_data_state.rb", @@ -333,8 +329,6 @@ "lib/workos/types/dsync_deleted_data_type.rb", "lib/workos/types/dsync_user_updated_data_state.rb", "lib/workos/types/event_context_actor_source.rb", - "lib/workos/types/events_order.rb", - "lib/workos/types/feature_flags_order.rb", "lib/workos/types/flag_created_context_actor_source.rb", "lib/workos/types/flag_deleted_context_actor_source.rb", "lib/workos/types/flag_rule_updated_context_access_type.rb", @@ -342,7 +336,6 @@ "lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb", "lib/workos/types/flag_updated_context_actor_source.rb", "lib/workos/types/generate_link_intent.rb", - "lib/workos/types/groups_order.rb", "lib/workos/types/invitation_accepted_data_state.rb", "lib/workos/types/invitation_created_data_state.rb", "lib/workos/types/invitation_resent_data_state.rb", @@ -374,10 +367,7 @@ "lib/workos/types/organization_membership_updated_data_status.rb", "lib/workos/types/organization_updated_data_domain_state.rb", "lib/workos/types/organization_updated_data_domain_verification_strategy.rb", - "lib/workos/types/organizations_api_keys_order.rb", - "lib/workos/types/organizations_feature_flags_order.rb", - "lib/workos/types/organizations_order.rb", - "lib/workos/types/permissions_order.rb", + "lib/workos/types/pagination_order.rb", "lib/workos/types/profile_connection_type.rb", "lib/workos/types/radar_action.rb", "lib/workos/types/radar_standalone_assess_request_action.rb", @@ -400,19 +390,12 @@ "lib/workos/types/user_invite_state.rb", "lib/workos/types/user_management_authentication_provider.rb", "lib/workos/types/user_management_authentication_screen_hint.rb", - "lib/workos/types/user_management_invitations_order.rb", - "lib/workos/types/user_management_multi_factor_authentication_order.rb", - "lib/workos/types/user_management_organization_membership_groups_order.rb", - "lib/workos/types/user_management_organization_membership_order.rb", "lib/workos/types/user_management_organization_membership_statuses.rb", - "lib/workos/types/user_management_users_authorized_applications_order.rb", - "lib/workos/types/user_management_users_feature_flags_order.rb", - "lib/workos/types/user_management_users_order.rb", "lib/workos/types/user_organization_membership_base_list_data_status.rb", "lib/workos/types/user_organization_membership_status.rb", "lib/workos/types/user_sessions_auth_method.rb", "lib/workos/types/user_sessions_status.rb", - "lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb", + "lib/workos/types/vault_byok_key_provider.rb", "lib/workos/types/vault_data_created_data_actor_source.rb", "lib/workos/types/vault_data_deleted_data_actor_source.rb", "lib/workos/types/vault_data_read_data_actor_source.rb", @@ -424,7 +407,6 @@ "lib/workos/types/vault_names_listed_data_actor_source.rb", "lib/workos/types/waitlist_user_state.rb", "lib/workos/types/webhook_endpoint_json_status.rb", - "lib/workos/types/webhooks_order.rb", "lib/workos/types/widget_session_token_scopes.rb", "lib/workos/user_management.rb", "lib/workos/user_management/action_authentication_denied.rb", @@ -490,6 +472,7 @@ "lib/workos/user_management/create_password_reset_token.rb", "lib/workos/user_management/create_redirect_uri.rb", "lib/workos/user_management/create_user.rb", + "lib/workos/user_management/create_user_api_key.rb", "lib/workos/user_management/create_user_invite_options.rb", "lib/workos/user_management/create_user_organization_membership.rb", "lib/workos/user_management/device_authorization_response.rb", @@ -544,6 +527,11 @@ "lib/workos/user_management/update_user.rb", "lib/workos/user_management/update_user_organization_membership.rb", "lib/workos/user_management/user.rb", + "lib/workos/user_management/user_api_key.rb", + "lib/workos/user_management/user_api_key_created_data_owner.rb", + "lib/workos/user_management/user_api_key_revoked_data_owner.rb", + "lib/workos/user_management/user_api_key_with_value.rb", + "lib/workos/user_management/user_api_key_with_value_owner.rb", "lib/workos/user_management/user_created.rb", "lib/workos/user_management/user_deleted.rb", "lib/workos/user_management/user_identities_get_item.rb", @@ -555,6 +543,8 @@ "lib/workos/user_management/verify_email_address.rb", "lib/workos/user_management/verify_email_response.rb", "lib/workos/user_management_organization_membership_groups.rb", + "lib/workos/vault/vault_byok_key_deleted.rb", + "lib/workos/vault/vault_byok_key_deleted_data.rb", "lib/workos/vault/vault_byok_key_verification_completed.rb", "lib/workos/vault/vault_byok_key_verification_completed_data.rb", "lib/workos/vault/vault_data_created.rb", @@ -597,8 +587,6 @@ "rbi/workos/api_key_revoked_data.rbi", "rbi/workos/api_key_revoked_data_owner.rbi", "rbi/workos/api_key_validation_response.rbi", - "rbi/workos/api_key_with_value.rbi", - "rbi/workos/api_key_with_value_owner.rbi", "rbi/workos/api_keys.rbi", "rbi/workos/application_credentials_list_item.rbi", "rbi/workos/assign_role.rbi", @@ -730,6 +718,7 @@ "rbi/workos/create_redirect_uri.rbi", "rbi/workos/create_role.rbi", "rbi/workos/create_user.rbi", + "rbi/workos/create_user_api_key.rbi", "rbi/workos/create_user_invite_options.rbi", "rbi/workos/create_user_organization_membership.rbi", "rbi/workos/create_webhook_endpoint.rbi", @@ -856,6 +845,10 @@ "rbi/workos/multi_factor_auth.rbi", "rbi/workos/new_connect_application_secret.rbi", "rbi/workos/organization.rbi", + "rbi/workos/organization_api_key.rbi", + "rbi/workos/organization_api_key_owner.rbi", + "rbi/workos/organization_api_key_with_value.rbi", + "rbi/workos/organization_api_key_with_value_owner.rbi", "rbi/workos/organization_created.rbi", "rbi/workos/organization_created_data.rbi", "rbi/workos/organization_created_data_domain.rbi", @@ -927,8 +920,6 @@ "rbi/workos/reset_password_response.rbi", "rbi/workos/revoke_session.rbi", "rbi/workos/role.rbi", - "rbi/workos/role_assignment.rbi", - "rbi/workos/role_assignment_resource.rbi", "rbi/workos/role_created.rbi", "rbi/workos/role_created_data.rbi", "rbi/workos/role_deleted.rbi", @@ -968,6 +959,12 @@ "rbi/workos/update_user_organization_membership.rbi", "rbi/workos/update_webhook_endpoint.rbi", "rbi/workos/user.rbi", + "rbi/workos/user_api_key.rbi", + "rbi/workos/user_api_key_created_data_owner.rbi", + "rbi/workos/user_api_key_owner.rbi", + "rbi/workos/user_api_key_revoked_data_owner.rbi", + "rbi/workos/user_api_key_with_value.rbi", + "rbi/workos/user_api_key_with_value_owner.rbi", "rbi/workos/user_authentication_factor_enroll_response.rbi", "rbi/workos/user_consent_option.rbi", "rbi/workos/user_consent_option_choice.rbi", @@ -981,10 +978,14 @@ "rbi/workos/user_object.rbi", "rbi/workos/user_organization_membership.rbi", "rbi/workos/user_organization_membership_base_list_data.rbi", + "rbi/workos/user_role_assignment.rbi", + "rbi/workos/user_role_assignment_resource.rbi", "rbi/workos/user_sessions_impersonator.rbi", "rbi/workos/user_sessions_list_item.rbi", "rbi/workos/user_updated.rbi", "rbi/workos/validate_api_key.rbi", + "rbi/workos/vault_byok_key_deleted.rbi", + "rbi/workos/vault_byok_key_deleted_data.rbi", "rbi/workos/vault_byok_key_verification_completed.rbi", "rbi/workos/vault_byok_key_verification_completed_data.rbi", "rbi/workos/vault_data_created.rbi", @@ -1038,14 +1039,6 @@ "test/workos/test_widgets.rb" ], "operations": { - "POST /api_keys/validations": { - "sdkMethod": "create_validation", - "service": "api_keys" - }, - "DELETE /api_keys/{id}": { - "sdkMethod": "delete_api_key", - "service": "api_keys" - }, "POST /auth/challenges/{id}/verify": { "sdkMethod": "verify_challenge", "service": "multi_factor_auth" @@ -1150,6 +1143,10 @@ "sdkMethod": "list_memberships_for_resource_by_external_id", "service": "authorization" }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/role_assignments": { + "sdkMethod": "list_role_assignments_for_resource_by_external_id", + "service": "authorization" + }, "GET /authorization/resources": { "sdkMethod": "list_resources", "service": "authorization" @@ -1174,6 +1171,10 @@ "sdkMethod": "list_memberships_for_resource", "service": "authorization" }, + "GET /authorization/resources/{resource_id}/role_assignments": { + "sdkMethod": "list_role_assignments_for_resource", + "service": "authorization" + }, "GET /authorization/roles": { "sdkMethod": "list_environment_roles", "service": "authorization" @@ -1622,6 +1623,10 @@ "sdkMethod": "revoke_invitation", "service": "user_management" }, + "GET /user_management/jwt_template": { + "sdkMethod": "list_jwt_template", + "service": "user_management" + }, "PUT /user_management/jwt_template": { "sdkMethod": "update_jwt_template", "service": "user_management" @@ -1722,6 +1727,22 @@ "sdkMethod": "create_token", "service": "widgets" }, + "POST /api_keys/validations": { + "sdkMethod": "create_validation", + "service": "api_keys" + }, + "DELETE /api_keys/{id}": { + "sdkMethod": "delete_api_key", + "service": "api_keys" + }, + "GET /user_management/users/{userId}/api_keys": { + "sdkMethod": "list_user_api_keys", + "service": "user_management" + }, + "POST /user_management/users/{userId}/api_keys": { + "sdkMethod": "create_user_api_key", + "service": "user_management" + }, "GET /audit_logs/actions": { "sdkMethod": "list_actions", "service": "audit_logs" diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 5fb3a995..5dee92a1 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -10,54 +10,14 @@ def initialize(client) @client = client end - # Validate API key - # @param value [String] The value for an API key. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ApiKeyValidationResponse] - def create_validation( - value:, - request_options: {} - ) - body = { - "value" => value - } - response = @client.request( - method: :post, - path: "/api_keys/validations", - auth: true, - body: body, - request_options: request_options - ) - result = WorkOS::ApiKeyValidationResponse.new(response.body) - 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"]) - result - end - - # Delete an API key - # @param id [String] The unique ID of the API key. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [void] - def delete_api_key( - id:, - request_options: {} - ) - @client.request( - method: :delete, - path: "/api_keys/#{WorkOS::Util.encode_path(id)}", - auth: true, - request_options: request_options - ) - nil - end - # List API keys for an organization # @param organization_id [String] Unique identifier of the Organization. # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::OrganizationsApiKeysOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::Types::ListStruct] + # @return [WorkOS::Types::ListStruct] def list_organization_api_keys( organization_id:, before: nil, @@ -91,7 +51,7 @@ def list_organization_api_keys( } WorkOS::Types::ListStruct.from_response( response, - model: WorkOS::ApiKey, + model: WorkOS::OrganizationApiKey, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, fetch_next: fetch_next ) @@ -102,7 +62,7 @@ def list_organization_api_keys( # @param name [String] The name for the API key. # @param permissions [Array, nil] The permission slugs to assign to the API key. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ApiKeyWithValue] + # @return [WorkOS::OrganizationApiKeyWithValue] def create_organization_api_key( organization_id:, name:, @@ -120,9 +80,49 @@ def create_organization_api_key( body: body, request_options: request_options ) - result = WorkOS::ApiKeyWithValue.new(response.body) + result = WorkOS::OrganizationApiKeyWithValue.new(response.body) 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"]) result end + + # Validate API key + # @param value [String] The value for an API key. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ApiKeyValidationResponse] + def create_validation( + value:, + request_options: {} + ) + body = { + "value" => value + } + response = @client.request( + method: :post, + path: "/api_keys/validations", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::ApiKeyValidationResponse.new(response.body) + 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"]) + result + end + + # Delete an API key + # @param id [String] The unique ID of the API key. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_api_key( + id:, + request_options: {} + ) + @client.request( + method: :delete, + path: "/api_keys/#{WorkOS::Util.encode_path(id)}", + auth: true, + request_options: request_options + ) + nil + end end end diff --git a/lib/workos/api_keys/api_key.rb b/lib/workos/api_keys/api_key.rb index 94020562..c69d2fa9 100644 --- a/lib/workos/api_keys/api_key.rb +++ b/lib/workos/api_keys/api_key.rb @@ -31,7 +31,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? (case hash[:owner][:type] when "organization" then WorkOS::ApiKeyOwner.new(hash[:owner]) when "user" then WorkOS::UserApiKeyOwner.new(hash[:owner]) else hash[:owner] end) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/api_keys/api_key_created_data.rb b/lib/workos/api_keys/api_key_created_data.rb index 024af96c..8128befc 100644 --- a/lib/workos/api_keys/api_key_created_data.rb +++ b/lib/workos/api_keys/api_key_created_data.rb @@ -31,7 +31,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? (case hash[:owner][:type] when "organization" then WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) when "user" then WorkOS::UserApiKeyCreatedDataOwner.new(hash[:owner]) else hash[:owner] end) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/api_keys/organization_api_key.rb b/lib/workos/api_keys/organization_api_key.rb new file mode 100644 index 00000000..f2131bae --- /dev/null +++ b/lib/workos/api_keys/organization_api_key.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::OrganizationApiKeyOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/types/events_order.rb b/lib/workos/api_keys/organization_api_key_owner.rb similarity index 64% rename from lib/workos/types/events_order.rb rename to lib/workos/api_keys/organization_api_key_owner.rb index 4f73381f..6b8527a8 100644 --- a/lib/workos/types/events_order.rb +++ b/lib/workos/api_keys/organization_api_key_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - EventsOrder = ApplicationsOrder - end + OrganizationApiKeyOwner = ApiKeyCreatedDataOwner end diff --git a/lib/workos/api_keys/organization_api_key_with_value.rb b/lib/workos/api_keys/organization_api_key_with_value.rb new file mode 100644 index 00000000..c8bced69 --- /dev/null +++ b/lib/workos/api_keys/organization_api_key_with_value.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationApiKeyWithValue < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at, + value: :value + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at, + :value + + def initialize(json) + hash = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::OrganizationApiKeyWithValueOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @value = hash[:value] + end + end +end diff --git a/lib/workos/types/audit_logs_order.rb b/lib/workos/api_keys/organization_api_key_with_value_owner.rb similarity index 63% rename from lib/workos/types/audit_logs_order.rb rename to lib/workos/api_keys/organization_api_key_with_value_owner.rb index 598b6279..8b685426 100644 --- a/lib/workos/types/audit_logs_order.rb +++ b/lib/workos/api_keys/organization_api_key_with_value_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - AuditLogsOrder = ApplicationsOrder - end + OrganizationApiKeyWithValueOwner = ApiKeyCreatedDataOwner end diff --git a/lib/workos/api_keys/api_key_with_value_owner.rb b/lib/workos/api_keys/user_api_key_owner.rb similarity index 68% rename from lib/workos/api_keys/api_key_with_value_owner.rb rename to lib/workos/api_keys/user_api_key_owner.rb index 20ed52cd..9a9ce16f 100644 --- a/lib/workos/api_keys/api_key_with_value_owner.rb +++ b/lib/workos/api_keys/user_api_key_owner.rb @@ -3,5 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - ApiKeyWithValueOwner = ApiKeyCreatedDataOwner + UserApiKeyOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 45226db3..79dc10eb 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -58,7 +58,7 @@ def update_organization_audit_logs_retention( # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_actions( @@ -103,7 +103,7 @@ def list_actions( # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_action_schemas( diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index fcdc09aa..a8bb9b34 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -93,7 +93,7 @@ def check( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param permission_slug [String] The permission slug to filter by. Only child resources where the organization membership has this permission are returned. # @param parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -157,7 +157,7 @@ def list_resources_for_membership( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_effective_permissions( @@ -208,7 +208,7 @@ def list_effective_permissions( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_effective_permissions_by_external_id( @@ -259,9 +259,9 @@ def list_effective_permissions_by_external_id( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::Types::ListStruct] + # @return [WorkOS::Types::ListStruct] def list_role_assignments( organization_membership_id:, before: nil, @@ -295,7 +295,7 @@ def list_role_assignments( } WorkOS::Types::ListStruct.from_response( response, - model: WorkOS::RoleAssignment, + model: WorkOS::UserRoleAssignment, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}, fetch_next: fetch_next ) @@ -306,7 +306,7 @@ def list_role_assignments( # @param role_slug [String] The slug of the role to assign. # @param resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::RoleAssignment] + # @return [WorkOS::UserRoleAssignment] def assign_role( organization_membership_id:, role_slug:, @@ -332,7 +332,7 @@ def assign_role( body: body, request_options: request_options ) - result = WorkOS::RoleAssignment.new(response.body) + result = WorkOS::UserRoleAssignment.new(response.body) 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"]) result end @@ -694,7 +694,7 @@ def delete_resource_by_external_id( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -748,11 +748,64 @@ def list_memberships_for_resource_by_external_id( ) end + # List role assignments for a resource by external ID + # @param organization_id [String] The ID of the organization that owns the resource. + # @param resource_type_slug [String] The slug of the resource type. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @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"`. + # @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"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::PaginationOrder, 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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_role_assignments_for_resource_by_external_id( + organization_id:, + resource_type_slug:, + external_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request( + method: :get, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/role_assignments", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_role_assignments_for_resource_by_external_id( + organization_id: organization_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserRoleAssignment, + filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + # List resources # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param organization_id [String, nil] Filter resources by organization ID. # @param resource_type_slug [String, nil] Filter resources by resource type slug. # @param resource_external_id [String, nil] Filter resources by external ID. @@ -958,7 +1011,7 @@ def delete_resource( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::AuthorizationOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -1008,6 +1061,53 @@ def list_memberships_for_resource( ) end + # List role assignments for a resource + # @param resource_id [String] The ID of the authorization resource. + # @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"`. + # @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"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::PaginationOrder, 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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_role_assignments_for_resource( + resource_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request( + method: :get, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/role_assignments", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_role_assignments_for_resource( + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserRoleAssignment, + filters: {resource_id: resource_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + # List environment roles # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RoleList] @@ -1156,7 +1256,7 @@ def set_environment_role_permissions( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::PermissionsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_permissions( diff --git a/lib/workos/authorization/user_organization_membership_base_list_data.rb b/lib/workos/authorization/user_organization_membership_base_list_data.rb index c52c73d0..5403c5df 100644 --- a/lib/workos/authorization/user_organization_membership_base_list_data.rb +++ b/lib/workos/authorization/user_organization_membership_base_list_data.rb @@ -14,7 +14,8 @@ class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel organization_name: :organization_name, custom_attributes: :custom_attributes, created_at: :created_at, - updated_at: :updated_at + updated_at: :updated_at, + user: :user }.freeze attr_accessor \ @@ -27,7 +28,8 @@ class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel :organization_name, :custom_attributes, :created_at, - :updated_at + :updated_at, + :user def initialize(json) hash = self.class.normalize(json) @@ -41,6 +43,7 @@ def initialize(json) @custom_attributes = hash[:custom_attributes] || {} @created_at = hash[:created_at] @updated_at = hash[:updated_at] + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/authorization/role_assignment.rb b/lib/workos/authorization/user_role_assignment.rb similarity index 67% rename from lib/workos/authorization/role_assignment.rb rename to lib/workos/authorization/user_role_assignment.rb index b2281332..0a0ff87e 100644 --- a/lib/workos/authorization/role_assignment.rb +++ b/lib/workos/authorization/user_role_assignment.rb @@ -3,10 +3,11 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class RoleAssignment < WorkOS::Types::BaseModel + class UserRoleAssignment < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, + organization_membership_id: :organization_membership_id, role: :role, resource: :resource, created_at: :created_at, @@ -16,6 +17,7 @@ class RoleAssignment < WorkOS::Types::BaseModel attr_accessor \ :object, :id, + :organization_membership_id, :role, :resource, :created_at, @@ -25,8 +27,9 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] + @organization_membership_id = hash[:organization_membership_id] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil - @resource = hash[:resource] ? WorkOS::RoleAssignmentResource.new(hash[:resource]) : nil + @resource = hash[:resource] ? WorkOS::UserRoleAssignmentResource.new(hash[:resource]) : nil @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/authorization/role_assignment_resource.rb b/lib/workos/authorization/user_role_assignment_resource.rb similarity index 89% rename from lib/workos/authorization/role_assignment_resource.rb rename to lib/workos/authorization/user_role_assignment_resource.rb index bcdae5f2..9128e967 100644 --- a/lib/workos/authorization/role_assignment_resource.rb +++ b/lib/workos/authorization/user_role_assignment_resource.rb @@ -3,7 +3,7 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class RoleAssignmentResource < WorkOS::Types::BaseModel + class UserRoleAssignmentResource < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, external_id: :external_id, diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 36aa03a9..fa9b29bb 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -4,10 +4,6 @@ module WorkOS class Client < BaseClient - def api_keys - @api_keys ||= WorkOS::ApiKeys.new(self) - end - def multi_factor_auth @multi_factor_auth ||= WorkOS::MultiFactorAuth.new(self) end @@ -48,6 +44,10 @@ def organizations @organizations ||= WorkOS::Organizations.new(self) end + def api_keys + @api_keys ||= WorkOS::ApiKeys.new(self) + end + def groups @groups ||= WorkOS::Groups.new(self) end diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index 3a46e737..2d31504f 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -43,7 +43,7 @@ def complete_oauth2( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::ApplicationsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param organization_id [String, nil] Filter Connect Applications by organization ID. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 70e856d1..6e8a0a2a 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -14,7 +14,7 @@ def initialize(client) # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::DirectoriesOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param organization_id [String, nil] Filter Directories by their associated organization. # @param search [String, nil] Searchable text to match against Directory names. # @param domain [String, nil] (deprecated) Filter Directories by their associated domain. @@ -106,7 +106,7 @@ def delete_directory( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::DirectoryGroupsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param directory [String, nil] Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. # @param user [String, nil] Unique identifier of the WorkOS Directory User. This value can be obtained from the WorkOS API. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -177,7 +177,7 @@ def get_group( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::DirectoryUsersOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param directory [String, nil] Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. # @param group [String, nil] Unique identifier of the WorkOS Directory Group. This value can be obtained from the WorkOS API. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) diff --git a/lib/workos/directory_sync/directory_user.rb b/lib/workos/directory_sync/directory_user.rb index b3b06b43..e5c7d28e 100644 --- a/lib/workos/directory_sync/directory_user.rb +++ b/lib/workos/directory_sync/directory_user.rb @@ -13,6 +13,7 @@ class DirectoryUser < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -43,6 +44,7 @@ class DirectoryUser < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -88,6 +90,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb index b75d84fc..7bcbf7c0 100644 --- a/lib/workos/directory_sync/directory_user_with_groups.rb +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -13,6 +13,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -35,7 +36,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel # @!attribute raw_attributes # @deprecated The raw attributes received from the directory provider. # @!attribute groups - # @deprecated The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead. + # @deprecated The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships. attr_accessor \ :object, @@ -46,6 +47,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -98,6 +100,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserWithGroupsEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/directory_sync/dsync_user_updated_data.rb b/lib/workos/directory_sync/dsync_user_updated_data.rb index 8298a54c..55791806 100644 --- a/lib/workos/directory_sync/dsync_user_updated_data.rb +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -13,6 +13,7 @@ class DsyncUserUpdatedData < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -44,6 +45,7 @@ class DsyncUserUpdatedData < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -90,6 +92,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DsyncUserUpdatedDataEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/events.rb b/lib/workos/events.rb index fbe5f618..88ee43d7 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -14,7 +14,7 @@ def initialize(client) # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::EventsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param events [Array, nil] Filter events by one or more event types (e.g. `dsync.user.created`). # @param range_start [String, nil] ISO-8601 date string to filter events created after this date. # @param range_end [String, nil] ISO-8601 date string to filter events created before this date. diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index e1b1a195..ef397399 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -14,7 +14,7 @@ def initialize(client) # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::FeatureFlagsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_feature_flags( @@ -154,7 +154,7 @@ def remove_flag_target( # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::OrganizationsFeatureFlagsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_feature_flags( @@ -201,7 +201,7 @@ def list_organization_feature_flags( # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::UserManagementUsersFeatureFlagsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_feature_flags( diff --git a/lib/workos/groups.rb b/lib/workos/groups.rb index d506e1f9..398dcf91 100644 --- a/lib/workos/groups.rb +++ b/lib/workos/groups.rb @@ -15,7 +15,7 @@ def initialize(client) # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::GroupsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_groups( @@ -161,7 +161,7 @@ def delete_organization_group( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::GroupsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_group_organization_memberships( diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 59b66850..1d9c7d65 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -136,7 +136,7 @@ def challenge_factor( # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::UserManagementMultiFactorAuthenticationOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_auth_factors( diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index f886ded7..ff5ecf3b 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -14,7 +14,7 @@ def initialize(client) # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::OrganizationsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param domains [Array, nil] The domains of an Organization. Any Organization with a matching domain will be returned. # @param search [String, nil] Searchable text for an Organization. Matches against the organization name. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 6f71c5ed..81e8e7fe 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -14,7 +14,7 @@ def initialize(client) # @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. # @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. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::ConnectionsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param connection_type [WorkOS::Types::ConnectionsConnectionType, nil] Filter Connections by their type. # @param domain [String, nil] Filter Connections by their associated domain. # @param organization_id [String, nil] Filter Connections by their associated organization. diff --git a/lib/workos/sso/profile.rb b/lib/workos/sso/profile.rb index 39b3520c..ba35eeb5 100644 --- a/lib/workos/sso/profile.rb +++ b/lib/workos/sso/profile.rb @@ -14,6 +14,7 @@ class Profile < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, role: :role, roles: :roles, groups: :groups, @@ -31,6 +32,7 @@ class Profile < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :role, :roles, :groups, @@ -48,6 +50,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } @groups = hash[:groups] || [] diff --git a/lib/workos/types/authorization_order.rb b/lib/workos/types/authorization_order.rb deleted file mode 100644 index 76c3a7e4..00000000 --- a/lib/workos/types/authorization_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - AuthorizationOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/connections_order.rb b/lib/workos/types/connections_order.rb deleted file mode 100644 index 97175e72..00000000 --- a/lib/workos/types/connections_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - ConnectionsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directories_order.rb b/lib/workos/types/directories_order.rb deleted file mode 100644 index 4fc0eff0..00000000 --- a/lib/workos/types/directories_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoriesOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directory_groups_order.rb b/lib/workos/types/directory_groups_order.rb deleted file mode 100644 index 1cc006ec..00000000 --- a/lib/workos/types/directory_groups_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoryGroupsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directory_users_order.rb b/lib/workos/types/directory_users_order.rb deleted file mode 100644 index 37052177..00000000 --- a/lib/workos/types/directory_users_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoryUsersOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/event_context_actor_source.rb b/lib/workos/types/event_context_actor_source.rb index 8ba757fa..d49ea597 100644 --- a/lib/workos/types/event_context_actor_source.rb +++ b/lib/workos/types/event_context_actor_source.rb @@ -7,8 +7,9 @@ module Types class EventContextActorSource API = "api" DASHBOARD = "dashboard" + ADMIN_PORTAL = "admin_portal" SYSTEM = "system" - ALL = [API, DASHBOARD, SYSTEM].freeze + ALL = [API, DASHBOARD, ADMIN_PORTAL, SYSTEM].freeze end end end diff --git a/lib/workos/types/feature_flags_order.rb b/lib/workos/types/feature_flags_order.rb deleted file mode 100644 index c66da69e..00000000 --- a/lib/workos/types/feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - FeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_api_keys_order.rb b/lib/workos/types/organizations_api_keys_order.rb deleted file mode 100644 index 01c79f57..00000000 --- a/lib/workos/types/organizations_api_keys_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsApiKeysOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_feature_flags_order.rb b/lib/workos/types/organizations_feature_flags_order.rb deleted file mode 100644 index d7e5414e..00000000 --- a/lib/workos/types/organizations_feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsFeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_order.rb b/lib/workos/types/organizations_order.rb deleted file mode 100644 index 38fad388..00000000 --- a/lib/workos/types/organizations_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/applications_order.rb b/lib/workos/types/pagination_order.rb similarity index 89% rename from lib/workos/types/applications_order.rb rename to lib/workos/types/pagination_order.rb index 779a57ee..b85f0705 100644 --- a/lib/workos/types/applications_order.rb +++ b/lib/workos/types/pagination_order.rb @@ -4,7 +4,7 @@ module WorkOS module Types - class ApplicationsOrder + class PaginationOrder NORMAL = "normal" DESC = "desc" ASC = "asc" diff --git a/lib/workos/types/permissions_order.rb b/lib/workos/types/permissions_order.rb deleted file mode 100644 index a55d8a97..00000000 --- a/lib/workos/types/permissions_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - PermissionsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_invitations_order.rb b/lib/workos/types/user_management_invitations_order.rb deleted file mode 100644 index 59339740..00000000 --- a/lib/workos/types/user_management_invitations_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementInvitationsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_multi_factor_authentication_order.rb b/lib/workos/types/user_management_multi_factor_authentication_order.rb deleted file mode 100644 index 32948f79..00000000 --- a/lib/workos/types/user_management_multi_factor_authentication_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementMultiFactorAuthenticationOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_organization_membership_groups_order.rb b/lib/workos/types/user_management_organization_membership_groups_order.rb deleted file mode 100644 index 5b8749cf..00000000 --- a/lib/workos/types/user_management_organization_membership_groups_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementOrganizationMembershipGroupsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_organization_membership_order.rb b/lib/workos/types/user_management_organization_membership_order.rb deleted file mode 100644 index 54b5bc4c..00000000 --- a/lib/workos/types/user_management_organization_membership_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementOrganizationMembershipOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_users_authorized_applications_order.rb b/lib/workos/types/user_management_users_authorized_applications_order.rb deleted file mode 100644 index e3b383f3..00000000 --- a/lib/workos/types/user_management_users_authorized_applications_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementUsersAuthorizedApplicationsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_users_feature_flags_order.rb b/lib/workos/types/user_management_users_feature_flags_order.rb deleted file mode 100644 index 8ab6a151..00000000 --- a/lib/workos/types/user_management_users_feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementUsersFeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_users_order.rb b/lib/workos/types/user_management_users_order.rb deleted file mode 100644 index 6caafaf0..00000000 --- a/lib/workos/types/user_management_users_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementUsersOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb b/lib/workos/types/vault_byok_key_provider.rb similarity index 82% rename from lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb rename to lib/workos/types/vault_byok_key_provider.rb index f50670b3..7061c81f 100644 --- a/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb +++ b/lib/workos/types/vault_byok_key_provider.rb @@ -4,7 +4,7 @@ module WorkOS module Types - class VaultByokKeyVerificationCompletedDataKeyProvider + class VaultByokKeyProvider AWS_KMS = "AWS_KMS" GCP_KMS = "GCP_KMS" AZURE_KEY_VAULT = "AZURE_KEY_VAULT" diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index b76145fa..799375ab 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -580,7 +580,7 @@ def get_password_reset( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`. # @param organization_id [String, nil] Filter users by the organization they are a member of. # @param email [String, nil] Filter users by their email address. @@ -911,7 +911,7 @@ def get_user_identities( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_sessions( @@ -957,7 +957,7 @@ def list_sessions( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. # @param email [String, nil] The email address of the recipient. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -1144,6 +1144,21 @@ def revoke_invitation( result end + # Get JWT template + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::JWTTemplateResponse] + def list_jwt_template(request_options: {}) + response = @client.request( + method: :get, + path: "/user_management/jwt_template", + auth: true, + request_options: request_options + ) + result = WorkOS::JWTTemplateResponse.new(response.body) + 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"]) + result + end + # Update JWT template # @param content [String] The JWT template content as a Liquid template string. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -1216,7 +1231,7 @@ def get_magic_auth( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. # @param statuses [Array, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user). @@ -1441,7 +1456,7 @@ def create_redirect_uri( # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_authorized_applications( @@ -1502,6 +1517,88 @@ def delete_user_authorized_application( nil end + # List API keys for a user + # @param user_id [String] Unique identifier of the user. + # @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. + # @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. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. + # @param organization_id [String, nil] The ID of the organization to filter user API keys by. When provided, only API keys created against that organization membership are returned. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_user_api_keys( + user_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + organization_id: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id + }.compact + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_user_api_keys( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserApiKey, + filters: {user_id: user_id, before: before, limit: limit, order: order, organization_id: organization_id}, + fetch_next: fetch_next + ) + end + + # Create an API key for a user + # @param user_id [String] Unique identifier of the user. + # @param name [String] A descriptive name for the API key. + # @param organization_id [String] The ID of the organization the user API key is associated with. The user must have an active membership in this organization. + # @param permissions [Array, nil] The permission slugs to assign to the API key. Each permission must be enabled for user API keys. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::UserApiKeyWithValue] + def create_user_api_key( + user_id:, + name:, + organization_id:, + permissions: nil, + request_options: {} + ) + body = { + "name" => name, + "organization_id" => organization_id, + "permissions" => permissions + }.compact + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::UserApiKeyWithValue.new(response.body) + 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"]) + result + end + # @oagen-ignore-start — non-spec helpers (hand-maintained) # H13 — Build the JWKS URL for a given client_id (no HTTP call). # Pair with #get_jwks (generated) to fetch the keyset. diff --git a/lib/workos/user_management/create_user_api_key.rb b/lib/workos/user_management/create_user_api_key.rb new file mode 100644 index 00000000..17cf44f5 --- /dev/null +++ b/lib/workos/user_management/create_user_api_key.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateUserApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + organization_id: :organization_id, + permissions: :permissions + }.freeze + + attr_accessor \ + :name, + :organization_id, + :permissions + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @organization_id = hash[:organization_id] + @permissions = hash[:permissions] || [] + end + end +end diff --git a/lib/workos/user_management/organization_membership.rb b/lib/workos/user_management/organization_membership.rb index e2d9cf95..e73f24f3 100644 --- a/lib/workos/user_management/organization_membership.rb +++ b/lib/workos/user_management/organization_membership.rb @@ -15,7 +15,8 @@ class OrganizationMembership < WorkOS::Types::BaseModel custom_attributes: :custom_attributes, created_at: :created_at, updated_at: :updated_at, - role: :role + role: :role, + user: :user }.freeze attr_accessor \ @@ -29,7 +30,8 @@ class OrganizationMembership < WorkOS::Types::BaseModel :custom_attributes, :created_at, :updated_at, - :role + :role, + :user def initialize(json) hash = self.class.normalize(json) @@ -44,6 +46,7 @@ def initialize(json) @created_at = hash[:created_at] @updated_at = hash[:updated_at] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/user_management/user_api_key.rb b/lib/workos/user_management/user_api_key.rb new file mode 100644 index 00000000..cd68aec5 --- /dev/null +++ b/lib/workos/user_management/user_api_key.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::UserApiKeyOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/user_api_key_created_data_owner.rb b/lib/workos/user_management/user_api_key_created_data_owner.rb new file mode 100644 index 00000000..d1e1d25b --- /dev/null +++ b/lib/workos/user_management/user_api_key_created_data_owner.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserApiKeyCreatedDataOwner < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + id: :id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :type, + :id, + :organization_id + + def initialize(json) + hash = self.class.normalize(json) + @type = hash[:type] + @id = hash[:id] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/types/webhooks_order.rb b/lib/workos/user_management/user_api_key_revoked_data_owner.rb similarity index 63% rename from lib/workos/types/webhooks_order.rb rename to lib/workos/user_management/user_api_key_revoked_data_owner.rb index 955368cd..6482c3cc 100644 --- a/lib/workos/types/webhooks_order.rb +++ b/lib/workos/user_management/user_api_key_revoked_data_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - WebhooksOrder = ApplicationsOrder - end + UserApiKeyRevokedDataOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/api_keys/api_key_with_value.rb b/lib/workos/user_management/user_api_key_with_value.rb similarity index 87% rename from lib/workos/api_keys/api_key_with_value.rb rename to lib/workos/user_management/user_api_key_with_value.rb index 196bcce0..6016ae72 100644 --- a/lib/workos/api_keys/api_key_with_value.rb +++ b/lib/workos/user_management/user_api_key_with_value.rb @@ -3,7 +3,7 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class ApiKeyWithValue < WorkOS::Types::BaseModel + class UserApiKeyWithValue < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -33,7 +33,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyWithValueOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? WorkOS::UserApiKeyWithValueOwner.new(hash[:owner]) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/types/groups_order.rb b/lib/workos/user_management/user_api_key_with_value_owner.rb similarity index 64% rename from lib/workos/types/groups_order.rb rename to lib/workos/user_management/user_api_key_with_value_owner.rb index a000ce31..5c506d62 100644 --- a/lib/workos/types/groups_order.rb +++ b/lib/workos/user_management/user_api_key_with_value_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - GroupsOrder = ApplicationsOrder - end + UserApiKeyWithValueOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/user_management/user_organization_membership.rb b/lib/workos/user_management/user_organization_membership.rb index ff127f31..22a8b2fb 100644 --- a/lib/workos/user_management/user_organization_membership.rb +++ b/lib/workos/user_management/user_organization_membership.rb @@ -15,7 +15,8 @@ class UserOrganizationMembership < WorkOS::Types::BaseModel custom_attributes: :custom_attributes, created_at: :created_at, updated_at: :updated_at, - role: :role + role: :role, + user: :user }.freeze attr_accessor \ @@ -29,7 +30,8 @@ class UserOrganizationMembership < WorkOS::Types::BaseModel :custom_attributes, :created_at, :updated_at, - :role + :role, + :user def initialize(json) hash = self.class.normalize(json) @@ -44,6 +46,7 @@ def initialize(json) @created_at = hash[:created_at] @updated_at = hash[:updated_at] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/user_management_organization_membership_groups.rb b/lib/workos/user_management_organization_membership_groups.rb index ddecd12c..9d20678b 100644 --- a/lib/workos/user_management_organization_membership_groups.rb +++ b/lib/workos/user_management_organization_membership_groups.rb @@ -15,7 +15,7 @@ def initialize(client) # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::UserManagementOrganizationMembershipGroupsOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_membership_groups( diff --git a/lib/workos/vault/vault_byok_key_deleted.rb b/lib/workos/vault/vault_byok_key_deleted.rb new file mode 100644 index 00000000..8ad39249 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyDeleted < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = self.class.normalize(json) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultByokKeyDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_byok_key_deleted_data.rb b/lib/workos/vault/vault_byok_key_deleted_data.rb new file mode 100644 index 00000000..9c3a51f9 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_deleted_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyDeletedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_id: :organization_id, + key_provider: :key_provider + }.freeze + + attr_accessor \ + :organization_id, + :key_provider + + def initialize(json) + hash = self.class.normalize(json) + @organization_id = hash[:organization_id] + @key_provider = hash[:key_provider] + end + end +end diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index 8b86d12c..b5dd3ad5 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -14,7 +14,7 @@ def initialize(client) # @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"`. # @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"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. - # @param order [WorkOS::Types::WebhooksOrder, 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. + # @param order [WorkOS::Types::PaginationOrder, 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. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_webhook_endpoints( diff --git a/rbi/workos/api_key.rbi b/rbi/workos/api_key.rbi index 1a91ee61..016787a3 100644 --- a/rbi/workos/api_key.rbi +++ b/rbi/workos/api_key.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyOwner) } + sig { returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyOwner).returns(WorkOS::ApiKeyOwner) } + sig { params(value: T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)).returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_key_created_data.rbi b/rbi/workos/api_key_created_data.rbi index dfab3a6f..b676aada 100644 --- a/rbi/workos/api_key_created_data.rbi +++ b/rbi/workos/api_key_created_data.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyCreatedDataOwner) } + sig { returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyCreatedDataOwner).returns(WorkOS::ApiKeyCreatedDataOwner) } + sig { params(value: T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)).returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_key_revoked_data.rbi b/rbi/workos/api_key_revoked_data.rbi index 2fe10d3a..ffb02ca8 100644 --- a/rbi/workos/api_key_revoked_data.rbi +++ b/rbi/workos/api_key_revoked_data.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyRevokedDataOwner) } + sig { returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyRevokedDataOwner).returns(WorkOS::ApiKeyRevokedDataOwner) } + sig { params(value: T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)).returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_keys.rbi b/rbi/workos/api_keys.rbi index 059df93a..ae85f013 100644 --- a/rbi/workos/api_keys.rbi +++ b/rbi/workos/api_keys.rbi @@ -9,22 +9,6 @@ module WorkOS sig { params(client: WorkOS::BaseClient).void } def initialize(client); end - sig do - params( - value: String, - request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ApiKeyValidationResponse) - end - def create_validation(value:, request_options:); end - - sig do - params( - id: String, - request_options: T::Hash[Symbol, T.untyped] - ).returns(NilClass) - end - def delete_api_key(id:, request_options:); end - sig do params( organization_id: String, @@ -43,9 +27,25 @@ module WorkOS name: String, permissions: T.nilable(T::Array[String]), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ApiKeyWithValue) + ).returns(WorkOS::OrganizationApiKeyWithValue) end def create_organization_api_key(organization_id:, name:, permissions:, request_options:); end + sig do + params( + value: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ApiKeyValidationResponse) + end + def create_validation(value:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_api_key(id:, request_options:); end + end end diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi index 5e4eea64..6d2d35e0 100644 --- a/rbi/workos/authorization.rbi +++ b/rbi/workos/authorization.rbi @@ -162,7 +162,7 @@ module WorkOS role_slug: String, resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::RoleAssignment) + ).returns(WorkOS::UserRoleAssignment) end def assign_role(organization_membership_id:, role_slug:, resource_target:, request_options:); end @@ -313,6 +313,20 @@ module WorkOS end def list_memberships_for_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + sig do + params( + organization_id: String, + resource_type_slug: String, + external_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_role_assignments_for_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, before:, after:, limit:, order:, request_options:); end + sig do params( before: T.nilable(String), @@ -384,6 +398,18 @@ module WorkOS end def list_memberships_for_resource(resource_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + sig do + params( + resource_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_role_assignments_for_resource(resource_id:, before:, after:, limit:, order:, request_options:); end + sig do params( request_options: T::Hash[Symbol, T.untyped] diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi index ca3c8bc1..d2cf6514 100644 --- a/rbi/workos/client.rbi +++ b/rbi/workos/client.rbi @@ -6,9 +6,6 @@ module WorkOS class Client < BaseClient - sig { returns(WorkOS::ApiKeys) } - def api_keys; end - sig { returns(WorkOS::MultiFactorAuth) } def multi_factor_auth; end @@ -42,6 +39,9 @@ module WorkOS sig { returns(WorkOS::AuditLogs) } def audit_logs; end + sig { returns(WorkOS::ApiKeys) } + def api_keys; end + sig { returns(WorkOS::Groups) } def groups; end diff --git a/rbi/workos/create_user_api_key.rbi b/rbi/workos/create_user_api_key.rbi new file mode 100644 index 00000000..6186a001 --- /dev/null +++ b/rbi/workos/create_user_api_key.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateUserApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def permissions=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_user.rbi b/rbi/workos/directory_user.rbi index baaaaa95..a0e65e9a 100644 --- a/rbi/workos/directory_user.rbi +++ b/rbi/workos/directory_user.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(value); end + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + sig { returns(T.nilable(T::Array[WorkOS::DirectoryUserEmail])) } def emails; end diff --git a/rbi/workos/directory_user_with_groups.rbi b/rbi/workos/directory_user_with_groups.rbi index 55fba4d7..61bddd7b 100644 --- a/rbi/workos/directory_user_with_groups.rbi +++ b/rbi/workos/directory_user_with_groups.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(value); end + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + sig { returns(T.nilable(T::Array[WorkOS::DirectoryUserWithGroupsEmail])) } def emails; end diff --git a/rbi/workos/dsync_user_updated_data.rbi b/rbi/workos/dsync_user_updated_data.rbi index a96b6925..f1d26b09 100644 --- a/rbi/workos/dsync_user_updated_data.rbi +++ b/rbi/workos/dsync_user_updated_data.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(value); end + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + sig { returns(T.nilable(T::Array[WorkOS::DsyncUserUpdatedDataEmail])) } def emails; end diff --git a/rbi/workos/organization_api_key.rbi b/rbi/workos/organization_api_key.rbi new file mode 100644 index 00000000..c2413b53 --- /dev/null +++ b/rbi/workos/organization_api_key.rbi @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::OrganizationApiKeyOwner) } + def owner; end + + sig { params(value: WorkOS::OrganizationApiKeyOwner).returns(WorkOS::OrganizationApiKeyOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_with_value_owner.rbi b/rbi/workos/organization_api_key_owner.rbi similarity index 95% rename from rbi/workos/api_key_with_value_owner.rbi rename to rbi/workos/organization_api_key_owner.rbi index 4dcca49b..00ddb120 100644 --- a/rbi/workos/api_key_with_value_owner.rbi +++ b/rbi/workos/organization_api_key_owner.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class ApiKeyWithValueOwner + class OrganizationApiKeyOwner sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end diff --git a/rbi/workos/organization_api_key_with_value.rbi b/rbi/workos/organization_api_key_with_value.rbi new file mode 100644 index 00000000..ddf7c6a1 --- /dev/null +++ b/rbi/workos/organization_api_key_with_value.rbi @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKeyWithValue + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::OrganizationApiKeyWithValueOwner) } + def owner; end + + sig { params(value: WorkOS::OrganizationApiKeyWithValueOwner).returns(WorkOS::OrganizationApiKeyWithValueOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def value; end + + sig { params(value: String).returns(String) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_api_key_with_value_owner.rbi b/rbi/workos/organization_api_key_with_value_owner.rbi new file mode 100644 index 00000000..3a470243 --- /dev/null +++ b/rbi/workos/organization_api_key_with_value_owner.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKeyWithValueOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership.rbi b/rbi/workos/organization_membership.rbi index f51180a2..90776d84 100644 --- a/rbi/workos/organization_membership.rbi +++ b/rbi/workos/organization_membership.rbi @@ -75,6 +75,12 @@ module WorkOS sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); end + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/profile.rbi b/rbi/workos/profile.rbi index fc021e14..d2ff5e40 100644 --- a/rbi/workos/profile.rbi +++ b/rbi/workos/profile.rbi @@ -63,6 +63,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(value); end + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + sig { returns(T.nilable(WorkOS::SlimRole)) } def role; end diff --git a/rbi/workos/user_api_key.rbi b/rbi/workos/user_api_key.rbi new file mode 100644 index 00000000..3da15af1 --- /dev/null +++ b/rbi/workos/user_api_key.rbi @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::UserApiKeyOwner) } + def owner; end + + sig { params(value: WorkOS::UserApiKeyOwner).returns(WorkOS::UserApiKeyOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_api_key_created_data_owner.rbi b/rbi/workos/user_api_key_created_data_owner.rbi new file mode 100644 index 00000000..fce87524 --- /dev/null +++ b/rbi/workos/user_api_key_created_data_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyCreatedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_api_key_owner.rbi b/rbi/workos/user_api_key_owner.rbi new file mode 100644 index 00000000..272e6d62 --- /dev/null +++ b/rbi/workos/user_api_key_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_api_key_revoked_data_owner.rbi b/rbi/workos/user_api_key_revoked_data_owner.rbi new file mode 100644 index 00000000..944e5f15 --- /dev/null +++ b/rbi/workos/user_api_key_revoked_data_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyRevokedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_with_value.rbi b/rbi/workos/user_api_key_with_value.rbi similarity index 90% rename from rbi/workos/api_key_with_value.rbi rename to rbi/workos/user_api_key_with_value.rbi index 6519584f..66c5296e 100644 --- a/rbi/workos/api_key_with_value.rbi +++ b/rbi/workos/user_api_key_with_value.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class ApiKeyWithValue + class UserApiKeyWithValue sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyWithValueOwner) } + sig { returns(WorkOS::UserApiKeyWithValueOwner) } def owner; end - sig { params(value: WorkOS::ApiKeyWithValueOwner).returns(WorkOS::ApiKeyWithValueOwner) } + sig { params(value: WorkOS::UserApiKeyWithValueOwner).returns(WorkOS::UserApiKeyWithValueOwner) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/user_api_key_with_value_owner.rbi b/rbi/workos/user_api_key_with_value_owner.rbi new file mode 100644 index 00000000..1f1b7566 --- /dev/null +++ b/rbi/workos/user_api_key_with_value_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyWithValueOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_management.rbi b/rbi/workos/user_management.rbi index 2d2c0bca..c0e19532 100644 --- a/rbi/workos/user_management.rbi +++ b/rbi/workos/user_management.rbi @@ -333,6 +333,13 @@ module WorkOS end def revoke_invitation(id:, request_options:); end + sig do + params( + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::JWTTemplateResponse) + end + def list_jwt_template(request_options:); end + sig do params( content: String, @@ -452,5 +459,29 @@ module WorkOS end def delete_user_authorized_application(application_id:, user_id:, request_options:); end + sig do + params( + user_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_user_api_keys(user_id:, before:, after:, limit:, order:, organization_id:, request_options:); end + + sig do + params( + user_id: String, + name: String, + organization_id: String, + permissions: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserApiKeyWithValue) + end + def create_user_api_key(user_id:, name:, organization_id:, permissions:, request_options:); end + end end diff --git a/rbi/workos/user_organization_membership.rbi b/rbi/workos/user_organization_membership.rbi index 5ebf5d51..06990a12 100644 --- a/rbi/workos/user_organization_membership.rbi +++ b/rbi/workos/user_organization_membership.rbi @@ -75,6 +75,12 @@ module WorkOS sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); end + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/user_organization_membership_base_list_data.rbi b/rbi/workos/user_organization_membership_base_list_data.rbi index 33d6d634..d720fe76 100644 --- a/rbi/workos/user_organization_membership_base_list_data.rbi +++ b/rbi/workos/user_organization_membership_base_list_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: String).returns(String) } def updated_at=(value); end + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/role_assignment.rbi b/rbi/workos/user_role_assignment.rbi similarity index 75% rename from rbi/workos/role_assignment.rbi rename to rbi/workos/user_role_assignment.rbi index a5f17a46..2e6c4882 100644 --- a/rbi/workos/role_assignment.rbi +++ b/rbi/workos/user_role_assignment.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class RoleAssignment + class UserRoleAssignment sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end @@ -21,16 +21,22 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end + sig { returns(String) } + def organization_membership_id; end + + sig { params(value: String).returns(String) } + def organization_membership_id=(value); end + sig { returns(WorkOS::SlimRole) } def role; end sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); end - sig { returns(WorkOS::RoleAssignmentResource) } + sig { returns(WorkOS::UserRoleAssignmentResource) } def resource; end - sig { params(value: WorkOS::RoleAssignmentResource).returns(WorkOS::RoleAssignmentResource) } + sig { params(value: WorkOS::UserRoleAssignmentResource).returns(WorkOS::UserRoleAssignmentResource) } def resource=(value); end sig { returns(String) } diff --git a/rbi/workos/role_assignment_resource.rbi b/rbi/workos/user_role_assignment_resource.rbi similarity index 95% rename from rbi/workos/role_assignment_resource.rbi rename to rbi/workos/user_role_assignment_resource.rbi index cce0558b..0cff34c4 100644 --- a/rbi/workos/role_assignment_resource.rbi +++ b/rbi/workos/user_role_assignment_resource.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class RoleAssignmentResource + class UserRoleAssignmentResource sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end diff --git a/rbi/workos/vault_byok_key_deleted.rbi b/rbi/workos/vault_byok_key_deleted.rbi new file mode 100644 index 00000000..c82e4f2d --- /dev/null +++ b/rbi/workos/vault_byok_key_deleted.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultByokKeyDeletedData) } + def data; end + + sig { params(value: WorkOS::VaultByokKeyDeletedData).returns(WorkOS::VaultByokKeyDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_byok_key_deleted_data.rbi b/rbi/workos/vault_byok_key_deleted_data.rbi new file mode 100644 index 00000000..37dff254 --- /dev/null +++ b/rbi/workos/vault_byok_key_deleted_data.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def key_provider; end + + sig { params(value: String).returns(String) } + def key_provider=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/test/workos/test_api_keys.rb b/test/workos/test_api_keys.rb index 0e3737f2..f2695f69 100644 --- a/test/workos/test_api_keys.rb +++ b/test/workos/test_api_keys.rb @@ -11,20 +11,6 @@ def setup @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_create_validation_returns_expected_result - stub_request(:post, %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.api_keys.create_validation(value: "stub") - refute_nil result - end - - def test_delete_api_key_returns_expected_result - stub_request(:delete, %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.api_keys.delete_api_key(id: "stub") - assert_nil result - end - def test_list_organization_api_keys_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) @@ -39,12 +25,26 @@ def test_create_organization_api_key_returns_expected_result refute_nil result end + def test_create_validation_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.api_keys.create_validation(value: "stub") + refute_nil result + end + + def test_delete_api_key_returns_expected_result + stub_request(:delete, %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.api_keys.delete_api_key(id: "stub") + assert_nil result + end + # Parameterized authentication error tests (one per endpoint). [ - {name: :create_validation, verb: :post, url: %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}, args: {value: "stub"}}, - {name: :delete_api_key, verb: :delete, url: %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}, args: {id: "stub"}}, {name: :list_organization_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub"}}, - {name: :create_organization_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub", name: "stub"}} + {name: :create_organization_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub", name: "stub"}}, + {name: :create_validation, verb: :post, url: %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}, args: {value: "stub"}}, + {name: :delete_api_key, verb: :delete, url: %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}, args: {id: "stub"}} ].each do |spec| define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do stub_request(spec[:verb], spec[:url]) diff --git a/test/workos/test_authorization.rb b/test/workos/test_authorization.rb index 56de8137..3f074b6c 100644 --- a/test/workos/test_authorization.rb +++ b/test/workos/test_authorization.rb @@ -192,6 +192,13 @@ def test_list_memberships_for_resource_by_external_id_returns_expected_result assert_kind_of WorkOS::Types::ListStruct, result end + def test_list_role_assignments_for_resource_by_external_id_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/role_assignments(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_role_assignments_for_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + def test_list_resources_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) @@ -259,6 +266,13 @@ def test_list_memberships_for_resource_returns_expected_result assert_kind_of WorkOS::Types::ListStruct, result end + def test_list_role_assignments_for_resource_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources/stub/role_assignments(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_role_assignments_for_resource(resource_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + def test_list_environment_roles_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}) .to_return(body: "{}", status: 200) @@ -358,12 +372,14 @@ def test_delete_permission_returns_expected_result {name: :update_resource_by_external_id, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :delete_resource_by_external_id, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, {name: :list_memberships_for_resource_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/organization_memberships(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub"}}, + {name: :list_role_assignments_for_resource_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/role_assignments(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, {name: :list_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}, args: {parent: WorkOS::Authorization::ParentById.new(parent_resource_id: "stub")}}, {name: :create_resource, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}, args: {external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :get_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}}, {name: :update_resource, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :delete_resource, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}}, {name: :list_memberships_for_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub/organization_memberships(\?|\z)}, args: {resource_id: "stub", permission_slug: "stub"}}, + {name: :list_role_assignments_for_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub/role_assignments(\?|\z)}, args: {resource_id: "stub"}}, {name: :list_environment_roles, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}}, {name: :create_environment_role, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}, args: {slug: "stub", name: "stub"}}, {name: :get_environment_role, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub(\?|\z)}, args: {slug: "stub"}}, diff --git a/test/workos/test_model_round_trip.rb b/test/workos/test_model_round_trip.rb index b5b481c7..1df43396 100644 --- a/test/workos/test_model_round_trip.rb +++ b/test/workos/test_model_round_trip.rb @@ -709,6 +709,20 @@ def test_update_user_organization_membership_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_create_user_api_key_round_trip + fixture = { + "name" => "stub", + "organization_id" => "stub", + "permissions" => [] + } + model = WorkOS::CreateUserApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_create_user_round_trip fixture = { "email" => "stub", @@ -1183,19 +1197,21 @@ def test_slim_role_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_role_assignment_round_trip + def test_user_role_assignment_round_trip fixture = { "object" => "role_assignment", "id" => "stub", + "organization_membership_id" => "stub", "role" => {}, "resource" => {}, "created_at" => "stub", "updated_at" => "stub" } - model = WorkOS::RoleAssignment.new(fixture.to_json) + model = WorkOS::UserRoleAssignment.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_membership_id"], json[:organization_membership_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } @@ -1238,6 +1254,38 @@ def test_role_list_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_round_trip + fixture = { + "object" => "user", + "id" => "stub", + "first_name" => nil, + "last_name" => nil, + "profile_picture_url" => nil, + "email" => "stub", + "email_verified" => true, + "external_id" => nil, + "metadata" => {}, + "last_sign_in_at" => nil, + "locale" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::User.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:first_name] + assert_nil json[:last_name] + assert_nil json[:profile_picture_url] + assert_equal fixture["email"], json[:email] + assert_equal fixture["email_verified"], json[:email_verified] + assert_nil json[:external_id] + assert_nil json[:last_sign_in_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_connection_round_trip fixture = { "object" => "connection", @@ -1341,6 +1389,7 @@ def test_directory_user_with_groups_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -1427,6 +1476,7 @@ def test_directory_user_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -1451,38 +1501,6 @@ def test_directory_user_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_user_round_trip - fixture = { - "object" => "user", - "id" => "stub", - "first_name" => nil, - "last_name" => nil, - "profile_picture_url" => nil, - "email" => "stub", - "email_verified" => true, - "external_id" => nil, - "metadata" => {}, - "last_sign_in_at" => nil, - "locale" => nil, - "created_at" => "stub", - "updated_at" => "stub" - } - model = WorkOS::User.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_nil json[:first_name] - assert_nil json[:last_name] - assert_nil json[:profile_picture_url] - assert_equal fixture["email"], json[:email] - assert_equal fixture["email_verified"], json[:email_verified] - assert_nil json[:external_id] - assert_nil json[:last_sign_in_at] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - def test_waitlist_user_round_trip fixture = { "object" => "waitlist_user", @@ -1657,6 +1675,20 @@ def test_api_key_created_data_owner_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_created_data_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyCreatedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_api_key_revoked_round_trip fixture = { "id" => "stub", @@ -1710,6 +1742,20 @@ def test_api_key_revoked_data_owner_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_revoked_data_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyRevokedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_authentication_email_verification_failed_round_trip fixture = { "id" => "stub", @@ -3109,6 +3155,7 @@ def test_dsync_user_updated_data_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -5161,6 +5208,35 @@ def test_user_updated_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_vault_byok_key_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "vault.byok_key.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultByokKeyDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_vault_byok_key_deleted_data_round_trip + fixture = { + "organization_id" => "stub", + "key_provider" => "stub" + } + model = WorkOS::VaultByokKeyDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_vault_byok_key_verification_completed_round_trip fixture = { "id" => "stub", @@ -5548,22 +5624,6 @@ def test_waitlist_user_denied_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_jwt_template_response_round_trip - fixture = { - "object" => "jwt_template", - "content" => "stub", - "created_at" => "stub", - "updated_at" => "stub" - } - model = WorkOS::JWTTemplateResponse.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["content"], json[:content] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - def test_organization_domain_stand_alone_round_trip fixture = { "object" => "organization_domain", @@ -5616,7 +5676,31 @@ def test_flag_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_api_key_with_value_round_trip + def test_organization_api_key_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_organization_api_key_with_value_round_trip fixture = { "object" => "api_key", "id" => "stub", @@ -5629,7 +5713,7 @@ def test_api_key_with_value_round_trip "updated_at" => "stub", "value" => "stub" } - model = WorkOS::ApiKeyWithValue.new(fixture.to_json) + model = WorkOS::OrganizationApiKeyWithValue.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -5879,7 +5963,8 @@ def test_user_organization_membership_round_trip "custom_attributes" => {}, "created_at" => "stub", "updated_at" => "stub", - "role" => {} + "role" => {}, + "user" => {} } model = WorkOS::UserOrganizationMembership.new(fixture.to_json) json = model.to_h @@ -5893,6 +5978,56 @@ def test_user_organization_membership_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::UserApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_user_api_key_with_value_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub", + "value" => "stub" + } + model = WorkOS::UserApiKeyWithValue.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["value"], json[:value] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_email_verification_round_trip fixture = { "object" => "email_verification", @@ -6081,6 +6216,7 @@ def test_profile_round_trip "email" => "stub", "first_name" => nil, "last_name" => nil, + "name" => nil, "role" => nil, "roles" => nil, "groups" => [], @@ -6097,6 +6233,7 @@ def test_profile_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + assert_nil json[:name] fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end @@ -6139,6 +6276,22 @@ def test_jwks_response_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_jwt_template_response_round_trip + fixture = { + "object" => "jwt_template", + "content" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::JWTTemplateResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["content"], json[:content] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_jwks_response_keys_round_trip fixture = { "alg" => "RS256", @@ -6209,6 +6362,34 @@ def test_authenticate_response_oauth_token_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_with_value_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyWithValueOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_user_api_key_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_data_integrations_list_response_data_round_trip fixture = { "object" => "data_provider", @@ -6295,12 +6476,24 @@ def test_organization_domain_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_api_key_with_value_owner_round_trip + def test_organization_api_key_with_value_owner_round_trip fixture = { "type" => "organization", "id" => "stub" } - model = WorkOS::ApiKeyWithValueOwner.new(fixture.to_json) + model = WorkOS::OrganizationApiKeyWithValueOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_organization_api_key_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::OrganizationApiKeyOwner.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -6358,6 +6551,32 @@ def test_event_context_google_analytics_session_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_organization_membership_base_list_data_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "directory_managed" => true, + "organization_name" => "stub", + "custom_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub", + "user" => {} + } + model = WorkOS::UserOrganizationMembershipBaseListData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_directory_user_with_groups_email_round_trip fixture = { "primary" => true, @@ -6407,38 +6626,13 @@ def test_connection_option_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_user_organization_membership_base_list_data_round_trip - fixture = { - "object" => "organization_membership", - "id" => "stub", - "user_id" => "stub", - "organization_id" => "stub", - "status" => "stub", - "directory_managed" => true, - "organization_name" => "stub", - "custom_attributes" => {}, - "created_at" => "stub", - "updated_at" => "stub" - } - model = WorkOS::UserOrganizationMembershipBaseListData.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_equal fixture["user_id"], json[:user_id] - assert_equal fixture["organization_id"], json[:organization_id] - assert_equal fixture["directory_managed"], json[:directory_managed] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_role_assignment_resource_round_trip + def test_user_role_assignment_resource_round_trip fixture = { "id" => "stub", "external_id" => "stub", "resource_type_slug" => "stub" } - model = WorkOS::RoleAssignmentResource.new(fixture.to_json) + model = WorkOS::UserRoleAssignmentResource.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -6990,7 +7184,8 @@ def test_organization_membership_round_trip "custom_attributes" => {}, "created_at" => "stub", "updated_at" => "stub", - "role" => {} + "role" => {}, + "user" => {} } model = WorkOS::OrganizationMembership.new(fixture.to_json) json = model.to_h diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb index f2520e0b..b2aebf55 100644 --- a/test/workos/test_user_management.rb +++ b/test/workos/test_user_management.rb @@ -345,6 +345,13 @@ def test_revoke_invitation_returns_expected_result refute_nil result end + def test_list_jwt_template_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.user_management.list_jwt_template + refute_nil result + end + def test_update_jwt_template_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}) .to_return(body: "{}", status: 200) @@ -454,6 +461,20 @@ def test_delete_user_authorized_application_returns_expected_result assert_nil result end + def test_list_user_api_keys_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_user_api_keys(user_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_create_user_api_key_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_user_api_key(user_id: "stub", name: "stub", organization_id: "stub") + refute_nil result + end + # Parameterized authentication error tests (one per endpoint). [ {name: :get_jwks, verb: :get, url: %r{\Ahttps://api\.workos\.com/sso/jwks/stub(\?|\z)}, args: {client_id: "stub"}}, @@ -484,6 +505,7 @@ def test_delete_user_authorized_application_returns_expected_result {name: :accept_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/accept(\?|\z)}, args: {id: "stub"}}, {name: :resend_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/resend(\?|\z)}, args: {id: "stub"}}, {name: :revoke_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/revoke(\?|\z)}, args: {id: "stub"}}, + {name: :list_jwt_template, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}}, {name: :update_jwt_template, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}, args: {content: "stub"}}, {name: :create_magic_auth, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth(\?|\z)}, args: {email: "stub"}}, {name: :get_magic_auth, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth/stub(\?|\z)}, args: {id: "stub"}}, @@ -496,7 +518,9 @@ def test_delete_user_authorized_application_returns_expected_result {name: :reactivate_organization_membership, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/reactivate(\?|\z)}, args: {id: "stub"}}, {name: :create_redirect_uri, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}, args: {uri: "stub"}}, {name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}}, - {name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}} + {name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}}, + {name: :list_user_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub"}}, + {name: :create_user_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub", name: "stub", organization_id: "stub"}} ].each do |spec| define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do stub_request(spec[:verb], spec[:url]) From 0f5e417d8a550c6697c31cdb1c6df42fcaee6a39 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 6 May 2026 15:36:03 -0700 Subject: [PATCH 2/2] regeneration --- .oagen-manifest.json | 4 ++-- lib/workos/api_keys.rb | 2 +- lib/workos/audit_logs.rb | 4 ++-- lib/workos/authorization.rb | 24 +++++++++---------- lib/workos/connect.rb | 2 +- lib/workos/directory_sync.rb | 6 ++--- lib/workos/events.rb | 2 +- lib/workos/feature_flags.rb | 6 ++--- lib/workos/groups.rb | 4 ++-- lib/workos/multi_factor_auth.rb | 2 +- lib/workos/organizations.rb | 2 +- lib/workos/sso.rb | 2 +- lib/workos/user_management.rb | 12 +++++----- .../user_api_key_owner.rb | 0 ...nagement_organization_membership_groups.rb | 2 +- lib/workos/webhooks.rb | 2 +- 16 files changed, 38 insertions(+), 38 deletions(-) rename lib/workos/{api_keys => user_management}/user_api_key_owner.rb (100%) diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 4b5b3e1b..7c73f868 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-05-06T01:54:11.909Z", + "generatedAt": "2026-05-06T22:30:35.198Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -25,7 +25,6 @@ "lib/workos/api_keys/organization_api_key_owner.rb", "lib/workos/api_keys/organization_api_key_with_value.rb", "lib/workos/api_keys/organization_api_key_with_value_owner.rb", - "lib/workos/api_keys/user_api_key_owner.rb", "lib/workos/api_keys/validate_api_key.rb", "lib/workos/audit_logs.rb", "lib/workos/audit_logs/audit_log_action_json.rb", @@ -529,6 +528,7 @@ "lib/workos/user_management/user.rb", "lib/workos/user_management/user_api_key.rb", "lib/workos/user_management/user_api_key_created_data_owner.rb", + "lib/workos/user_management/user_api_key_owner.rb", "lib/workos/user_management/user_api_key_revoked_data_owner.rb", "lib/workos/user_management/user_api_key_with_value.rb", "lib/workos/user_management/user_api_key_with_value_owner.rb", diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 5dee92a1..5f105047 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -22,7 +22,7 @@ def list_organization_api_keys( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 79dc10eb..e70e9eb0 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -64,7 +64,7 @@ def update_organization_audit_logs_retention( def list_actions( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -110,7 +110,7 @@ def list_action_schemas( action_name:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index a8bb9b34..d7c29cd6 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -104,7 +104,7 @@ def list_resources_for_membership( parent_resource:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -165,7 +165,7 @@ def list_effective_permissions( resource_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -217,7 +217,7 @@ def list_effective_permissions_by_external_id( external_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -266,7 +266,7 @@ def list_role_assignments( organization_membership_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -671,7 +671,7 @@ def delete_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, - cascade_delete: nil, + cascade_delete: false, request_options: {} ) params = { @@ -706,7 +706,7 @@ def list_memberships_for_resource_by_external_id( permission_slug:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", assignment: nil, request_options: {} @@ -764,7 +764,7 @@ def list_role_assignments_for_resource_by_external_id( external_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -816,7 +816,7 @@ def list_role_assignments_for_resource_by_external_id( def list_resources( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, resource_type_slug: nil, @@ -990,7 +990,7 @@ def update_resource( # @return [void] def delete_resource( resource_id:, - cascade_delete: nil, + cascade_delete: false, request_options: {} ) params = { @@ -1021,7 +1021,7 @@ def list_memberships_for_resource( permission_slug:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", assignment: nil, request_options: {} @@ -1073,7 +1073,7 @@ def list_role_assignments_for_resource( resource_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -1262,7 +1262,7 @@ def set_environment_role_permissions( def list_permissions( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index 2d31504f..09bb810a 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -50,7 +50,7 @@ def complete_oauth2( def list_applications( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, request_options: {} diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 6e8a0a2a..ac473f94 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -23,7 +23,7 @@ def initialize(client) def list_directories( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, search: nil, @@ -114,7 +114,7 @@ def delete_directory( def list_groups( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", directory: nil, user: nil, @@ -185,7 +185,7 @@ def get_group( def list_users( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", directory: nil, group: nil, diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 88ee43d7..b8b97111 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -24,7 +24,7 @@ def initialize(client) def list_events( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", events: nil, range_start: nil, diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index ef397399..00019cad 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -20,7 +20,7 @@ def initialize(client) def list_feature_flags( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -161,7 +161,7 @@ def list_organization_feature_flags( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -208,7 +208,7 @@ def list_user_feature_flags( user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/groups.rb b/lib/workos/groups.rb index 398dcf91..934f0e76 100644 --- a/lib/workos/groups.rb +++ b/lib/workos/groups.rb @@ -22,7 +22,7 @@ def list_organization_groups( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -169,7 +169,7 @@ def list_group_organization_memberships( group_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 1d9c7d65..fb38831f 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -143,7 +143,7 @@ def list_user_auth_factors( userland_user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index ff5ecf3b..d03fd37b 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -22,7 +22,7 @@ def initialize(client) def list_organizations( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", domains: nil, search: nil, diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 81e8e7fe..080093d7 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -24,7 +24,7 @@ def initialize(client) def list_connections( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", connection_type: nil, domain: nil, diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 799375ab..4916649c 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -589,7 +589,7 @@ def get_password_reset( def list_users( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization: nil, organization_id: nil, @@ -918,7 +918,7 @@ def list_sessions( id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -965,7 +965,7 @@ def list_sessions( def list_invitations( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, email: nil, @@ -1240,7 +1240,7 @@ def get_magic_auth( def list_organization_memberships( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, statuses: nil, @@ -1463,7 +1463,7 @@ def list_user_authorized_applications( user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -1530,7 +1530,7 @@ def list_user_api_keys( user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, request_options: {} diff --git a/lib/workos/api_keys/user_api_key_owner.rb b/lib/workos/user_management/user_api_key_owner.rb similarity index 100% rename from lib/workos/api_keys/user_api_key_owner.rb rename to lib/workos/user_management/user_api_key_owner.rb diff --git a/lib/workos/user_management_organization_membership_groups.rb b/lib/workos/user_management_organization_membership_groups.rb index 9d20678b..f2cad83f 100644 --- a/lib/workos/user_management_organization_membership_groups.rb +++ b/lib/workos/user_management_organization_membership_groups.rb @@ -22,7 +22,7 @@ def list_organization_membership_groups( om_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index b5dd3ad5..c4b6dba1 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -20,7 +20,7 @@ def initialize(client) def list_webhook_endpoints( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} )