Variables

Phones Object

.all

List of all available phone numbers in the particular context.

TYPE
phone list object
CONSTRAINTS
n/a
PRESENCE
always

Examples

CODE{% if session.user %}
{% for phone in session.user.account.phones.all %}
  {{ phone.type }}: {{ phone.number }} <br/>
{% endfor %}
{% else %}
 not signed in, cannot list phone numbers
{% endif %}
OUTPUTmobile: 083-100-2000
office: 011-123-4567
...

.by_type

List of all available phone numbers of a particular type. There are 4 types of phone numbers: mobile, home, office and unknown

TYPE
phone list object
CONSTRAINTS
n/a
PRESENCE
always

Examples

CODE{% if session.user %}
{% for phone in session.user.account.phones.by_type.mobile %}
  {{ phone.type }}: {{ phone.number }} <br/>
{% endfor %}
{% else %}
 not signed in, cannot list mobile phone numbers
{% endif %}
OUTPUTmobile: 083-100-2000
...

Phone List Object

.has

Evaluates to true if there is at least one phone number in the list.

TYPE
boolean
CONSTRAINTS
none
PRESENCE
always

Examples

CODE{% if session.user %}
{% if session.user.account.phones.by_type.mobile.has %}
  user has mobile phone(s)<br/>
{% else %}
  user does NOT have mobile phone<br/>
{% endif %}
{% else %}
 not signed in, cannot access phone list
{% endif %}
OUTPUTuser has mobile phone(s)

.size

Number of phone numbers in the list.

TYPE
numeric
CONSTRAINTS
>= 0
PRESENCE
always

Examples

CODE{% if session.user %}
user has {{ session.user.account.phones.by_type.mobile.size %} mobile numbers
{% else %}
 not signed in, cannot access phone list
{% endif %}
OUTPUTuser has mobile phone(s)

.first

Access to the first phone number in the list.

TYPE
phone object
CONSTRAINTS
n/a
PRESENCE
always, but can be null

Examples

CODE{% if session.user %}
{% if session.user.account.phones.by_type.mobile.has %}
  first mobile number is {{ session.user.account.phones.by_type.mobile.first.number %}
{% else %}
  user has not mobile numbers
{% endif %}
{% else %}
  not signed in, cannot access phone list
{% endif %}
OUTPUTfirst mobile number is 083-100-2000

.all

All phone numbers in the list.

TYPE
array of phone objects
CONSTRAINTS
n/a
PRESENCE
always, but can be an empry array

Examples

CODE{% if session.user %}
{% for phone in session.user.account.phones.by_type.mobile.all %}
  mobile number: {{ phone.number %}
{% endfor %}
{% else %}
  not signed in, cannot access phone list
{% endif %}
OUTPUTmobile number: 083-100-2000
mobile number: 083-100-2001
...

.filter.<key>.<value>

Filter phone numbers by a field. Filtering is usually done on metafield values, and it requires that the metafield name and value conform to reference name constraints, that is, contains only alpha-numeric, dashes and underscores. Multiple fiters can be applies after each other, narrowing down the result progressively.

To specify the filtering criteria, add two elements to the path, one for the key and the other for the value. For example, lets say there is a number with a metafield key of use, and value of sms. To filter for a number matching this criteria, specify at the end of the access path something like ... .filter.use.sms. This will return a phone list containing all numbers having a metafield named use set to sms.

TYPE
filter
CONSTRAINTS
n/a
PRESENCE
always

Examples

CODE{% if session.user %}
use for sms: {{ session.user.account.phones.by_type.mobile.filter.use.sms.first.number %}
{% else %}
  not signed in, cannot access phone list
{% endif %}
OUTPUTuse for sms: 083-100-2000

Phone Object

.type

The type of the phone number. This is typically set to mobile, home, office or unknown.

TYPE
enumeration
CONSTRAINTS
mobile, home, office, unknown
PRESENCE
always

Examples

CODE{% if session.user %}
type of first number: {{ session.user.account.phones.all.first.type %}
{% endif %}
OUTPUTtype of first number: mobile

.number

The phone number.

TYPE
string
CONSTRAINTS
up to 24 characters
PRESENCE
always

Examples

CODE{% if session.user %}
first phone number: {{ session.user.account.phones.all.first.number %}
{% endif %}
OUTPUTfirst phone number: 083-100-2001