workos 10.3.0 → 10.5.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 (210) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/.github/workflows/docs.yml +4 -4
  4. data/.github/workflows/lint.yml +2 -2
  5. data/.github/workflows/release-please.yml +3 -3
  6. data/.github/workflows/release.yml +2 -2
  7. data/.last-synced-sha +1 -1
  8. data/.oagen-manifest.json +326 -158
  9. data/.release-please-manifest.json +1 -1
  10. data/.ruby-version +1 -1
  11. data/CHANGELOG.md +388 -0
  12. data/Gemfile.lock +14 -14
  13. data/README.md +23 -0
  14. data/lib/workos/admin_portal/generate_link.rb +3 -0
  15. data/lib/workos/admin_portal/revoke_link.rb +22 -0
  16. data/lib/workos/admin_portal.rb +29 -2
  17. data/lib/workos/agents/agent_blueprint.rb +3 -0
  18. data/lib/workos/agents/agent_blueprint_invocable_as.rb +18 -0
  19. data/lib/workos/agents/agent_blueprints_create_request.rb +3 -0
  20. data/lib/workos/agents/agent_blueprints_create_request_invocable_as.rb +18 -0
  21. data/lib/workos/agents/agent_blueprints_update_request.rb +3 -0
  22. data/lib/workos/agents/agent_blueprints_update_request_invocable_as.rb +18 -0
  23. data/lib/workos/agents/agent_registration.rb +3 -0
  24. data/lib/workos/agents.rb +30 -1
  25. data/lib/workos/api_keys/validate_api_key.rb +12 -1
  26. data/lib/workos/authorization/user_role_assignment_source.rb +5 -2
  27. data/lib/workos/authorization/user_role_assignment_source_group.rb +7 -0
  28. data/lib/workos/base_client.rb +6 -2
  29. data/lib/workos/configuration.rb +3 -2
  30. data/lib/workos/directory_sync/directory_sync_rate_limit_error.rb +25 -0
  31. data/lib/workos/directory_sync/directory_sync_response.rb +18 -0
  32. data/lib/workos/directory_sync.rb +19 -0
  33. data/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb +3 -0
  34. data/lib/workos/feature_flags/flag_updated_context_previous_attribute_data_owner.rb +7 -0
  35. data/lib/workos/inflections.rb +2 -0
  36. data/lib/workos/multi_factor_auth.rb +1 -1
  37. data/lib/workos/pipes/add_data_integrations_get_data_integration_authorize_url_request.rb +37 -0
  38. data/lib/workos/pipes/connected_account.rb +15 -0
  39. data/lib/workos/pipes/connected_account_input.rb +6 -0
  40. data/lib/workos/pipes/connected_account_write_response.rb +73 -0
  41. data/lib/workos/pipes/connected_account_write_response_warning.rb +22 -0
  42. data/lib/workos/pipes/create_connected_account.rb +40 -0
  43. data/lib/workos/pipes/create_data_integration.rb +3 -0
  44. data/lib/workos/pipes/create_organization_connected_account.rb +43 -0
  45. data/lib/workos/pipes/data_integration.rb +3 -0
  46. data/lib/workos/pipes/data_integration_credentials_response.rb +1 -1
  47. data/lib/workos/pipes/data_integration_installation.rb +9 -0
  48. data/lib/workos/pipes/{data_integration_credentials_response_credential.rb → data_integration_vended_credential.rb} +9 -3
  49. data/lib/workos/pipes/data_integrations_create_api_key_connection_request.rb +37 -0
  50. data/lib/workos/pipes/data_integrations_create_client_credentials_connection_request.rb +43 -0
  51. data/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb +6 -0
  52. data/lib/workos/pipes/data_integrations_get_user_token_request.rb +11 -2
  53. data/lib/workos/pipes/data_integrations_list_response_data.rb +18 -3
  54. data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +15 -0
  55. data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +28 -1
  56. data/lib/workos/pipes/data_integrations_upsert_api_key_request_2.rb +37 -0
  57. data/lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb +9 -0
  58. data/lib/workos/pipes/data_integrations_upsert_client_credentials_request_2.rb +43 -0
  59. data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +11 -2
  60. data/lib/workos/pipes/organization_connected_account.rb +40 -0
  61. data/lib/workos/pipes/reauthorize_data_integrations_get_data_integration_authorize_url_request.rb +40 -0
  62. data/lib/workos/pipes/reauthorize_data_integrations_upsert_api_key_request.rb +40 -0
  63. data/lib/workos/pipes/reauthorize_data_integrations_upsert_client_credentials_request.rb +46 -0
  64. data/lib/workos/pipes.rb +498 -30
  65. data/lib/workos/session_manager.rb +11 -6
  66. data/lib/workos/shared/account_selection_required_error.rb +22 -0
  67. data/lib/workos/shared/agent_blueprint_created_data.rb +3 -0
  68. data/lib/workos/shared/agent_blueprint_created_data_invocable_as.rb +18 -0
  69. data/lib/workos/shared/agent_blueprint_updated_data.rb +40 -1
  70. data/lib/workos/shared/agent_blueprint_updated_data_invocable_as.rb +18 -0
  71. data/lib/workos/shared/pipe_connected_account.rb +21 -0
  72. data/lib/workos/shared/pipes_account_connection_add_failed.rb +34 -0
  73. data/lib/workos/shared/pipes_account_connection_add_failed_data.rb +49 -0
  74. data/lib/workos/shared/pipes_account_connection_connected.rb +34 -0
  75. data/lib/workos/shared/pipes_account_connection_connection_failed.rb +34 -0
  76. data/lib/workos/shared/pipes_account_connection_connection_failed_data.rb +7 -0
  77. data/lib/workos/shared/pipes_account_connection_disconnected.rb +34 -0
  78. data/lib/workos/shared/pipes_account_connection_reauthorization_needed.rb +34 -0
  79. data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +1 -40
  80. data/lib/workos/sso/token_query.rb +3 -0
  81. data/lib/workos/sso.rb +3 -0
  82. data/lib/workos/types/add_data_integrations_get_data_integration_authorize_url_request_connection_owner.rb +13 -0
  83. data/lib/workos/types/agent_blueprint_created_data_invocable_as_instance_types.rb +13 -0
  84. data/lib/workos/types/agent_blueprint_invocable_as_instance_types.rb +9 -0
  85. data/lib/workos/types/agent_blueprint_updated_data_invocable_as_instance_types.rb +9 -0
  86. data/lib/workos/types/agent_blueprints_create_request_invocable_as_instance_types.rb +9 -0
  87. data/lib/workos/types/agent_blueprints_update_request_invocable_as_instance_types.rb +9 -0
  88. data/lib/workos/types/agent_instance_created_data_type.rb +1 -5
  89. data/lib/workos/types/agent_instance_deleted_data_type.rb +1 -1
  90. data/lib/workos/types/agent_instance_type.rb +1 -1
  91. data/lib/workos/types/connected_account_connection_role.rb +13 -0
  92. data/lib/workos/types/connected_account_write_response_auth_method.rb +9 -0
  93. data/lib/workos/types/connected_account_write_response_connection_role.rb +9 -0
  94. data/lib/workos/types/connected_account_write_response_state.rb +9 -0
  95. data/lib/workos/types/create_connected_account_state.rb +9 -0
  96. data/lib/workos/types/create_data_integration_ownership.rb +9 -0
  97. data/lib/workos/types/create_organization_connected_account_state.rb +9 -0
  98. data/lib/workos/types/create_webhook_endpoint_events.rb +6 -1
  99. data/lib/workos/types/data_integration_installation_connection_role.rb +9 -0
  100. data/lib/workos/types/data_integration_ownership.rb +9 -0
  101. data/lib/workos/types/data_integrations_create_api_key_connection_request_connection_owner.rb +9 -0
  102. data/lib/workos/types/data_integrations_create_client_credentials_connection_request_connection_owner.rb +9 -0
  103. data/lib/workos/types/data_integrations_get_data_integration_authorize_url_request_connection_owner.rb +9 -0
  104. data/lib/workos/types/data_integrations_get_user_token_request_connection_owner.rb +9 -0
  105. data/lib/workos/types/data_integrations_list_response_data_connected_account_connection_role.rb +9 -0
  106. data/lib/workos/types/data_integrations_list_response_data_connection_owner.rb +9 -0
  107. data/lib/workos/types/data_integrations_upsert_api_key_request_2_connection_owner.rb +9 -0
  108. data/lib/workos/types/data_integrations_upsert_api_key_request_connection_owner.rb +9 -0
  109. data/lib/workos/types/data_integrations_upsert_client_credentials_request_2_connection_owner.rb +9 -0
  110. data/lib/workos/types/data_integrations_upsert_client_credentials_request_connection_owner.rb +9 -0
  111. data/lib/workos/types/data_integrations_vend_credentials_request_connection_owner.rb +9 -0
  112. data/lib/workos/types/organization_connected_account_state.rb +9 -0
  113. data/lib/workos/types/pipe_connected_account_auth_method.rb +9 -0
  114. data/lib/workos/types/pipe_connected_account_connection_role.rb +9 -0
  115. data/lib/workos/types/pipes_ownership.rb +9 -0
  116. data/lib/workos/types/reauthorize_data_integrations_get_data_integration_authorize_url_request_connection_owner.rb +9 -0
  117. data/lib/workos/types/reauthorize_data_integrations_upsert_api_key_request_connection_owner.rb +9 -0
  118. data/lib/workos/types/reauthorize_data_integrations_upsert_client_credentials_request_connection_owner.rb +9 -0
  119. data/lib/workos/types/resource_export_completed_data_resource_type.rb +4 -1
  120. data/lib/workos/types/vault_dek_rekeyed_data_actor_source.rb +9 -0
  121. data/lib/workos/user_management/authkit_oauth_resource.rb +34 -0
  122. data/lib/workos/user_management/create_authkit_oauth_resource.rb +22 -0
  123. data/lib/workos/user_management.rb +88 -1
  124. data/lib/workos/vault/vault_dek_rekeyed.rb +34 -0
  125. data/lib/workos/vault/vault_dek_rekeyed_data.rb +31 -0
  126. data/lib/workos/version.rb +1 -1
  127. data/rbi/workos/account_selection_required_error.rbi +30 -0
  128. data/rbi/workos/add_data_integrations_get_data_integration_authorize_url_request.rbi +60 -0
  129. data/rbi/workos/admin_portal.rbi +11 -1
  130. data/rbi/workos/agent_blueprint.rbi +6 -0
  131. data/rbi/workos/agent_blueprint_created_data.rbi +6 -0
  132. data/rbi/workos/agent_blueprint_created_data_invocable_as.rbi +24 -0
  133. data/rbi/workos/agent_blueprint_invocable_as.rbi +24 -0
  134. data/rbi/workos/agent_blueprint_updated_data.rbi +6 -0
  135. data/rbi/workos/agent_blueprint_updated_data_invocable_as.rbi +24 -0
  136. data/rbi/workos/agent_blueprints_create_request.rbi +6 -0
  137. data/rbi/workos/agent_blueprints_create_request_invocable_as.rbi +24 -0
  138. data/rbi/workos/agent_blueprints_update_request.rbi +6 -0
  139. data/rbi/workos/agent_blueprints_update_request_invocable_as.rbi +24 -0
  140. data/rbi/workos/agent_registration.rbi +6 -0
  141. data/rbi/workos/agents.rbi +14 -3
  142. data/rbi/workos/authkit_oauth_resource.rbi +54 -0
  143. data/rbi/workos/connected_account.rbi +30 -0
  144. data/rbi/workos/connected_account_input.rbi +12 -0
  145. data/rbi/workos/connected_account_write_response.rbi +132 -0
  146. data/rbi/workos/connected_account_write_response_warning.rbi +30 -0
  147. data/rbi/workos/create_authkit_oauth_resource.rbi +30 -0
  148. data/rbi/workos/create_connected_account.rbi +66 -0
  149. data/rbi/workos/create_data_integration.rbi +6 -0
  150. data/rbi/workos/create_organization_connected_account.rbi +72 -0
  151. data/rbi/workos/data_integration.rbi +6 -0
  152. data/rbi/workos/data_integration_credentials_response.rbi +2 -2
  153. data/rbi/workos/data_integration_installation.rbi +19 -1
  154. data/rbi/workos/data_integration_vended_credential.rbi +66 -0
  155. data/rbi/workos/data_integrations_create_api_key_connection_request.rbi +60 -0
  156. data/rbi/workos/data_integrations_create_client_credentials_connection_request.rbi +72 -0
  157. data/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi +12 -0
  158. data/rbi/workos/data_integrations_get_user_token_request.rbi +18 -0
  159. data/rbi/workos/data_integrations_list_response_data.rbi +12 -0
  160. data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +30 -0
  161. data/rbi/workos/data_integrations_upsert_api_key_request.rbi +18 -0
  162. data/rbi/workos/data_integrations_upsert_api_key_request_2.rbi +60 -0
  163. data/rbi/workos/data_integrations_upsert_client_credentials_request.rbi +18 -0
  164. data/rbi/workos/data_integrations_upsert_client_credentials_request_2.rbi +72 -0
  165. data/rbi/workos/data_integrations_vend_credentials_request.rbi +18 -0
  166. data/rbi/workos/directory_sync.rbi +8 -0
  167. data/rbi/workos/directory_sync_rate_limit_error.rbi +36 -0
  168. data/rbi/workos/directory_sync_response.rbi +24 -0
  169. data/rbi/workos/flag_updated_context_previous_attribute_data.rbi +6 -0
  170. data/rbi/workos/flag_updated_context_previous_attribute_data_owner.rbi +36 -0
  171. data/rbi/workos/generate_link.rbi +6 -0
  172. data/rbi/workos/organization_connected_account.rbi +66 -0
  173. data/rbi/workos/pipe_connected_account.rbi +42 -0
  174. data/rbi/workos/pipes.rbi +176 -16
  175. data/rbi/workos/pipes_account_connection_add_failed.rbi +54 -0
  176. data/rbi/workos/pipes_account_connection_add_failed_data.rbi +84 -0
  177. data/rbi/workos/pipes_account_connection_connected.rbi +54 -0
  178. data/rbi/workos/pipes_account_connection_connection_failed.rbi +54 -0
  179. data/rbi/workos/pipes_account_connection_connection_failed_data.rbi +84 -0
  180. data/rbi/workos/pipes_account_connection_disconnected.rbi +54 -0
  181. data/rbi/workos/pipes_account_connection_reauthorization_needed.rbi +54 -0
  182. data/rbi/workos/pipes_connected_account_connection_failed_data.rbi +6 -0
  183. data/rbi/workos/reauthorize_data_integrations_get_data_integration_authorize_url_request.rbi +66 -0
  184. data/rbi/workos/reauthorize_data_integrations_upsert_api_key_request.rbi +66 -0
  185. data/rbi/workos/reauthorize_data_integrations_upsert_client_credentials_request.rbi +78 -0
  186. data/rbi/workos/revoke_link.rbi +30 -0
  187. data/rbi/workos/sso.rbi +2 -1
  188. data/rbi/workos/token_query.rbi +6 -0
  189. data/rbi/workos/user_management.rbi +28 -0
  190. data/rbi/workos/user_role_assignment_source.rbi +6 -0
  191. data/rbi/workos/user_role_assignment_source_group.rbi +30 -0
  192. data/rbi/workos/vault_dek_rekeyed.rbi +54 -0
  193. data/rbi/workos/{data_integration_credentials_response_credential.rbi → vault_dek_rekeyed_data.rbi} +13 -19
  194. data/test/workos/test_admin_portal.rb +9 -1
  195. data/test/workos/test_admin_portal_model_round_trip.rb +14 -0
  196. data/test/workos/test_agents.rb +8 -0
  197. data/test/workos/test_agents_model_round_trip.rb +35 -0
  198. data/test/workos/test_authorization_model_round_trip.rb +15 -1
  199. data/test/workos/test_directory_sync.rb +8 -0
  200. data/test/workos/test_directory_sync_model_round_trip.rb +24 -0
  201. data/test/workos/test_feature_flags_model_round_trip.rb +16 -0
  202. data/test/workos/test_pipes.rb +80 -0
  203. data/test/workos/test_pipes_model_round_trip.rb +317 -18
  204. data/test/workos/test_session.rb +63 -0
  205. data/test/workos/test_shared_model_round_trip.rb +185 -0
  206. data/test/workos/test_sso_model_round_trip.rb +1 -0
  207. data/test/workos/test_user_management.rb +24 -0
  208. data/test/workos/test_user_management_model_round_trip.rb +32 -0
  209. data/test/workos/test_vault_model_round_trip.rb +33 -0
  210. metadata +107 -3
