workos 7.1.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +46 -0
  3. data/.gitignore +2 -0
  4. data/.last-synced-sha +1 -1
  5. data/.oagen-manifest.json +61 -40
  6. data/.release-please-manifest.json +1 -1
  7. data/.yardopts +6 -0
  8. data/CHANGELOG.md +38 -0
  9. data/Gemfile +6 -0
  10. data/Gemfile.lock +33 -2
  11. data/lib/workos/api_keys/api_key.rb +1 -1
  12. data/lib/workos/api_keys/api_key_created_data.rb +1 -1
  13. data/lib/workos/api_keys/organization_api_key.rb +43 -0
  14. data/lib/workos/{types/events_order.rb → api_keys/organization_api_key_owner.rb} +1 -3
  15. data/lib/workos/api_keys/organization_api_key_with_value.rb +46 -0
  16. data/lib/workos/{types/audit_logs_order.rb → api_keys/organization_api_key_with_value_owner.rb} +1 -3
  17. data/lib/workos/api_keys.rb +46 -46
  18. data/lib/workos/audit_logs.rb +6 -6
  19. data/lib/workos/authorization/user_organization_membership_base_list_data.rb +5 -2
  20. data/lib/workos/authorization/{role_assignment.rb → user_role_assignment.rb} +5 -2
  21. data/lib/workos/authorization/{role_assignment_resource.rb → user_role_assignment_resource.rb} +1 -1
  22. data/lib/workos/authorization.rb +250 -138
  23. data/lib/workos/base_client.rb +6 -1
  24. data/lib/workos/client.rb +4 -4
  25. data/lib/workos/connect.rb +2 -2
  26. data/lib/workos/directory_sync/directory_user.rb +3 -0
  27. data/lib/workos/directory_sync/directory_user_with_groups.rb +4 -1
  28. data/lib/workos/directory_sync/dsync_user_updated_data.rb +3 -0
  29. data/lib/workos/directory_sync.rb +6 -6
  30. data/lib/workos/encryptors/aes_gcm.rb +35 -3
  31. data/lib/workos/events.rb +2 -2
  32. data/lib/workos/feature_flags.rb +6 -6
  33. data/lib/workos/groups.rb +5 -5
  34. data/lib/workos/multi_factor_auth.rb +3 -3
  35. data/lib/workos/organization_domains.rb +1 -1
  36. data/lib/workos/organizations.rb +2 -2
  37. data/lib/workos/radar.rb +2 -2
  38. data/lib/workos/sso/profile.rb +3 -0
  39. data/lib/workos/sso.rb +4 -4
  40. data/lib/workos/types/event_context_actor_source.rb +2 -1
  41. data/lib/workos/types/{applications_order.rb → pagination_order.rb} +1 -1
  42. data/lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb → vault_byok_key_provider.rb} +1 -1
  43. data/lib/workos/user_management/create_user_api_key.rb +25 -0
  44. data/lib/workos/user_management/organization_membership.rb +5 -2
  45. data/lib/workos/user_management/user_api_key.rb +43 -0
  46. data/lib/workos/user_management/user_api_key_created_data_owner.rb +25 -0
  47. data/lib/workos/{api_keys/api_key_with_value_owner.rb → user_management/user_api_key_owner.rb} +1 -1
  48. data/lib/workos/{types/webhooks_order.rb → user_management/user_api_key_revoked_data_owner.rb} +1 -3
  49. data/lib/workos/{api_keys/api_key_with_value.rb → user_management/user_api_key_with_value.rb} +2 -2
  50. data/lib/workos/{types/groups_order.rb → user_management/user_api_key_with_value_owner.rb} +1 -3
  51. data/lib/workos/user_management/user_organization_membership.rb +5 -2
  52. data/lib/workos/user_management.rb +181 -75
  53. data/lib/workos/user_management_organization_membership_groups.rb +2 -2
  54. data/lib/workos/vault/vault_byok_key_deleted.rb +34 -0
  55. data/lib/workos/vault/vault_byok_key_deleted_data.rb +22 -0
  56. data/lib/workos/version.rb +1 -1
  57. data/lib/workos/webhooks.rb +3 -3
  58. data/rbi/workos/api_key.rbi +2 -2
  59. data/rbi/workos/api_key_created_data.rbi +2 -2
  60. data/rbi/workos/api_key_revoked_data.rbi +2 -2
  61. data/rbi/workos/api_keys.rbi +17 -17
  62. data/rbi/workos/authorization.rbi +127 -27
  63. data/rbi/workos/client.rbi +3 -3
  64. data/rbi/workos/create_user_api_key.rbi +36 -0
  65. data/rbi/workos/directory_user.rbi +6 -0
  66. data/rbi/workos/directory_user_with_groups.rbi +6 -0
  67. data/rbi/workos/dsync_user_updated_data.rbi +6 -0
  68. data/rbi/workos/organization_api_key.rbi +72 -0
  69. data/rbi/workos/{api_key_with_value_owner.rbi → organization_api_key_owner.rbi} +1 -1
  70. data/rbi/workos/organization_api_key_with_value.rbi +78 -0
  71. data/rbi/workos/organization_api_key_with_value_owner.rbi +30 -0
  72. data/rbi/workos/organization_membership.rbi +6 -0
  73. data/rbi/workos/profile.rbi +6 -0
  74. data/rbi/workos/user_api_key.rbi +72 -0
  75. data/rbi/workos/user_api_key_created_data_owner.rbi +36 -0
  76. data/rbi/workos/user_api_key_owner.rbi +36 -0
  77. data/rbi/workos/user_api_key_revoked_data_owner.rbi +36 -0
  78. data/rbi/workos/{api_key_with_value.rbi → user_api_key_with_value.rbi} +3 -3
  79. data/rbi/workos/user_api_key_with_value_owner.rbi +36 -0
  80. data/rbi/workos/user_management.rbi +91 -14
  81. data/rbi/workos/user_organization_membership.rbi +6 -0
  82. data/rbi/workos/user_organization_membership_base_list_data.rbi +6 -0
  83. data/rbi/workos/{role_assignment.rbi → user_role_assignment.rbi} +9 -3
  84. data/rbi/workos/{role_assignment_resource.rbi → user_role_assignment_resource.rbi} +1 -1
  85. data/rbi/workos/vault_byok_key_deleted.rbi +54 -0
  86. data/rbi/workos/vault_byok_key_deleted_data.rbi +30 -0
  87. data/script/docs +16 -0
  88. data/script/docs-serve +12 -0
  89. data/script/llms-txt +37 -0
  90. data/test/workos/test_api_keys.rb +17 -17
  91. data/test/workos/test_audit_logs.rb +2 -2
  92. data/test/workos/test_authorization.rb +102 -20
  93. data/test/workos/test_encryptors_aes_gcm.rb +21 -0
  94. data/test/workos/test_model_round_trip.rb +278 -83
  95. data/test/workos/test_session.rb +68 -0
  96. data/test/workos/test_user_management.rb +69 -9
  97. data/test/workos/test_webhooks.rb +2 -2
  98. metadata +39 -33
  99. data/lib/workos/types/authorization_order.rb +0 -9
  100. data/lib/workos/types/connections_order.rb +0 -9
  101. data/lib/workos/types/directories_order.rb +0 -9
  102. data/lib/workos/types/directory_groups_order.rb +0 -9
  103. data/lib/workos/types/directory_users_order.rb +0 -9
  104. data/lib/workos/types/feature_flags_order.rb +0 -9
  105. data/lib/workos/types/organizations_api_keys_order.rb +0 -9
  106. data/lib/workos/types/organizations_feature_flags_order.rb +0 -9
  107. data/lib/workos/types/organizations_order.rb +0 -9
  108. data/lib/workos/types/permissions_order.rb +0 -9
  109. data/lib/workos/types/user_management_invitations_order.rb +0 -9
  110. data/lib/workos/types/user_management_multi_factor_authentication_order.rb +0 -9
  111. data/lib/workos/types/user_management_organization_membership_groups_order.rb +0 -9
  112. data/lib/workos/types/user_management_organization_membership_order.rb +0 -9
  113. data/lib/workos/types/user_management_users_authorized_applications_order.rb +0 -9
  114. data/lib/workos/types/user_management_users_feature_flags_order.rb +0 -9
  115. data/lib/workos/types/user_management_users_order.rb +0 -9
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class UserApiKeyCreatedDataOwner < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ type: :type,
9
+ id: :id,
10
+ organization_id: :organization_id
11
+ }.freeze
12
+
13
+ attr_accessor \
14
+ :type,
15
+ :id,
16
+ :organization_id
17
+
18
+ def initialize(json)
19
+ hash = self.class.normalize(json)
20
+ @type = hash[:type]
21
+ @id = hash[:id]
22
+ @organization_id = hash[:organization_id]
23
+ end
24
+ end
25
+ end
@@ -3,5 +3,5 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- ApiKeyWithValueOwner = ApiKeyCreatedDataOwner
6
+ UserApiKeyOwner = UserApiKeyCreatedDataOwner
7
7
  end
