workos 7.1.2 → 8.0.1

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +49 -0
  3. data/.github/workflows/release-please.yml +2 -2
  4. data/.gitignore +2 -0
  5. data/.last-synced-sha +1 -1
  6. data/.oagen-manifest.json +61 -40
  7. data/.release-please-manifest.json +1 -1
  8. data/.yardopts +6 -0
  9. data/CHANGELOG.md +36 -0
  10. data/Gemfile +6 -0
  11. data/Gemfile.lock +33 -2
  12. data/README.md +19 -0
  13. data/docs/V7_MIGRATION_GUIDE.md +21 -0
  14. data/lib/workos/actions.rb +1 -1
  15. data/lib/workos/api_keys/api_key.rb +1 -1
  16. data/lib/workos/api_keys/api_key_created_data.rb +1 -1
  17. data/lib/workos/api_keys/organization_api_key.rb +43 -0
  18. data/lib/workos/{types/events_order.rb → api_keys/organization_api_key_owner.rb} +1 -3
  19. data/lib/workos/api_keys/organization_api_key_with_value.rb +46 -0
  20. data/lib/workos/{types/audit_logs_order.rb → api_keys/organization_api_key_with_value_owner.rb} +1 -3
  21. data/lib/workos/api_keys.rb +46 -46
  22. data/lib/workos/audit_logs.rb +4 -4
  23. data/lib/workos/authorization/user_organization_membership_base_list_data.rb +5 -2
  24. data/lib/workos/authorization/{role_assignment.rb → user_role_assignment.rb} +5 -2
  25. data/lib/workos/authorization/{role_assignment_resource.rb → user_role_assignment_resource.rb} +1 -1
  26. data/lib/workos/authorization.rb +122 -22
  27. data/lib/workos/base_client.rb +71 -5
  28. data/lib/workos/client.rb +4 -4
  29. data/lib/workos/connect.rb +2 -2
  30. data/lib/workos/directory_sync/directory_user.rb +3 -0
  31. data/lib/workos/directory_sync/directory_user_with_groups.rb +4 -1
  32. data/lib/workos/directory_sync/dsync_user_updated_data.rb +3 -0
  33. data/lib/workos/directory_sync.rb +6 -6
  34. data/lib/workos/encryptors/aes_gcm.rb +19 -5
  35. data/lib/workos/events.rb +2 -2
  36. data/lib/workos/feature_flags.rb +6 -6
  37. data/lib/workos/groups.rb +4 -4
  38. data/lib/workos/multi_factor_auth.rb +2 -2
  39. data/lib/workos/organizations.rb +2 -2
  40. data/lib/workos/session.rb +28 -7
  41. data/lib/workos/session_manager.rb +24 -1
  42. data/lib/workos/sso/profile.rb +3 -0
  43. data/lib/workos/sso.rb +2 -2
  44. data/lib/workos/types/event_context_actor_source.rb +2 -1
  45. data/lib/workos/types/{applications_order.rb → pagination_order.rb} +1 -1
  46. data/lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb → vault_byok_key_provider.rb} +1 -1
  47. data/lib/workos/user_management/create_user_api_key.rb +25 -0
  48. data/lib/workos/user_management/organization_membership.rb +5 -2
  49. data/lib/workos/user_management/user_api_key.rb +43 -0
  50. data/lib/workos/user_management/user_api_key_created_data_owner.rb +25 -0
  51. data/lib/workos/{api_keys/api_key_with_value_owner.rb → user_management/user_api_key_owner.rb} +1 -1
  52. data/lib/workos/{types/webhooks_order.rb → user_management/user_api_key_revoked_data_owner.rb} +1 -3
  53. data/lib/workos/{api_keys/api_key_with_value.rb → user_management/user_api_key_with_value.rb} +2 -2
  54. data/lib/workos/{types/groups_order.rb → user_management/user_api_key_with_value_owner.rb} +1 -3
  55. data/lib/workos/user_management/user_organization_membership.rb +5 -2
  56. data/lib/workos/user_management.rb +114 -10
  57. data/lib/workos/user_management_organization_membership_groups.rb +2 -2
  58. data/lib/workos/vault/vault_byok_key_deleted.rb +34 -0
  59. data/lib/workos/vault/vault_byok_key_deleted_data.rb +22 -0
  60. data/lib/workos/version.rb +1 -1
  61. data/lib/workos/webhooks.rb +3 -3
  62. data/rbi/workos/api_key.rbi +2 -2
  63. data/rbi/workos/api_key_created_data.rbi +2 -2
  64. data/rbi/workos/api_key_revoked_data.rbi +2 -2
  65. data/rbi/workos/api_keys.rbi +17 -17
  66. data/rbi/workos/authorization.rbi +27 -1
  67. data/rbi/workos/client.rbi +3 -3
  68. data/rbi/workos/create_user_api_key.rbi +36 -0
  69. data/rbi/workos/directory_user.rbi +6 -0
  70. data/rbi/workos/directory_user_with_groups.rbi +6 -0
  71. data/rbi/workos/dsync_user_updated_data.rbi +6 -0
  72. data/rbi/workos/organization_api_key.rbi +72 -0
  73. data/rbi/workos/{api_key_with_value_owner.rbi → organization_api_key_owner.rbi} +1 -1
  74. data/rbi/workos/organization_api_key_with_value.rbi +78 -0
  75. data/rbi/workos/organization_api_key_with_value_owner.rbi +30 -0
  76. data/rbi/workos/organization_membership.rbi +6 -0
  77. data/rbi/workos/profile.rbi +6 -0
  78. data/rbi/workos/user_api_key.rbi +72 -0
  79. data/rbi/workos/user_api_key_created_data_owner.rbi +36 -0
  80. data/rbi/workos/user_api_key_owner.rbi +36 -0
  81. data/rbi/workos/user_api_key_revoked_data_owner.rbi +36 -0
  82. data/rbi/workos/{api_key_with_value.rbi → user_api_key_with_value.rbi} +3 -3
  83. data/rbi/workos/user_api_key_with_value_owner.rbi +36 -0
  84. data/rbi/workos/user_management.rbi +31 -0
  85. data/rbi/workos/user_organization_membership.rbi +6 -0
  86. data/rbi/workos/user_organization_membership_base_list_data.rbi +6 -0
  87. data/rbi/workos/{role_assignment.rbi → user_role_assignment.rbi} +9 -3
  88. data/rbi/workos/{role_assignment_resource.rbi → user_role_assignment_resource.rbi} +1 -1
  89. data/rbi/workos/vault_byok_key_deleted.rbi +54 -0
  90. data/rbi/workos/vault_byok_key_deleted_data.rbi +30 -0
  91. data/script/docs +16 -0
  92. data/script/docs-serve +12 -0
  93. data/script/llms-txt +37 -0
  94. data/test/workos/test_actions.rb +9 -0
  95. data/test/workos/test_api_keys.rb +17 -17
  96. data/test/workos/test_authorization.rb +16 -0
  97. data/test/workos/test_base_client.rb +44 -0
  98. data/test/workos/test_encryptors_aes_gcm.rb +16 -1
  99. data/test/workos/test_model_round_trip.rb +278 -83
  100. data/test/workos/test_session.rb +43 -4
  101. data/test/workos/test_user_management.rb +25 -1
  102. data/test/workos/test_webhook_verify.rb +11 -0
  103. metadata +39 -33
  104. data/lib/workos/types/authorization_order.rb +0 -9
  105. data/lib/workos/types/connections_order.rb +0 -9
  106. data/lib/workos/types/directories_order.rb +0 -9
  107. data/lib/workos/types/directory_groups_order.rb +0 -9
  108. data/lib/workos/types/directory_users_order.rb +0 -9
  109. data/lib/workos/types/feature_flags_order.rb +0 -9
  110. data/lib/workos/types/organizations_api_keys_order.rb +0 -9
  111. data/lib/workos/types/organizations_feature_flags_order.rb +0 -9
  112. data/lib/workos/types/organizations_order.rb +0 -9
  113. data/lib/workos/types/permissions_order.rb +0 -9
  114. data/lib/workos/types/user_management_invitations_order.rb +0 -9
  115. data/lib/workos/types/user_management_multi_factor_authentication_order.rb +0 -9
  116. data/lib/workos/types/user_management_organization_membership_groups_order.rb +0 -9
  117. data/lib/workos/types/user_management_organization_membership_order.rb +0 -9
  118. data/lib/workos/types/user_management_users_authorized_applications_order.rb +0 -9
  119. data/lib/workos/types/user_management_users_feature_flags_order.rb +0 -9
  120. data/lib/workos/types/user_management_users_order.rb +0 -9
