diff --git a/.changelog-pending/2026-07-02T14-59-27-e350eb0b1521b954c25625b4858b2fd14a506cd2.md b/.changelog-pending/2026-07-02T14-59-27-e350eb0b1521b954c25625b4858b2fd14a506cd2.md new file mode 100644 index 00000000..cbf28743 --- /dev/null +++ b/.changelog-pending/2026-07-02T14-59-27-e350eb0b1521b954c25625b4858b2fd14a506cd2.md @@ -0,0 +1,27 @@ +* [#512](https://github.com/workos/workos-ruby/pull/512) feat(generated): regenerate from spec (1 change) + + **Features** + * **[pipes](https://workos.com/docs/reference/pipes)**: + * Added model `DataIntegrationCredentialsDto` + * Added model `CustomProviderDefinition` + * Added model `CreateDataIntegration` + * Added model `UpdateCustomProviderDefinition` + * Added model `UpdateDataIntegration` + * Added model `DataIntegration` + * Added model `DataIntegrationList` + * Added model `DataIntegrationListListMetadata` + * Added model `DataIntegrationCredential` + * Added model `DataIntegrationCustomProvider` + * Added enum `DataIntegrationCredentialsType` + * Added enum `CustomProviderDefinitionAuthenticateVia` + * Added enum `UpdateCustomProviderDefinitionAuthenticateVia` + * Added enum `DataIntegrationState` + * Added enum `DataIntegrationCredentialType` + * Added enum `DataIntegrationCustomProviderAuthenticateVia` + * Added endpoint `GET /data-integrations` + * Added endpoint `POST /data-integrations` + * Added endpoint `GET /data-integrations/{slug}` + * Added endpoint `PUT /data-integrations/{slug}` + * Added endpoint `DELETE /data-integrations/{slug}` + * Added endpoint `POST /user_management/users/{user_id}/connected_accounts/{slug}` + * Added endpoint `PUT /user_management/users/{user_id}/connected_accounts/{slug}` diff --git a/.last-synced-sha b/.last-synced-sha index cdc071b3..639e2e87 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -dc04d30b352063b5c97e45de03be5c83629f5412 +4b4e0618779460dbebc1cf5e0f02197c21796d1f diff --git a/.oagen-manifest.json b/.oagen-manifest.json index be22b1a6..11eef1c7 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-07-01T18:19:13.490Z", + "generatedAt": "2026-07-02T14:59:01.941Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -252,11 +252,18 @@ "lib/workos/organizations/update_organization.rb", "lib/workos/pipes.rb", "lib/workos/pipes/connected_account.rb", + "lib/workos/pipes/connected_account_dto.rb", + "lib/workos/pipes/create_data_integration.rb", + "lib/workos/pipes/custom_provider_definition.rb", + "lib/workos/pipes/data_integration.rb", "lib/workos/pipes/data_integration_access_token_response.rb", "lib/workos/pipes/data_integration_access_token_response_access_token.rb", "lib/workos/pipes/data_integration_authorize_url_response.rb", + "lib/workos/pipes/data_integration_credential.rb", + "lib/workos/pipes/data_integration_credentials_dto.rb", "lib/workos/pipes/data_integration_credentials_response.rb", "lib/workos/pipes/data_integration_credentials_response_credential.rb", + "lib/workos/pipes/data_integration_custom_provider.rb", "lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb", "lib/workos/pipes/data_integrations_get_user_token_request.rb", "lib/workos/pipes/data_integrations_list_response.rb", @@ -264,6 +271,8 @@ "lib/workos/pipes/data_integrations_list_response_data_connected_account.rb", "lib/workos/pipes/data_integrations_upsert_api_key_request.rb", "lib/workos/pipes/data_integrations_vend_credentials_request.rb", + "lib/workos/pipes/update_custom_provider_definition.rb", + "lib/workos/pipes/update_data_integration.rb", "lib/workos/pipes_provider.rb", "lib/workos/pipes_provider/configure_data_integration_body.rb", "lib/workos/pipes_provider/data_integration_configuration_list_response.rb", @@ -355,9 +364,14 @@ "lib/workos/types/create_user_invite_options_locale.rb", "lib/workos/types/create_user_password_hash_type.rb", "lib/workos/types/create_webhook_endpoint_events.rb", + "lib/workos/types/custom_provider_definition_authenticate_via.rb", "lib/workos/types/data_integration_access_token_response_error.rb", + "lib/workos/types/data_integration_credential_type.rb", "lib/workos/types/data_integration_credentials_credentials_type.rb", "lib/workos/types/data_integration_credentials_response_error.rb", + "lib/workos/types/data_integration_credentials_type.rb", + "lib/workos/types/data_integration_custom_provider_authenticate_via.rb", + "lib/workos/types/data_integration_state.rb", "lib/workos/types/data_integrations_list_response_data_auth_methods.rb", "lib/workos/types/data_integrations_list_response_data_connected_account_auth_method.rb", "lib/workos/types/data_integrations_list_response_data_connected_account_state.rb", @@ -427,6 +441,7 @@ "lib/workos/types/session_revoked_data_auth_method.rb", "lib/workos/types/session_revoked_data_status.rb", "lib/workos/types/sso_provider.rb", + "lib/workos/types/update_custom_provider_definition_authenticate_via.rb", "lib/workos/types/update_user_password_hash_type.rb", "lib/workos/types/update_webhook_endpoint_events.rb", "lib/workos/types/update_webhook_endpoint_status.rb", @@ -753,6 +768,7 @@ "rbi/workos/connect_application_oauth.rbi", "rbi/workos/connect_application_oauth_redirect_uris.rbi", "rbi/workos/connected_account.rbi", + "rbi/workos/connected_account_dto.rbi", "rbi/workos/connection.rbi", "rbi/workos/connection_activated.rbi", "rbi/workos/connection_activated_data.rbi", @@ -777,6 +793,7 @@ "rbi/workos/create_authorization_permission.rbi", "rbi/workos/create_authorization_resource.rbi", "rbi/workos/create_cors_origin.rbi", + "rbi/workos/create_data_integration.rbi", "rbi/workos/create_data_key_request.rbi", "rbi/workos/create_data_key_response.rbi", "rbi/workos/create_group.rbi", @@ -798,14 +815,19 @@ "rbi/workos/create_user_invite_options.rbi", "rbi/workos/create_user_organization_membership.rbi", "rbi/workos/create_webhook_endpoint.rbi", + "rbi/workos/custom_provider_definition.rbi", + "rbi/workos/data_integration.rbi", "rbi/workos/data_integration_access_token_response.rbi", "rbi/workos/data_integration_access_token_response_access_token.rbi", "rbi/workos/data_integration_authorize_url_response.rbi", "rbi/workos/data_integration_configuration_list_response.rbi", "rbi/workos/data_integration_configuration_response.rbi", + "rbi/workos/data_integration_credential.rbi", "rbi/workos/data_integration_credentials.rbi", + "rbi/workos/data_integration_credentials_dto.rbi", "rbi/workos/data_integration_credentials_response.rbi", "rbi/workos/data_integration_credentials_response_credential.rbi", + "rbi/workos/data_integration_custom_provider.rbi", "rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi", "rbi/workos/data_integrations_get_user_token_request.rbi", "rbi/workos/data_integrations_list_response.rbi", @@ -1054,6 +1076,8 @@ "rbi/workos/update_audit_logs_retention.rbi", "rbi/workos/update_authorization_permission.rbi", "rbi/workos/update_authorization_resource.rbi", + "rbi/workos/update_custom_provider_definition.rbi", + "rbi/workos/update_data_integration.rbi", "rbi/workos/update_group.rbi", "rbi/workos/update_jwt_template.rbi", "rbi/workos/update_oauth_application.rbi", @@ -1148,6 +1172,7 @@ "test/workos/test_organizations.rb", "test/workos/test_organizations_model_round_trip.rb", "test/workos/test_pipes.rb", + "test/workos/test_pipes_model_round_trip.rb", "test/workos/test_pipes_provider.rb", "test/workos/test_radar.rb", "test/workos/test_shared_model_round_trip.rb", @@ -1987,6 +2012,38 @@ "GET /user_management/redirect_uris": { "sdkMethod": "list_redirect_uris", "service": "user_management" + }, + "GET /data-integrations": { + "sdkMethod": "list_data_integrations", + "service": "pipes" + }, + "POST /data-integrations": { + "sdkMethod": "create_data_integration", + "service": "pipes" + }, + "GET /data-integrations/{slug}": { + "sdkMethod": "get_data_integration", + "service": "pipes" + }, + "PUT /data-integrations/{slug}": { + "sdkMethod": "update_data_integration", + "service": "pipes" + }, + "DELETE /data-integrations/{slug}": { + "sdkMethod": "delete_data_integration", + "service": "pipes" + }, + "POST /user_management/radar_challenges": { + "sdkMethod": "create_radar_challenge", + "service": "user_management" + }, + "POST /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "create_user_connected_account", + "service": "pipes" + }, + "PUT /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "update_user_connected_account", + "service": "pipes" } } } diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb index 3ae1824f..1a211e5e 100644 --- a/lib/workos/pipes.rb +++ b/lib/workos/pipes.rb @@ -10,6 +10,161 @@ def initialize(client) @client = client end + # List data integrations + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @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"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @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). + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_data_integrations( + before: nil, + after: nil, + limit: 10, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request( + method: :get, + path: "/data-integrations", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_data_integrations( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::DataIntegration, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + + # Create a data integration + # @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. + # @param description [String, nil] An optional description of the Data Integration. + # @param enabled [Boolean, nil] Whether the Data Integration is enabled. Defaults to `false`. + # @param scopes [Array, nil] The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted. + # @param credentials [WorkOS::DataIntegrationCredentialsDto, nil] The credentials to configure for the Data Integration. Required for both built-in and custom providers. + # @param custom_provider [WorkOS::CustomProviderDefinition, nil] The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::DataIntegration] + def create_data_integration( + provider:, + description: nil, + enabled: nil, + scopes: nil, + credentials: nil, + custom_provider: nil, + request_options: {} + ) + body = { + "provider" => provider, + "description" => description, + "enabled" => enabled, + "scopes" => scopes, + "credentials" => credentials, + "custom_provider" => custom_provider + }.compact + response = @client.request( + method: :post, + path: "/data-integrations", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::DataIntegration.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 data integration + # @param slug [String] The slug identifier of the data integration. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::DataIntegration] + def get_data_integration( + slug:, + request_options: {} + ) + response = @client.request( + method: :get, + path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}", + auth: true, + request_options: request_options + ) + result = WorkOS::DataIntegration.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 a data integration + # @param slug [String] The slug identifier of the data integration. + # @param description [String, nil] An optional description of the Data Integration. + # @param enabled [Boolean, nil] Whether the Data Integration is enabled. + # @param scopes [Array, nil] The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes. + # @param credentials [WorkOS::DataIntegrationCredentialsDto, nil] New credentials for the Data Integration. When provided, rotates the stored client secret. + # @param custom_provider [WorkOS::UpdateCustomProviderDefinition, nil] Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::DataIntegration] + def update_data_integration( + slug:, + description: nil, + enabled: nil, + scopes: nil, + credentials: nil, + custom_provider: nil, + request_options: {} + ) + body = { + "description" => description, + "enabled" => enabled, + "scopes" => scopes, + "credentials" => credentials, + "custom_provider" => custom_provider + }.compact + response = @client.request( + method: :put, + path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::DataIntegration.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 a data integration + # @param slug [String] The slug identifier of the data integration. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_data_integration( + slug:, + request_options: {} + ) + @client.request( + method: :delete, + path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}", + auth: true, + request_options: request_options + ) + nil + end + # Upsert an API key for a connected account # @param slug [String] The identifier of the integration. # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. @@ -155,6 +310,96 @@ def get_user_connected_account( result end + # Import 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`). + # @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::ConnectedAccountState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ConnectedAccount] + def create_user_connected_account( + user_id:, + slug:, + access_token: nil, + refresh_token: nil, + expires_at: nil, + scopes: nil, + state: nil, + organization_id: nil, + request_options: {} + ) + params = { + "organization_id" => organization_id + }.compact + body = { + "access_token" => access_token, + "refresh_token" => refresh_token, + "expires_at" => expires_at, + "scopes" => scopes, + "state" => state + }.compact + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_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 + + # Update 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`). + # @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::ConnectedAccountState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ConnectedAccount] + def update_user_connected_account( + user_id:, + slug:, + access_token: nil, + refresh_token: nil, + expires_at: nil, + scopes: nil, + state: nil, + organization_id: nil, + request_options: {} + ) + params = { + "organization_id" => organization_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: "/user_management/users/#{WorkOS::Util.encode_path(user_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 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/connected_account_dto.rb b/lib/workos/pipes/connected_account_dto.rb new file mode 100644 index 00000000..e182a12d --- /dev/null +++ b/lib/workos/pipes/connected_account_dto.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectedAccountDto < 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/pipes/create_data_integration.rb b/lib/workos/pipes/create_data_integration.rb new file mode 100644 index 00000000..76dee6de --- /dev/null +++ b/lib/workos/pipes/create_data_integration.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateDataIntegration < WorkOS::Types::BaseModel + HASH_ATTRS = { + provider: :provider, + description: :description, + enabled: :enabled, + scopes: :scopes, + credentials: :credentials, + custom_provider: :custom_provider + }.freeze + + attr_accessor \ + :provider, + :description, + :enabled, + :scopes, + :credentials, + :custom_provider + + def initialize(json) + hash = self.class.normalize(json) + @provider = hash[:provider] + @description = hash[:description] + @enabled = hash[:enabled] + @scopes = hash[:scopes] || [] + @credentials = hash[:credentials] ? WorkOS::DataIntegrationCredentialsDto.new(hash[:credentials]) : nil + @custom_provider = hash[:custom_provider] ? WorkOS::CustomProviderDefinition.new(hash[:custom_provider]) : nil + end + end +end diff --git a/lib/workos/pipes/custom_provider_definition.rb b/lib/workos/pipes/custom_provider_definition.rb new file mode 100644 index 00000000..e97e9c52 --- /dev/null +++ b/lib/workos/pipes/custom_provider_definition.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CustomProviderDefinition < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + authorization_url: :authorization_url, + token_url: :token_url, + refresh_token_url: :refresh_token_url, + pkce_enabled: :pkce_enabled, + request_scope_separator: :request_scope_separator, + scopes_required: :scopes_required, + client_secret_required: :client_secret_required, + additional_authorization_parameters: :additional_authorization_parameters, + token_body_content_type: :token_body_content_type, + authenticate_via: :authenticate_via + }.freeze + + attr_accessor \ + :name, + :authorization_url, + :token_url, + :refresh_token_url, + :pkce_enabled, + :request_scope_separator, + :scopes_required, + :client_secret_required, + :additional_authorization_parameters, + :token_body_content_type, + :authenticate_via + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @authorization_url = hash[:authorization_url] + @token_url = hash[:token_url] + @refresh_token_url = hash[:refresh_token_url] + @pkce_enabled = hash[:pkce_enabled] + @request_scope_separator = hash[:request_scope_separator] + @scopes_required = hash[:scopes_required] + @client_secret_required = hash[:client_secret_required] + @additional_authorization_parameters = hash[:additional_authorization_parameters] || {} + @token_body_content_type = hash[:token_body_content_type] + @authenticate_via = hash[:authenticate_via] + end + end +end diff --git a/lib/workos/pipes/data_integration.rb b/lib/workos/pipes/data_integration.rb new file mode 100644 index 00000000..7be63a59 --- /dev/null +++ b/lib/workos/pipes/data_integration.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegration < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + slug: :slug, + integration_type: :integration_type, + description: :description, + enabled: :enabled, + state: :state, + scopes: :scopes, + redirect_uri: :redirect_uri, + credentials: :credentials, + custom_provider: :custom_provider, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :slug, + :integration_type, + :description, + :enabled, + :state, + :scopes, + :redirect_uri, + :credentials, + :custom_provider, + :created_at, + :updated_at + + def initialize(json) + hash = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @slug = hash[:slug] + @integration_type = hash[:integration_type] + @description = hash[:description] + @enabled = hash[:enabled] + @state = hash[:state] + @scopes = hash[:scopes] || [] + @redirect_uri = hash[:redirect_uri] + @credentials = hash[:credentials] ? WorkOS::DataIntegrationCredential.new(hash[:credentials]) : nil + @custom_provider = hash[:custom_provider] ? WorkOS::DataIntegrationCustomProvider.new(hash[:custom_provider]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/pipes/data_integration_credential.rb b/lib/workos/pipes/data_integration_credential.rb new file mode 100644 index 00000000..0a1791e1 --- /dev/null +++ b/lib/workos/pipes/data_integration_credential.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationCredential < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + client_id: :client_id, + redacted_client_secret: :redacted_client_secret + }.freeze + + attr_accessor \ + :type, + :client_id, + :redacted_client_secret + + def initialize(json) + hash = self.class.normalize(json) + @type = hash[:type] + @client_id = hash[:client_id] + @redacted_client_secret = hash[:redacted_client_secret] + end + end +end diff --git a/lib/workos/pipes/data_integration_credentials_dto.rb b/lib/workos/pipes/data_integration_credentials_dto.rb new file mode 100644 index 00000000..6096f0e5 --- /dev/null +++ b/lib/workos/pipes/data_integration_credentials_dto.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationCredentialsDto < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + client_id: :client_id, + client_secret: :client_secret + }.freeze + + attr_accessor \ + :type, + :client_id, + :client_secret + + def initialize(json) + hash = self.class.normalize(json) + @type = hash[:type] + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + end + end +end diff --git a/lib/workos/pipes/data_integration_custom_provider.rb b/lib/workos/pipes/data_integration_custom_provider.rb new file mode 100644 index 00000000..4aecef2b --- /dev/null +++ b/lib/workos/pipes/data_integration_custom_provider.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationCustomProvider < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + authorization_url: :authorization_url, + token_url: :token_url, + refresh_token_url: :refresh_token_url, + pkce_enabled: :pkce_enabled, + request_scope_separator: :request_scope_separator, + scopes_required: :scopes_required, + client_secret_required: :client_secret_required, + additional_authorization_parameters: :additional_authorization_parameters, + token_body_content_type: :token_body_content_type, + authenticate_via: :authenticate_via + }.freeze + + attr_accessor \ + :name, + :authorization_url, + :token_url, + :refresh_token_url, + :pkce_enabled, + :request_scope_separator, + :scopes_required, + :client_secret_required, + :additional_authorization_parameters, + :token_body_content_type, + :authenticate_via + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @authorization_url = hash[:authorization_url] + @token_url = hash[:token_url] + @refresh_token_url = hash[:refresh_token_url] + @pkce_enabled = hash[:pkce_enabled] + @request_scope_separator = hash[:request_scope_separator] + @scopes_required = hash[:scopes_required] + @client_secret_required = hash[:client_secret_required] + @additional_authorization_parameters = hash[:additional_authorization_parameters] || {} + @token_body_content_type = hash[:token_body_content_type] + @authenticate_via = hash[:authenticate_via] + end + end +end diff --git a/lib/workos/pipes/update_custom_provider_definition.rb b/lib/workos/pipes/update_custom_provider_definition.rb new file mode 100644 index 00000000..3de1c141 --- /dev/null +++ b/lib/workos/pipes/update_custom_provider_definition.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateCustomProviderDefinition < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + authorization_url: :authorization_url, + token_url: :token_url, + refresh_token_url: :refresh_token_url, + pkce_enabled: :pkce_enabled, + request_scope_separator: :request_scope_separator, + scopes_required: :scopes_required, + client_secret_required: :client_secret_required, + additional_authorization_parameters: :additional_authorization_parameters, + token_body_content_type: :token_body_content_type, + authenticate_via: :authenticate_via + }.freeze + + attr_accessor \ + :name, + :authorization_url, + :token_url, + :refresh_token_url, + :pkce_enabled, + :request_scope_separator, + :scopes_required, + :client_secret_required, + :additional_authorization_parameters, + :token_body_content_type, + :authenticate_via + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @authorization_url = hash[:authorization_url] + @token_url = hash[:token_url] + @refresh_token_url = hash[:refresh_token_url] + @pkce_enabled = hash[:pkce_enabled] + @request_scope_separator = hash[:request_scope_separator] + @scopes_required = hash[:scopes_required] + @client_secret_required = hash[:client_secret_required] + @additional_authorization_parameters = hash[:additional_authorization_parameters] || {} + @token_body_content_type = hash[:token_body_content_type] + @authenticate_via = hash[:authenticate_via] + end + end +end diff --git a/lib/workos/pipes/update_data_integration.rb b/lib/workos/pipes/update_data_integration.rb new file mode 100644 index 00000000..a1d003f6 --- /dev/null +++ b/lib/workos/pipes/update_data_integration.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateDataIntegration < WorkOS::Types::BaseModel + HASH_ATTRS = { + description: :description, + enabled: :enabled, + scopes: :scopes, + credentials: :credentials, + custom_provider: :custom_provider + }.freeze + + attr_accessor \ + :description, + :enabled, + :scopes, + :credentials, + :custom_provider + + def initialize(json) + hash = self.class.normalize(json) + @description = hash[:description] + @enabled = hash[:enabled] + @scopes = hash[:scopes] || [] + @credentials = hash[:credentials] ? WorkOS::DataIntegrationCredentialsDto.new(hash[:credentials]) : nil + @custom_provider = hash[:custom_provider] ? WorkOS::UpdateCustomProviderDefinition.new(hash[:custom_provider]) : nil + end + end +end diff --git a/lib/workos/types/connected_account_state.rb b/lib/workos/types/connected_account_state.rb index 766f6c5a..76ed0525 100644 --- a/lib/workos/types/connected_account_state.rb +++ b/lib/workos/types/connected_account_state.rb @@ -7,8 +7,7 @@ module Types class ConnectedAccountState CONNECTED = "connected" NEEDS_REAUTHORIZATION = "needs_reauthorization" - DISCONNECTED = "disconnected" - ALL = [CONNECTED, NEEDS_REAUTHORIZATION, DISCONNECTED].freeze + ALL = [CONNECTED, NEEDS_REAUTHORIZATION].freeze end end end diff --git a/lib/workos/types/custom_provider_definition_authenticate_via.rb b/lib/workos/types/custom_provider_definition_authenticate_via.rb new file mode 100644 index 00000000..736c10fc --- /dev/null +++ b/lib/workos/types/custom_provider_definition_authenticate_via.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class CustomProviderDefinitionAuthenticateVia + REQUEST_BODY = "request_body" + BASIC_AUTH_HEADER = "basic_auth_header" + ALL = [REQUEST_BODY, BASIC_AUTH_HEADER].freeze + end + end +end diff --git a/lib/workos/types/data_integration_credential_type.rb b/lib/workos/types/data_integration_credential_type.rb new file mode 100644 index 00000000..c85f3c91 --- /dev/null +++ b/lib/workos/types/data_integration_credential_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DataIntegrationCredentialType + CUSTOM = "custom" + ORGANIZATION = "organization" + ALL = [CUSTOM, ORGANIZATION].freeze + end + end +end diff --git a/lib/workos/types/data_integration_credentials_type.rb b/lib/workos/types/data_integration_credentials_type.rb new file mode 100644 index 00000000..2e85943c --- /dev/null +++ b/lib/workos/types/data_integration_credentials_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DataIntegrationCredentialsType = DataIntegrationCredentialType + end +end diff --git a/lib/workos/types/data_integration_custom_provider_authenticate_via.rb b/lib/workos/types/data_integration_custom_provider_authenticate_via.rb new file mode 100644 index 00000000..db93e53b --- /dev/null +++ b/lib/workos/types/data_integration_custom_provider_authenticate_via.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DataIntegrationCustomProviderAuthenticateVia = CustomProviderDefinitionAuthenticateVia + end +end diff --git a/lib/workos/types/data_integration_state.rb b/lib/workos/types/data_integration_state.rb new file mode 100644 index 00000000..a3b4a500 --- /dev/null +++ b/lib/workos/types/data_integration_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DataIntegrationState + VALID = "valid" + INVALID = "invalid" + REQUESTED = "requested" + ALL = [VALID, INVALID, REQUESTED].freeze + end + end +end diff --git a/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb b/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb index 5cb4e2e9..6fcd6ddd 100644 --- a/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +++ b/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb @@ -4,6 +4,11 @@ module WorkOS module Types - DataIntegrationsListResponseDataConnectedAccountState = ConnectedAccountState + class DataIntegrationsListResponseDataConnectedAccountState + CONNECTED = "connected" + NEEDS_REAUTHORIZATION = "needs_reauthorization" + DISCONNECTED = "disconnected" + ALL = [CONNECTED, NEEDS_REAUTHORIZATION, DISCONNECTED].freeze + end end end diff --git a/lib/workos/types/update_custom_provider_definition_authenticate_via.rb b/lib/workos/types/update_custom_provider_definition_authenticate_via.rb new file mode 100644 index 00000000..8fca8d3d --- /dev/null +++ b/lib/workos/types/update_custom_provider_definition_authenticate_via.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UpdateCustomProviderDefinitionAuthenticateVia = CustomProviderDefinitionAuthenticateVia + end +end diff --git a/rbi/workos/connected_account_dto.rbi b/rbi/workos/connected_account_dto.rbi new file mode 100644 index 00000000..afaaa677 --- /dev/null +++ b/rbi/workos/connected_account_dto.rbi @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectedAccountDto + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def access_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def access_token=(value); end + + sig { returns(T.nilable(String)) } + def refresh_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def refresh_token=(value); end + + sig { returns(T.nilable(String)) } + def expires_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def expires_at=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_data_integration.rbi b/rbi/workos/create_data_integration.rbi new file mode 100644 index 00000000..205efcc9 --- /dev/null +++ b/rbi/workos/create_data_integration.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateDataIntegration + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def provider; end + + sig { params(value: String).returns(String) } + def provider=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def enabled=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T.nilable(WorkOS::DataIntegrationCredentialsDto)) } + def credentials; end + + sig { params(value: T.nilable(WorkOS::DataIntegrationCredentialsDto)).returns(T.nilable(WorkOS::DataIntegrationCredentialsDto)) } + def credentials=(value); end + + sig { returns(T.nilable(WorkOS::CustomProviderDefinition)) } + def custom_provider; end + + sig { params(value: T.nilable(WorkOS::CustomProviderDefinition)).returns(T.nilable(WorkOS::CustomProviderDefinition)) } + def custom_provider=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/custom_provider_definition.rbi b/rbi/workos/custom_provider_definition.rbi new file mode 100644 index 00000000..7239607b --- /dev/null +++ b/rbi/workos/custom_provider_definition.rbi @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CustomProviderDefinition + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def authorization_url; end + + sig { params(value: String).returns(String) } + def authorization_url=(value); end + + sig { returns(String) } + def token_url; end + + sig { params(value: String).returns(String) } + def token_url=(value); end + + sig { returns(T.nilable(String)) } + def refresh_token_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def refresh_token_url=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def pkce_enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def pkce_enabled=(value); end + + sig { returns(T.nilable(String)) } + def request_scope_separator; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def request_scope_separator=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def scopes_required; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def scopes_required=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def client_secret_required; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def client_secret_required=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def additional_authorization_parameters; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def additional_authorization_parameters=(value); end + + sig { returns(T.nilable(String)) } + def token_body_content_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def token_body_content_type=(value); end + + sig { returns(T.nilable(String)) } + def authenticate_via; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authenticate_via=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration.rbi b/rbi/workos/data_integration.rbi new file mode 100644 index 00000000..2d9093ac --- /dev/null +++ b/rbi/workos/data_integration.rbi @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegration + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def integration_type; end + + sig { params(value: String).returns(String) } + def integration_type=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(String) } + def redirect_uri; end + + sig { params(value: String).returns(String) } + def redirect_uri=(value); end + + sig { returns(WorkOS::DataIntegrationCredential) } + def credentials; end + + sig { params(value: WorkOS::DataIntegrationCredential).returns(WorkOS::DataIntegrationCredential) } + def credentials=(value); end + + sig { returns(T.nilable(WorkOS::DataIntegrationCustomProvider)) } + def custom_provider; end + + sig { params(value: T.nilable(WorkOS::DataIntegrationCustomProvider)).returns(T.nilable(WorkOS::DataIntegrationCustomProvider)) } + def custom_provider=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_credential.rbi b/rbi/workos/data_integration_credential.rbi new file mode 100644 index 00000000..c40e0326 --- /dev/null +++ b/rbi/workos/data_integration_credential.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationCredential + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def client_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def client_id=(value); end + + sig { returns(T.nilable(String)) } + def redacted_client_secret; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def redacted_client_secret=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_credentials_dto.rbi b/rbi/workos/data_integration_credentials_dto.rbi new file mode 100644 index 00000000..e263a641 --- /dev/null +++ b/rbi/workos/data_integration_credentials_dto.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationCredentialsDto + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def client_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def client_id=(value); end + + sig { returns(T.nilable(String)) } + def client_secret; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def client_secret=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_custom_provider.rbi b/rbi/workos/data_integration_custom_provider.rbi new file mode 100644 index 00000000..b6d5e277 --- /dev/null +++ b/rbi/workos/data_integration_custom_provider.rbi @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationCustomProvider + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def authorization_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authorization_url=(value); end + + sig { returns(T.nilable(String)) } + def token_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def token_url=(value); end + + sig { returns(T.nilable(String)) } + def refresh_token_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def refresh_token_url=(value); end + + sig { returns(T::Boolean) } + def pkce_enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def pkce_enabled=(value); end + + sig { returns(String) } + def request_scope_separator; end + + sig { params(value: String).returns(String) } + def request_scope_separator=(value); end + + sig { returns(T::Boolean) } + def scopes_required; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def scopes_required=(value); end + + sig { returns(T::Boolean) } + def client_secret_required; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def client_secret_required=(value); end + + sig { returns(T::Hash[String, String]) } + def additional_authorization_parameters; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def additional_authorization_parameters=(value); end + + sig { returns(String) } + def token_body_content_type; end + + sig { params(value: String).returns(String) } + def token_body_content_type=(value); end + + sig { returns(String) } + def authenticate_via; end + + sig { params(value: String).returns(String) } + def authenticate_via=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/pipes.rbi b/rbi/workos/pipes.rbi index 988b570c..a6695395 100644 --- a/rbi/workos/pipes.rbi +++ b/rbi/workos/pipes.rbi @@ -9,6 +9,59 @@ module WorkOS sig { params(client: WorkOS::BaseClient).void } def initialize(client); end + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_data_integrations(before:, after:, limit:, order:, request_options:); end + + sig do + params( + provider: String, + description: T.nilable(String), + enabled: T.nilable(T::Boolean), + scopes: T.nilable(T::Array[String]), + credentials: T.nilable(WorkOS::DataIntegrationCredentialsDto), + custom_provider: T.nilable(WorkOS::CustomProviderDefinition), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegration) + end + def create_data_integration(provider:, description:, enabled:, scopes:, credentials:, custom_provider:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegration) + end + def get_data_integration(slug:, request_options:); end + + sig do + params( + slug: String, + description: T.nilable(String), + enabled: T.nilable(T::Boolean), + scopes: T.nilable(T::Array[String]), + credentials: T.nilable(WorkOS::DataIntegrationCredentialsDto), + custom_provider: T.nilable(WorkOS::UpdateCustomProviderDefinition), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegration) + end + def update_data_integration(slug:, description:, enabled:, scopes:, credentials:, custom_provider:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_data_integration(slug:, request_options:); end + sig do params( slug: String, @@ -61,6 +114,36 @@ module WorkOS end def get_user_connected_account(user_id:, slug:, organization_id:, request_options:); end + sig do + params( + user_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), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def create_user_connected_account(user_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, organization_id:, request_options:); end + + sig do + params( + user_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), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def update_user_connected_account(user_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, organization_id:, request_options:); end + sig do params( user_id: String, diff --git a/rbi/workos/update_custom_provider_definition.rbi b/rbi/workos/update_custom_provider_definition.rbi new file mode 100644 index 00000000..6d650517 --- /dev/null +++ b/rbi/workos/update_custom_provider_definition.rbi @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateCustomProviderDefinition + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def authorization_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authorization_url=(value); end + + sig { returns(T.nilable(String)) } + def token_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def token_url=(value); end + + sig { returns(T.nilable(String)) } + def refresh_token_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def refresh_token_url=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def pkce_enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def pkce_enabled=(value); end + + sig { returns(T.nilable(String)) } + def request_scope_separator; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def request_scope_separator=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def scopes_required; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def scopes_required=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def client_secret_required; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def client_secret_required=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def additional_authorization_parameters; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def additional_authorization_parameters=(value); end + + sig { returns(T.nilable(String)) } + def token_body_content_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def token_body_content_type=(value); end + + sig { returns(T.nilable(String)) } + def authenticate_via; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authenticate_via=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_data_integration.rbi b/rbi/workos/update_data_integration.rbi new file mode 100644 index 00000000..ec526c1b --- /dev/null +++ b/rbi/workos/update_data_integration.rbi @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateDataIntegration + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def enabled=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T.nilable(WorkOS::DataIntegrationCredentialsDto)) } + def credentials; end + + sig { params(value: T.nilable(WorkOS::DataIntegrationCredentialsDto)).returns(T.nilable(WorkOS::DataIntegrationCredentialsDto)) } + def credentials=(value); end + + sig { returns(T.nilable(WorkOS::UpdateCustomProviderDefinition)) } + def custom_provider; end + + sig { params(value: T.nilable(WorkOS::UpdateCustomProviderDefinition)).returns(T.nilable(WorkOS::UpdateCustomProviderDefinition)) } + def custom_provider=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/test/workos/test_pipes.rb b/test/workos/test_pipes.rb index aba29613..3bf90043 100644 --- a/test/workos/test_pipes.rb +++ b/test/workos/test_pipes.rb @@ -11,6 +11,41 @@ def setup @client = WorkOS::Client.new(api_key: "sk_test_123") end + def test_list_data_integrations_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.pipes.list_data_integrations + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_create_data_integration_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.create_data_integration(provider: "stub") + refute_nil result + end + + def test_get_data_integration_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.get_data_integration(slug: "stub") + refute_nil result + end + + def test_update_data_integration_returns_expected_result + stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.update_data_integration(slug: "stub") + refute_nil result + end + + def test_delete_data_integration_returns_expected_result + stub_request(:delete, %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.delete_data_integration(slug: "stub") + assert_nil result + end + def test_update_data_integration_api_key_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}) .to_return(body: "{}", status: 200) @@ -46,6 +81,20 @@ def test_get_user_connected_account_returns_expected_result refute_nil result end + def test_create_user_connected_account_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.create_user_connected_account(user_id: "stub", slug: "stub") + refute_nil result + end + + def test_update_user_connected_account_returns_expected_result + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.pipes.update_user_connected_account(user_id: "stub", slug: "stub") + refute_nil result + end + def test_delete_user_connected_account_returns_expected_result stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) .to_return(body: "{}", status: 200) @@ -62,11 +111,18 @@ def test_list_user_data_providers_returns_expected_result # Parameterized authentication error tests (one per endpoint). [ + {name: :list_data_integrations, verb: :get, url: %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}}, + {name: :create_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations(\?|\z)}, args: {provider: "stub"}}, + {name: :get_data_integration, verb: :get, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :update_data_integration, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :delete_data_integration, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}}, {name: :update_data_integration_api_key, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}, args: {slug: "stub", user_id: "stub", secret: "stub"}}, {name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}}, {name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "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_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"}}, {name: :delete_user_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, {name: :list_user_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/data_providers(\?|\z)}, args: {user_id: "stub"}} ].each do |spec| diff --git a/test/workos/test_pipes_model_round_trip.rb b/test/workos/test_pipes_model_round_trip.rb new file mode 100644 index 00000000..29c52088 --- /dev/null +++ b/test/workos/test_pipes_model_round_trip.rb @@ -0,0 +1,389 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class PipesModelRoundTripTest < Minitest::Test + def test_data_integration_credentials_dto_round_trip + fixture = { + "type" => "stub", + "client_id" => "stub", + "client_secret" => "stub" + } + model = WorkOS::DataIntegrationCredentialsDto.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_custom_provider_definition_round_trip + fixture = { + "name" => "stub", + "authorization_url" => "stub", + "token_url" => "stub", + "refresh_token_url" => nil, + "pkce_enabled" => true, + "request_scope_separator" => "stub", + "scopes_required" => true, + "client_secret_required" => true, + "additional_authorization_parameters" => {}, + "token_body_content_type" => "stub", + "authenticate_via" => "stub" + } + model = WorkOS::CustomProviderDefinition.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_equal fixture["authorization_url"], json[:authorization_url] + assert_equal fixture["token_url"], json[:token_url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_create_data_integration_round_trip + fixture = { + "provider" => "stub", + "description" => nil, + "enabled" => true, + "scopes" => nil, + "credentials" => {}, + "custom_provider" => {} + } + model = WorkOS::CreateDataIntegration.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["provider"], json[:provider] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_update_custom_provider_definition_round_trip + fixture = { + "name" => "stub", + "authorization_url" => "stub", + "token_url" => "stub", + "refresh_token_url" => nil, + "pkce_enabled" => true, + "request_scope_separator" => "stub", + "scopes_required" => true, + "client_secret_required" => true, + "additional_authorization_parameters" => {}, + "token_body_content_type" => "stub", + "authenticate_via" => "stub" + } + model = WorkOS::UpdateCustomProviderDefinition.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_update_data_integration_round_trip + fixture = { + "description" => nil, + "enabled" => true, + "scopes" => nil, + "credentials" => {}, + "custom_provider" => {} + } + model = WorkOS::UpdateDataIntegration.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_connected_account_dto_round_trip + fixture = { + "access_token" => "stub", + "refresh_token" => "stub", + "expires_at" => "stub", + "scopes" => [], + "state" => "stub" + } + model = WorkOS::ConnectedAccountDto.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", + "id" => "stub", + "slug" => "stub", + "integration_type" => "stub", + "description" => nil, + "enabled" => true, + "state" => "stub", + "scopes" => nil, + "redirect_uri" => "stub", + "credentials" => {}, + "custom_provider" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::DataIntegration.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["integration_type"], json[:integration_type] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["redirect_uri"], json[:redirect_uri] + 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_authorize_url_response_round_trip + fixture = { + "url" => "stub" + } + model = WorkOS::DataIntegrationAuthorizeUrlResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["url"], json[:url] + 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_access_token_response_round_trip + fixture = { + "active" => true, + "access_token" => {}, + "error" => "stub" + } + model = WorkOS::DataIntegrationAccessTokenResponse.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_credentials_response_round_trip + fixture = { + "active" => true, + "credential" => {}, + "error" => "stub" + } + model = WorkOS::DataIntegrationCredentialsResponse.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_connected_account_round_trip + fixture = { + "object" => "connected_account", + "id" => "stub", + "user_id" => nil, + "organization_id" => nil, + "scopes" => [], + "auth_method" => "stub", + "api_key_last_4" => nil, + "state" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ConnectedAccount.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + 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] + 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 + } + 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", + "auth_method" => "oauth", + "value" => "stub", + "expires_at" => nil, + "scopes" => [], + "missing_scopes" => [] + } + model = WorkOS::DataIntegrationCredentialsResponseCredential.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["value"], json[:value] + assert_nil json[:expires_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_access_token_response_access_token_round_trip + fixture = { + "object" => "access_token", + "access_token" => "stub", + "expires_at" => nil, + "scopes" => [], + "missing_scopes" => [] + } + model = WorkOS::DataIntegrationAccessTokenResponseAccessToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["access_token"], json[:access_token] + assert_nil json[:expires_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_credential_round_trip + fixture = { + "type" => "stub", + "client_id" => nil, + "redacted_client_secret" => nil + } + model = WorkOS::DataIntegrationCredential.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:client_id] + assert_nil json[:redacted_client_secret] + 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_custom_provider_round_trip + fixture = { + "name" => "stub", + "authorization_url" => nil, + "token_url" => nil, + "refresh_token_url" => nil, + "pkce_enabled" => true, + "request_scope_separator" => "stub", + "scopes_required" => true, + "client_secret_required" => true, + "additional_authorization_parameters" => {}, + "token_body_content_type" => "stub", + "authenticate_via" => "stub" + } + model = WorkOS::DataIntegrationCustomProvider.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_nil json[:authorization_url] + assert_nil json[:token_url] + assert_nil json[:refresh_token_url] + assert_equal fixture["pkce_enabled"], json[:pkce_enabled] + assert_equal fixture["request_scope_separator"], json[:request_scope_separator] + assert_equal fixture["scopes_required"], json[:scopes_required] + assert_equal fixture["client_secret_required"], json[:client_secret_required] + assert_equal fixture["token_body_content_type"], json[:token_body_content_type] + 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_upsert_api_key_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub", + "secret" => "stub" + } + model = WorkOS::DataIntegrationsUpsertApiKeyRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["secret"], json[:secret] + 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_get_data_integration_authorize_url_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub", + "return_to" => "stub" + } + model = WorkOS::DataIntegrationsGetDataIntegrationAuthorizeUrlRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + 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_vend_credentials_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::DataIntegrationsVendCredentialsRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + 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_get_user_token_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => nil + } + model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + 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", + "user_id" => nil, + "organization_id" => nil, + "scopes" => [], + "auth_method" => "stub", + "api_key_last_4" => nil, + "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[: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_shared_model_round_trip.rb b/test/workos/test_shared_model_round_trip.rb index dc4c3b32..38e2ff98 100644 --- a/test/workos/test_shared_model_round_trip.rb +++ b/test/workos/test_shared_model_round_trip.rb @@ -5,88 +5,15 @@ require "test_helper" class SharedModelRoundTripTest < Minitest::Test - def test_connect_application_oauth_round_trip + def test_auth_method_mismatch_error_round_trip fixture = { - "object" => "connect_application", - "id" => "stub", - "client_id" => "stub", - "description" => nil, - "name" => "stub", - "scopes" => [], - "created_at" => "stub", - "updated_at" => "stub", - "application_type" => "oauth", - "redirect_uris" => [], - "uses_pkce" => true, - "is_first_party" => true, - "was_dynamically_registered" => true, - "organization_id" => "stub" + "code" => "auth_method_mismatch", + "message" => "stub" } - model = WorkOS::ConnectApplicationOAuth.new(fixture.to_json) + model = WorkOS::AuthMethodMismatchError.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_equal fixture["client_id"], json[:client_id] - assert_nil json[:description] - assert_equal fixture["name"], json[:name] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - assert_equal fixture["uses_pkce"], json[:uses_pkce] - assert_equal fixture["is_first_party"], json[:is_first_party] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_connect_application_oauth_redirect_uris_round_trip - fixture = { - "uri" => "stub", - "default" => true - } - model = WorkOS::ConnectApplicationOAuthRedirectUris.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["uri"], json[:uri] - assert_equal fixture["default"], json[:default] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_connect_application_m2m_round_trip - fixture = { - "object" => "connect_application", - "id" => "stub", - "client_id" => "stub", - "description" => nil, - "name" => "stub", - "scopes" => [], - "created_at" => "stub", - "updated_at" => "stub", - "application_type" => "m2m", - "organization_id" => "stub" - } - model = WorkOS::ConnectApplicationM2M.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] - assert_equal fixture["client_id"], json[:client_id] - assert_nil json[:description] - assert_equal fixture["name"], json[:name] - assert_equal fixture["created_at"], json[:created_at] - assert_equal fixture["updated_at"], json[:updated_at] - assert_equal fixture["organization_id"], json[:organization_id] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - - def test_authorized_connect_application_list_data_round_trip - fixture = { - "object" => "authorized_connect_application", - "id" => "stub", - "granted_scopes" => [], - "oauth_resource" => "stub", - "application" => {} - } - model = WorkOS::AuthorizedConnectApplicationListData.new(fixture.to_json) - json = model.to_h - assert_kind_of Hash, json - assert_equal fixture["id"], json[:id] + assert_equal fixture["message"], json[:message] fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end end