workos 7.1.2 → 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 (107) 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 +29 -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 +4 -4
  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 +122 -22
  23. data/lib/workos/client.rb +4 -4
  24. data/lib/workos/connect.rb +2 -2
  25. data/lib/workos/directory_sync/directory_user.rb +3 -0
  26. data/lib/workos/directory_sync/directory_user_with_groups.rb +4 -1
  27. data/lib/workos/directory_sync/dsync_user_updated_data.rb +3 -0
  28. data/lib/workos/directory_sync.rb +6 -6
  29. data/lib/workos/events.rb +2 -2
  30. data/lib/workos/feature_flags.rb +6 -6
  31. data/lib/workos/groups.rb +4 -4
  32. data/lib/workos/multi_factor_auth.rb +2 -2
  33. data/lib/workos/organizations.rb +2 -2
  34. data/lib/workos/sso/profile.rb +3 -0
  35. data/lib/workos/sso.rb +2 -2
  36. data/lib/workos/types/event_context_actor_source.rb +2 -1
  37. data/lib/workos/types/{applications_order.rb → pagination_order.rb} +1 -1
  38. data/lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb → vault_byok_key_provider.rb} +1 -1
  39. data/lib/workos/user_management/create_user_api_key.rb +25 -0
  40. data/lib/workos/user_management/organization_membership.rb +5 -2
  41. data/lib/workos/user_management/user_api_key.rb +43 -0
  42. data/lib/workos/user_management/user_api_key_created_data_owner.rb +25 -0
  43. data/lib/workos/{api_keys/api_key_with_value_owner.rb → user_management/user_api_key_owner.rb} +1 -1
  44. data/lib/workos/{types/webhooks_order.rb → user_management/user_api_key_revoked_data_owner.rb} +1 -3
  45. data/lib/workos/{api_keys/api_key_with_value.rb → user_management/user_api_key_with_value.rb} +2 -2
  46. data/lib/workos/{types/groups_order.rb → user_management/user_api_key_with_value_owner.rb} +1 -3
  47. data/lib/workos/user_management/user_organization_membership.rb +5 -2
  48. data/lib/workos/user_management.rb +107 -10
  49. data/lib/workos/user_management_organization_membership_groups.rb +2 -2
  50. data/lib/workos/vault/vault_byok_key_deleted.rb +34 -0
  51. data/lib/workos/vault/vault_byok_key_deleted_data.rb +22 -0
  52. data/lib/workos/version.rb +1 -1
  53. data/lib/workos/webhooks.rb +2 -2
  54. data/rbi/workos/api_key.rbi +2 -2
  55. data/rbi/workos/api_key_created_data.rbi +2 -2
  56. data/rbi/workos/api_key_revoked_data.rbi +2 -2
  57. data/rbi/workos/api_keys.rbi +17 -17
  58. data/rbi/workos/authorization.rbi +27 -1
  59. data/rbi/workos/client.rbi +3 -3
  60. data/rbi/workos/create_user_api_key.rbi +36 -0
  61. data/rbi/workos/directory_user.rbi +6 -0
  62. data/rbi/workos/directory_user_with_groups.rbi +6 -0
  63. data/rbi/workos/dsync_user_updated_data.rbi +6 -0
  64. data/rbi/workos/organization_api_key.rbi +72 -0
  65. data/rbi/workos/{api_key_with_value_owner.rbi → organization_api_key_owner.rbi} +1 -1
  66. data/rbi/workos/organization_api_key_with_value.rbi +78 -0
  67. data/rbi/workos/organization_api_key_with_value_owner.rbi +30 -0
  68. data/rbi/workos/organization_membership.rbi +6 -0
  69. data/rbi/workos/profile.rbi +6 -0
  70. data/rbi/workos/user_api_key.rbi +72 -0
  71. data/rbi/workos/user_api_key_created_data_owner.rbi +36 -0
  72. data/rbi/workos/user_api_key_owner.rbi +36 -0
  73. data/rbi/workos/user_api_key_revoked_data_owner.rbi +36 -0
  74. data/rbi/workos/{api_key_with_value.rbi → user_api_key_with_value.rbi} +3 -3
  75. data/rbi/workos/user_api_key_with_value_owner.rbi +36 -0
  76. data/rbi/workos/user_management.rbi +31 -0
  77. data/rbi/workos/user_organization_membership.rbi +6 -0
  78. data/rbi/workos/user_organization_membership_base_list_data.rbi +6 -0
  79. data/rbi/workos/{role_assignment.rbi → user_role_assignment.rbi} +9 -3
  80. data/rbi/workos/{role_assignment_resource.rbi → user_role_assignment_resource.rbi} +1 -1
  81. data/rbi/workos/vault_byok_key_deleted.rbi +54 -0
  82. data/rbi/workos/vault_byok_key_deleted_data.rbi +30 -0
  83. data/script/docs +16 -0
  84. data/script/docs-serve +12 -0
  85. data/script/llms-txt +37 -0
  86. data/test/workos/test_api_keys.rb +17 -17
  87. data/test/workos/test_authorization.rb +16 -0
  88. data/test/workos/test_model_round_trip.rb +278 -83
  89. data/test/workos/test_user_management.rb +25 -1
  90. metadata +38 -32
  91. data/lib/workos/types/authorization_order.rb +0 -9
  92. data/lib/workos/types/connections_order.rb +0 -9
  93. data/lib/workos/types/directories_order.rb +0 -9
  94. data/lib/workos/types/directory_groups_order.rb +0 -9
  95. data/lib/workos/types/directory_users_order.rb +0 -9
  96. data/lib/workos/types/feature_flags_order.rb +0 -9
  97. data/lib/workos/types/organizations_api_keys_order.rb +0 -9
  98. data/lib/workos/types/organizations_feature_flags_order.rb +0 -9
  99. data/lib/workos/types/organizations_order.rb +0 -9
  100. data/lib/workos/types/permissions_order.rb +0 -9
  101. data/lib/workos/types/user_management_invitations_order.rb +0 -9
  102. data/lib/workos/types/user_management_multi_factor_authentication_order.rb +0 -9
  103. data/lib/workos/types/user_management_organization_membership_groups_order.rb +0 -9
  104. data/lib/workos/types/user_management_organization_membership_order.rb +0 -9
  105. data/lib/workos/types/user_management_users_authorized_applications_order.rb +0 -9
  106. data/lib/workos/types/user_management_users_feature_flags_order.rb +0 -9
  107. data/lib/workos/types/user_management_users_order.rb +0 -9
