Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major release 1.0.0 #52

Merged
merged 49 commits into from Dec 20, 2023
Merged

Major release 1.0.0 #52

merged 49 commits into from Dec 20, 2023

Conversation

LauraBeatris
Copy link
Contributor

@LauraBeatris LauraBeatris commented Nov 29, 2023

Breaking changes

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 option is :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:

@LauraBeatris LauraBeatris self-assigned this Nov 29, 2023
@LauraBeatris LauraBeatris changed the title Major release 1.0.0v [WIP] Major release 1.0.0v Nov 29, 2023
@LauraBeatris LauraBeatris mentioned this pull request Dec 1, 2023
LauraBeatris and others added 13 commits December 3, 2023 21:50
* Add config modules

* Start to build behavior for HTTP client

* Add `Castable` module to define behavior for casting or transforming data

* Handle response

* Add HTTP methods to client behavior

* Add `TeslaClient` implementation

* Add comment to prod.exs to fix `mix format`

* Fix casing for `WorkOS` namespace

* Add `@deprecated` to `WorkOS.API`

* Fix test config

* Validate config

* Fix linter

* Add module for structured error response

* Extract env variables to separate variables
* Add `ISSUE_TEMPLATE.md` (#34)

* Permit `expires_in` param when creating passwordless session (#35)

Co-authored-by: Mark Tran <mark.tran@gmail.com>

* Start to build behavior for HTTP client

* Add `Castable` module to define behavior for casting or transforming data

* Handle response

* Add HTTP methods to client behavior

* Add `TeslaClient` implementation

* Add comment to prod.exs to fix `mix format`

* Fix casing for `WorkOS` namespace

* Add `@deprecated` to `WorkOS.API`

* Fix test config

* Validate config

* Fix linter

* Add livebook file

---------

Co-authored-by: Jordan Mackie <12185627+jmackie@users.noreply.github.com>
Co-authored-by: Mark Tran <mark.tran@gmail.com>
* Update `mix.exs`

* Add util module

* Add `Connection` struct

* Add `List` castable module

* Add `list_connections` method

* Add `delete_connection` method

* Add `get_connection` method

* Add draft for `get_authorization_url`

* Add `dialyxir` dependency

* Remove old SSO module

* Define logic for `get_authorization_url`

* Add `Profile` and `ProfileAndToken` response structs

* Add `get_profile` function

* Add basic layer for tests

* Add structs to `mix.exs`

* Fix guard on `get_authorization_url`

* Remove deprecated tests

* Add doc comments for parameter options of `get_authorization_url`

* Remove `Application.put_env` from `test_helper`

* Add draft test

* Fix extension of test files to `exs`

* Apply case for test config

* Define base URL for test

* Fix test

* Implement tests for `get_authorization_url`

* Define test for `get_profile_and_token`

* Implement tests for `get_profile_and_token`

* Implement tests for `get_profile`

* Implement test for `get_connection`

* Implement test for `list_connections`

* Rename `ClientMock` to `SSO.ClientMock`

* Implement test for `delete_connection`

* Fix return type for `delete_connection`

* Fix `mix credo` issues

* Update comment indentation

* Handle case where `get_authorization_url` is called without having the application config loaded

* Add validation for `redirect_uri`

* Include `client_id` on WorkOS Client

* Update livebook examples

* Fix connection struct

* Add `WorkOS.Empty`

* Remove `IO.inspect`
* Add skeleton for Organizations module

* Remove old `Organizations` module

* Add missing `object` key to connections domain

* Add response struct for organizations

* Implement functions for `Organization` module

* Add `create_organization` and `update_organization`

* Extract exceptions to separate modules

* Allow to call `list` functions without client and map args

* Implement tests for organizations

* Update Livebook examples

* Remove `Logger`

* Remove `WorkOS.Util` and fix timestamps
* Add basic modules

* Define function clauses

* Include implementation

* Add Portal link response struct

* Add portal client mock

* Implement tests

* Add example to Livebook
* Restructure modules

* Add `Event` struct to `mix.exs`
* Add base modules

* Implement `get_directory`

* Implement `list_directories`

* Implement `delete_directory`

* Implement `Directory.User`

* Add tests for directory users

* Remove `WorkOS.Util`

* Add Livebook examples

* Rollback `Util` changes

* Remove `DateTime` from timestamps to match API reference

* Add missing `object` keys to response structs

* Remove WorkOS.Util
* Add base modules

* Implement functions

* Implement tests

* Remove `message` property
* Add base modules

* Implement `list_events`

* Implement tests

* Add to Livebook
* Add export response struct

* Add base modules

* Add implementation for `create_export`

* Add tests for `create_export`

* Add `get_export` method

* Add `add_event` method

* Add examples to Livebook
* Add draft for User Management module

* Add `Invitation` struct

* Add `User` struct

* Add User API methods

* Add methods from `Invitation` API

* Add `OrganizationMembership` API methods

* Add Password Reset API methods

* Add Email Verification API methods

* Add MFA response structs

* Add Multi-Factor API methods

* Add Magic Auth API methods

* Add Authentication API methods

* Add `get_authorization_url`

* Update Livebook

* Fixes `authorize` parameters
* Remove legacy `WorkOS.API`

* Add `OrganizationDomain` struct

* Add Domain Verification API methods

* Add domain verification API methods
@LauraBeatris LauraBeatris changed the title [WIP] Major release 1.0.0v [WIP] Major release 1.0.0 Dec 4, 2023
@LauraBeatris LauraBeatris changed the title [WIP] Major release 1.0.0 Major release 1.0.0 Dec 17, 2023
@LauraBeatris LauraBeatris force-pushed the release/1.0.0 branch 6 times, most recently from 6485c93 to 40c7f1d Compare December 19, 2023 15:24
@LauraBeatris LauraBeatris marked this pull request as ready for review December 19, 2023 17:35
@LauraBeatris LauraBeatris force-pushed the release/1.0.0 branch 4 times, most recently from 3212fe4 to d0d625e Compare December 20, 2023 12:17
@LauraBeatris LauraBeatris merged commit e979826 into main Dec 20, 2023
5 checks passed
@LauraBeatris LauraBeatris deleted the release/1.0.0 branch December 20, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants