oauth2_utils v0.1.0 OAuth2Utils.Scope.Set View Source
Link to this section Summary
Functions
Returns a scope set from a scope param if the scope param
is well-formed, raise an InvalidScopeParam
exception otherwise
Returns a {:ok, scope_set}
structure from a scope param if the scope param
is well-formed, {:error, :malformed_scope_param}
otherwise
Returns a new OAuth2Utils.Scope.Set.t
Returns a conform scope param string from a scope set
Link to this section Types
Link to this section Functions
Link to this function
from_scope_param!(scope_param)
View Source
from_scope_param!(OAuth2Utils.Scope.scope_param()) :: t()
Returns a scope set from a scope param if the scope param
is well-formed, raise an InvalidScopeParam
exception otherwise
Link to this function
from_scope_param(scope_param)
View Source
from_scope_param(OAuth2Utils.Scope.scope_param()) :: {:ok, t()} | {:error, :malformed_scope_param}
Returns a {:ok, scope_set}
structure from a scope param if the scope param
is well-formed, {:error, :malformed_scope_param}
otherwise
Example
iex(5)> OAuth2Utils.Scope.Set.from_scope_param("users:read feed:edit room:manage")
{:ok, #MapSet<["feed:edit", "room:manage", "users:read"]>}
Returns a new OAuth2Utils.Scope.Set.t
This functions extends the MapSet.new/1
the following way:
- if the param is
nil
, returns an emptyOAuth2Utils.Scope.Set.t
- if the param is the empty string
""
, returns an emptyOAuth2Utils.Scope.Set.t
- if the param is a non-empty string, call
from_scope_param!/1
- otherwise, calls
MapSet.new/1
Link to this function
to_scope_param(scope_set)
View Source
to_scope_param(t()) :: OAuth2Utils.Scope.scope_param()
Returns a conform scope param string from a scope set
Example
iex> OAuth2Utils.Scope.Set.to_scope_param(scopes)
"calendar.read calendar.write document.read"