data/lib/workos/pipes.rb CHANGED
@@ -15,6 +15,7 @@ module WorkOS
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
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).
18
+ # @param ownership [WorkOS::Types::PipesOwnership, nil] Only return Data Integrations with this ownership: `user` for the integrations users connect their own accounts to, or `organization` for the roots organizations connect to. Omit to return both.
18
19
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
19
20
  # @return [WorkOS::Types::ListStruct<WorkOS::DataIntegration>]
20
21
  def list_data_integrations(
@@ -22,13 +23,15 @@ module WorkOS
22
23
  after: nil,
23
24
  limit: 10,
24
25
  order: "desc",
26
+ ownership: nil,
25
27
  request_options: {}
26
28
  )
27
29
  params = {
28
30
  "before" => before,
29
31
  "after" => after,
30
32
  "limit" => limit,
31
- "order" => order
33
+ "order" => order,
34
+ "ownership" => ownership
32
35
  }.compact
33
36
  response = @client.request(
34
37
  method: :get,
@@ -43,19 +46,21 @@ module WorkOS
43
46
  after: cursor,
44
47
  limit: limit,
45
48
  order: order,
49
+ ownership: ownership,
46
50
  request_options: request_options
47
51
  )
48
52
  }
49
53
  WorkOS::Types::ListStruct.from_response(
50
54
  response,
51
55
  model: WorkOS::DataIntegration,
52
- filters: {before: before, limit: limit, order: order},
56
+ filters: {before: before, limit: limit, order: order, ownership: ownership},
53
57
  fetch_next: fetch_next
54
58
  )