@@ -3,7 +3,5 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- module Types
7
- WebhooksOrder = ApplicationsOrder
8
- end
6
+ UserApiKeyRevokedDataOwner = UserApiKeyCreatedDataOwner
9
7
  end
@@ -3,7 +3,7 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- class ApiKeyWithValue < WorkOS::Types::BaseModel
6
+ class UserApiKeyWithValue < WorkOS::Types::BaseModel
7
7
  HASH_ATTRS = {
8
8
  object: :object,
9
9
  id: :id,
@@ -33,7 +33,7 @@ module WorkOS
33
33
  hash = self.class.normalize(json)
34
34
  @object = hash[:object]
35
35
  @id = hash[:id]
36
- @owner = hash[:owner] ? WorkOS::ApiKeyWithValueOwner.new(hash[:owner]) : nil
36
+ @owner = hash[:owner] ? WorkOS::UserApiKeyWithValueOwner.new(hash[:owner]) : nil
37
37
  @name = hash[:name]
38
38
  @obfuscated_value = hash[:obfuscated_value]
39
39
  @last_used_at = hash[:last_used_at]
@@ -3,7 +3,5 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- module Types
7
- GroupsOrder = ApplicationsOrder
8
- end
6
+ UserApiKeyWithValueOwner = UserApiKeyCreatedDataOwner
9
7
  end
@@ -15,7 +15,8 @@ module WorkOS
15
15
  custom_attributes: :custom_attributes,
16
16
  created_at: :created_at,
17
17
  updated_at: :updated_at,
18
- role: :role
18
+ role: :role,
19
+ user: :user
19
20
  }.freeze