@@ -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
- AuditLogsOrder = ApplicationsOrder
8
- end
6
+ OrganizationApiKeyWithValueOwner = ApiKeyCreatedDataOwner
9
7
  end
@@ -10,59 +10,19 @@ module WorkOS
10
10
  @client = client
11
11
  end
12
12
 
13
- # Validate API key
14
- # @param value [String] The value for an API key.
15
- # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
16
- # @return [WorkOS::ApiKeyValidationResponse]
17
- def create_validation(
18
- value:,
19
- request_options: {}
20
- )
21
- body = {
22
- "value" => value
23
- }
24
- response = @client.request(
25
- method: :post,
26
- path: "/api_keys/validations",
27
- auth: true,
28
- body: body,
29
- request_options: request_options
30
- )
31
- result = WorkOS::ApiKeyValidationResponse.new(response.body)
32
- 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"])
33
- result
34
- end
35
-
36
- # Delete an API key
37
- # @param id [String] The unique ID of the API key.
38
- # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
39
- # @return [void]
40
- def delete_api_key(
41
- id:,
42
- request_options: {}
43
- )
44
- @client.request(
45
- method: :delete,
46
- path: "/api_keys/#{WorkOS::Util.encode_path(id)}",
47
- auth: true,
48
- request_options: request_options
49
- )
50
- nil
51
- end
52
-
53
13
  # List API keys for an organization
54
14
  # @param organization_id [String] Unique identifier of the Organization.