55
59
  end
56
60
 
57
61
  # Create a data integration
58
62
  # @param provider [String] The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
63
+ # @param ownership [WorkOS::Types::CreateDataIntegrationOwnership, nil] Who owns the Data Integration. `user` (the default) creates the integration users connect their own accounts to; `organization` creates the root organizations connect to. Ownership is fixed at creation, and one integration of each ownership may exist per provider. Independent of `credentials.type`.
59
64
  # @param description [String, nil] An optional description of the Data Integration.
60
65
  # @param enabled [Boolean, nil] Whether the Data Integration is enabled. Defaults to `false`.
61
66
  # @param scopes [Array<String>, nil] The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
@@ -68,6 +73,7 @@ module WorkOS
68
73
  # @return [WorkOS::DataIntegration]
69
74
  def create_data_integration(
70
75
  provider:,
76
+ ownership: nil,
71
77
  description: WorkOS::OMIT,
72
78
  enabled: nil,
73
79
  scopes: WorkOS::OMIT,
@@ -80,6 +86,7 @@ module WorkOS
80
86
  )
81
87
  body = {
82
88
  "provider" => provider,
89
+ "ownership" => ownership,
83
90
  "enabled" => enabled,
84
91
  "auth_methods" => auth_methods,
85
92
  "config" => config,
@@ -177,25 +184,83 @@ module WorkOS
177
184
  nil
178
185
  end
179
186
 
187
+ # Create another API key connected account
188
+ # @param slug [String] The identifier of the integration.
189
+ # @param account_display_name [String, nil] A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
190
+ # @param account_identifier [String, nil] A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
191
+ # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
192
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
193
+ # @param connection_owner [WorkOS::Types::DataIntegrationsCreateApiKeyConnectionRequestConnectionOwner, nil] Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
194
+ # @param secret [String] The API key secret to store for this integration.
195
+ # @param connection_intent [String] Must be `add`: this endpoint only creates another connection. The first connection for an owner shape fills the compatibility slot; later connections are standard. Creating an additional connection is not yet available: until it is, `add` succeeds only when the owner has no connection for this integration and otherwise returns 404 `multiple_connections_unavailable`.
196
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
197
+ # @return [WorkOS::ConnectedAccountWriteResponse]
198
+ def create_data_integration_api_key(
199
+ slug:,
200
+ user_id:,
201
+ secret:,
202
+ connection_intent:,
203
+ account_display_name: WorkOS::OMIT,
204
+ account_identifier: WorkOS::OMIT,
205
+ organization_id: nil,
206
+ connection_owner: nil,
207
+ request_options: {}
208
+ )
209
+ body = {
210
+ "user_id" => user_id,
211
+ "organization_id" => organization_id,
212
+ "connection_owner" => connection_owner,
213
+ "secret" => secret,
214
+ "connection_intent" => connection_intent
215
+ }.compact
216
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
217
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
218
+ response = @client.request(
219
+ method: :post,
220
+ path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/api-key",
221
+ auth: true,
222
+ body: body,
223
+ request_options: request_options
224
+ )
225
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
226
+ 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"])
227
+ result
228
+ end
229
+
180
230
  # Upsert an API key for a connected account
181
231
  # @param slug [String] The identifier of the integration.
232
+ # @param account_display_name [String, nil] A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
233
+ # @param account_identifier [String, nil] A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
182
234
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
183
- # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
235
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
236
+ # @param connection_owner [WorkOS::Types::DataIntegrationsUpsertApiKeyRequestConnectionOwner, nil] Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
184
237
  # @param secret [String] The API key secret to store for this integration.
238
+ # @param connection_intent [String, nil] Reauthorize exactly the connection named by `connected_account_id`.
239
+ # @param connected_account_id [String, nil] The exact connected account to reauthorize. Required with `connection_intent: reauthorize`.
185
240
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
186
- # @return [WorkOS::ConnectedAccount]
241
+ # @return [WorkOS::ConnectedAccountWriteResponse]
187
242
  def update_data_integration_api_key(
188
243
  slug:,
189
244
  user_id:,
190
245
  secret:,
246
+ account_display_name: WorkOS::OMIT,
247
+ account_identifier: WorkOS::OMIT,
191
248
  organization_id: nil,
249
+ connection_owner: nil,
250
+ connection_intent: nil,
251
+ connected_account_id: nil,
192
252
  request_options: {}
193
253
  )
194
254
  body = {
195
255
  "user_id" => user_id,
196
256
  "organization_id" => organization_id,
197
- "secret" => secret
257
+ "connection_owner" => connection_owner,
258
+ "secret" => secret,
259
+ "connection_intent" => connection_intent,
260
+ "connected_account_id" => connected_account_id
198
261
  }.compact
262
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
263
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
199
264
  response = @client.request(
200
265
  method: :put,
201
266
  path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/api-key",
@@ -203,33 +268,45 @@ module WorkOS
203
268
  body: body,
204
269
  request_options: request_options
205
270
  )
206
- result = WorkOS::ConnectedAccount.new(response.body)
271
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
207
272
  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"])
208
273
  result
209
274
  end
210
275
 
211
276
  # Get authorization URL
212
277
  # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
213
- # @param user_id [String] The ID of the user to authorize.
214
- # @param organization_id [String, nil] An organization ID to scope the authorization to a specific organization.
278
+ # @param account_display_name [String, nil] A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
279
+ # @param user_id [String] The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account.
280
+ # @param organization_id [String, nil] An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`.
281
+ # @param connection_owner [WorkOS::Types::DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner, nil] Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`.
215
282
  # @param return_to [String, nil] The URL to redirect the user to after authorization.
216
283
  # @param config [Hash{String => String}, nil] Connect-time config values for the provider-declared `installation`-scope fields (e.g. a Zendesk `subdomain`), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration.
284
+ # @param connection_intent [String, nil] Create another connection. The first connection for an owner shape fills the compatibility slot; later connections are standard. Creating an additional connection is not yet available: until it is, `add` succeeds only when the owner has no connection for this integration and otherwise returns 404 `multiple_connections_unavailable`. Omit `connection_intent` to use the compatibility connection, or send `reauthorize` with `connected_account_id` to reauthorize one exact connection.
285
+ # @param connected_account_id [String, nil] The exact connected account to reauthorize. Required with `connection_intent: reauthorize`.
217
286
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
218
287
  # @return [WorkOS::DataIntegrationAuthorizeUrlResponse]
219
288
  def authorize_data_integration(
220
289
  slug:,
221
290
  user_id:,
291
+ account_display_name: WorkOS::OMIT,
222
292
  organization_id: nil,
293
+ connection_owner: nil,
223
294
  return_to: nil,
224
295
  config: nil,
296
+ connection_intent: nil,
297
+ connected_account_id: nil,
225
298
  request_options: {}
226
299
  )
227
300
  body = {
228
301
  "user_id" => user_id,
229
302
  "organization_id" => organization_id,
303
+ "connection_owner" => connection_owner,
230
304
  "return_to" => return_to,
231
- "config" => config
305
+ "config" => config,
306
+ "connection_intent" => connection_intent,
307
+ "connected_account_id" => connected_account_id
232
308
  }.compact
309
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
233
310
  response = @client.request(
234
311
  method: :post,
235
312
  path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/authorize",
@@ -242,31 +319,95 @@ module WorkOS
242
319
  result
243
320
  end
244
321
 
322
+ # Create another client credentials connected account
323
+ # @param slug [String] The identifier of the integration.
324
+ # @param account_display_name [String, nil] A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
325
+ # @param account_identifier [String, nil] A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
326
+ # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
327
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
328
+ # @param connection_owner [WorkOS::Types::DataIntegrationsCreateClientCredentialsConnectionRequestConnectionOwner, nil] Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
329
+ # @param client_id [String] The OAuth client ID to store for this integration.
330
+ # @param client_secret [String] The OAuth client secret to store for this integration.
331
+ # @param config [Hash{String => String}, nil] Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
332
+ # @param connection_intent [String] Must be `add`: this endpoint only creates another connection. The first connection for an owner shape fills the compatibility slot; later connections are standard. Creating an additional connection is not yet available: until it is, `add` succeeds only when the owner has no connection for this integration and otherwise returns 404 `multiple_connections_unavailable`.
333
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
334
+ # @return [WorkOS::ConnectedAccountWriteResponse]
335
+ def create_data_integration_client_credential(
336
+ slug:,
337
+ user_id:,
338
+ client_id:,
339
+ client_secret:,
340
+ connection_intent:,
341
+ account_display_name: WorkOS::OMIT,
342
+ account_identifier: WorkOS::OMIT,
343
+ organization_id: nil,
344
+ connection_owner: nil,
345
+ config: nil,
346
+ request_options: {}
347
+ )
348
+ body = {
349
+ "user_id" => user_id,
350
+ "organization_id" => organization_id,
351
+ "connection_owner" => connection_owner,
352
+ "client_id" => client_id,
353
+ "client_secret" => client_secret,
354
+ "config" => config,
355
+ "connection_intent" => connection_intent
356
+ }.compact
357
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
358
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
359
+ response = @client.request(
360
+ method: :post,
361
+ path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/client-credentials",
362
+ auth: true,
363
+ body: body,
364
+ request_options: request_options
365
+ )
366
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
367
+ 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"])
368
+ result
369
+ end
370
+
245
371
  # Upsert client credentials for a connected account
246
372
  # @param slug [String] The identifier of the integration.
373
+ # @param account_display_name [String, nil] A mutable, non-unique label. Omit to preserve an existing label; null clears it. Labels are never account identifiers.
374
+ # @param account_identifier [String, nil] A developer-attested provider account identifier, never inferred from a label or credential. Omit to preserve an existing identifier; null clears it.
247
375
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
248
- # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
376
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
377
+ # @param connection_owner [WorkOS::Types::DataIntegrationsUpsertClientCredentialsRequestConnectionOwner, nil] Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
249
378
  # @param client_id [String] The OAuth client ID to store for this integration.
250
379
  # @param client_secret [String] The OAuth client secret to store for this integration.
251
380
  # @param config [Hash{String => String}, nil] Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
381
+ # @param connection_intent [String, nil] Reauthorize exactly the connection named by `connected_account_id`.
382
+ # @param connected_account_id [String, nil] The exact connected account to reauthorize. Required with `connection_intent: reauthorize`.
252
383
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
253
- # @return [WorkOS::ConnectedAccount]
384
+ # @return [WorkOS::ConnectedAccountWriteResponse]
254
385
  def update_data_integration_client_credentials(
255
386
  slug:,
256
387
  user_id:,
257
388
  client_id:,
258
389
  client_secret:,
390
+ account_display_name: WorkOS::OMIT,
391
+ account_identifier: WorkOS::OMIT,
259
392
  organization_id: nil,
393
+ connection_owner: nil,
260
394
  config: nil,
395
+ connection_intent: nil,
396
+ connected_account_id: nil,
261
397
  request_options: {}
262
398
  )
263
399
  body = {
264
400
  "user_id" => user_id,
265
401
  "organization_id" => organization_id,
402
+ "connection_owner" => connection_owner,
266
403
  "client_id" => client_id,
267
404
  "client_secret" => client_secret,
268
- "config" => config
405
+ "config" => config,
406
+ "connection_intent" => connection_intent,
407
+ "connected_account_id" => connected_account_id
269
408
  }.compact
409
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
410
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
270
411
  response = @client.request(
271
412
  method: :put,
272
413
  path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/client-credentials",
@@ -274,26 +415,35 @@ module WorkOS
274
415
  body: body,
275
416
  request_options: request_options
276
417
  )
277
- result = WorkOS::ConnectedAccount.new(response.body)
418
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
278
419
  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"])
279
420
  result
280
421
  end
281
422
 
282
423
  # Vend credentials for a connected account
283
424
  # @param slug [String] The identifier of the integration.
284
- # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
285
- # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
425
+ # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
426
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
427
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
428
+ # @param connection_owner [WorkOS::Types::DataIntegrationsVendCredentialsRequestConnectionOwner, nil] Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
429
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
286
430
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
287
431
  # @return [WorkOS::DataIntegrationCredentialsResponse]
288
432
  def create_data_integration_credential(
289
433
  slug:,
290
434
  user_id:,
291
435
  organization_id: nil,
436
+ connected_account_id: nil,
437
+ connection_owner: nil,
438
+ supports_multiple_connections: nil,
292
439
  request_options: {}
293
440
  )
294
441
  body = {
295
442
  "user_id" => user_id,
296
- "organization_id" => organization_id
443
+ "organization_id" => organization_id,
444
+ "connected_account_id" => connected_account_id,
445
+ "connection_owner" => connection_owner,
446
+ "supports_multiple_connections" => supports_multiple_connections
297
447
  }.compact
298
448
  response = @client.request(
299
449
  method: :post,
@@ -307,21 +457,106 @@ module WorkOS
307
457
  result
308
458
  end
309
459
 
460
+ # Get an organization-owned data integration
461
+ # @param slug [String] The slug identifier of the data integration.
462
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
463
+ # @return [WorkOS::DataIntegration]
464
+ def list_data_integration_organization(
465
+ slug:,
466
+ request_options: {}
467
+ )
468
+ response = @client.request(
469
+ method: :get,
470
+ path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/organization",
471
+ auth: true,
472
+ request_options: request_options
473
+ )
474
+ result = WorkOS::DataIntegration.new(response.body)
475
+ 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"])
476
+ result
477
+ end
478
+
479
+ # Update an organization-owned data integration
480
+ # @param slug [String] The slug identifier of the data integration.
481
+ # @param description [String, nil] An optional description of the Data Integration.
482
+ # @param enabled [Boolean, nil] Whether the Data Integration is enabled.
483
+ # @param scopes [Array<String>, nil] The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes.
484
+ # @param credentials [WorkOS::DataIntegrationCredentialsInput, nil] New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with `api_key`.
485
+ # @param api_key [WorkOS::ApiKeyInstallation, nil] An API key to install or rotate for a tenant on an `api_key` integration. Upserts the tenant installation identified by `user_id` (and optional `organization_id`).
486
+ # @param custom_provider [WorkOS::UpdateCustomProviderDefinition, nil] Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.
487
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
488
+ # @return [WorkOS::DataIntegration]
489
+ def update_data_integration_organization(
490
+ slug:,
491
+ description: WorkOS::OMIT,
492
+ enabled: nil,
493
+ scopes: WorkOS::OMIT,
494
+ credentials: nil,
495
+ api_key: nil,
496
+ custom_provider: nil,
497
+ request_options: {}
498
+ )
499
+ body = {
500
+ "enabled" => enabled,
501
+ "credentials" => credentials,
502
+ "api_key" => api_key,
503
+ "custom_provider" => custom_provider
504
+ }.compact
505
+ body["description"] = description unless description.equal?(WorkOS::OMIT)
506
+ body["scopes"] = scopes unless scopes.equal?(WorkOS::OMIT)
507
+ response = @client.request(
508
+ method: :put,
509
+ path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/organization",
510
+ auth: true,
511
+ body: body,
512
+ request_options: request_options
513
+ )
514
+ result = WorkOS::DataIntegration.new(response.body)
515
+ 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"])
516
+ result
517
+ end
518
+
519
+ # Delete an organization-owned data integration
520
+ # @param slug [String] The slug identifier of the data integration.
521
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
522
+ # @return [void]
523
+ def delete_data_integration_organization(
524
+ slug:,
525
+ request_options: {}
526
+ )
527
+ @client.request(
528
+ method: :delete,
529
+ path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/organization",
530
+ auth: true,
531
+ request_options: request_options
532
+ )
533
+ nil
534
+ end
535
+
310
536
  # Get an access token for a connected account
311
537
  # @param provider [String] The identifier of the integration.
312
- # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
313
- # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
538
+ # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
539
+ # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
540
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
541
+ # @param connection_owner [WorkOS::Types::DataIntegrationsGetUserTokenRequestConnectionOwner, nil] Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
542
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
314
543
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
315
544
  # @return [WorkOS::DataIntegrationAccessTokenResponse]
316
545
  def get_access_token(
317
546
  provider:,
318
547
  user_id:,
319
548
  organization_id: WorkOS::OMIT,
549
+ connected_account_id: nil,
550
+ connection_owner: nil,
551
+ supports_multiple_connections: nil,
320
552
  request_options: {}
321
553
  )
322
554
  body = {
323
- "user_id" => user_id
324
- }
555
+ "user_id" => user_id,
556
+ "connected_account_id" => connected_account_id,
557
+ "connection_owner" => connection_owner,
558
+ "supports_multiple_connections" => supports_multiple_connections
559
+ }.compact
325
560
  body["organization_id"] = organization_id unless organization_id.equal?(WorkOS::OMIT)
326
561
  response = @client.request(
327
562
  method: :post,
@@ -335,20 +570,220 @@ module WorkOS
335
570
  result
336
571
  end
337
572
 
573
+ # Get an organization connected account
574
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier.
575
+ # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
576
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
577
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the organization has several for this provider.
578
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
579
+ # @return [WorkOS::ConnectedAccount]
580
+ def get_organization_connected_account(
581
+ organization_id:,
582
+ slug:,
583
+ supports_multiple_connections: nil,
584
+ connected_account_id: nil,
585
+ request_options: {}
586
+ )
587
+ params = {
588
+ "supports_multiple_connections" => supports_multiple_connections,
589
+ "connected_account_id" => connected_account_id
590
+ }.compact
591
+ response = @client.request(
592
+ method: :get,
593
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
594
+ auth: true,
595
+ params: params,
596
+ request_options: request_options
597
+ )
598
+ result = WorkOS::ConnectedAccount.new(response.body)
599
+ 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"])
600
+ result
601
+ end
602
+
603
+ # Import an organization connected account
604
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier.
605
+ # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
606
+ # @param account_display_name [String, nil] A mutable, non-unique connection label; null clears it. Not an account identifier.
607
+ # @param account_identifier [String, nil] A developer-attested account identifier; null clears it.
608
+ # @param access_token [String, nil] The OAuth access token for the connected account.
609
+ # @param refresh_token [String, nil] The OAuth refresh token for the connected account.
610
+ # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
611
+ # @param scopes [Array<String>, nil] The OAuth scopes granted for this connection.
612
+ # @param state [WorkOS::Types::CreateOrganizationConnectedAccountState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
613
+ # @param user_id [String] The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization.
614
+ # @param connection_intent [String, nil] Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. Creating an additional connection is not yet available: until it is, `add` succeeds only when the owner has no connection for this integration, which creates the compatibility connection, and otherwise returns 404 `multiple_connections_unavailable`.
615
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
616
+ # @return [WorkOS::ConnectedAccountWriteResponse]
617
+ def create_organization_connected_account(
618
+ organization_id:,
619
+ slug:,
620
+ user_id:,
621
+ account_display_name: WorkOS::OMIT,
622
+ account_identifier: WorkOS::OMIT,
623
+ access_token: nil,
624
+ refresh_token: nil,
625
+ expires_at: nil,
626
+ scopes: nil,
627
+ state: nil,
628
+ connection_intent: nil,
629
+ request_options: {}
630
+ )
631
+ body = {
632
+ "access_token" => access_token,
633
+ "refresh_token" => refresh_token,
634
+ "expires_at" => expires_at,
635
+ "scopes" => scopes,
636
+ "state" => state,
637
+ "user_id" => user_id,
638
+ "connection_intent" => connection_intent
639
+ }.compact
640
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
641
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
642
+ response = @client.request(
643
+ method: :post,
644
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
645
+ auth: true,
646
+ body: body,
647
+ request_options: request_options
648
+ )
649
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
650
+ 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"])
651
+ result
652
+ end
653
+
654
+ # Update an organization connected account
655
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier.
656
+ # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
657
+ # @param account_display_name [String, nil] A mutable, non-unique connection label; null clears it. Not an account identifier.
658
+ # @param account_identifier [String, nil] A developer-attested account identifier; null clears it.
659
+ # @param access_token [String, nil] The OAuth access token for the connected account.
660
+ # @param refresh_token [String, nil] The OAuth refresh token for the connected account.
661
+ # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
662
+ # @param scopes [Array<String>, nil] The OAuth scopes granted for this connection.
663
+ # @param state [WorkOS::Types::OrganizationConnectedAccountState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
664
+ # @param user_id [String] The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization.
665
+ # @param supports_multiple_connections [Boolean, nil] Accepted for compatibility; does not change update targeting. Omit intent and selector to update the compatibility connection, or supply `connected_account_id` to update an exact connection.
666
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
667
+ # @param connection_intent [String, nil] Set to `reauthorize` with `connected_account_id` to update one exact connection. The intent may be omitted when supplying an ID. Omit both for permanent compatibility behavior.
668
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
669
+ # @return [WorkOS::ConnectedAccountWriteResponse]
670
+ def update_organization_connected_account(
671
+ organization_id:,
672
+ slug:,
673
+ user_id:,
674
+ account_display_name: WorkOS::OMIT,
675
+ account_identifier: WorkOS::OMIT,
676
+ access_token: nil,
677
+ refresh_token: nil,
678
+ expires_at: nil,
679
+ scopes: nil,
680
+ state: nil,
681
+ supports_multiple_connections: nil,
682
+ connected_account_id: nil,
683
+ connection_intent: nil,
684
+ request_options: {}
685
+ )
686
+ params = {
687
+ "supports_multiple_connections" => supports_multiple_connections,
688
+ "connected_account_id" => connected_account_id,
689
+ "connection_intent" => connection_intent
690
+ }.compact
691
+ body = {
692
+ "access_token" => access_token,
693
+ "refresh_token" => refresh_token,
694
+ "expires_at" => expires_at,
695
+ "scopes" => scopes,
696
+ "state" => state,
697
+ "user_id" => user_id
698
+ }.compact
699
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
700
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
701
+ response = @client.request(
702
+ method: :put,
703
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
704
+ auth: true,
705
+ params: params,
706
+ body: body,
707
+ request_options: request_options
708
+ )
709
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
710
+ 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"])
711
+ result
712
+ end
713
+
714
+ # Delete an organization connected account
715
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier.
716
+ # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
717
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
718
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
719
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
720
+ # @return [void]
721
+ def delete_organization_connected_account(
722
+ organization_id:,
723
+ slug:,
724
+ supports_multiple_connections: nil,
725
+ connected_account_id: nil,
726
+ request_options: {}
727
+ )
728
+ params = {
729
+ "supports_multiple_connections" => supports_multiple_connections,
730
+ "connected_account_id" => connected_account_id
731
+ }.compact
732
+ @client.request(
733
+ method: :delete,
734
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
735
+ auth: true,
736
+ params: params,
737
+ request_options: request_options
738
+ )
739
+ nil
740
+ end
741
+
742
+ # List providers for an organization
743
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for.
744
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
745
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
746
+ # @return [WorkOS::DataIntegrationsListResponse]
747
+ def list_organization_data_providers(
748
+ organization_id:,
749
+ supports_multiple_connections: nil,
750
+ request_options: {}
751
+ )
752
+ params = {
753
+ "supports_multiple_connections" => supports_multiple_connections
754
+ }.compact
755
+ response = @client.request(
756
+ method: :get,
757
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_providers",
758
+ auth: true,
759
+ params: params,
760
+ request_options: request_options
761
+ )
762
+ result = WorkOS::DataIntegrationsListResponse.new(response.body)
763
+ 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"])
764
+ result
765
+ end
766
+
338
767
  # Get a connected account
339
768
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
340
769
  # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
341
770
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
771
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
772
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
342
773
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
343
774
  # @return [WorkOS::ConnectedAccount]
344
775
  def get_user_connected_account(
345
776
  user_id:,
346
777
  slug:,
347
778
  organization_id: nil,
779
+ supports_multiple_connections: nil,
780
+ connected_account_id: nil,
348
781
  request_options: {}
349
782
  )
350
783
  params = {
351
- "organization_id" => organization_id
784
+ "organization_id" => organization_id,
785
+ "supports_multiple_connections" => supports_multiple_connections,
786
+ "connected_account_id" => connected_account_id
352
787
  }.compact
353
788
  response = @client.request(
354
789
  method: :get,
@@ -365,22 +800,28 @@ module WorkOS
365
800
  # Import a connected account
366
801
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
367
802
  # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
803
+ # @param account_display_name [String, nil] A mutable, non-unique connection label; null clears it. Not an account identifier.
804
+ # @param account_identifier [String, nil] A developer-attested account identifier; null clears it.
368
805
  # @param access_token [String, nil] The OAuth access token for the connected account.
369
806
  # @param refresh_token [String, nil] The OAuth refresh token for the connected account.
370
807
  # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
371
808
  # @param scopes [Array<String>, nil] The OAuth scopes granted for this connection.
372
- # @param state [WorkOS::Types::ConnectedAccountInputState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
809
+ # @param state [WorkOS::Types::CreateConnectedAccountState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
810
+ # @param connection_intent [String, nil] Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. Creating an additional connection is not yet available: until it is, `add` succeeds only when the owner has no connection for this integration, which creates the compatibility connection, and otherwise returns 404 `multiple_connections_unavailable`.
373
811
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
374
812
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
375
- # @return [WorkOS::ConnectedAccount]
813
+ # @return [WorkOS::ConnectedAccountWriteResponse]
376
814
  def create_user_connected_account(
377
815
  user_id:,
378
816
  slug:,
817
+ account_display_name: WorkOS::OMIT,
818
+ account_identifier: WorkOS::OMIT,
379
819
  access_token: nil,
380
820
  refresh_token: nil,
381
821
  expires_at: nil,
382
822
  scopes: nil,
383
823
  state: nil,
824
+ connection_intent: nil,
384
825
  organization_id: nil,
385
826
  request_options: {}
386
827
  )
@@ -392,8 +833,11 @@ module WorkOS
392
833
  "refresh_token" => refresh_token,
393
834
  "expires_at" => expires_at,
394
835
  "scopes" => scopes,
395
- "state" => state
836
+ "state" => state,
837
+ "connection_intent" => connection_intent
396
838
  }.compact
839
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
840
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
397
841
  response = @client.request(
398
842
  method: :post,
399
843
  path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
@@ -402,7 +846,7 @@ module WorkOS
402
846
  body: body,
403
847
  request_options: request_options
404
848
  )
405
- result = WorkOS::ConnectedAccount.new(response.body)
849
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
406
850
  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"])
407
851
  result
408
852
  end
@@ -410,27 +854,40 @@ module WorkOS
410
854
  # Update a connected account
411
855
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
412
856
  # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
857
+ # @param account_display_name [String, nil] A mutable, non-unique connection label; null clears it. Not an account identifier.
858
+ # @param account_identifier [String, nil] A developer-attested account identifier; null clears it.
413
859
  # @param access_token [String, nil] The OAuth access token for the connected account.
414
860
  # @param refresh_token [String, nil] The OAuth refresh token for the connected account.
415
861
  # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.
416
862
  # @param scopes [Array<String>, nil] The OAuth scopes granted for this connection.
417
863
  # @param state [WorkOS::Types::ConnectedAccountInputState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
418
864
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
865
+ # @param supports_multiple_connections [Boolean, nil] Accepted for compatibility; does not change update targeting. Omit intent and selector to update the compatibility connection, or supply `connected_account_id` to update an exact connection.
866
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
867
+ # @param connection_intent [String, nil] Set to `reauthorize` with `connected_account_id` to update one exact connection. The intent may be omitted when supplying an ID. Omit both for permanent compatibility behavior.
419
868
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
420
- # @return [WorkOS::ConnectedAccount]
869
+ # @return [WorkOS::ConnectedAccountWriteResponse]
421
870
  def update_user_connected_account(
422
871
  user_id:,
423
872
  slug:,
873
+ account_display_name: WorkOS::OMIT,
874
+ account_identifier: WorkOS::OMIT,
424
875
  access_token: nil,
425
876
  refresh_token: nil,
426
877
  expires_at: nil,
427
878
  scopes: nil,
428
879
  state: nil,
429
880
  organization_id: nil,
881
+ supports_multiple_connections: nil,
882
+ connected_account_id: nil,
883
+ connection_intent: nil,
430
884
  request_options: {}
431
885
  )
432
886
  params = {
433
- "organization_id" => organization_id
887
+ "organization_id" => organization_id,
888
+ "supports_multiple_connections" => supports_multiple_connections,
889
+ "connected_account_id" => connected_account_id,
890
+ "connection_intent" => connection_intent
434
891
  }.compact
435
892
  body = {
436
893
  "access_token" => access_token,
@@ -439,6 +896,8 @@ module WorkOS
439
896
  "scopes" => scopes,
440
897
  "state" => state
441
898
  }.compact
899
+ body["account_display_name"] = account_display_name unless account_display_name.equal?(WorkOS::OMIT)
900
+ body["account_identifier"] = account_identifier unless account_identifier.equal?(WorkOS::OMIT)
442
901
  response = @client.request(
443
902
  method: :put,
444
903
  path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}",
@@ -447,7 +906,7 @@ module WorkOS
447
906
  body: body,
448
907
  request_options: request_options
449
908
  )
450
- result = WorkOS::ConnectedAccount.new(response.body)
909
+ result = WorkOS::ConnectedAccountWriteResponse.new(response.body)
451
910
  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"])
452
911
  result
453
912
  end
@@ -456,16 +915,22 @@ module WorkOS
456
915
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
457
916
  # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
458
917
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
918
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
919
+ # @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
459
920
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
460
921
  # @return [void]
461
922
  def delete_user_connected_account(
462
923
  user_id:,
463
924
  slug:,
464
925
  organization_id: nil,
926
+ supports_multiple_connections: nil,
927
+ connected_account_id: nil,
465
928
  request_options: {}
466
929
  )
467
930
  params = {
468
- "organization_id" => organization_id
931
+ "organization_id" => organization_id,
932
+ "supports_multiple_connections" => supports_multiple_connections,
933
+ "connected_account_id" => connected_account_id
469
934
  }.compact
470
935
  @client.request(
471
936
  method: :delete,
@@ -480,15 +945,18 @@ module WorkOS
480
945
  # List providers for a user
481
946
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier to list providers and connected accounts for.
482
947
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization.
948
+ # @param supports_multiple_connections [Boolean, nil] Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
483
949
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
484
950
  # @return [WorkOS::DataIntegrationsListResponse]
485
951
  def list_user_data_providers(
486
952
  user_id:,
487
953
  organization_id: nil,
954
+ supports_multiple_connections: nil,
488
955
  request_options: {}
489
956
  )
490
957
  params = {
491
- "organization_id" => organization_id
958
+ "organization_id" => organization_id,
959
+ "supports_multiple_connections" => supports_multiple_connections
492
960
  }.compact
493
961
  response = @client.request(
494
962
  method: :get,