From f9564dc27fae2cdbc2b40674b07a250bb8722c0e Mon Sep 17 00:00:00 2001 From: Michael Miller-Hairston Date: Sun, 24 Aug 2025 12:45:49 -0700 Subject: [PATCH 1/3] Update org actions with domain_data --- lib/workos/organizations.ex | 8 ++++---- test/workos/organizations_test.exs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/workos/organizations.ex b/lib/workos/organizations.ex index a3b58c38..2dcdcbe1 100644 --- a/lib/workos/organizations.ex +++ b/lib/workos/organizations.ex @@ -81,7 +81,7 @@ defmodule WorkOS.Organizations do Parameter options: * `:name` - A descriptive name for the Organization. This field does not need to be unique. (required) - * `:domains` - The domains of the Organization. + * `:domain_data` - The domains of the Organization. * `:allow_profiles_outside_organization` - Whether the Connections within this Organization should allow Profiles that do not have a domain that is present in the set of the Organization’s User Email Domains. * `:idempotency_key` - A unique string as the value. Each subsequent request matching this unique string will return the same response. @@ -96,7 +96,7 @@ defmodule WorkOS.Organizations do "/organizations", %{ name: opts[:name], - domains: opts[:domains], + domain_data: opts[:domain_data], allow_profiles_outside_organization: opts[:allow_profiles_outside_organization] }, headers: [ @@ -112,7 +112,7 @@ defmodule WorkOS.Organizations do * `:organization` - Unique identifier of the Organization. (required) * `:name` - A descriptive name for the Organization. This field does not need to be unique. (required) - * `:domains` - The domains of the Organization. + * `:domain_data` - The domains of the Organization. * `:allow_profiles_outside_organization` - Whether the Connections within this Organization should allow Profiles that do not have a domain that is present in the set of the Organization’s User Email Domains. """ @@ -123,7 +123,7 @@ defmodule WorkOS.Organizations do when is_map_key(opts, :name) do WorkOS.Client.put(client, Organization, "/organizations/#{organization_id}", %{ name: opts[:name], - domains: opts[:domains], + domain_data: opts[:domain_data], allow_profiles_outside_organization: !!opts[:allow_profiles_outside_organization] }) end diff --git a/test/workos/organizations_test.exs b/test/workos/organizations_test.exs index 15b0b606..5857378c 100644 --- a/test/workos/organizations_test.exs +++ b/test/workos/organizations_test.exs @@ -58,7 +58,7 @@ defmodule WorkOS.OrganizationsTest do describe "create_organization" do test "with an idempotency key, includes an idempotency key with request", context do opts = [ - domains: ["example.com"], + domain_data: [%{domain: "example.com", state: "pending"}], name: "Test Organization", idempotency_key: "the-idempotency-key" ] @@ -72,7 +72,10 @@ defmodule WorkOS.OrganizationsTest do end test "with a valid payload, creates an organization", context do - opts = [domains: ["example.com"], name: "Test Organization"] + opts = [ + domain_data: [%{domain: "example.com", state: "pending"}], + name: "Test Organization" + ] context |> ClientMock.create_organization(assert_fields: opts) @@ -87,7 +90,7 @@ defmodule WorkOS.OrganizationsTest do test "with a valid payload, updates an organization", context do opts = [ organization_id: "org_01EHT88Z8J8795GZNQ4ZP1J81T", - domains: ["example.com"], + domain_data: [%{domain: "example.com", state: "pending"}], name: "Test Organization 2" ] From 880394f8af53b42f7484f7f15cad9cf5636cfe95 Mon Sep 17 00:00:00 2001 From: Michael Miller-Hairston Date: Sun, 24 Aug 2025 13:00:43 -0700 Subject: [PATCH 2/3] Update documentation to reflect changes --- lib/workos/organizations.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/workos/organizations.ex b/lib/workos/organizations.ex index 2dcdcbe1..3334d249 100644 --- a/lib/workos/organizations.ex +++ b/lib/workos/organizations.ex @@ -81,7 +81,9 @@ defmodule WorkOS.Organizations do Parameter options: * `:name` - A descriptive name for the Organization. This field does not need to be unique. (required) - * `:domain_data` - The domains of the Organization. + * `:domain_data` - A list of maps containing domain information composed of the following: + * `:domain` - The domain of the Organization + * `:state` - The verification state of the domain. "pending" | "verified" * `:allow_profiles_outside_organization` - Whether the Connections within this Organization should allow Profiles that do not have a domain that is present in the set of the Organization’s User Email Domains. * `:idempotency_key` - A unique string as the value. Each subsequent request matching this unique string will return the same response. @@ -112,7 +114,9 @@ defmodule WorkOS.Organizations do * `:organization` - Unique identifier of the Organization. (required) * `:name` - A descriptive name for the Organization. This field does not need to be unique. (required) - * `:domain_data` - The domains of the Organization. + * `:domain_data` - A list of maps containing domain information composed of the following: + * `:domain` - The domain of the Organization + * `:state` - The verification state of the domain. "pending" | "verified" * `:allow_profiles_outside_organization` - Whether the Connections within this Organization should allow Profiles that do not have a domain that is present in the set of the Organization’s User Email Domains. """ From 17b8cedf11c55bdbeb8f4a151c4b18452768c552 Mon Sep 17 00:00:00 2001 From: Michael Miller-Hairston Date: Thu, 18 Sep 2025 19:50:41 -0700 Subject: [PATCH 3/3] Fix tests --- test/workos/organizations_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/workos/organizations_test.exs b/test/workos/organizations_test.exs index 5857378c..56648226 100644 --- a/test/workos/organizations_test.exs +++ b/test/workos/organizations_test.exs @@ -58,7 +58,7 @@ defmodule WorkOS.OrganizationsTest do describe "create_organization" do test "with an idempotency key, includes an idempotency key with request", context do opts = [ - domain_data: [%{domain: "example.com", state: "pending"}], + domain_data: [%{"domain" => "example.com", "state" => "pending"}], name: "Test Organization", idempotency_key: "the-idempotency-key" ] @@ -73,7 +73,7 @@ defmodule WorkOS.OrganizationsTest do test "with a valid payload, creates an organization", context do opts = [ - domain_data: [%{domain: "example.com", state: "pending"}], + domain_data: [%{"domain" => "example.com", "state" => "pending"}], name: "Test Organization" ] @@ -90,7 +90,7 @@ defmodule WorkOS.OrganizationsTest do test "with a valid payload, updates an organization", context do opts = [ organization_id: "org_01EHT88Z8J8795GZNQ4ZP1J81T", - domain_data: [%{domain: "example.com", state: "pending"}], + domain_data: [%{"domain" => "example.com", "state" => "pending"}], name: "Test Organization 2" ]