55
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.
56
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.
57
17
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
58
- # @param order [WorkOS::Types::OrganizationsApiKeysOrder, nil] Order the results by the creation time.
18
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time.
59
19
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
60
- # @return [WorkOS::Types::ListStruct<WorkOS::ApiKey>]
20
+ # @return [WorkOS::Types::ListStruct<WorkOS::OrganizationApiKey>]
61
21
  def list_organization_api_keys(
62
22
  organization_id:,
63
23
  before: nil,
64
24
  after: nil,
65
- limit: nil,
25
+ limit: 10,
66
26
  order: "desc",
67
27
  request_options: {}
68
28
  )
@@ -91,7 +51,7 @@ module WorkOS
91
51
  }
92
52
  WorkOS::Types::ListStruct.from_response(
93
53
  response,
94
- model: WorkOS::ApiKey,
54
+ model: WorkOS::OrganizationApiKey,
95
55
  filters: {organization_id: organization_id, before: before, limit: limit, order: order},
96
56
  fetch_next: fetch_next
97
57
  )
@@ -102,7 +62,7 @@ module WorkOS
102
62
  # @param name [String] The name for the API key.
103
63
  # @param permissions [Array<String>, nil] The permission slugs to assign to the API key.
104
64
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
105
- # @return [WorkOS::ApiKeyWithValue]
65
+ # @return [WorkOS::OrganizationApiKeyWithValue]
106
66
  def create_organization_api_key(
107
67
  organization_id:,
108
68
  name:,
@@ -120,9 +80,49 @@ module WorkOS
120
80
  body: body,
121
81
  request_options: request_options
122
82
  )
123
- result = WorkOS::ApiKeyWithValue.new(response.body)
83
+ result = WorkOS::OrganizationApiKeyWithValue.new(response.body)
124
84
  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"])
125
85
  result
126
86
  end
87
+
88
+ # Validate API key
89
+ # @param value [String] The value for an API key.
90
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
91
+ # @return [WorkOS::ApiKeyValidationResponse]
92
+ def create_validation(
93
+ value:,
94
+ request_options: {}
95
+ )
96
+ body = {
97
+ "value" => value
98
+ }
99
+ response = @client.request(
100
+ method: :post,
101
+ path: "/api_keys/validations",
102
+ auth: true,
103
+ body: body,
104
+ request_options: request_options
105
+ )
106
+ result = WorkOS::ApiKeyValidationResponse.new(response.body)
107
+ 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"])
108
+ result
109
+ end
110
+
111
+ # Delete an API key
112
+ # @param id [String] The unique ID of the API key.
113
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
114
+ # @return [void]
115
+ def delete_api_key(
116
+ id:,
117
+ request_options: {}
118
+ )
119
+ @client.request(
120
+ method: :delete,
121
+ path: "/api_keys/#{WorkOS::Util.encode_path(id)}",
122
+ auth: true,
123
+ request_options: request_options
124
+ )
125
+ nil
126
+ end
127
127
  end
128
128
  end
@@ -58,13 +58,13 @@ module WorkOS
58
58
  # @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.
59
59
  # @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.
60
60
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
61
- # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time.
61
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time.
62
62
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
63
63
  # @return [WorkOS::Types::ListStruct<WorkOS::AuditLogActionJson>]
64
64
  def list_actions(
65
65
  before: nil,
66
66
  after: nil,
67
- limit: nil,
67
+ limit: 10,
68
68
  order: "desc",
69
69
  request_options: {}
70
70
  )
@@ -103,14 +103,14 @@ module WorkOS
103
103
  # @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.
104
104
  # @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.
105
105
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
106
- # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time.
106
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time.
107
107
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
108
108
  # @return [WorkOS::Types::ListStruct<WorkOS::AuditLogSchemaJson>]
109
109
  def list_action_schemas(
110
110
  action_name:,
111
111
  before: nil,
112
112
  after: nil,
113
- limit: nil,
113
+ limit: 10,
114
114
  order: "desc",
115
115
  request_options: {}
116
116
  )
@@ -14,7 +14,8 @@ module WorkOS
14
14
  organization_name: :organization_name,
15
15
  custom_attributes: :custom_attributes,
16
16
  created_at: :created_at,
17
- updated_at: :updated_at
17
+ updated_at: :updated_at,
18
+ user: :user
18
19
  }.freeze
19
20
 
20
21
  attr_accessor \
@@ -27,7 +28,8 @@ module WorkOS
27
28
  :organization_name,
28
29
  :custom_attributes,
29
30
  :created_at,
30
- :updated_at
31
+ :updated_at,
32
+ :user
31
33
 
32
34
  def initialize(json)
33
35
  hash = self.class.normalize(json)
@@ -41,6 +43,7 @@ module WorkOS
41
43
  @custom_attributes = hash[:custom_attributes] || {}
42
44
  @created_at = hash[:created_at]
43
45
  @updated_at = hash[:updated_at]
46
+ @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil
44
47
  end
45
48
  end
46
49
  end
@@ -3,10 +3,11 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- class RoleAssignment < WorkOS::Types::BaseModel
6
+ class UserRoleAssignment < WorkOS::Types::BaseModel
7
7
  HASH_ATTRS = {
8
8
  object: :object,
9
9
  id: :id,
10
+ organization_membership_id: :organization_membership_id,
10
11
  role: :role,
11
12
  resource: :resource,
12
13
  created_at: :created_at,
@@ -16,6 +17,7 @@ module WorkOS
16
17
  attr_accessor \
17
18
  :object,
18
19
  :id,
20
+ :organization_membership_id,
19
21
  :role,
20
22
  :resource,
21
23
  :created_at,
@@ -25,8 +27,9 @@ module WorkOS
25
27
  hash = self.class.normalize(json)
26
28
  @object = hash[:object]
27
29
  @id = hash[:id]
30
+ @organization_membership_id = hash[:organization_membership_id]
28
31
  @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil
29
- @resource = hash[:resource] ? WorkOS::RoleAssignmentResource.new(hash[:resource]) : nil
32
+ @resource = hash[:resource] ? WorkOS::UserRoleAssignmentResource.new(hash[:resource]) : nil
30
33
  @created_at = hash[:created_at]
31
34
  @updated_at = hash[:updated_at]
32
35
  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 RoleAssignmentResource < WorkOS::Types::BaseModel
6
+ class UserRoleAssignmentResource < WorkOS::Types::BaseModel
7
7
  HASH_ATTRS = {
8
8
  id: :id,
9
9
  external_id: :external_id,
@@ -93,7 +93,7 @@ module WorkOS
93
93
  # @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"`.
94
94
  # @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"`.
95
95
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
96
- # @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.
96
+ # @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.
97
97
  # @param permission_slug [String] The permission slug to filter by. Only child resources where the organization membership has this permission are returned.
98
98
  # @param parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId] Identifies the parent resource.
99
99
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -104,7 +104,7 @@ module WorkOS
104
104
  parent_resource:,
105
105
  before: nil,
106
106
  after: nil,
107
- limit: nil,
107
+ limit: 10,
108
108
  order: "desc",
109
109
  request_options: {}
110
110
  )
@@ -157,7 +157,7 @@ module WorkOS
157
157
  # @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"`.
158
158
  # @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"`.
159
159
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
160
- # @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.
160
+ # @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.
161
161
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
162
162
  # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizationPermission>]
163
163
  def list_effective_permissions(
@@ -165,7 +165,7 @@ module WorkOS
165
165
  resource_id:,
166
166
  before: nil,
167
167
  after: nil,
168
- limit: nil,
168
+ limit: 10,
169
169
  order: "desc",
170
170
  request_options: {}
171
171
  )
@@ -208,7 +208,7 @@ module WorkOS
208
208
  # @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"`.
209
209
  # @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"`.
210
210
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
211
- # @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.
211
+ # @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.
212
212
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
213
213
  # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizationPermission>]
214
214
  def list_effective_permissions_by_external_id(
@@ -217,7 +217,7 @@ module WorkOS
217
217
  external_id:,
218
218
  before: nil,
219
219
  after: nil,
220
- limit: nil,
220
+ limit: 10,
221
221
  order: "desc",
222
222
  request_options: {}
223
223
  )
@@ -259,14 +259,14 @@ module WorkOS
259
259
  # @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"`.
260
260
  # @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"`.
261
261
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
262
- # @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.
262
+ # @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.
263
263
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
264
- # @return [WorkOS::Types::ListStruct<WorkOS::RoleAssignment>]
264
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserRoleAssignment>]
265
265
  def list_role_assignments(
266
266
  organization_membership_id:,
267
267
  before: nil,
268
268
  after: nil,
269
- limit: nil,
269
+ limit: 10,
270
270
  order: "desc",
271
271
  request_options: {}
272
272
  )
