smart_city_registry v3.3.1 SmartCity.Organization View Source
Struct defining an organization definition and functions for reading and writing organization definitions to Redis.
const Organization = {
"id": "", // uuid
"orgTitle": "", // user friendly
"orgName": "", // system friendly
"description": "",
"logoUrl": "",
"homepage": "",
"dn": "" // LDAP distinguished name
}
Link to this section Summary
Functions
Returns {:ok, organization}
with the organization for the given id, or an error with the reason.
Returns the organization with the given id or raises an error.
Returns {:ok, organization}
with all organization definitions in the system.
See get_all/0
. Raises on errors.
Returns {:ok, organization_versions}
with a history of all versions of the given organization.
See get_history/1
. Raises on errors.
Returns a new SmartCity.Organization
struct.
Writes the organization to history and sets the organization as the latest definition for the given id
field of the passed in organization in Redis.
Link to this section Types
Link to this section Functions
get(id)
View Source
get(id()) :: {:ok, SmartCity.Organization.t()} | {:error, term()}
get(id()) :: {:ok, SmartCity.Organization.t()} | {:error, term()}
Returns {:ok, organization}
with the organization for the given id, or an error with the reason.
get!(id)
View Source
get!(id()) :: SmartCity.Organization.t() | no_return()
get!(id()) :: SmartCity.Organization.t() | no_return()
Returns the organization with the given id or raises an error.
get_all()
View Source
get_all() :: {:ok, [SmartCity.Organization.t()]} | {:error, term()}
get_all() :: {:ok, [SmartCity.Organization.t()]} | {:error, term()}
Returns {:ok, organization}
with all organization definitions in the system.
get_all!()
View Source
get_all!() :: [SmartCity.Organization.t()] | no_return()
get_all!() :: [SmartCity.Organization.t()] | no_return()
See get_all/0
. Raises on errors.
get_history(id)
View Source
get_history(id()) :: {:ok, [SmartCity.Organization.t()]} | {:error, term()}
get_history(id()) :: {:ok, [SmartCity.Organization.t()]} | {:error, term()}
Returns {:ok, organization_versions}
with a history of all versions of the given organization.
get_history!(id)
View Source
get_history!(id()) :: [SmartCity.Organization.t()] | no_return()
get_history!(id()) :: [SmartCity.Organization.t()] | no_return()
See get_history/1
. Raises on errors.
new(msg)
View Source
new(String.t() | map()) :: {:ok, SmartCity.Organization.t()} | {:error, term()}
new(String.t() | map()) :: {:ok, SmartCity.Organization.t()} | {:error, term()}
Returns a new SmartCity.Organization
struct.
Can be created from:
- map with string keys
- map with atom keys
- JSON
write(organization)
View Source
write(SmartCity.Organization.t()) :: {:ok, id()} | {:error, reason()}
write(SmartCity.Organization.t()) :: {:ok, id()} | {:error, reason()}
Writes the organization to history and sets the organization as the latest definition for the given id
field of the passed in organization in Redis.
Registry subscribers will be notified and have their handle_organization/1
callback triggered.
Returns an {:ok, id} tuple() where id is the organization id.
Parameters
- organization: SmartCity.Organization struct to be written.