Sigra.EnterpriseRouting (Sigra v1.0.0)

Copy Markdown View Source

Library-owned enterprise routing rules for bounded discovery and canonical organization entry.

Summary

Types

config()

@type config() :: %{
  repo: module(),
  schemas: %{
    :enterprise_connection => module(),
    optional(:organization) => module()
  }
}

Functions

discover_connection(config, email)

@spec discover_connection(config(), String.t() | nil) ::
  {:ok,
   %{
     organization_id: term(),
     organization_slug: String.t(),
     organization_name: String.t() | nil,
     connection_id: term(),
     routing_source: :domain_discovery
   }}
  | {:error,
     :no_org_match | :multiple_org_matches | :org_connection_unavailable}

get_routable_connection(config, organization)

@spec get_routable_connection(config(), map() | String.t()) ::
  {:ok,
   %{
     organization: struct() | nil,
     organization_id: term(),
     organization_slug: String.t() | nil,
     organization_name: String.t() | nil,
     connection: struct(),
     connection_id: term(),
     routing_source: :explicit_org
   }}
  | {:error, :org_connection_unavailable | :multiple_org_matches}