@@ -295,7 +295,7 @@ module WorkOS
295
295
  }
296
296
  WorkOS::Types::ListStruct.from_response(
297
297
  response,
298
- model: WorkOS::RoleAssignment,
298
+ model: WorkOS::UserRoleAssignment,
299
299
  filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order},
300
300
  fetch_next: fetch_next
301
301
  )
@@ -306,7 +306,7 @@ module WorkOS
306
306
  # @param role_slug [String] The slug of the role to assign.
307
307
  # @param resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target.
308
308
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
309
- # @return [WorkOS::RoleAssignment]
309
+ # @return [WorkOS::UserRoleAssignment]
310
310
  def assign_role(
311
311
  organization_membership_id:,
312
312
  role_slug:,
@@ -332,7 +332,7 @@ module WorkOS
332
332
  body: body,
333
333
  request_options: request_options
334
334
  )
335
- result = WorkOS::RoleAssignment.new(response.body)
335
+ result = WorkOS::UserRoleAssignment.new(response.body)
336
336
  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"])
337
337
  result
338
338
  end
@@ -671,7 +671,7 @@ module WorkOS
671
671
  organization_id:,
672
672
  resource_type_slug:,
673
673
  external_id:,
674
- cascade_delete: nil,
674
+ cascade_delete: false,
675
675
  request_options: {}
676
676
  )
677
677
  params = {
@@ -694,7 +694,7 @@ module WorkOS
694
694
  # @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"`.
695
695
  # @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"`.
696
696
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
697
- # @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.
697
+ # @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.
698
698
  # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned.
699
699
  # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments.
700
700
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -706,7 +706,7 @@ module WorkOS
706
706
  permission_slug:,
707
707
  before: nil,
708
708
  after: nil,
709
- limit: nil,
709
+ limit: 10,
710
710
  order: "desc",
711
711
  assignment: nil,
712
712
  request_options: {}
@@ -748,11 +748,64 @@ module WorkOS
748
748
  )
749
749
  end
750
750
 
751
+ # List role assignments for a resource by external ID
752
+ # @param organization_id [String] The ID of the organization that owns the resource.
753
+ # @param resource_type_slug [String] The slug of the resource type.
754
+ # @param external_id [String] An identifier you provide to reference the resource in your system.
755
+ # @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"`.
756
+ # @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"`.
757
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
758
+ # @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.
759
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
760
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserRoleAssignment>]
761
+ def list_role_assignments_for_resource_by_external_id(
762
+ organization_id:,
763
+ resource_type_slug:,
764
+ external_id:,
765
+ before: nil,
766
+ after: nil,
767
+ limit: 10,
768
+ order: "desc",
769
+ request_options: {}
770
+ )
771
+ params = {
772
+ "before" => before,
773
+ "after" => after,
774
+ "limit" => limit,
775
+ "order" => order
776
+ }.compact
777
+ response = @client.request(
778
+ method: :get,
779
+ 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",
780
+ auth: true,
781
+ params: params,
782
+ request_options: request_options
783
+ )
784
+ fetch_next = ->(cursor) {
785
+ list_role_assignments_for_resource_by_external_id(
786
+ organization_id: organization_id,
787
+ resource_type_slug: resource_type_slug,
788
+ external_id: external_id,
789
+ before: before,
790
+ after: cursor,
791
+ limit: limit,
792
+ order: order,
793
+ request_options: request_options
794
+ )
795
+ }
796
+ WorkOS::Types::ListStruct.from_response(
797
+ response,
798
+ model: WorkOS::UserRoleAssignment,
799
+ filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order},
800
+ fetch_next: fetch_next
801
+ )
802
+ end
803
+
751
804
  # List resources
