diff --git a/lib/workos/organizations.ex b/lib/workos/organizations.ex index a3b58c38..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) - * `:domains` - 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. @@ -96,7 +98,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 +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) - * `:domains` - 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. """ @@ -123,7 +127,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..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 = [ - 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" ]