20
21
 
21
22
  attr_accessor \
@@ -29,7 +30,8 @@ module WorkOS
29
30
  :custom_attributes,
30
31
  :created_at,
31
32
  :updated_at,
32
- :role
33
+ :role,
34
+ :user
33
35
 
34
36
  def initialize(json)
35
37
  hash = self.class.normalize(json)
@@ -44,6 +46,7 @@ module WorkOS
44
46
  @created_at = hash[:created_at]
45
47
  @updated_at = hash[:updated_at]
46
48
  @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil
49
+ @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil
47
50
  end
48
51
  end
49
52
  end
@@ -6,6 +6,32 @@ require "json"
6
6
 
7
7
  module WorkOS
8
8
  class UserManagement
9
+ # Identifies the password (plaintext variant).
10
+ #
11
+ # @!attribute [r] password
12
+ # @return [String]
13
+ PasswordPlaintext = Data.define(:password)
14
+
15
+ # Identifies the password (hashed variant).
16
+ #
17
+ # @!attribute [r] password_hash
18
+ # @return [String]
19
+ # @!attribute [r] password_hash_type
20
+ # @return [WorkOS::Types::CreateUserPasswordHashType]
21
+ PasswordHashed = Data.define(:password_hash, :password_hash_type)
22
+
23
+ # Identifies the role (single variant).
24
+ #
25
+ # @!attribute [r] role_slug
26
+ # @return [String]
27
+ RoleSingle = Data.define(:role_slug)
28
+
29
+ # Identifies the role (multiple variant).
30
+ #
31
+ # @!attribute [r] role_slugs
32
+ # @return [Array<String>]
33
+ RoleMultiple = Data.define(:role_slugs)
34
+
9
35
  def initialize(client)
10
36
  @client = client
11
37
  end
@@ -403,7 +429,7 @@ module WorkOS
403
429
  )
404
430
  body = {
405
431
  "client_id" => client_id
406
- }.compact
432
+ }
407
433
  response = @client.request(
408
434
  method: :post,
409
435
  path: "/user_management/authorize/device",
@@ -450,7 +476,7 @@ module WorkOS
450
476
  )