752
805
  # @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"`.
753
806
  # @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"`.
754
807
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
755
- # @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.
808
+ # @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.
756
809
  # @param organization_id [String, nil] Filter resources by organization ID.
757
810
  # @param resource_type_slug [String, nil] Filter resources by resource type slug.
758
811
  # @param resource_external_id [String, nil] Filter resources by external ID.
@@ -763,7 +816,7 @@ module WorkOS
763
816
  def list_resources(
764
817
  before: nil,
765
818
  after: nil,
766
- limit: nil,
819
+ limit: 10,
767
820
  order: "desc",
768
821
  organization_id: nil,
769
822
  resource_type_slug: nil,
@@ -937,7 +990,7 @@ module WorkOS
937
990
  # @return [void]
938
991
  def delete_resource(
939
992
  resource_id:,
940
- cascade_delete: nil,
993
+ cascade_delete: false,
941
994
  request_options: {}
942
995
  )
943
996
  params = {
@@ -958,7 +1011,7 @@ module WorkOS
958
1011
  # @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"`.
959
1012
  # @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"`.
960
1013
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
961
- # @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.
1014
+ # @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.
962
1015
  # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned.
963
1016
  # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments.
964
1017
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -968,7 +1021,7 @@ module WorkOS
968
1021
  permission_slug:,
969
1022
  before: nil,
970
1023
  after: nil,
971
- limit: nil,
1024
+ limit: 10,
972
1025
  order: "desc",
973
1026
  assignment: nil,
974
1027
  request_options: {}
@@ -1008,6 +1061,53 @@ module WorkOS
1008
1061
  )
1009
1062
  end
1010
1063
 
1064
+ # List role assignments for a resource
1065
+ # @param resource_id [String] The ID of the authorization resource.
1066
+ # @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"`.
1067
+ # @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"`.
1068
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1069
+ # @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.
1070
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1071
+ # @return [WorkOS::Types::ListStruct<WorkOS::UserRoleAssignment>]
1072
+ def list_role_assignments_for_resource(
1073
+ resource_id:,
1074
+ before: nil,
1075
+ after: nil,
1076
+ limit: 10,
1077
+ order: "desc",
1078
+ request_options: {}
1079
+ )
1080
+ params = {
1081
+ "before" => before,
1082
+ "after" => after,
1083
+ "limit" => limit,
1084
+ "order" => order
1085
+ }.compact
1086
+ response = @client.request(
1087
+ method: :get,
1088
+ path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/role_assignments",
1089
+ auth: true,
1090
+ params: params,
1091
+ request_options: request_options
1092
+ )
1093
+ fetch_next = ->(cursor) {
1094
+ list_role_assignments_for_resource(
1095
+ resource_id: resource_id,
1096
+ before: before,
1097
+ after: cursor,
1098
+ limit: limit,
1099
+ order: order,
1100
+ request_options: request_options
1101
+ )
1102
+ }
1103
+ WorkOS::Types::ListStruct.from_response(
1104
+ response,
1105
+ model: WorkOS::UserRoleAssignment,
1106
+ filters: {resource_id: resource_id, before: before, limit: limit, order: order},
1107
+ fetch_next: fetch_next
1108
+ )
1109
+ end
1110
+
1011
1111
  # List environment roles
1012
1112
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1013
1113
  # @return [WorkOS::RoleList]
@@ -1156,13 +1256,13 @@ module WorkOS
1156
1256
  # @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"`.
1157
1257
  # @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"`.
1158
1258
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
1159
- # @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.
1259
+ # @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.
1160
1260
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
1161
1261
  # @return [WorkOS::Types::ListStruct<WorkOS::AuthorizationPermission>]
1162
1262
  def list_permissions(
1163
1263
  before: nil,
1164
1264
  after: nil,
1165
- limit: nil,
1265
+ limit: 10,
1166
1266
  order: "desc",
1167
1267
  request_options: {}
1168
1268
  )
data/lib/workos/client.rb CHANGED
@@ -4,10 +4,6 @@
4
4
 
5
5
  module WorkOS
6
6
  class Client < BaseClient
7
- def api_keys
8
- @api_keys ||= WorkOS::ApiKeys.new(self)
9
- end
10
-
11
7
  def multi_factor_auth
12
8
  @multi_factor_auth ||= WorkOS::MultiFactorAuth.new(self)
13
9
  end
@@ -48,6 +44,10 @@ module WorkOS
48
44
  @organizations ||= WorkOS::Organizations.new(self)
49
45
  end
50
46
 
47
+ def api_keys
48
+ @api_keys ||= WorkOS::ApiKeys.new(self)
49
+ end
50
+
51
51
  def groups
52
52
  @groups ||= WorkOS::Groups.new(self)
53
53
  end
@@ -43,14 +43,14 @@ module WorkOS
43
43
  # @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"`.
44
44
  # @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"`.
45
45
  # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
46
- # @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.
46
+ # @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.
47
47
  # @param organization_id [String, nil] Filter Connect Applications by organization ID.
48
48
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
49
49
  # @return [WorkOS::Types::ListStruct<WorkOS::ConnectApplication>]
50
50
  def list_applications(
51
51
  before: nil,
52
52
  after: nil,
53
- limit: nil,
53
+ limit: 10,
54
54
  order: "desc",
55
55
  organization_id: nil,
56
56
  request_options: {}
@@ -13,6 +13,7 @@ module WorkOS
13
13
  email: :email,
14
14
  first_name: :first_name,
15
15
  last_name: :last_name,
16
+ name: :name,
16
17
  emails: :emails,
17
18
  job_title: :job_title,
18
19
  username: :username,
@@ -43,6 +44,7 @@ module WorkOS
43
44
  :email,
44
45
  :first_name,
45
46
  :last_name,
47
+ :name,
46
48
  :state,
47
49
  :custom_attributes,
48
50
  :role,
@@ -88,6 +90,7 @@ module WorkOS
88
90
  @email = hash[:email]
89
91
  @first_name = hash[:first_name]
90
92
  @last_name = hash[:last_name]
93
+ @name = hash[:name]
91
94
  @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserEmail.new(item) : nil }
92
95
  @job_title = hash[:job_title]
93
96
  @username = hash[:username]
@@ -13,6 +13,7 @@ module WorkOS
13
13
  email: :email,
14
14
  first_name: :first_name,
15
15
  last_name: :last_name,
16
+ name: :name,
16
17
  emails: :emails,
17
18
  job_title: :job_title,
18
19
  username: :username,
@@ -35,7 +36,7 @@ module WorkOS
35
36
  # @!attribute raw_attributes
36
37
  # @deprecated The raw attributes received from the directory provider.
37
38
  # @!attribute groups
38
- # @deprecated The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead.
39
+ # @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.
39
40
 
40
41
  attr_accessor \
41
42
  :object,
@@ -46,6 +47,7 @@ module WorkOS
46
47
  :email,
47
48
  :first_name,
48
49
  :last_name,
50
+ :name,
49
51
  :state,
50
52
  :custom_attributes,
51
53
  :role,
@@ -98,6 +100,7 @@ module WorkOS
98
100
  @email = hash[:email]
99
101
  @first_name = hash[:first_name]
100
102
  @last_name = hash[:last_name]
103
+ @name = hash[:name]
101
104
  @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserWithGroupsEmail.new(item) : nil }
102
105
  @job_title = hash[:job_title]
103
106
  @username = hash[:username]