data/lib/workos/sso.rb CHANGED
@@ -14,7 +14,7 @@ module WorkOS
14
14
  # @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.
15
15
  # @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.
16
16
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
17
- # @param order [WorkOS::Types::ConnectionsOrder, nil] Order the results by the creation time.
17
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time.
18
18
  # @param connection_type [WorkOS::Types::ConnectionsConnectionType, nil] Filter Connections by their type.
19
19
  # @param domain [String, nil] Filter Connections by their associated domain.
20
20
  # @param organization_id [String, nil] Filter Connections by their associated organization.
@@ -24,7 +24,7 @@ module WorkOS
24
24
  def list_connections(
25
25
  before: nil,
26
26
  after: nil,
27
- limit: nil,
27
+ limit: 10,
28
28
  order: "desc",
29
29
  connection_type: nil,
30
30
  domain: nil,
@@ -7,8 +7,9 @@ module WorkOS
7
7
  class EventContextActorSource
8
8
  API = "api"
9
9
  DASHBOARD = "dashboard"
10
+ ADMIN_PORTAL = "admin_portal"
10
11
  SYSTEM = "system"
11
- ALL = [API, DASHBOARD, SYSTEM].freeze
12
+ ALL = [API, DASHBOARD, ADMIN_PORTAL, SYSTEM].freeze
12
13
  end
13
14
  end
14
15
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  module WorkOS
6
6
  module Types
7
- class ApplicationsOrder
7
+ class PaginationOrder
8
8
  NORMAL = "normal"
9
9
  DESC = "desc"
10
10
  ASC = "asc"
@@ -4,7 +4,7 @@
4
4
 
5
5
  module WorkOS
6
6
  module Types
7
- class VaultByokKeyVerificationCompletedDataKeyProvider
7
+ class VaultByokKeyProvider
8
8
  AWS_KMS = "AWS_KMS"
9
9
  GCP_KMS = "GCP_KMS"
10
10
  AZURE_KEY_VAULT = "AZURE_KEY_VAULT"
@@ -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 CreateUserApiKey < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ name: :name,
9
+ organization_id: :organization_id,
10
+ permissions: :permissions
11
+ }.freeze
12
+
13
+ attr_accessor \
14
+ :name,
15
+ :organization_id,
16
+ :permissions
17
+
18
+ def initialize(json)
19
+ hash = self.class.normalize(json)
20
+ @name = hash[:name]
21
+ @organization_id = hash[:organization_id]
22
+ @permissions = hash[:permissions] || []
23
+ end
24
+ end
25
+ 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
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class UserApiKey < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ object: :object,
9
+ id: :id,
10
+ owner: :owner,
11
+ name: :name,
12
+ obfuscated_value: :obfuscated_value,
13
+ last_used_at: :last_used_at,
14
+ permissions: :permissions,
15
+ created_at: :created_at,
16
+ updated_at: :updated_at
17
+ }.freeze
18
+
19
+ attr_accessor \
20
+ :object,
21
+ :id,
22
+ :owner,
23
+ :name,
24
+ :obfuscated_value,
25
+ :last_used_at,
26
+ :permissions,
27
+ :created_at,
28
+ :updated_at
29
+
30
+ def initialize(json)
31
+ hash = self.class.normalize(json)
32
+ @object = hash[:object]
33
+ @id = hash[:id]
34
+ @owner = hash[:owner] ? WorkOS::UserApiKeyOwner.new(hash[:owner]) : nil
35
+ @name = hash[:name]
36
+ @obfuscated_value = hash[:obfuscated_value]
37
+ @last_used_at = hash[:last_used_at]
38
+ @permissions = hash[:permissions] || []
39
+ @created_at = hash[:created_at]
40
+ @updated_at = hash[:updated_at]
41
+ end
42
+ end
43
+ end
@@ -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
@@ -580,7 +580,7 @@ module WorkOS
580
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"`.
581
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"`.
582
582
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
583
- # @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.
584
584
  # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`.
