diff --git a/.changelog-pending/2026-09-16T19-24-45-949c30cb87778129af801fadc33546518853d045.md b/.changelog-pending/2026-09-16T19-24-45-949c30cb87778129af801fadc33546518853d045.md index 6928ad91..edaf54d3 100644 --- a/.changelog-pending/2026-09-16T19-24-45-949c30cb87778129af801fadc33546518853d045.md +++ b/.changelog-pending/2026-09-16T19-24-45-949c30cb87778129af801fadc33546518853d045.md @@ -16,13 +16,12 @@ * Added enum `DataIntegrationInstallationConnectionRole` * Added `connection_owner` to `DataIntegrationsGetDataIntegrationAuthorizeUrlRequest` * Added enum `DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner` + * Added the organization connected-account operations on `Pipes`: `client.pipes.get_organization_connected_account`, `create_organization_connected_account`, `update_organization_connected_account`, `delete_organization_connected_account`, `list_organization_data_providers` * **[connect](https://workos.com/docs/reference/workos-connect/standalone)**: * Added `connection_role` to `ConnectedAccount` * Added `account_identifier` to `ConnectedAccount` * Added `account_display_name` to `ConnectedAccount` * Added enum `ConnectedAccountConnectionRole` - * **[organizations](https://workos.com/docs/reference/organization)**: - * Added service `OrganizationsDataProviders` * **[webhooks](https://workos.com/docs/reference/webhooks)**: * Added `pipes.account_connection.add_failed` to `CreateWebhookEndpointEvents` * Added `pipes.account_connection.connected` to `CreateWebhookEndpointEvents` diff --git a/.changelog-pending/2026-09-17T21-00-23-bfe7aedb3cf7296ffb6ead1e287e844186479702.md b/.changelog-pending/2026-09-17T21-00-23-bfe7aedb3cf7296ffb6ead1e287e844186479702.md new file mode 100644 index 00000000..17d56713 --- /dev/null +++ b/.changelog-pending/2026-09-17T21-00-23-bfe7aedb3cf7296ffb6ead1e287e844186479702.md @@ -0,0 +1,5 @@ +* [#557](https://github.com/workos/workos-ruby/pull/557) fix(generated): regenerate from spec (1 change) + + **Fixes** + * **[multi_factor_auth](https://workos.com/docs/reference/authkit/mfa)**: + * Changed errors for endpoint `POST /auth/factors/{id}/challenge` diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 8a59d245..294027c3 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -276,11 +276,6 @@ "lib/workos/organizations/organization_updated_data_domain.rb", "lib/workos/organizations/update_audit_logs_retention.rb", "lib/workos/organizations/update_organization.rb", - "lib/workos/organizations_data_providers.rb", - "lib/workos/organizations_data_providers/connected_account_input.rb", - "lib/workos/organizations_data_providers/data_integrations_list_response.rb", - "lib/workos/organizations_data_providers/data_integrations_list_response_data.rb", - "lib/workos/organizations_data_providers/data_integrations_list_response_data_connected_account.rb", "lib/workos/pipes.rb", "lib/workos/pipes/api_key_installation.rb", "lib/workos/pipes/connected_account.rb", @@ -1269,7 +1264,6 @@ "rbi/workos/organization_updated_data.rbi", "rbi/workos/organization_updated_data_domain.rbi", "rbi/workos/organizations.rbi", - "rbi/workos/organizations_data_providers.rbi", "rbi/workos/password_reset.rbi", "rbi/workos/password_reset_created.rbi", "rbi/workos/password_reset_created_data.rbi", @@ -1480,8 +1474,6 @@ "test/workos/test_organization_membership_model_round_trip.rb", "test/workos/test_organization_membership_service.rb", "test/workos/test_organizations.rb", - "test/workos/test_organizations_data_providers.rb", - "test/workos/test_organizations_data_providers_model_round_trip.rb", "test/workos/test_organizations_model_round_trip.rb", "test/workos/test_pipes.rb", "test/workos/test_pipes_model_round_trip.rb", @@ -1504,6 +1496,34 @@ "test/workos/test_widgets_model_round_trip.rb" ], "operations": { + "GET /agents/blueprints": { + "sdkMethod": "list_blueprints", + "service": "agents" + }, + "POST /agents/blueprints": { + "sdkMethod": "create_blueprint", + "service": "agents" + }, + "GET /agents/blueprints/{agent_blueprint_id}": { + "sdkMethod": "get_blueprint", + "service": "agents" + }, + "PATCH /agents/blueprints/{agent_blueprint_id}": { + "sdkMethod": "update_blueprint", + "service": "agents" + }, + "DELETE /agents/blueprints/{agent_blueprint_id}": { + "sdkMethod": "delete_blueprint", + "service": "agents" + }, + "POST /agents/blueprints/{agent_blueprint_id}/tokens": { + "sdkMethod": "create_blueprint_token", + "service": "agents" + }, + "POST /agents/blueprints/{agent_blueprint_id}/tokens/validate": { + "sdkMethod": "validate_blueprint_token", + "service": "agents" + }, "PATCH /agents/claims/attempts": { "sdkMethod": "update_attempts", "service": "agents" @@ -1516,6 +1536,30 @@ "sdkMethod": "get_registration", "service": "agents" }, + "GET /agents/instances": { + "sdkMethod": "list_instances", + "service": "agents" + }, + "GET /agents/instances/{agent_instance_id}": { + "sdkMethod": "get_instance", + "service": "agents" + }, + "DELETE /agents/instances/{agent_instance_id}": { + "sdkMethod": "delete_instance", + "service": "agents" + }, + "GET /agents/sessions": { + "sdkMethod": "list_sessions", + "service": "agents" + }, + "GET /agents/sessions/{agent_instance_session_id}": { + "sdkMethod": "get_session", + "service": "agents" + }, + "POST /agents/sessions/{agent_instance_session_id}/revoke": { + "sdkMethod": "revoke_session", + "service": "agents" + }, "POST /auth/challenges/{id}/verify": { "sdkMethod": "verify_challenge", "service": "multi_factor_auth" @@ -1768,10 +1812,54 @@ "sdkMethod": "list_connections", "service": "sso" }, + "POST /connections": { + "sdkMethod": "create_connection", + "service": "sso" + }, + "GET /connections/{connectionId}/saml_idp_signing_certs": { + "sdkMethod": "list_connection_saml_idp_signing_certs", + "service": "sso" + }, + "POST /connections/{connectionId}/saml_idp_signing_certs": { + "sdkMethod": "create_connection_saml_idp_signing_cert", + "service": "sso" + }, + "DELETE /connections/{connectionId}/saml_idp_signing_certs/{certificateId}": { + "sdkMethod": "delete_connection_saml_idp_signing_cert", + "service": "sso" + }, + "GET /connections/{connectionId}/saml_sp_encryption_certs": { + "sdkMethod": "list_connection_saml_sp_encryption_certs", + "service": "sso" + }, + "POST /connections/{connectionId}/saml_sp_encryption_certs": { + "sdkMethod": "create_connection_saml_sp_encryption_cert", + "service": "sso" + }, + "DELETE /connections/{connectionId}/saml_sp_encryption_certs/{certificateId}": { + "sdkMethod": "delete_connection_saml_sp_encryption_cert", + "service": "sso" + }, + "GET /connections/{connectionId}/saml_sp_signing_cert": { + "sdkMethod": "list_connection_saml_sp_signing_cert", + "service": "sso" + }, + "POST /connections/{connectionId}/saml_sp_signing_cert": { + "sdkMethod": "create_connection_saml_sp_signing_cert", + "service": "sso" + }, + "DELETE /connections/{connectionId}/saml_sp_signing_cert/{certificateId}": { + "sdkMethod": "delete_connection_saml_sp_signing_cert", + "service": "sso" + }, "GET /connections/{id}": { "sdkMethod": "get_connection", "service": "sso" }, + "PATCH /connections/{id}": { + "sdkMethod": "update_connection", + "service": "sso" + }, "DELETE /connections/{id}": { "sdkMethod": "delete_connection", "service": "sso" @@ -1804,10 +1892,26 @@ "sdkMethod": "authorize_data_integration", "service": "pipes" }, + "PUT /data-integrations/{slug}/client-credentials": { + "sdkMethod": "update_data_integration_client_credentials", + "service": "pipes" + }, "POST /data-integrations/{slug}/credentials": { "sdkMethod": "create_data_integration_credential", "service": "pipes" }, + "GET /data-integrations/{slug}/organization": { + "sdkMethod": "list_data_integration_organization", + "service": "pipes" + }, + "PUT /data-integrations/{slug}/organization": { + "sdkMethod": "update_data_integration_organization", + "service": "pipes" + }, + "DELETE /data-integrations/{slug}/organization": { + "sdkMethod": "delete_data_integration_organization", + "service": "pipes" + }, "POST /data-integrations/{provider}/token": { "sdkMethod": "get_access_token", "service": "pipes" @@ -1976,6 +2080,54 @@ "sdkMethod": "list_authorized_applications", "service": "organizations" }, + "GET /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "get_organization_connected_account", + "service": "pipes" + }, + "POST /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "create_organization_connected_account", + "service": "pipes" + }, + "PUT /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "update_organization_connected_account", + "service": "pipes" + }, + "DELETE /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "delete_organization_connected_account", + "service": "pipes" + }, + "GET /organizations/{organization_id}/data_providers": { + "sdkMethod": "list_organization_data_providers", + "service": "pipes" + }, + "GET /organizations/{organization_id}/it_contacts": { + "sdkMethod": "list_it_contacts", + "service": "organizations" + }, + "POST /organizations/{organization_id}/it_contacts": { + "sdkMethod": "create_it_contact", + "service": "organizations" + }, + "DELETE /organizations/{organization_id}/it_contacts/{contact_id}": { + "sdkMethod": "delete_it_contact", + "service": "organizations" + }, + "POST /organizations/{organization_id}/it_contacts/{contact_id}/invite": { + "sdkMethod": "invite_it_contact", + "service": "organizations" + }, + "POST /organizations/{organization_id}/it_contacts/{contact_id}/revoke": { + "sdkMethod": "revoke_it_contact", + "service": "organizations" + }, + "POST /platform/teams": { + "sdkMethod": "create_team", + "service": "platform_teams" + }, + "GET /platform/teams/{team_id}": { + "sdkMethod": "get_team", + "service": "platform_teams" + }, "POST /portal/generate_link": { "sdkMethod": "generate_link", "service": "admin_portal" @@ -2088,6 +2240,18 @@ "sdkMethod": "revoke_session", "service": "user_management" }, + "GET /user_management/authkit_oauth_resources": { + "sdkMethod": "list_authkit_oauth_resources", + "service": "user_management" + }, + "POST /user_management/authkit_oauth_resources": { + "sdkMethod": "create_authkit_oauth_resource", + "service": "user_management" + }, + "DELETE /user_management/authkit_oauth_resources/{id}": { + "sdkMethod": "delete_authkit_oauth_resource", + "service": "user_management" + }, "GET /user_management/cors_origins": { "sdkMethod": "list_cors_origins", "service": "user_management" @@ -2288,6 +2452,34 @@ "sdkMethod": "create_user_auth_factor", "service": "multi_factor_auth" }, + "DELETE /user_management/waitlist_entries/{id}": { + "sdkMethod": "delete_waitlist_entry", + "service": "user_management" + }, + "POST /user_management/waitlist_entries/{id}/approve": { + "sdkMethod": "create_waitlist_entry_approve", + "service": "user_management" + }, + "POST /user_management/waitlist_entries/{id}/deny": { + "sdkMethod": "create_waitlist_entry_deny", + "service": "user_management" + }, + "GET /user_management/waitlists": { + "sdkMethod": "list_waitlists", + "service": "user_management" + }, + "GET /user_management/waitlists/{id}": { + "sdkMethod": "get_waitlist", + "service": "user_management" + }, + "GET /user_management/waitlists/{id}/entries": { + "sdkMethod": "list_waitlist_entries", + "service": "user_management" + }, + "POST /user_management/waitlists/{id}/entries": { + "sdkMethod": "create_waitlist_entry", + "service": "user_management" + }, "POST /vault/v1/keys/data-key": { "sdkMethod": "create_data_key", "service": "vault" @@ -2395,206 +2587,6 @@ "GET /audit_logs/exports/{auditLogExportId}": { "sdkMethod": "get_export", "service": "audit_logs" - }, - "PUT /data-integrations/{slug}/client-credentials": { - "sdkMethod": "update_data_integration_client_credentials", - "service": "pipes" - }, - "GET /agents/blueprints": { - "sdkMethod": "list_blueprints", - "service": "agents" - }, - "POST /agents/blueprints": { - "sdkMethod": "create_blueprint", - "service": "agents" - }, - "GET /agents/blueprints/{agent_blueprint_id}": { - "sdkMethod": "get_blueprint", - "service": "agents" - }, - "PATCH /agents/blueprints/{agent_blueprint_id}": { - "sdkMethod": "update_blueprint", - "service": "agents" - }, - "DELETE /agents/blueprints/{agent_blueprint_id}": { - "sdkMethod": "delete_blueprint", - "service": "agents" - }, - "POST /agents/blueprints/{agent_blueprint_id}/tokens": { - "sdkMethod": "create_blueprint_token", - "service": "agents" - }, - "GET /agents/instances": { - "sdkMethod": "list_instances", - "service": "agents" - }, - "GET /agents/instances/{agent_instance_id}": { - "sdkMethod": "get_instance", - "service": "agents" - }, - "DELETE /agents/instances/{agent_instance_id}": { - "sdkMethod": "delete_instance", - "service": "agents" - }, - "GET /agents/sessions": { - "sdkMethod": "list_sessions", - "service": "agents" - }, - "GET /agents/sessions/{agent_instance_session_id}": { - "sdkMethod": "get_session", - "service": "agents" - }, - "POST /agents/sessions/{agent_instance_session_id}/revoke": { - "sdkMethod": "revoke_session", - "service": "agents" - }, - "POST /connections": { - "sdkMethod": "create_connection", - "service": "sso" - }, - "GET /connections/{connectionId}/saml_idp_signing_certs": { - "sdkMethod": "list_connection_saml_idp_signing_certs", - "service": "sso" - }, - "POST /connections/{connectionId}/saml_idp_signing_certs": { - "sdkMethod": "create_connection_saml_idp_signing_cert", - "service": "sso" - }, - "DELETE /connections/{connectionId}/saml_idp_signing_certs/{certificateId}": { - "sdkMethod": "delete_connection_saml_idp_signing_cert", - "service": "sso" - }, - "GET /connections/{connectionId}/saml_sp_encryption_certs": { - "sdkMethod": "list_connection_saml_sp_encryption_certs", - "service": "sso" - }, - "POST /connections/{connectionId}/saml_sp_encryption_certs": { - "sdkMethod": "create_connection_saml_sp_encryption_cert", - "service": "sso" - }, - "DELETE /connections/{connectionId}/saml_sp_encryption_certs/{certificateId}": { - "sdkMethod": "delete_connection_saml_sp_encryption_cert", - "service": "sso" - }, - "GET /connections/{connectionId}/saml_sp_signing_cert": { - "sdkMethod": "list_connection_saml_sp_signing_cert", - "service": "sso" - }, - "POST /connections/{connectionId}/saml_sp_signing_cert": { - "sdkMethod": "create_connection_saml_sp_signing_cert", - "service": "sso" - }, - "DELETE /connections/{connectionId}/saml_sp_signing_cert/{certificateId}": { - "sdkMethod": "delete_connection_saml_sp_signing_cert", - "service": "sso" - }, - "PATCH /connections/{id}": { - "sdkMethod": "update_connection", - "service": "sso" - }, - "GET /organizations/{organization_id}/it_contacts": { - "sdkMethod": "list_it_contacts", - "service": "organizations" - }, - "POST /organizations/{organization_id}/it_contacts": { - "sdkMethod": "create_it_contact", - "service": "organizations" - }, - "DELETE /organizations/{organization_id}/it_contacts/{contact_id}": { - "sdkMethod": "delete_it_contact", - "service": "organizations" - }, - "POST /organizations/{organization_id}/it_contacts/{contact_id}/invite": { - "sdkMethod": "invite_it_contact", - "service": "organizations" - }, - "POST /organizations/{organization_id}/it_contacts/{contact_id}/revoke": { - "sdkMethod": "revoke_it_contact", - "service": "organizations" - }, - "POST /platform/teams": { - "sdkMethod": "create_team", - "service": "platform_teams" - }, - "GET /platform/teams/{team_id}": { - "sdkMethod": "get_team", - "service": "platform_teams" - }, - "DELETE /user_management/waitlist_entries/{id}": { - "sdkMethod": "delete_waitlist_entry", - "service": "user_management" - }, - "POST /user_management/waitlist_entries/{id}/approve": { - "sdkMethod": "create_waitlist_entry_approve", - "service": "user_management" - }, - "POST /user_management/waitlist_entries/{id}/deny": { - "sdkMethod": "create_waitlist_entry_deny", - "service": "user_management" - }, - "GET /user_management/waitlists": { - "sdkMethod": "list_waitlists", - "service": "user_management" - }, - "GET /user_management/waitlists/{id}": { - "sdkMethod": "get_waitlist", - "service": "user_management" - }, - "GET /user_management/waitlists/{id}/entries": { - "sdkMethod": "list_waitlist_entries", - "service": "user_management" - }, - "POST /user_management/waitlists/{id}/entries": { - "sdkMethod": "create_waitlist_entry", - "service": "user_management" - }, - "POST /agents/blueprints/{agent_blueprint_id}/tokens/validate": { - "sdkMethod": "validate_blueprint_token", - "service": "agents" - }, - "GET /data-integrations/{slug}/organization": { - "sdkMethod": "list_data_integration_organization", - "service": "pipes" - }, - "PUT /data-integrations/{slug}/organization": { - "sdkMethod": "update_data_integration_organization", - "service": "pipes" - }, - "DELETE /data-integrations/{slug}/organization": { - "sdkMethod": "delete_data_integration_organization", - "service": "pipes" - }, - "GET /user_management/authkit_oauth_resources": { - "sdkMethod": "list_authkit_oauth_resources", - "service": "user_management" - }, - "POST /user_management/authkit_oauth_resources": { - "sdkMethod": "create_authkit_oauth_resource", - "service": "user_management" - }, - "DELETE /user_management/authkit_oauth_resources/{id}": { - "sdkMethod": "delete_authkit_oauth_resource", - "service": "user_management" - }, - "GET /organizations/{organization_id}/connected_accounts/{slug}": { - "sdkMethod": "get_organization_connected_account", - "service": "organizations_data_providers" - }, - "POST /organizations/{organization_id}/connected_accounts/{slug}": { - "sdkMethod": "create_organization_connected_account", - "service": "organizations_data_providers" - }, - "PUT /organizations/{organization_id}/connected_accounts/{slug}": { - "sdkMethod": "update_organization_connected_account", - "service": "organizations_data_providers" - }, - "DELETE /organizations/{organization_id}/connected_accounts/{slug}": { - "sdkMethod": "delete_organization_connected_account", - "service": "organizations_data_providers" - }, - "GET /organizations/{organization_id}/data_providers": { - "sdkMethod": "list_organization_data_providers", - "service": "organizations_data_providers" } } } diff --git a/lib/workos.rb b/lib/workos.rb index c6bd5965..87a178ce 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -35,7 +35,6 @@ def OMIT.inspect loader.collapse("#{__dir__}/workos/organization_domains") loader.collapse("#{__dir__}/workos/organization_membership") loader.collapse("#{__dir__}/workos/organizations") -loader.collapse("#{__dir__}/workos/organizations_data_providers") loader.collapse("#{__dir__}/workos/pipes") loader.collapse("#{__dir__}/workos/pipes_provider") loader.collapse("#{__dir__}/workos/platform_teams") diff --git a/lib/workos/client.rb b/lib/workos/client.rb index b981740f..b376b47b 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -64,10 +64,6 @@ def groups @groups ||= WorkOS::Groups.new(self) end - def organizations_data_providers - @organizations_data_providers ||= WorkOS::OrganizationsDataProviders.new(self) - end - def platform_teams @platform_teams ||= WorkOS::PlatformTeams.new(self) end diff --git a/lib/workos/organizations_data_providers.rb b/lib/workos/organizations_data_providers.rb deleted file mode 100644 index a2eb2762..00000000 --- a/lib/workos/organizations_data_providers.rb +++ /dev/null @@ -1,183 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -require "json" - -module WorkOS - class OrganizationsDataProviders - def initialize(client) - @client = client - end - - # Get an organization connected account - # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. - # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - # @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. - # @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. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ConnectedAccount] - def get_organization_connected_account( - organization_id:, - slug:, - supports_multiple_connections: nil, - connected_account_id: nil, - request_options: {} - ) - params = { - "supports_multiple_connections" => supports_multiple_connections, - "connected_account_id" => connected_account_id - }.compact - response = @client.request( - method: :get, - path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", - auth: true, - params: params, - request_options: request_options - ) - result = WorkOS::ConnectedAccount.new(response.body) - result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) - result - end - - # Import an organization connected account - # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. - # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - # @param access_token [String, nil] The OAuth access token for the connected account. - # @param refresh_token [String, nil] The OAuth refresh token for the connected account. - # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. - # @param scopes [Array, nil] The OAuth scopes granted for this connection. - # @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. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ConnectedAccount] - def create_organization_connected_account( - organization_id:, - slug:, - access_token: nil, - refresh_token: nil, - expires_at: nil, - scopes: nil, - state: nil, - request_options: {} - ) - body = { - "access_token" => access_token, - "refresh_token" => refresh_token, - "expires_at" => expires_at, - "scopes" => scopes, - "state" => state - }.compact - response = @client.request( - method: :post, - path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", - auth: true, - body: body, - request_options: request_options - ) - result = WorkOS::ConnectedAccount.new(response.body) - result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) - result - end - - # Update an organization connected account - # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. - # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - # @param access_token [String, nil] The OAuth access token for the connected account. - # @param refresh_token [String, nil] The OAuth refresh token for the connected account. - # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. - # @param scopes [Array, nil] The OAuth scopes granted for this connection. - # @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. - # @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. - # @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. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ConnectedAccount] - def update_organization_connected_account( - organization_id:, - slug:, - access_token: nil, - refresh_token: nil, - expires_at: nil, - scopes: nil, - state: nil, - supports_multiple_connections: nil, - connected_account_id: nil, - request_options: {} - ) - params = { - "supports_multiple_connections" => supports_multiple_connections, - "connected_account_id" => connected_account_id - }.compact - body = { - "access_token" => access_token, - "refresh_token" => refresh_token, - "expires_at" => expires_at, - "scopes" => scopes, - "state" => state - }.compact - response = @client.request( - method: :put, - path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", - auth: true, - params: params, - body: body, - request_options: request_options - ) - result = WorkOS::ConnectedAccount.new(response.body) - result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) - result - end - - # Delete an organization connected account - # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. - # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - # @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. - # @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. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [void] - def delete_organization_connected_account( - organization_id:, - slug:, - supports_multiple_connections: nil, - connected_account_id: nil, - request_options: {} - ) - params = { - "supports_multiple_connections" => supports_multiple_connections, - "connected_account_id" => connected_account_id - }.compact - @client.request( - method: :delete, - path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", - auth: true, - params: params, - request_options: request_options - ) - nil - end - - # List providers for an organization - # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for. - # @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. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::DataIntegrationsListResponse] - def list_organization_data_providers( - organization_id:, - supports_multiple_connections: nil, - request_options: {} - ) - params = { - "supports_multiple_connections" => supports_multiple_connections - }.compact - response = @client.request( - method: :get, - path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_providers", - auth: true, - params: params, - request_options: request_options - ) - result = WorkOS::DataIntegrationsListResponse.new(response.body) - result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) - result - end - end -end diff --git a/lib/workos/organizations_data_providers/connected_account_input.rb b/lib/workos/organizations_data_providers/connected_account_input.rb deleted file mode 100644 index 83533cff..00000000 --- a/lib/workos/organizations_data_providers/connected_account_input.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - class ConnectedAccountInput < WorkOS::Types::BaseModel - HASH_ATTRS = { - access_token: :access_token, - refresh_token: :refresh_token, - expires_at: :expires_at, - scopes: :scopes, - state: :state - }.freeze - - attr_accessor \ - :access_token, - :refresh_token, - :expires_at, - :scopes, - :state - - def initialize(json) - hash = self.class.normalize(json) - @access_token = hash[:access_token] - @refresh_token = hash[:refresh_token] - @expires_at = hash[:expires_at] - @scopes = hash[:scopes] || [] - @state = hash[:state] - end - end -end diff --git a/lib/workos/organizations_data_providers/data_integrations_list_response.rb b/lib/workos/organizations_data_providers/data_integrations_list_response.rb deleted file mode 100644 index 35837685..00000000 --- a/lib/workos/organizations_data_providers/data_integrations_list_response.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - class DataIntegrationsListResponse < WorkOS::Types::BaseModel - HASH_ATTRS = { - object: :object, - data: :data - }.freeze - - attr_accessor \ - :object, - :data - - def initialize(json) - hash = self.class.normalize(json) - @object = hash[:object] - @data = (hash[:data] || []).map { |item| item ? WorkOS::DataIntegrationsListResponseData.new(item) : nil } - end - end -end diff --git a/lib/workos/organizations_data_providers/data_integrations_list_response_data.rb b/lib/workos/organizations_data_providers/data_integrations_list_response_data.rb deleted file mode 100644 index 731696cf..00000000 --- a/lib/workos/organizations_data_providers/data_integrations_list_response_data.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - class DataIntegrationsListResponseData < WorkOS::Types::BaseModel - HASH_ATTRS = { - object: :object, - id: :id, - name: :name, - description: :description, - slug: :slug, - integration_type: :integration_type, - credentials_type: :credentials_type, - scopes: :scopes, - auth_methods: :auth_methods, - connection_owner: :connection_owner, - ownership: :ownership, - created_at: :created_at, - updated_at: :updated_at, - connected_account: :connected_account, - connected_accounts: :connected_accounts - }.freeze - - # @!attribute ownership - # @deprecated Use `connection_owner` instead. Legacy spelling of the same value: `userland_user` corresponds to `connection_owner: "user"` and `organization` to `connection_owner: "organization"`. - - attr_accessor \ - :object, - :id, - :name, - :description, - :slug, - :integration_type, - :credentials_type, - :scopes, - :auth_methods, - :connection_owner, - :created_at, - :updated_at, - :connected_account, - :connected_accounts - - def ownership - warn "[DEPRECATION] `ownership` is deprecated and will be removed in a future version.", uplevel: 1 - @ownership - end - - attr_writer :ownership - - def initialize(json) - hash = self.class.normalize(json) - @object = hash[:object] - @id = hash[:id] - @name = hash[:name] - @description = hash[:description] - @slug = hash[:slug] - @integration_type = hash[:integration_type] - @credentials_type = hash[:credentials_type] - @scopes = hash[:scopes] || [] - @auth_methods = hash[:auth_methods] || [] - @connection_owner = hash[:connection_owner] - @ownership = hash[:ownership] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - @connected_account = hash[:connected_account] ? WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(hash[:connected_account]) : nil - @connected_accounts = (hash[:connected_accounts] || []).map { |item| item ? WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(item) : nil } - end - end -end diff --git a/lib/workos/organizations_data_providers/data_integrations_list_response_data_connected_account.rb b/lib/workos/organizations_data_providers/data_integrations_list_response_data_connected_account.rb deleted file mode 100644 index df078128..00000000 --- a/lib/workos/organizations_data_providers/data_integrations_list_response_data_connected_account.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - class DataIntegrationsListResponseDataConnectedAccount < WorkOS::Types::BaseModel - HASH_ATTRS = { - object: :object, - id: :id, - connection_role: :connection_role, - account_identifier: :account_identifier, - account_display_name: :account_display_name, - user_id: :user_id, - organization_id: :organization_id, - scopes: :scopes, - auth_method: :auth_method, - api_key_last_4: :api_key_last_4, - client_id: :client_id, - client_secret_last_4: :client_secret_last_4, - config: :config, - state: :state, - created_at: :created_at, - updated_at: :updated_at, - userlandUserId: :userland_user_id - }.freeze - - # @!attribute userland_user_id - # @deprecated Use `user_id` instead. - - attr_accessor \ - :object, - :id, - :connection_role, - :account_identifier, - :account_display_name, - :user_id, - :organization_id, - :scopes, - :auth_method, - :api_key_last_4, - :client_id, - :client_secret_last_4, - :config, - :state, - :created_at, - :updated_at - - def userland_user_id - warn "[DEPRECATION] `userland_user_id` is deprecated and will be removed in a future version.", uplevel: 1 - @userland_user_id - end - - attr_writer :userland_user_id - - def initialize(json) - hash = self.class.normalize(json) - @object = hash[:object] - @id = hash[:id] - @connection_role = hash[:connection_role] - @account_identifier = hash[:account_identifier] - @account_display_name = hash[:account_display_name] - @user_id = hash[:user_id] - @organization_id = hash[:organization_id] - @scopes = hash[:scopes] || [] - @auth_method = hash[:auth_method] - @api_key_last_4 = hash[:api_key_last_4] - @client_id = hash[:client_id] - @client_secret_last_4 = hash[:client_secret_last_4] - @config = hash[:config] || {} - @state = hash[:state] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - @userland_user_id = hash[:userlandUserId] - end - end -end diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb index 75103802..9c271cdf 100644 --- a/lib/workos/pipes.rb +++ b/lib/workos/pipes.rb @@ -451,6 +451,176 @@ def get_access_token( result end + # Get an organization connected account + # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @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. + # @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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ConnectedAccount] + def get_organization_connected_account( + organization_id:, + slug:, + supports_multiple_connections: nil, + connected_account_id: nil, + request_options: {} + ) + params = { + "supports_multiple_connections" => supports_multiple_connections, + "connected_account_id" => connected_account_id + }.compact + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + params: params, + request_options: request_options + ) + result = WorkOS::ConnectedAccount.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result + end + + # Import an organization connected account + # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @param access_token [String, nil] The OAuth access token for the connected account. + # @param refresh_token [String, nil] The OAuth refresh token for the connected account. + # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. + # @param scopes [Array, nil] The OAuth scopes granted for this connection. + # @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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ConnectedAccount] + def create_organization_connected_account( + organization_id:, + slug:, + access_token: nil, + refresh_token: nil, + expires_at: nil, + scopes: nil, + state: nil, + request_options: {} + ) + body = { + "access_token" => access_token, + "refresh_token" => refresh_token, + "expires_at" => expires_at, + "scopes" => scopes, + "state" => state + }.compact + response = @client.request( + method: :post, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::ConnectedAccount.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result + end + + # Update an organization connected account + # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @param access_token [String, nil] The OAuth access token for the connected account. + # @param refresh_token [String, nil] The OAuth refresh token for the connected account. + # @param expires_at [String, nil] The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. + # @param scopes [Array, nil] The OAuth scopes granted for this connection. + # @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. + # @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. + # @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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ConnectedAccount] + def update_organization_connected_account( + organization_id:, + slug:, + access_token: nil, + refresh_token: nil, + expires_at: nil, + scopes: nil, + state: nil, + supports_multiple_connections: nil, + connected_account_id: nil, + request_options: {} + ) + params = { + "supports_multiple_connections" => supports_multiple_connections, + "connected_account_id" => connected_account_id + }.compact + body = { + "access_token" => access_token, + "refresh_token" => refresh_token, + "expires_at" => expires_at, + "scopes" => scopes, + "state" => state + }.compact + response = @client.request( + method: :put, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + params: params, + body: body, + request_options: request_options + ) + result = WorkOS::ConnectedAccount.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result + end + + # Delete an organization connected account + # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @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. + # @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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_organization_connected_account( + organization_id:, + slug:, + supports_multiple_connections: nil, + connected_account_id: nil, + request_options: {} + ) + params = { + "supports_multiple_connections" => supports_multiple_connections, + "connected_account_id" => connected_account_id + }.compact + @client.request( + method: :delete, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + params: params, + request_options: request_options + ) + nil + end + + # List providers for an organization + # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for. + # @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. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::DataIntegrationsListResponse] + def list_organization_data_providers( + organization_id:, + supports_multiple_connections: nil, + request_options: {} + ) + params = { + "supports_multiple_connections" => supports_multiple_connections + }.compact + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_providers", + auth: true, + params: params, + request_options: request_options + ) + result = WorkOS::DataIntegrationsListResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result + end + # Get a connected account # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). diff --git a/lib/workos/pipes/data_integrations_list_response_data.rb b/lib/workos/pipes/data_integrations_list_response_data.rb index 1a25ca17..731696cf 100644 --- a/lib/workos/pipes/data_integrations_list_response_data.rb +++ b/lib/workos/pipes/data_integrations_list_response_data.rb @@ -14,6 +14,7 @@ class DataIntegrationsListResponseData < WorkOS::Types::BaseModel credentials_type: :credentials_type, scopes: :scopes, auth_methods: :auth_methods, + connection_owner: :connection_owner, ownership: :ownership, created_at: :created_at, updated_at: :updated_at, @@ -21,6 +22,9 @@ class DataIntegrationsListResponseData < WorkOS::Types::BaseModel connected_accounts: :connected_accounts }.freeze + # @!attribute ownership + # @deprecated Use `connection_owner` instead. Legacy spelling of the same value: `userland_user` corresponds to `connection_owner: "user"` and `organization` to `connection_owner: "organization"`. + attr_accessor \ :object, :id, @@ -31,12 +35,19 @@ class DataIntegrationsListResponseData < WorkOS::Types::BaseModel :credentials_type, :scopes, :auth_methods, - :ownership, + :connection_owner, :created_at, :updated_at, :connected_account, :connected_accounts + def ownership + warn "[DEPRECATION] `ownership` is deprecated and will be removed in a future version.", uplevel: 1 + @ownership + end + + attr_writer :ownership + def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @@ -48,6 +59,7 @@ def initialize(json) @credentials_type = hash[:credentials_type] @scopes = hash[:scopes] || [] @auth_methods = hash[:auth_methods] || [] + @connection_owner = hash[:connection_owner] @ownership = hash[:ownership] @created_at = hash[:created_at] @updated_at = hash[:updated_at] diff --git a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb index 508a0439..df078128 100644 --- a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -7,6 +7,9 @@ class DataIntegrationsListResponseDataConnectedAccount < WorkOS::Types::BaseMode HASH_ATTRS = { object: :object, id: :id, + connection_role: :connection_role, + account_identifier: :account_identifier, + account_display_name: :account_display_name, user_id: :user_id, organization_id: :organization_id, scopes: :scopes, @@ -27,6 +30,9 @@ class DataIntegrationsListResponseDataConnectedAccount < WorkOS::Types::BaseMode attr_accessor \ :object, :id, + :connection_role, + :account_identifier, + :account_display_name, :user_id, :organization_id, :scopes, @@ -50,6 +56,9 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] + @connection_role = hash[:connection_role] + @account_identifier = hash[:account_identifier] + @account_display_name = hash[:account_display_name] @user_id = hash[:user_id] @organization_id = hash[:organization_id] @scopes = hash[:scopes] || [] diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi index 7327001b..08ac7602 100644 --- a/rbi/workos/client.rbi +++ b/rbi/workos/client.rbi @@ -54,9 +54,6 @@ module WorkOS sig { returns(WorkOS::Groups) } def groups; end - sig { returns(WorkOS::OrganizationsDataProviders) } - def organizations_data_providers; end - sig { returns(WorkOS::PlatformTeams) } def platform_teams; end diff --git a/rbi/workos/organizations_data_providers.rbi b/rbi/workos/organizations_data_providers.rbi deleted file mode 100644 index 6f2717dd..00000000 --- a/rbi/workos/organizations_data_providers.rbi +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -# typed: strong - -module WorkOS - class OrganizationsDataProviders - sig { params(client: WorkOS::BaseClient).void } - def initialize(client); end - - sig do - params( - organization_id: String, - slug: String, - supports_multiple_connections: T.nilable(T::Boolean), - connected_account_id: T.nilable(String), - request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ConnectedAccount) - end - def get_organization_connected_account(organization_id:, slug:, supports_multiple_connections:, connected_account_id:, request_options:); end - - sig do - params( - organization_id: String, - slug: String, - access_token: T.nilable(String), - refresh_token: T.nilable(String), - expires_at: T.nilable(String), - scopes: T.nilable(T::Array[String]), - state: T.nilable(String), - request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ConnectedAccount) - end - def create_organization_connected_account(organization_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, request_options:); end - - sig do - params( - organization_id: String, - slug: String, - access_token: T.nilable(String), - refresh_token: T.nilable(String), - expires_at: T.nilable(String), - scopes: T.nilable(T::Array[String]), - state: T.nilable(String), - supports_multiple_connections: T.nilable(T::Boolean), - connected_account_id: T.nilable(String), - request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ConnectedAccount) - end - def update_organization_connected_account(organization_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, supports_multiple_connections:, connected_account_id:, request_options:); end - - sig do - params( - organization_id: String, - slug: String, - supports_multiple_connections: T.nilable(T::Boolean), - connected_account_id: T.nilable(String), - request_options: T::Hash[Symbol, T.untyped] - ).returns(NilClass) - end - def delete_organization_connected_account(organization_id:, slug:, supports_multiple_connections:, connected_account_id:, request_options:); end - - sig do - params( - organization_id: String, - supports_multiple_connections: T.nilable(T::Boolean), - request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::DataIntegrationsListResponse) - end - def list_organization_data_providers(organization_id:, supports_multiple_connections:, request_options:); end - - end -end diff --git a/rbi/workos/pipes.rbi b/rbi/workos/pipes.rbi index a3c2337f..14d132c6 100644 --- a/rbi/workos/pipes.rbi +++ b/rbi/workos/pipes.rbi @@ -165,6 +165,67 @@ module WorkOS end def get_access_token(provider:, user_id:, organization_id:, connected_account_id:, connection_owner:, supports_multiple_connections:, request_options:); end + sig do + params( + organization_id: String, + slug: String, + supports_multiple_connections: T.nilable(T::Boolean), + connected_account_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def get_organization_connected_account(organization_id:, slug:, supports_multiple_connections:, connected_account_id:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + access_token: T.nilable(String), + refresh_token: T.nilable(String), + expires_at: T.nilable(String), + scopes: T.nilable(T::Array[String]), + state: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def create_organization_connected_account(organization_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + access_token: T.nilable(String), + refresh_token: T.nilable(String), + expires_at: T.nilable(String), + scopes: T.nilable(T::Array[String]), + state: T.nilable(String), + supports_multiple_connections: T.nilable(T::Boolean), + connected_account_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def update_organization_connected_account(organization_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, supports_multiple_connections:, connected_account_id:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + supports_multiple_connections: T.nilable(T::Boolean), + connected_account_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_connected_account(organization_id:, slug:, supports_multiple_connections:, connected_account_id:, request_options:); end + + sig do + params( + organization_id: String, + supports_multiple_connections: T.nilable(T::Boolean), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegrationsListResponse) + end + def list_organization_data_providers(organization_id:, supports_multiple_connections:, request_options:); end + sig do params( user_id: String, diff --git a/test/workos/test_organizations_data_providers.rb b/test/workos/test_organizations_data_providers.rb deleted file mode 100644 index a092d58e..00000000 --- a/test/workos/test_organizations_data_providers.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -require "test_helper" - -class OrganizationsDataProvidersTest < Minitest::Test - include FixtureHelper - - def setup - @client = WorkOS::Client.new(api_key: "sk_test_123") - end - - def test_get_organization_connected_account_returns_expected_result - stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.organizations_data_providers.get_organization_connected_account(organization_id: "stub", slug: "stub") - refute_nil result - end - - def test_create_organization_connected_account_returns_expected_result - stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.organizations_data_providers.create_organization_connected_account(organization_id: "stub", slug: "stub") - refute_nil result - end - - def test_update_organization_connected_account_returns_expected_result - stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.organizations_data_providers.update_organization_connected_account(organization_id: "stub", slug: "stub") - refute_nil result - end - - def test_delete_organization_connected_account_returns_expected_result - stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.organizations_data_providers.delete_organization_connected_account(organization_id: "stub", slug: "stub") - assert_nil result - end - - def test_list_organization_data_providers_returns_expected_result - stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)}) - .to_return(body: "{}", status: 200) - result = @client.organizations_data_providers.list_organization_data_providers(organization_id: "stub") - refute_nil result - end - - # Parameterized authentication error tests (one per endpoint). - [ - {name: :get_organization_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, - {name: :create_organization_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, - {name: :update_organization_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, - {name: :delete_organization_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, - {name: :list_organization_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)}, args: {organization_id: "stub"}} - ].each do |spec| - define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do - stub_request(spec[:verb], spec[:url]) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations_data_providers.send(spec[:name], **(spec[:args] || {})) - end - end - end -end diff --git a/test/workos/test_organizations_data_providers_model_round_trip.rb b/test/workos/test_organizations_data_providers_model_round_trip.rb deleted file mode 100644 index d4e0bd7e..00000000 --- a/test/workos/test_organizations_data_providers_model_round_trip.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -require "test_helper" - -class OrganizationsDataProvidersModelRoundTripTest < Minitest::Test - def test_connected_account_input_round_trip - fixture = { - "access_token" => "stub", - "refresh_token" => "stub", - "expires_at" => "stub", - "scopes" => [], - "state" => "stub" - } - model = WorkOS::ConnectedAccountInput.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_data_integrations_list_response_round_trip - fixture = { - "object" => "list", - "data" => [] - } - model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_data_integrations_list_response_data_round_trip - fixture = { - "object" => "data_provider", - "id" => "stub", - "name" => "stub", - "description" => nil, - "slug" => "stub", - "integration_type" => "stub", - "credentials_type" => "stub", - "scopes" => nil, - "auth_methods" => [], - "connection_owner" => "stub", - "ownership" => "stub", - "created_at" => "stub", - "updated_at" => "stub", - "connected_account" => nil, - "connected_accounts" => [] - } - model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_equal fixture["name"], json[:name] - assert_nil json[:description] - assert_equal fixture["slug"], json[:slug] - assert_equal fixture["integration_type"], json[:integration_type] - assert_equal fixture["credentials_type"], json[:credentials_type] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_data_integrations_list_response_data_connected_account_round_trip - fixture = { - "object" => "connected_account", - "id" => "stub", - "connection_role" => "stub", - "account_identifier" => nil, - "account_display_name" => nil, - "user_id" => nil, - "organization_id" => nil, - "scopes" => [], - "auth_method" => "stub", - "api_key_last_4" => nil, - "client_id" => nil, - "client_secret_last_4" => nil, - "config" => {}, - "state" => "stub", - "created_at" => "stub", - "updated_at" => "stub", - "userlandUserId" => nil - } - model = WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_nil json[:account_identifier] - assert_nil json[:account_display_name] - assert_nil json[:user_id] - assert_nil json[:organization_id] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - assert_nil json[:userlandUserId] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end -end diff --git a/test/workos/test_pipes.rb b/test/workos/test_pipes.rb index 903028f2..a59c761c 100644 --- a/test/workos/test_pipes.rb +++ b/test/workos/test_pipes.rb @@ -102,6 +102,41 @@ def test_get_access_token_returns_expected_result refute_nil result end + def test_get_organization_connected_account_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.get_organization_connected_account(organization_id: "stub", slug: "stub") + refute_nil result + end + + def test_create_organization_connected_account_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.create_organization_connected_account(organization_id: "stub", slug: "stub") + refute_nil result + end + + def test_update_organization_connected_account_returns_expected_result + stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.update_organization_connected_account(organization_id: "stub", slug: "stub") + refute_nil result + end + + def test_delete_organization_connected_account_returns_expected_result + stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.delete_organization_connected_account(organization_id: "stub", slug: "stub") + assert_nil result + end + + def test_list_organization_data_providers_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.list_organization_data_providers(organization_id: "stub") + refute_nil result + end + def test_get_user_connected_account_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) .to_return(body: "{}", status: 200) @@ -152,6 +187,11 @@ def test_list_user_data_providers_returns_expected_result {name: :update_data_integration_organization, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)}, args: {slug: "stub"}}, {name: :delete_data_integration_organization, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/organization(\?|\z)}, args: {slug: "stub"}}, {name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}}, + {name: :get_organization_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :create_organization_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :update_organization_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :delete_organization_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/connected_accounts/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :list_organization_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/data_providers(\?|\z)}, args: {organization_id: "stub"}}, {name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, {name: :create_user_connected_account, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, {name: :update_user_connected_account, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, diff --git a/test/workos/test_pipes_model_round_trip.rb b/test/workos/test_pipes_model_round_trip.rb index 166010e8..cd051116 100644 --- a/test/workos/test_pipes_model_round_trip.rb +++ b/test/workos/test_pipes_model_round_trip.rb @@ -107,6 +107,20 @@ def test_update_data_integration_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_connected_account_input_round_trip + fixture = { + "access_token" => "stub", + "refresh_token" => "stub", + "expires_at" => "stub", + "scopes" => [], + "state" => "stub" + } + model = WorkOS::ConnectedAccountInput.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_data_integration_round_trip fixture = { "object" => "data_integration", @@ -208,6 +222,49 @@ def test_connected_account_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_data_integrations_list_response_round_trip + fixture = { + "object" => "list", + "data" => [] + } + model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_data_integrations_list_response_data_round_trip + fixture = { + "object" => "data_provider", + "id" => "stub", + "name" => "stub", + "description" => nil, + "slug" => "stub", + "integration_type" => "stub", + "credentials_type" => "stub", + "scopes" => nil, + "auth_methods" => [], + "connection_owner" => "stub", + "ownership" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "connected_account" => nil, + "connected_accounts" => [] + } + model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["integration_type"], json[:integration_type] + assert_equal fixture["credentials_type"], json[:credentials_type] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + def test_data_integration_credentials_response_credential_round_trip fixture = { "object" => "credential", @@ -386,66 +443,13 @@ def test_data_integrations_get_user_token_request_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end - def test_connected_account_input_round_trip - fixture = { - "access_token" => "stub", - "refresh_token" => "stub", - "expires_at" => "stub", - "scopes" => [], - "state" => "stub" - } - model = WorkOS::ConnectedAccountInput.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_data_integrations_list_response_round_trip - fixture = { - "object" => "list", - "data" => [] - } - model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_data_integrations_list_response_data_round_trip - fixture = { - "object" => "data_provider", - "id" => "stub", - "name" => "stub", - "description" => nil, - "slug" => "stub", - "integration_type" => "stub", - "credentials_type" => "stub", - "scopes" => nil, - "auth_methods" => [], - "ownership" => "stub", - "created_at" => "stub", - "updated_at" => "stub", - "connected_account" => nil, - "connected_accounts" => [] - } - model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_equal fixture["name"], json[:name] - assert_nil json[:description] - assert_equal fixture["slug"], json[:slug] - assert_equal fixture["integration_type"], json[:integration_type] - assert_equal fixture["credentials_type"], json[:credentials_type] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - def test_data_integrations_list_response_data_connected_account_round_trip fixture = { "object" => "connected_account", "id" => "stub", + "connection_role" => "stub", + "account_identifier" => nil, + "account_display_name" => nil, "user_id" => nil, "organization_id" => nil, "scopes" => [], @@ -463,6 +467,8 @@ def test_data_integrations_list_response_data_connected_account_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + assert_nil json[:account_identifier] + assert_nil json[:account_display_name] assert_nil json[:user_id] assert_nil json[:organization_id] assert_equal fixture["created_at"], json[:created_at]