451
477
  body = {
452
478
  "origin" => origin
453
- }.compact
479
+ }
454
480
  response = @client.request(
455
481
  method: :post,
456
482
  path: "/user_management/cors_origins",
@@ -492,7 +518,7 @@ module WorkOS
492
518
  )
493
519
  body = {
494
520
  "email" => email
495
- }.compact
521
+ }
496
522
  response = @client.request(
497
523
  method: :post,
498
524
  path: "/user_management/password_reset",
@@ -518,7 +544,7 @@ module WorkOS
518
544
  body = {
519
545
  "token" => token,
520
546
  "new_password" => new_password
521
- }.compact
547
+ }
522
548
  response = @client.request(
523
549
  method: :post,
524
550
  path: "/user_management/password_reset/confirm",
@@ -554,7 +580,7 @@ module WorkOS
554
580
  # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
555
581
  # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
556
582
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
557
- # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
583
+ # @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.
558
584
  # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`.
559
585
  # @param organization_id [String, nil] Filter users by the organization they are a member of.
560
586
  # @param email [String, nil] Filter users by their email address.
@@ -563,7 +589,7 @@ module WorkOS
563
589
  def list_users(
564
590
  before: nil,
565
591
  after: nil,
566
- limit: nil,
592
+ limit: 10,
567
593
  order: "desc",
568
594
  organization: nil,
569
595
  organization_id: nil,
@@ -613,9 +639,7 @@ module WorkOS
613
639
  # @param email_verified [Boolean, nil] Whether the user's email has been verified.
614
640
  # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
615
641
  # @param external_id [String, nil] The external ID of the user.
616
- # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.
617
- # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
618
- # @param password_hash_type [WorkOS::Types::CreateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
642
+ # @param password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password.
619
643
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
620
644
  # @return [WorkOS::User]
621
645
  def create_user(
@@ -626,8 +650,6 @@ module WorkOS
626
650
  metadata: nil,
627
651
  external_id: nil,
628
652
  password: nil,
629
- password_hash: nil,
630
- password_hash_type: nil,
631
653
  request_options: {}
632
654
  )
633
655
  body = {
@@ -636,18 +658,17 @@ module WorkOS
636
658
  "last_name" => last_name,
637
659
  "email_verified" => email_verified,
638
660
  "metadata" => metadata,
639
- "external_id" => external_id,
640
- "password" => password,
641
- "password_hash" => password_hash,
642
- "password_hash_type" => password_hash_type
661
+ "external_id" => external_id
643
662
  }.compact
644
663
  if password
645
- case password[:type]
646
- when "plaintext"
647
- body["password"] = password[:password]
648
- when "hashed"
649
- body["password_hash"] = password[:password_hash]
650
- body["password_hash_type"] = password[:password_hash_type]
664
+ case password
665
+ when WorkOS::UserManagement::PasswordPlaintext
666
+ body["password"] = password.password
667
+ when WorkOS::UserManagement::PasswordHashed
668
+ body["password_hash"] = password.password_hash
669
+ body["password_hash_type"] = password.password_hash_type
670
+ else
671
+ raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}"
651
672
  end
652
673
  end
653
674
  response = @client.request(
@@ -709,9 +730,7 @@ module WorkOS
709
730
  # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user.
710
731
  # @param external_id [String, nil] The external ID of the user.
711
732
  # @param locale [String, nil] The user's preferred locale.
712
- # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.
713
- # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.
714
- # @param password_hash_type [WorkOS::Types::UpdateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.
733
+ # @param password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password.
715
734
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
716
735
  # @return [WorkOS::User]
717
736
  def update_user(
@@ -724,8 +743,6 @@ module WorkOS
724
743
  external_id: nil,
725
744
  locale: nil,
726
745
  password: nil,
727
- password_hash: nil,
728
- password_hash_type: nil,
729
746
  request_options: {}
730
747
  )
731
748
  body = {
@@ -735,18 +752,17 @@ module WorkOS
735
752
  "email_verified" => email_verified,
736
753
  "metadata" => metadata,
737
754
  "external_id" => external_id,
738
- "locale" => locale,
739
- "password" => password,
740
- "password_hash" => password_hash,
741
- "password_hash_type" => password_hash_type
755
+ "locale" => locale
742
756
  }.compact
743
757
  if password
744
- case password[:type]
745
- when "plaintext"
746
- body["password"] = password[:password]
747
- when "hashed"
748
- body["password_hash"] = password[:password_hash]
749
- body["password_hash_type"] = password[:password_hash_type]
758
+ case password
759
+ when WorkOS::UserManagement::PasswordPlaintext
760
+ body["password"] = password.password
761
+ when WorkOS::UserManagement::PasswordHashed
762
+ body["password_hash"] = password.password_hash
763
+ body["password_hash_type"] = password.password_hash_type
764
+ else
765
+ raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}"
750
766
  end
751
767
  end
752
768
  response = @client.request(
@@ -790,7 +806,7 @@ module WorkOS
790
806
  )
791
807
  body = {
792
808
  "code" => code
793
- }.compact
809
+ }
794
810
  response = @client.request(
795
811
  method: :post,
796
812
  path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm",
@@ -815,7 +831,7 @@ module WorkOS
815
831
  )
816
832
  body = {
817
833
  "new_email" => new_email
818
- }.compact
834
+ }
819
835
  response = @client.request(
820
836
  method: :post,
821
837
  path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send",
@@ -840,7 +856,7 @@ module WorkOS
840
856
  )
841
857
  body = {
842
858
  "code" => code
843
- }.compact
859
+ }
844
860
  response = @client.request(
845
861
  method: :post,
846
862
  path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm",
@@ -895,14 +911,14 @@ module WorkOS
895
911
  # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
896
912
  # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
897
913
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
898
- # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
914
+ # @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.
899
915
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
900
916
  # @return [WorkOS::Types::ListStruct<WorkOS::UserSessionsListItem>]
901
917
  def list_sessions(
902
918
  id:,
903
919
  before: nil,
904
920
  after: nil,
905
- limit: nil,
921
+ limit: 10,
906
922
  order: "desc",
907
923
  request_options: {}
908
924
  )
@@ -941,7 +957,7 @@ module WorkOS
941
957
  # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
942
958
  # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
943
959
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
944
- # @param order [WorkOS::Types::UserManagementInvitationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
960
+ # @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.
945
961
  # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.
946
962
  # @param email [String, nil] The email address of the recipient.
947
963
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -949,7 +965,7 @@ module WorkOS
949
965
  def list_invitations(
950
966
  before: nil,
951
967
  after: nil,
952
- limit: nil,
968
+ limit: 10,
953
969
  order: "desc",
954
970
  organization_id: nil,
955
971
  email: nil,
@@ -1128,6 +1144,21 @@ module WorkOS
1128
1144
  result
1129
1145
  end
1130
1146
 
1147
+ # Get JWT template
1148
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1149
+ # @return [WorkOS::JWTTemplateResponse]
1150
+ def list_jwt_template(request_options: {})
1151
+ response = @client.request(
1152
+ method: :get,
1153
+ path: "/user_management/jwt_template",
1154
+ auth: true,
1155
+ request_options: request_options
1156
+ )
1157
+ result = WorkOS::JWTTemplateResponse.new(response.body)
1158
+ 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"])
1159
+ result
1160
+ end
1161
+
1131
1162
  # Update JWT template
1132
1163
  # @param content [String] The JWT template content as a Liquid template string.
1133
1164
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -1138,7 +1169,7 @@ module WorkOS
1138
1169
  )
1139
1170
  body = {
1140
1171
  "content" => content
1141
- }.compact
1172
+ }
1142
1173
  response = @client.request(
1143
1174
  method: :put,
1144
1175
  path: "/user_management/jwt_template",
@@ -1200,7 +1231,7 @@ module WorkOS
1200
1231
  # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
1201
1232
  # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
1202
1233
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1203
- # @param order [WorkOS::Types::UserManagementOrganizationMembershipOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
1234
+ # @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.
1204
1235
  # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
1205
1236
  # @param statuses [Array<WorkOS::Types::UserManagementOrganizationMembershipStatuses>, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`.
1206
1237
  # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user).
@@ -1209,7 +1240,7 @@ module WorkOS
1209
1240
  def list_organization_memberships(
1210
1241
  before: nil,
1211
1242
  after: nil,
1212
- limit: nil,
1243
+ limit: 10,
1213
1244
  order: "desc",
1214
1245
  organization_id: nil,
1215
1246
  statuses: nil,
@@ -1255,30 +1286,27 @@ module WorkOS
1255
1286
  # Create an organization membership
1256
1287
  # @param user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user).
1257
1288
  # @param organization_id [String] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
1258
- # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`.
1259
- # @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
1289
+ # @param role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role.
1260
1290
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1261
1291
  # @return [WorkOS::OrganizationMembership]
1262
1292
  def create_organization_membership(
1263
1293
  user_id:,
1264
1294
  organization_id:,
1265
- role_slug: nil,
1266
- role_slugs: nil,
1267
1295
  role: nil,
1268
1296
  request_options: {}
1269
1297
  )
1270
1298
  body = {
1271
1299
  "user_id" => user_id,
1272
- "organization_id" => organization_id,
1273
- "role_slug" => role_slug,
1274
- "role_slugs" => role_slugs
1275
- }.compact
1300
+ "organization_id" => organization_id
1301
+ }
1276
1302
  if role
1277
- case role[:type]
1278
- when "single"
1279
- body["role_slug"] = role[:role_slug]
1280
- when "multiple"
1281
- body["role_slugs"] = role[:role_slugs]
1303
+ case role
1304
+ when WorkOS::UserManagement::RoleSingle
1305
+ body["role_slug"] = role.role_slug
1306
+ when WorkOS::UserManagement::RoleMultiple
1307
+ body["role_slugs"] = role.role_slugs
1308
+ else
1309
+ raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}"
1282
1310
  end
