-
Notifications
You must be signed in to change notification settings - Fork 0
/
amelinium.identity.html
110 lines (110 loc) · 58.3 KB
/
amelinium.identity.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>amelinium.identity documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Amelinium</span> <span class="project-version">1.0.1</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="20_hypermedia.html"><div class="inner"><span>Hypermedia-driven</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="amelinium.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>amelinium</span></div></a></li><li class="depth-2 branch"><a href="amelinium.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-2"><a href="amelinium.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-3"><a href="amelinium.api.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4"><a href="amelinium.api.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3"><a href="amelinium.api.url.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>url</span></div></a></li><li class="depth-2 branch"><a href="amelinium.app.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>app</span></div></a></li><li class="depth-2"><a href="amelinium.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>algo</span></div></div></li><li class="depth-4 branch"><a href="amelinium.auth.algo.append.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>append</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.fail.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fail</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.pbkdf2.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pbkdf2</span></div></a></li><li class="depth-4"><a href="amelinium.auth.algo.scrypt.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scrypt</span></div></a></li><li class="depth-3 branch"><a href="amelinium.auth.pwd.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-3"><a href="amelinium.auth.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-2"><a href="amelinium.common.html"><div class="inner"><span class="tree" style="top: -238px;"><span class="top" style="height: 247px;"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-3"><a href="amelinium.common.oplog.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oplog</span></div></a></li><li class="depth-4"><a href="amelinium.common.oplog.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.populators.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-3"><a href="amelinium.common.swagger.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>swagger</span></div></a></li><li class="depth-2 branch"><a href="amelinium.core.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="amelinium.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3"><a href="amelinium.db.sql.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sql</span></div></a></li><li class="depth-2 branch"><a href="amelinium.errors.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2"><a href="amelinium.http.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></div></li><li class="depth-4"><a href="amelinium.http.client.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.handler.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>handler</span></div></a></li><li class="depth-3"><a href="amelinium.http.middleware.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>middleware</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.coercion.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>coercion</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.content.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>content</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.debug.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>debug</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.headers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>headers</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.language.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>language</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.lazy-req.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lazy-req</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.populators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.remote-ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>remote-ip</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.roles.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>roles</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-4"><a href="amelinium.http.middleware.validators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>validators</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.router.html"><div class="inner"><span class="tree" style="top: -424px;"><span class="top" style="height: 433px;"></span><span class="bottom"></span></span><span>router</span></div></a></li><li class="depth-3"><a href="amelinium.http.server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.server.jetty.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jetty</span></div></a></li><li class="depth-4"><a href="amelinium.http.server.undertow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>undertow</span></div></a></li><li class="depth-2"><a href="amelinium.i18n.html"><div class="inner"><span class="tree" style="top: -672px;"><span class="top" style="height: 681px;"></span><span class="bottom"></span></span><span>i18n</span></div></a></li><li class="depth-3"><a href="amelinium.i18n.pluralizers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pluralizers</span></div></a></li><li class="depth-2 branch current"><a href="amelinium.identity.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-2 branch"><a href="amelinium.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="amelinium.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>model</span></div></div></li><li class="depth-3 branch"><a href="amelinium.model.confirmation.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>confirmation</span></div></a></li><li class="depth-3"><a href="amelinium.model.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>proto</span></div></div></li><li class="depth-3 branch"><a href="amelinium.proto.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.proto.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.schemas.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>schemas</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></div></li><li class="depth-3"><a href="amelinium.server.ssl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ssl</span></div></a></li><li class="depth-2 branch"><a href="amelinium.system.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>system</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></div></li><li class="depth-3 branch"><a href="amelinium.types.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.types.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.utils.html"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="amelinium.web.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>web</span></div></a></li><li class="depth-3"><a href="amelinium.web.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4 branch"><a href="amelinium.web.controller.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-4"><a href="amelinium.web.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.js.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>js</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.taggers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>taggers</span></div></a></li><li class="depth-3"><a href="amelinium.web.url.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>url</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="amelinium.identity.html#var--.3Edb"><div class="inner"><span>->db</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var--.3Estr"><div class="inner"><span>->str</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-acceptable-type"><div class="inner"><span>acceptable-type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-add-acceptable-type.21"><div class="inner"><span>add-acceptable-type!</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-check-type"><div class="inner"><span>check-type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-id-email-string"><div class="inner"><span>id-email-string</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-id-id-string"><div class="inner"><span>id-id-string</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-id-phone-string"><div class="inner"><span>id-phone-string</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-id-uid-string"><div class="inner"><span>id-uid-string</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-identity-map-keys"><div class="inner"><span>identity-map-keys</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-identity-map-keys-by-type"><div class="inner"><span>identity-map-keys-by-type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-of"><div class="inner"><span>of</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-of-known-type.3F"><div class="inner"><span>of-known-type?</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-of-seq"><div class="inner"><span>of-seq</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-of-type"><div class="inner"><span>of-type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-of-value"><div class="inner"><span>of-value</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-opt-type"><div class="inner"><span>opt-type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse"><div class="inner"><span>parse</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-email"><div class="inner"><span>parse-email</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-group"><div class="inner"><span>parse-group</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-id"><div class="inner"><span>parse-id</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-map"><div class="inner"><span>parse-map</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-phone"><div class="inner"><span>parse-phone</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-single"><div class="inner"><span>parse-single</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parse-uid"><div class="inner"><span>parse-uid</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-parser"><div class="inner"><span>parser</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-preparse-email"><div class="inner"><span>preparse-email</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-preparse-id"><div class="inner"><span>preparse-id</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-preparse-phone"><div class="inner"><span>preparse-phone</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-preparse-uid"><div class="inner"><span>preparse-uid</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-some-seq"><div class="inner"><span>some-seq</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-to-db"><div class="inner"><span>to-db</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-to-db*"><div class="inner"><span>to-db*</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-to-str"><div class="inner"><span>to-str</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-to-str*"><div class="inner"><span>to-str*</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-type"><div class="inner"><span>type</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-type-opt"><div class="inner"><span>type-opt</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-type.3F"><div class="inner"><span>type?</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-unaccept-type.21"><div class="inner"><span>unaccept-type!</span></div></a></li><li class="depth-1"><a href="amelinium.identity.html#var-value"><div class="inner"><span>value</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">amelinium.identity</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>Basic identity management for amelinium.</p>
</div></div><div class="public anchor" id="var--.3Edb"><h3>->db</h3><h4 class="type">macro</h4><div class="usage"><code>(->db user-identity)</code><code>(->db identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> and optional identity type <code>identity-type</code> tries to express the given identity’s value in a database suitable format.</p>
<p>Uses <code>to-db*</code> multimethod to perform <code>user-identity</code> transformation on a basis of its identity type.</p>
<p>If the given identity is not a kind of <code>amelinium.Identity</code> record, it will be converted to it first. If the given value cannot be used as valid identity, <code>nil</code> is returned.</p>
<p>If the <code>identity-type</code> is given, it should be a valid identity type. It instructs the function to treat the given identity as of this type during pre-conversion. If the identity is already an <code>amelinium.Identity</code> record but its type is different, <code>nil</code> will be returned.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If the <code>identity-type</code> is given as literal keyword, string or <code>nil</code>, then a specific conversion function will be obtained at compile-time.</p>
<p>If <code>identity-type</code> is an acceptable literal (or not given at all) and <code>user-identity</code> expression is a value for which the function <code>amelinium.proto.identity/literal?</code> returns <code>true</code> then the conversion is done immediately, and its result replaces the macro call at compile-time.</p>
<p>However, if the immediate conversion result is <code>nil</code>, or it is not a value for which the function <code>amelinium.proto.identity/literal?</code> returns <code>true</code>, an expression with call to <code>to-db</code> or <code>to-db*</code> will be generated as fallback to perform the conversion at run-time.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L837">view source</a></div></div><div class="public anchor" id="var--.3Estr"><h3>->str</h3><h4 class="type">macro</h4><div class="usage"><code>(->str user-identity)</code><code>(->str identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> and optional identity type <code>identity-type</code> tries to express the given identity’s value as a string.</p>
<p>Uses <code>to-str*</code> multimethod to perform <code>user-identity</code> transformation on a basis of its identity type.</p>
<p>If the given identity is not a kind of <code>amelinium.Identity</code> record, it will be converted to it first. If the given value cannot be used as valid identity, <code>nil</code> is returned.</p>
<p>If the <code>identity-type</code> is given, it should be a valid identity type. It instructs the function to treat the given identity as of this type during pre-conversion. If the identity is already an <code>amelinium.Identity</code> record but its type is different, <code>nil</code> will be returned.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If the <code>identity-type</code> is given as literal keyword, string or <code>nil</code>, then a specific conversion function will be obtained at compile-time.</p>
<p>If <code>identity-type</code> is an acceptable literal (or not given at all) and <code>user-identity</code> expression is a value for which the function <code>amelinium.proto.identity/literal?</code> returns <code>true</code> then the conversion is done immediately, and its result replaces the macro call at compile-time.</p>
<p>However, if the immediate conversion result is <code>nil</code>, or it is not a value for which the function <code>amelinium.proto.identity/literal?</code> returns <code>true</code>, an expression with call to <code>to-str</code> or <code>to-str*</code> will be generated as fallback to perform the conversion at run-time.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L977">view source</a></div></div><div class="public anchor" id="var-acceptable-type"><h3>acceptable-type</h3><div class="usage"><code>(acceptable-type user-identity acceptable-tag)</code><code>(acceptable-type user-identity identity-type acceptable-tag)</code></div><div class="doc"><div class="markdown"><p>Returns a keyword describing identity type detected by analyzing the given user identity <code>user-identity</code> and optional identity type <code>identity-type</code> given explicitly (e.g. <code>:phone</code> for a phone number, <code>:email</code> for e-mail address, <code>:id</code> for numeric user ID, <code>:uid</code> for UUID).</p>
<p>If the type is not given, or if it is <code>nil</code> or <code>false</code>, analysis of the given identity will be performed.</p>
<p>The given identity type must always be valid (registered with <code>amelinium.proto.identity/add-type!</code>) and the identity must not be <code>nil</code> nor <code>false</code>. If any of these happens, <code>nil</code> will be returned.</p>
<p>The <code>acceptable-tag</code> should be a tag type from which the given type is derived within the hierarchy <code>amelinium.proto.identity/type-hierarchy</code>.</p>
<p>To add acceptable type(s) use <code>amelinium.proto.identity/add-acceptable-type</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L215">view source</a></div></div><div class="public anchor" id="var-add-acceptable-type.21"><h3>add-acceptable-type!</h3><div class="usage"><code>(add-acceptable-type! acceptable-tag t)</code><code>(add-acceptable-type! acceptable-tag t & more)</code></div><div class="doc"><div class="markdown"><p>For the given parent tag <code>acceptable-tag</code> (which should be a qualified keyword) and an identity type <code>t</code>, creates a relation so that the identity type is a descendant of the given parent. It also ensures that the parent itself is a descendant of <code>:amelinium.identity/valid</code> tag.</p>
<p>Additionally, it makes an extra parent for the given acceptable tag in <code>amelinium.proto.identity/type-hierarchy</code> which is <code>:amelinium.proto.identity/group</code>. This special value is a valid dispatch for the <code>parser</code> multimethod which uses <code>parse-group</code> to handle identity parsing with acceptable tag given explicitly as its identity type specification. If you don’t want that, use <code>amelinium.proto.identity/add-acceptable-type!</code> directly.</p>
<p>Useful when there is a need to accept a limited set of recognized identity types. Then the detection function can check whether an identity belongs to a parent.</p>
<p>Makes changes in the global identity type hierarchy <code>amelinium.identity.proto/type-hierarchy</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L1072">view source</a></div></div><div class="public anchor" id="var-check-type"><h3>check-type</h3><div class="usage"><code>(check-type id-type)</code><code>(check-type id-type acceptable-tag)</code></div><div class="doc"><div class="markdown"><p>Returns a keyword for the given identity type <code>identity-type</code> if it is a valid identity. Otherwise it returns <code>nil</code>. To add acceptable type(s) use <code>amelinium.proto.identity/add-acceptable-type</code>.</p>
<p>If acceptable parent tag <code>acceptable-tag</code> is given, it must be a parent of the given identity type tag.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L160">view source</a></div></div><div class="public anchor" id="var-id-email-string"><h3>id-email-string</h3><div class="usage"><code>(id-email-string v)</code><code>(id-email-string v t)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given string looks like an e-mail address. If identity type or acceptable type <code>t</code> is given, then it must be a parent or be equal to <code>:email</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L53">view source</a></div></div><div class="public anchor" id="var-id-id-string"><h3>id-id-string</h3><div class="usage"><code>(id-id-string v)</code><code>(id-id-string v t)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given string looks like a user ID. If identity type or acceptable type <code>t</code> is given, then it must be a parent or be equal to <code>:id</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L73">view source</a></div></div><div class="public anchor" id="var-id-phone-string"><h3>id-phone-string</h3><div class="usage"><code>(id-phone-string v)</code><code>(id-phone-string v t)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given string looks like a phone number. If identity type or acceptable type <code>t</code> is given, then it must be a parent or be equal to <code>:phone</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L42">view source</a></div></div><div class="public anchor" id="var-id-uid-string"><h3>id-uid-string</h3><div class="usage"><code>(id-uid-string v)</code><code>(id-uid-string v t)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given string looks like a UID (UUID). If identity type or acceptable type <code>t</code> is given, then it must be a parent or be equal to <code>:uid</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L64">view source</a></div></div><div class="public anchor" id="var-identity-map-keys"><h3>identity-map-keys</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Commonly known map keys which may contain user identity.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L354">view source</a></div></div><div class="public anchor" id="var-identity-map-keys-by-type"><h3>identity-map-keys-by-type</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Commonly known map keys which may contain user identity grouped by identity types.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L373">view source</a></div></div><div class="public anchor" id="var-of"><h3>of</h3><div class="usage"><code>(of user-identity)</code><code>(of identity-type user-identity)</code><code>(of identity-type user-identity & user-identities)</code><code>(of user-identity & user-identities)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> tries to parse the identity and return an <code>amelinium.Identity</code> record containing a detected identity type and identity value in a form it expresses it best. If the identity type cannot be established and it was not given, <code>nil</code> is returned.</p>
<p>Optional identity type <code>identity-type</code> (which must be a keyword) may be given as a first argument. It is used to pick the right parser (if parsing is needed) or to simply reject wrong identity type (if <code>amelinium.Identity</code> record is given).</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If there is a need to give list of keywords as user identities (including the first), and not to give any identity type, then first argument’s value needs to be converted to a string, or <code>of-value</code> or <code>of-type</code> should be used as an alternative.</p>
<p>If multiple identities are given it will return a sequence of these identities parsed with parsing functions chosen for detected identity types. If an identity type is cannot be detected and/or is not valid, <code>nil</code> value will be inserted into the corresponding location of generated output sequence.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L430">view source</a></div></div><div class="public anchor" id="var-of-known-type.3F"><h3>of-known-type?</h3><div class="usage"><code>(of-known-type? v)</code><code>(of-known-type? v acceptable-tag)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given value <code>v</code> is a user identity of the known type.</p>
<p>If the <code>acceptable-tag</code> is present then it should be a tag type from which the given type is derived within hierarchy <code>amelinium.proto.identity/type-hierarchy</code>.</p>
<p>To add acceptable type(s) use <code>amelinium.proto.identity/add-acceptable-type</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L245">view source</a></div></div><div class="public anchor" id="var-of-seq"><h3>of-seq</h3><div class="usage"><code>(of-seq user-identities)</code><code>(of-seq identity-type user-identities)</code></div><div class="doc"><div class="markdown"><p>For the given user identities <code>user-identities</code> tries to parse each identity and return an <code>amelinium.Identity</code> record containing a detected identity type and identity value in a form it expresses it best. If the given identity type was given as an optional <code>identity-type</code> argument, it will be assumed as the expected type for all input values.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If an identity type was not given but it cannot be detected and/or is not valid, <code>nil</code> value will be inserted into the corresponding location of generated output sequence. Same with the given identity type which is not applicable to a particular value or invalid.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L528">view source</a></div></div><div class="public anchor" id="var-of-type"><h3>of-type</h3><div class="usage"><code>(of-type identity-type user-identity)</code><code>(of-type identity-type user-identity & ids)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> and identity type <code>identity-type</code> it tries to parse the identity and return an <code>amelinium.Identity</code> record containing an identity type and identity value in a form it expresses it best. If the identity type is <code>nil</code> then <code>nil</code> is returned.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If multiple identities are given it will return a sequence of these identities parsed with parsing functions chosen for the given identity type. If the identity type is not valid or the parsing cannot be applied for an input value, <code>nil</code> will be inserted into corresponding location of the output sequence.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L484">view source</a></div></div><div class="public anchor" id="var-of-value"><h3>of-value</h3><div class="usage"><code>(of-value user-identity)</code><code>(of-value user-identity & ids)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> tries to parse the identity and return an <code>amelinium.Identity</code> record containing a detected identity type and identity value in a form it expresses it best. If the identity type cannot be established and it was not given, <code>nil</code> is returned.</p>
<p>If multiple identities are given it will return a sequence of these identities parsed with parsing functions chosen for detected identity types. If an identity type is cannot be detected and/or is not valid, <code>nil</code> value will be inserted into the corresponding location of generated output sequence.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L468">view source</a></div></div><div class="public anchor" id="var-opt-type"><h3>opt-type</h3><div class="usage"><code>(opt-type identity-type user-identity)</code><code>(opt-type identity-type user-identity & ids)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> and identity type <code>identity-type</code> it tries to parse the identity and return an <code>amelinium.Identity</code> record containing an identity type and identity value in a form it expresses it best. If the identity type is <code>nil</code> or empty then any identity type is accepted.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If multiple identities are given it will return a sequence of these identities parsed with parsing functions chosen for the given identity type. If the identity type is not valid or the parsing cannot be applied for an input value, <code>nil</code> will be inserted into corresponding location of the output sequence.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L505">view source</a></div></div><div class="public anchor" id="var-parse"><h3>parse</h3><div class="usage"><code>(parse user-identity)</code><code>(parse identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Parses the given identity <code>user-identity</code> with optional <code>identity-type</code> predefined. Returns an identity record of type <code>amelinium.Identity</code>. Memoized proxy for parsing strings and other non-native data.</p>
<p>Do not use it directly, use <code>of</code> or <code>of-type</code> instead.</p>
<p>Caution: The identity type must be a keyword (it will not be coerced).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L314">view source</a></div></div><div class="public anchor" id="var-parse-email"><h3>parse-email</h3><div class="usage"><code>(parse-email v)</code></div><div class="doc"><div class="markdown"><p>Parses e-mail by doing basic checks and transforming it to an Identity object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L99">view source</a></div></div><div class="public anchor" id="var-parse-group"><h3>parse-group</h3><div class="usage"><code>(parse-group acceptable-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Parses identity <code>identity-type</code> with <code>acceptable-type</code> tag which should be a parent tag grouping identity types (like <code>:amelinium.identity/any</code> or another). Will use <code>amelinium.proto.identity/type</code> passing a tag to it to limit the parsers tried and constrain the identity type to one that belongs to a parent tag in <code>amelinium.proto.identity/type-hierarchy</code>. Hint: new parent tags can be registered with <code>amelinium.proto.identity/add-acceptable-type!</code>.</p>
<p>This is internal function. Use <code>of-type</code> instead, which will choose the appropriate parser via multimethod and cache the results.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L288">view source</a></div></div><div class="public anchor" id="var-parse-id"><h3>parse-id</h3><div class="usage"><code>(parse-id v)</code></div><div class="doc"><div class="markdown"><p>Parses user ID by doing basic checks and transforming it to an Identity record.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L112">view source</a></div></div><div class="public anchor" id="var-parse-map"><h3>parse-map</h3><div class="usage"><code>(parse-map m)</code><code>(parse-map identity-type m)</code></div><div class="doc"><div class="markdown"><p>Tries to extract identity from a map <code>m</code> by searching for commonly known identity keys.</p>
<p>Optional identity type <code>identity-type</code> will be used to constrain the conversion. Its value may also be an acceptable type tag used to group identity types semantically.</p>
<p>If a known key is found but its associated value cannot be converted to <code>Identity</code> object, process continues and other keys are tried.</p>
<p>It uses <code>identity-map-keys</code> when no identity type is given, or it is set to <code>:amelinium.identity/any</code>.</p>
<p>Uses <code>identity-map-keys-by-type</code> when an identity type is given to select a group of keys to be tried out. It will also look for a key that matches the given acceptable identity type tag (if passed as <code>identity-type</code> instead of a type). If that fails it performs a series of lookups in the map by taking each direct descendant of the given tag associated within <code>amelinium.proto.identity/type-hierarchy</code>.</p>
<p>When a group is not found for the given identity type or acceptable type tag, <code>nil</code> is returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L392">view source</a></div></div><div class="public anchor" id="var-parse-phone"><h3>parse-phone</h3><div class="usage"><code>(parse-phone v)</code></div><div class="doc"><div class="markdown"><p>Tries to interpret <code>v</code> as a phone number and returns an Identity record.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L125">view source</a></div></div><div class="public anchor" id="var-parse-single"><h3>parse-single</h3><div class="usage"><code>(parse-single identity-type user-identity)</code><code>(parse-single user-identity)</code></div><div class="doc"><div class="markdown"><p>Parses identity <code>user-identity</code> by choosing the parser with <code>parser</code> multimethod on a basis of the given <code>identity-type</code> or a detected identity type (by getting it with <code>amelinium.proto.identity/type</code>). Returns user identity object or <code>nil</code>.</p>
<p>This is internal function. Use <code>of</code> or <code>of-type</code> instead, which will cache the results.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L302">view source</a></div></div><div class="public anchor" id="var-parse-uid"><h3>parse-uid</h3><div class="usage"><code>(parse-uid v)</code></div><div class="doc"><div class="markdown"><p>Tries to interpret <code>v</code> as a UUID and returns an Identity record.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L138">view source</a></div></div><div class="public anchor" id="var-parser"><h3>parser</h3><h4 class="type">multimethod</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Takes an identity type expressed as keyword and returns a parser suitable for that identity type. The parser function takes 1 argument and converts the given value to identity record (of type <code>amelinium.Identity</code>).</p>
<p>Caution: The identity type must be a keyword (it will not be coerced).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L279">view source</a></div></div><div class="public anchor" id="var-preparse-email"><h3>preparse-email</h3><div class="usage"><code>(preparse-email v)</code></div><div class="doc"><div class="markdown"><p>Parses e-mail by doing basic checks and transforming it to a string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L89">view source</a></div></div><div class="public anchor" id="var-preparse-id"><h3>preparse-id</h3><div class="usage"><code>(preparse-id v)</code></div><div class="doc"><div class="markdown"><p>Parses user ID by doing basic checks and transforming it to a long number.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L105">view source</a></div></div><div class="public anchor" id="var-preparse-phone"><h3>preparse-phone</h3><div class="usage"><code>(preparse-phone v)</code></div><div class="doc"><div class="markdown"><p>Tries to create an object representing phone number. Returns <code>nil</code> if the input cannot be parsed.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L118">view source</a></div></div><div class="public anchor" id="var-preparse-uid"><h3>preparse-uid</h3><div class="usage"><code>(preparse-uid v)</code></div><div class="doc"><div class="markdown"><p>Tries to create UUID. Returns <code>nil</code> if the input cannot be converted to it.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L131">view source</a></div></div><div class="public anchor" id="var-some-seq"><h3>some-seq</h3><div class="usage"><code>(some-seq user-identities)</code><code>(some-seq identity-type user-identities)</code></div><div class="doc"><div class="markdown"><p>Tries to coerce identities to <code>amelinium.Identity</code> objects and filters out those who could not be coerced.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L550">view source</a></div></div><div class="public anchor" id="var-to-db"><h3>to-db</h3><div class="usage"><code>(to-db user-identity)</code><code>(to-db identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> tries to express the identity in a database suitable format.</p>
<p>Uses <code>to-db*</code> multimethod to perform <code>user-identity</code> transformation on a basis of its identity type.</p>
<p>If the given identity is not a kind of <code>amelinium.Identity</code> record it will be converted to it first. If the given value cannot be used as valid identity, <code>nil</code> is returned.</p>
<p>If the <code>identity-type</code> is given, it should be a valid identity type. It instructs the function to treat the given identity as of this type during pre-conversion.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If the identity is already an <code>amelinium.Identity</code> record but its type is different, <code>nil</code> will be returned.</p>
<p>If possible, use <code>->db</code> macro instead to get some compile-time optimizations.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L809">view source</a></div></div><div class="public anchor" id="var-to-db*"><h3>to-db*</h3><h4 class="type">multimethod</h4><div class="usage"><code>(to-db* user-identity)</code><code>(to-db* identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>For the given user identity <code>user-identity</code> which must be of type <code>amelinium.Identity</code>, tries to express the identity in a database suitable format.</p>
<p>If the given value cannot be used as valid identity, <code>nil</code> is returned.</p>
<p>If the <code>identity-type</code> is given, it must be a keyword and it should be a valid identity type. It instructs the function to treat the given identity as of this type.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>This is internal multimethod which does not perform conversions or checks. Use <code>to-db</code> or <code>->db</code> instead.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L785">view source</a></div></div><div class="public anchor" id="var-to-str"><h3>to-str</h3><div class="usage"><code>(to-str user-identity)</code><code>(to-str identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Takes a user identity <code>user-identity</code> and optional identity type <code>identity-type</code>, and converts it to a string.</p>
<p>If the given identity is not a kind of <code>amelinium.Identity</code> record it will be converted to it first. If the given value cannot be used as valid identity, <code>nil</code> is returned.</p>
<p>If the <code>identity-type</code> is given, it should be a valid identity type. It instructs the function to treat the given identity as of this type.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>If the identity is an <code>amelinium.Identity</code> record but its type is different, <code>nil</code> will be returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L954">view source</a></div></div><div class="public anchor" id="var-to-str*"><h3>to-str*</h3><h4 class="type">multimethod</h4><div class="usage"><code>(to-str* user-identity)</code><code>(to-str* identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Takes a user identity <code>user-identity</code> expressed as <code>Identity</code> record, and converts it to a string.</p>
<p>If the <code>identity-type</code> is given, it should be a valid identity type expressed with a keyword. It instructs the function to treat the given identity as of this type. If the identity type is different than in the given object, <code>nil</code> is returned.</p>
<p>A value of <code>identity-type</code> may also be an acceptable type tag (registered with <code>add-acceptable-type!</code>) which groups identity types. In such case parsing and detection will be constrained to identity types being its descendants.</p>
<p>This is internal multimethod which does not perform conversions or checks. Use <code>to-str</code> function or <code>->str</code> macro instead.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L931">view source</a></div></div><div class="public anchor" id="var-type"><h3>type</h3><div class="usage"><code>(type user-identity)</code><code>(type identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Returns a keyword describing identity type detected by analyzing the given user identity <code>user-identity</code> and optional identity type <code>identity-type</code> given explicitly (e.g. <code>:phone</code> for a phone number, <code>:email</code> for e-mail address, <code>:id</code> for numeric user ID, <code>:uid</code> for UUID). If the type is not given, analysis of the given identity will be performed.</p>
<p>Value of the given identity type <code>identity-type</code> must match the identity type, and not be <code>nil</code> nor <code>false</code>. If any of these happens, <code>nil</code> will be returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L177">view source</a></div></div><div class="public anchor" id="var-type-opt"><h3>type-opt</h3><div class="usage"><code>(type-opt user-identity)</code><code>(type-opt identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Returns a keyword describing identity type detected by analyzing the given user identity <code>user-identity</code> and optional identity type <code>identity-type</code> given explicitly (e.g. <code>:phone</code> for a phone number, <code>:email</code> for e-mail address, <code>:id</code> for numeric user ID, <code>:uid</code> for UUID).</p>
<p>If the type is not given or it is <code>nil</code>, analysis of the given identity will be performed.</p>
<p>Value of the given identity type <code>identity-type</code> must match the identity type. If it does not, <code>nil</code> will be returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L195">view source</a></div></div><div class="public anchor" id="var-type.3F"><h3>type?</h3><div class="usage"><code>(type? t)</code><code>(type? t acceptable-tag)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given identity type identifier <code>t</code> exists and is valid.</p>
<p>If <code>acceptable-tag</code> is given this function will in addition check if the given tag is a parent of the given type identifier or is <code>:amelinium.identity/any</code>. To add acceptable type(s) use <code>amelinium.proto.identity/add-acceptable-type</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L146">view source</a></div></div><div class="public anchor" id="var-unaccept-type.21"><h3>unaccept-type!</h3><div class="usage"><code>(unaccept-type! acceptable-tag t)</code><code>(unaccept-type! acceptable-tag t & more)</code></div><div class="doc"><div class="markdown"><p>Removes identity type <code>t</code> from the given parent <code>acceptable-tag</code> and removes parent <code>:amelinium.proto.identity/group</code> from the acceptable tag in the <code>amelinium.proto.</code> hierarchy. Makes changes in the global identity type hierarchy <code>amelinium.identity.proto/type-hierarchy</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L1098">view source</a></div></div><div class="public anchor" id="var-value"><h3>value</h3><div class="usage"><code>(value user-identity)</code><code>(value identity-type user-identity)</code></div><div class="doc"><div class="markdown"><p>Returns a value of the given identity type <code>user-identity</code> and optional identity type <code>identity-type</code>. If the type is not given, analysis of the given identity will be performed to establish the type first. If the type is given, it must be a valid type, otherwise <code>nil</code> will be returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/identity.clj#L265">view source</a></div></div></div></body></html>