585
585
  # @param organization_id [String, nil] Filter users by the organization they are a member of.
586
586
  # @param email [String, nil] Filter users by their email address.
@@ -589,7 +589,7 @@ module WorkOS
589
589
  def list_users(
590
590
  before: nil,
591
591
  after: nil,
592
- limit: nil,
592
+ limit: 10,
593
593
  order: "desc",
594
594
  organization: nil,
595
595
  organization_id: nil,
@@ -911,14 +911,14 @@ module WorkOS
911
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"`.
912
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"`.
913
913
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
914
- # @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.
915
915
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
916
916
  # @return [WorkOS::Types::ListStruct<WorkOS::UserSessionsListItem>]
917
917
  def list_sessions(
918
918
  id:,
919
919
  before: nil,
920
920
  after: nil,
921
- limit: nil,
921
+ limit: 10,
922
922
  order: "desc",
923
923
  request_options: {}
924
924
  )
@@ -957,7 +957,7 @@ module WorkOS
957
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"`.
958
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"`.
959
959
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
960
- # @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.
961
961
  # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.
962
962
  # @param email [String, nil] The email address of the recipient.
963
963
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -965,7 +965,7 @@ module WorkOS
965
965
  def list_invitations(
966
966
  before: nil,
967
967
  after: nil,
968
- limit: nil,
968
+ limit: 10,
969
969
  order: "desc",
970
970
  organization_id: nil,
971
971
  email: nil,
@@ -1144,6 +1144,21 @@ module WorkOS
1144
1144
  result
1145
1145
  end
1146
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
+
1147
1162
  # Update JWT template
1148
1163
  # @param content [String] The JWT template content as a Liquid template string.
1149
1164
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -1216,7 +1231,7 @@ module WorkOS
1216
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"`.
1217
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"`.
1218
1233
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1219
- # @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.
1220
1235
  # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to.
1221
1236
  # @param statuses [Array<WorkOS::Types::UserManagementOrganizationMembershipStatuses>, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`.
1222
1237
  # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user).
@@ -1225,7 +1240,7 @@ module WorkOS
1225
1240
  def list_organization_memberships(
1226
1241
  before: nil,
1227
1242
  after: nil,
1228
- limit: nil,
1243
+ limit: 10,
1229
1244
  order: "desc",
1230
1245
  organization_id: nil,
1231
1246
  statuses: nil,
@@ -1441,14 +1456,14 @@ module WorkOS
1441
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"`.
1442
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"`.
1443
1458
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1444
- # @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.
1445
1460
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1446
1461
  # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizedConnectApplicationListData>]
1447
1462
  def list_user_authorized_applications(
1448
1463
  user_id:,
1449
1464
  before: nil,
1450
1465
  after: nil,
1451
- limit: nil,
1466
+ limit: 10,
1452
1467
  order: "desc",
1453
1468
  request_options: {}
1454
1469
  )
@@ -1502,6 +1517,88 @@ module WorkOS
1502
1517
  nil
1503
1518
  end
1504
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
+
1505
1602
  # @oagen-ignore-start — non-spec helpers (hand-maintained)
1506
1603
  # H13 — Build the JWKS URL for a given client_id (no HTTP call).
1507
1604
  # Pair with #get_jwks (generated) to fetch the keyset.
@@ -1544,6 +1641,13 @@ module WorkOS
1544
1641
  def get_authorization_url_with_pkce(redirect_uri:, client_id: nil, **opts)
1545
1642
  pair = WorkOS::PKCE.generate_pair
1546
1643
  state = opts.delete(:state) || WorkOS::PKCE.generate_code_verifier
1644
+ # Strip caller-supplied PKCE params: this helper exists specifically
1645
+ # to generate them, so a caller-provided value would either silently
1646
+ # override our freshly-generated challenge (defeating the helper) or
1647
+ # collide with the keyword args below and raise. Mirror the existing
1648
+ # opts.delete(:state) pattern.
1649
+ opts.delete(:code_challenge)
1650
+ opts.delete(:code_challenge_method)
1547
1651
  url = get_authorization_url(
1548
1652
  redirect_uri: redirect_uri,
1549
1653
  client_id: client_id,
@@ -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.2"
5
+ VERSION = "8.0.1"
6
6
  end
@@ -14,13 +14,13 @@ module WorkOS
14
14
  # @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"`.
15
15
  # @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"`.
16
16
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
17
- # @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.
17
+ # @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.
18
18
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
19
19
  # @return [WorkOS::Types::ListStruct<WorkOS::WebhookEndpointJson>]
20
20
  def list_webhook_endpoints(
21
21
  before: nil,
22
22
  after: nil,
23
- limit: nil,
23
+ limit: 10,
24
24
  order: "desc",
25
25
  request_options: {}
26
26
  )
@@ -193,7 +193,7 @@ module WorkOS
193
193
  timestamp_ms, signature_hash = parse_signature_header(sig_header)
194
194
  max_age = tolerance.to_i
195
195
  issued_at = timestamp_ms.to_i / 1000.0
196
- if (Time.now.to_f - issued_at) > max_age
196
+ if (Time.now.to_f - issued_at).abs > max_age
197
197
  raise WorkOS::SignatureVerificationError.new(
198
198
  message: "Timestamp outside the tolerance zone",
199
199
  http_status: nil
@@ -21,10 +21,10 @@ module WorkOS
21
21
  sig { params(value: String).returns(String) }
22
22
  def id=(value); end
23
23
 
24
- sig { returns(WorkOS::ApiKeyOwner) }
24
+ sig { returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) }
25
25
  def owner; end
26
26
 
27
- sig { params(value: WorkOS::ApiKeyOwner).returns(WorkOS::ApiKeyOwner) }
27
+ sig { params(value: T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)).returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) }
28
28
  def owner=(value); end
29
29
 
30
30
  sig { returns(String) }
@@ -21,10 +21,10 @@ module WorkOS
21
21
  sig { params(value: String).returns(String) }
22
22
  def id=(value); end
23
23
 
24
- sig { returns(WorkOS::ApiKeyCreatedDataOwner) }
24
+ sig { returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) }
25
25
  def owner; end
26
26
 
27
- sig { params(value: WorkOS::ApiKeyCreatedDataOwner).returns(WorkOS::ApiKeyCreatedDataOwner) }
27
+ sig { params(value: T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)).returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) }
28
28
  def owner=(value); end
29
29
 
30
30
  sig { returns(String) }
@@ -21,10 +21,10 @@ module WorkOS
21
21
  sig { params(value: String).returns(String) }
22
22
  def id=(value); end
23
23
 
24
- sig { returns(WorkOS::ApiKeyRevokedDataOwner) }
24
+ sig { returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) }
25
25
  def owner; end
26
26
 
27
- sig { params(value: WorkOS::ApiKeyRevokedDataOwner).returns(WorkOS::ApiKeyRevokedDataOwner) }
27
+ sig { params(value: T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)).returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) }
28
28
  def owner=(value); end
29
29
 
30
30
  sig { returns(String) }