1283
1311
  end
1284
1312
  response = @client.request(
@@ -1314,27 +1342,23 @@ module WorkOS
1314
1342
 
1315
1343
  # Update an organization membership
1316
1344
  # @param id [String] The unique ID of the organization membership.
1317
- # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`.
1318
- # @param role_slugs [Array<String>, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`.
1345
+ # @param role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role.
1319
1346
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1320
1347
  # @return [WorkOS::UserOrganizationMembership]
1321
1348
  def update_organization_membership(
1322
1349
  id:,
1323
- role_slug: nil,
1324
- role_slugs: nil,
1325
1350
  role: nil,
1326
1351
  request_options: {}
1327
1352
  )
1328
- body = {
1329
- "role_slug" => role_slug,
1330
- "role_slugs" => role_slugs
1331
- }.compact
1353
+ body = {}
1332
1354
  if role
1333
- case role[:type]
1334
- when "single"
1335
- body["role_slug"] = role[:role_slug]
1336
- when "multiple"
1337
- body["role_slugs"] = role[:role_slugs]
1355
+ case role
1356
+ when WorkOS::UserManagement::RoleSingle
1357
+ body["role_slug"] = role.role_slug
1358
+ when WorkOS::UserManagement::RoleMultiple
1359
+ body["role_slugs"] = role.role_slugs
1360
+ else
1361
+ raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}"
1338
1362
  end
1339
1363
  end
1340
1364
  response = @client.request(
@@ -1414,7 +1438,7 @@ module WorkOS
1414
1438
  )
