Skip to content

v1.0.0

Compare
Choose a tag to compare
@LauraBeatris LauraBeatris released this 20 Dec 12:25
· 4 commits to main since this release
e979826

Description

This is the first major release of the WorkOS Elixir SDK, it introduces all of the core APIs from WorkOS released until this moment and provides better configuration support for applications.

However, it'll remain as an experimental SDK since we don't have plans to keep it up to date across core product API changes.

Breaking changes compared to previous minor versions

Response structs

For matching clauses like this one:

case WorkOS.Organizations.get_organization(org_id) do
      {:ok,
       %{
         "id" => id,
         "name" => name
       }} 

It might result in a similar "no clause matching" error:

CleanShot 2023-12-09 at 23 43 59

Responses now have their structs that are parsed from the JSON responses. For instance, here's how to perform matching on the result of get_organization with response structs:

{:ok, %WorkOS.Organizations.Organization{id: id}} =
  WorkOS.Organizations.get_organization("org_123")

You may also encounter errors regarding Access Behaviour on Structs.

Configuration

Introducing a new configuration option: :client, by default, this library uses Tesla but it can be replaced according to the WorkOS.Client module behavior.

However, as previously, the only required config options are :api_key and :client_id.

You can also create a client struct separately, and pass it to each method.

client = WorkOS.client(api_key: System.fetch_env!("WORKOS_API_KEY"), client_id: System.fetch_env!("WORKOS_CLIENT_ID"))

WorkOS.Organizations.get_organization(client, "org_123")

Note that if you choose to configure WorkOS in your app config, passing a client struct is always optional.

config :workos, WorkOS.Client,
      api_key: "sk_12345",
      client_id: "project_12345"

Removed

  • Removed deprecated domain option from WorkOS.SSO.get_authorization_url, organization should be used instead.

Added

We're introducing new API modules according to our latest features: