WorkOS.Pipes (WorkOS SDK for Elixir v3.0.1)

Copy Markdown View Source

Operations for the Pipes API.

Summary

Functions

authorize_data_integration(client, slug, params \\ %{}, opts \\ [])

@spec authorize_data_integration(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.DataIntegrationAuthorizeUrlResponse.t()}
  | {:error, WorkOS.Error.error()}

Get authorization URL

Generates an OAuth authorization URL to initiate the connection flow for a user. Redirect the user to the returned URL to begin the OAuth flow with the third-party provider.

Parameters

  • slug — The slug identifier of the provider (e.g., github, slack, notion).
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

create_data_integration(client, params \\ %{}, opts \\ [])

@spec create_data_integration(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.DataIntegration.t()} | {:error, WorkOS.Error.error()}

Create a data integration

Creates a data integration for a provider. Set credentials.type to custom to use your own OAuth app credentials or organization to have each organization supply its own. Set auth_methods to ["api_key"] to create an API key integration; you may optionally supply an api_key block to install a first tenant in the same call. For a built-in provider, pass its slug as provider. For a custom provider, pass a new slug plus a custom_provider definition.

Parameters

create_data_integration_credential(client, slug, params \\ %{}, opts \\ [])

@spec create_data_integration_credential(
  WorkOS.Client.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, WorkOS.DataIntegrationCredentialsResponse.t()}
  | {:error, WorkOS.Error.error()}

Vend credentials for a connected account

Returns credentials for a user's connected account. Branches on the installation's auth_method: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.

Parameters

  • slug — The identifier of the integration.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

create_user_connected_account(client, user_id, slug, params \\ %{}, opts \\ [])

@spec create_user_connected_account(
  WorkOS.Client.t(),
  String.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, WorkOS.ConnectedAccount.t()} | {:error, WorkOS.Error.error()}

Import a connected account

Imports a connected account for a user by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow.

Parameters

  • user_id — A User identifier.
  • slug — The slug identifier of the provider (e.g., github, slack, notion).
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

delete_data_integration(client, slug, opts \\ [])

@spec delete_data_integration(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, WorkOS.Error.error()}

Delete a data integration

Deletes a data integration and all of its connected installations. For a custom provider, also deletes the custom provider definition.

Parameters

delete_user_connected_account(client, user_id, slug, params \\ %{}, opts \\ [])

@spec delete_user_connected_account(
  WorkOS.Client.t(),
  String.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, term()} | {:error, WorkOS.Error.error()}

Delete a connected account

Disconnects WorkOS's account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect. This does not revoke access on the provider side.

Parameters

  • user_id — A User identifier.
  • slug — The slug identifier of the provider (e.g., github, slack, notion).
  • params — query parameters: :organization_id
  • opts — per-request options (see WorkOS.Client.request/5)

get_access_token(client, provider, params \\ %{}, opts \\ [])

@spec get_access_token(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.DataIntegrationAccessTokenResponse.t()}
  | {:error, WorkOS.Error.error()}

Get an access token for a connected account

Fetches a valid OAuth access token for a user's connected account. WorkOS automatically handles token refresh, ensuring you always receive a valid, non-expired token.

Parameters

  • provider — The identifier of the integration.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

get_data_integration(client, slug, opts \\ [])

@spec get_data_integration(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, WorkOS.DataIntegration.t()} | {:error, WorkOS.Error.error()}

Get a data integration

Retrieves a data integration by its slug.

Parameters

get_user_connected_account(client, user_id, slug, params \\ %{}, opts \\ [])

@spec get_user_connected_account(
  WorkOS.Client.t(),
  String.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, WorkOS.ConnectedAccount.t()} | {:error, WorkOS.Error.error()}

Get a connected account

Retrieves a user's connected account for a specific provider.

Parameters

  • user_id — A User identifier.
  • slug — The slug identifier of the provider (e.g., github, slack, notion).
  • params — query parameters: :organization_id
  • opts — per-request options (see WorkOS.Client.request/5)

list_data_integrations(client, params \\ %{}, opts \\ [])

@spec list_data_integrations(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.Page.t(WorkOS.DataIntegration.t())}
  | {:error, WorkOS.Error.error()}

List data integrations

Lists the environment's data integrations configured with custom or organization credentials, including custom providers and API key integrations.

Parameters

  • params — query parameters: :before, :after_, :limit, :order
  • opts — per-request options (see WorkOS.Client.request/5)

list_user_data_providers(client, user_id, params \\ %{}, opts \\ [])

@spec list_user_data_providers(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.DataIntegrationsListResponse.t()}
  | {:error, WorkOS.Error.error()}

List providers for a user

Retrieves a list of available providers and the user's connection status for each. Returns all providers configured for your environment, along with the user's connected account information where applicable.

Parameters

  • user_id — A User identifier to list providers and connected accounts for.
  • params — query parameters: :organization_id
  • opts — per-request options (see WorkOS.Client.request/5)

update_data_integration(client, slug, params \\ %{}, opts \\ [])

@spec update_data_integration(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.DataIntegration.t()} | {:error, WorkOS.Error.error()}

Update a data integration

Updates the description, enabled state, or custom credentials of a data integration. For custom providers, custom_provider updates the OAuth definition.

Parameters

  • slug — The slug identifier of the data integration.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

update_data_integration_api_key(client, slug, params \\ %{}, opts \\ [])

@spec update_data_integration_api_key(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.ConnectedAccount.t()} | {:error, WorkOS.Error.error()}

Upsert an API key for a connected account

Creates or updates an API-key-based installation for the specified integration and user. If an installation already exists, the stored API key is rotated to the new value.

Parameters

  • slug — The identifier of the integration.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

update_user_connected_account(client, user_id, slug, params \\ %{}, opts \\ [])

@spec update_user_connected_account(
  WorkOS.Client.t(),
  String.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, WorkOS.ConnectedAccount.t()} | {:error, WorkOS.Error.error()}

Update a connected account

Updates a user's connected account tokens, scopes, or state for a specific provider.

Parameters

  • user_id — A User identifier.
  • slug — The slug identifier of the provider (e.g., github, slack, notion).
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)