1415
1439
  body = {
1416
1440
  "uri" => uri
1417
- }.compact
1441
+ }
1418
1442
  response = @client.request(
1419
1443
  method: :post,
1420
1444
  path: "/user_management/redirect_uris",
@@ -1432,14 +1456,14 @@ module WorkOS
1432
1456
  # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
1433
1457
  # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
1434
1458
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1435
- # @param order [WorkOS::Types::UserManagementUsersAuthorizedApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
1459
+ # @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.
1436
1460
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1437
1461
  # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizedConnectApplicationListData>]
1438
1462
  def list_user_authorized_applications(
1439
1463
  user_id:,
1440
1464
  before: nil,
1441
1465
  after: nil,
1442
- limit: nil,
1466
+ limit: 10,
1443
1467
  order: "desc",
1444
1468
  request_options: {}
1445
1469
  )
@@ -1493,6 +1517,88 @@ module WorkOS
1493
1517
  nil
1494
1518
  end
1495
1519
 
1520
+ # List API keys for a user
1521
+ # @param user_id [String] Unique identifier of the user.
1522
+ # @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.
1523
+ # @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.
1524
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1525
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time.
1526
+ # @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.
1527
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1528
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserApiKey>]
1529
+ def list_user_api_keys(
1530
+ user_id:,
1531
+ before: nil,
1532
+ after: nil,
1533
+ limit: 10,
1534
+ order: "desc",
1535
+ organization_id: nil,
1536
+ request_options: {}
1537
+ )
1538
+ params = {
1539
+ "before" => before,
1540
+ "after" => after,
1541
+ "limit" => limit,
1542
+ "order" => order,
1543
+ "organization_id" => organization_id
1544
+ }.compact
1545
+ response = @client.request(
1546
+ method: :get,
1547
+ path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys",
1548
+ auth: true,
1549
+ params: params,
1550
+ request_options: request_options
1551
+ )
1552
+ fetch_next = ->(cursor) {
1553
+ list_user_api_keys(
1554
+ user_id: user_id,
1555
+ before: before,
1556
+ after: cursor,
1557
+ limit: limit,
1558
+ order: order,
1559
+ organization_id: organization_id,
1560
+ request_options: request_options
1561
+ )
1562
+ }
1563
+ WorkOS::Types::ListStruct.from_response(
1564
+ response,
1565
+ model: WorkOS::UserApiKey,
1566
+ filters: {user_id: user_id, before: before, limit: limit, order: order, organization_id: organization_id},
1567
+ fetch_next: fetch_next
1568
+ )
1569
+ end
1570
+
1571
+ # Create an API key for a user
1572
+ # @param user_id [String] Unique identifier of the user.
1573
+ # @param name [String] A descriptive name for the API key.
1574
+ # @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.
1575
+ # @param permissions [Array<String>, nil] The permission slugs to assign to the API key. Each permission must be enabled for user API keys.
1576
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1577
+ # @return [WorkOS::UserApiKeyWithValue]
1578
+ def create_user_api_key(
1579
+ user_id:,
1580
+ name:,
1581
+ organization_id:,
1582
+ permissions: nil,
1583
+ request_options: {}
1584
+ )
1585
+ body = {
1586
+ "name" => name,
1587
+ "organization_id" => organization_id,
1588
+ "permissions" => permissions
1589
+ }.compact
1590
+ response = @client.request(
1591
+ method: :post,
1592
+ path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys",
1593
+ auth: true,
1594
+ body: body,
1595
+ request_options: request_options
1596
+ )
1597
+ result = WorkOS::UserApiKeyWithValue.new(response.body)
1598
+ 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"])
1599
+ result
1600
+ end
1601
+
1496
1602
  # @oagen-ignore-start — non-spec helpers (hand-maintained)
1497
1603
  # H13 — Build the JWKS URL for a given client_id (no HTTP call).
1498
1604
  # Pair with #get_jwks (generated) to fetch the keyset.
@@ -15,14 +15,14 @@ module WorkOS
15
15
  # @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"`.
16
16
  # @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"`.
17
17
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
18
- # @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.
18
+ # @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.
19
19
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
20
20
  # @return [WorkOS::Types::ListStruct<WorkOS::Group>]
21
21
  def list_organization_membership_groups(
22
22
  om_id:,
23
23
  before: nil,
24
24
  after: nil,
25
- limit: nil,
25
+ limit: 10,
26
26
  order: "desc",
27
27
  request_options: {}
28
28
  )
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class VaultByokKeyDeleted < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ id: :id,
9
+ event: :event,
10
+ data: :data,
11
+ created_at: :created_at,
12
+ context: :context,
13
+ object: :object
14
+ }.freeze
15
+
16
+ attr_accessor \
17
+ :id,
18
+ :event,
19
+ :data,
20
+ :created_at,
21
+ :context,
22
+ :object
23
+
24
+ def initialize(json)
25
+ hash = self.class.normalize(json)
26
+ @id = hash[:id]
27
+ @event = hash[:event]
28
+ @data = hash[:data] ? WorkOS::VaultByokKeyDeletedData.new(hash[:data]) : nil
29
+ @created_at = hash[:created_at]
30
+ @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil
31
+ @object = hash[:object]
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class VaultByokKeyDeletedData < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ organization_id: :organization_id,
9
+ key_provider: :key_provider
10
+ }.freeze
11
+
12
+ attr_accessor \
13
+ :organization_id,
14
+ :key_provider
15
+
16
+ def initialize(json)
17
+ hash = self.class.normalize(json)
18
+ @organization_id = hash[:organization_id]
19
+ @key_provider = hash[:key_provider]
20
+ end
21
+ end
22
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # @oagen-ignore-file
4
4
  module WorkOS
5
- VERSION = "7.1.1"
5
+ VERSION = "8.0.0"
6
6
  end