Skip to content

API Quick Reference

nova706 edited this page Nov 17, 2014 · 6 revisions

PreparedQueryOptions

instance.$top(top)

Sets the number of results to retrieve.

Parameters:
top
Number >= 0

Returns: PreparedQueryOptions

instance.$skip(skip)

Sets the index of the first result to retrieve.

Parameters:
skip
Number >= 0

Returns: PreparedQueryOptions

instance.$orderBy(orderBy)

Sets orderBy string.

Parameters:
orderBy
String "firstName asc"

Returns: PreparedQueryOptions

instance.$expand(foreignKey)

Sets expand string.

Parameters:
foreignKey
String "phoneNumbers"
Array ["phoneNumbers", "addresses"]

Returns: PreparedQueryOptions

instance.$select(foreignKey)

Sets select string.

Parameters:
property
String "firstName"
Array ["firstName", "lastName"]

Returns: PreparedQueryOptions

instance.$inlinecount(enable)

Sets the inline count option.

Parameters:
enable
Boolean true by default

Returns: PreparedQueryOptions

instance.$filter(filter)

Sets filter option. Use the Predicate class to assist in building complex filter clauses.

Parameters:
filter
String "age gt 21"
Predicate Predicate('age').greaterThan(21)

Returns: PreparedQueryOptions

instance.custom(optionName, value)

Sets a custom query option parameter.

Parameters:
optionName
String "x" Must not start with "$"
value
String "y"

Returns: PreparedQueryOptions

instance.extend(preparedQueryOptions)

Extend existing query with options from another query. Only the original query will be modified. Any matching options will be overridden in the original query.

Parameters:
preparedQueryOptions
PreparedQueryOptions The prepared query objects with the properties to be added.

Returns: PreparedQueryOptions

instance.parseOptions()

Builds and returns a URL parameter string based on the query options.

Returns: String '?$top=25&$skip=0'

PreparedQueryOptions.fromObject()

Class method to create a new PreparedQueryOptions object from a simple object.

Returns: PreparedQueryOptions

Predicate

new Predicate(property)

Creates a new predicate. The parser is used in cloning a predicate when joining.

Parameters:
property
String
parser
Function Optional

Returns: Predicate

Predicate.join(predicates, groupOperator)

Joins a provided set of predicates using the 'and' operator and returns a new Predicate.

Parameters:
property
String operator
String Optional
value
String Optional

Returns: Predicate

Predicate.fromString(filterString)

Creates a predicate from a OData URL query string.

Parameters:
filterString
String

Returns: Predicate

predicate.equals(value)

Sets an existing predicate's operator and value. Parses as "property eq 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.notEqualTo(value)

Sets an existing predicate's operator and value. Parses as "property ne 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.greaterThan(value)

Sets an existing predicate's operator and value. Parses as "property gt 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.greaterThanOrEqualTo(value)

Sets an existing predicate's operator and value. Parses as "property ge 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.lessThan(value)

Sets an existing predicate's operator and value. Parses as "property lt 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.lessThanOrEqualTo(value)

Sets an existing predicate's operator and value. Parses as "property le 'value'"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.startsWith(value)

Sets an existing predicate's operator and value. Parses as "startswith(property, 'value')"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.endsWith(value)

Sets an existing predicate's operator and value. Parses as "endswith(property, 'value')"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.contains(value)

Sets an existing predicate's operator and value. Parses as "substringof('value', property)"

Parameters:
value
String | Number | Boolean

Returns: Predicate

predicate.join(predicates, groupOperator)

Joins an existing predicate with another predicate or a set of predicates.

Parameters:
predicates
Predicate[] | Predicate groupOperator 'and' | 'or'

Returns: Predicate

predicate.and(predicates)

Joins an existing predicate with another predicate or a set of predicates using the 'and' operator.

Parameters:
predicates
Predicate[] | Predicate

Returns: Predicate

predicate.or(predicates)

Joins an existing predicate with another predicate or a set of predicates using the 'or' operator.

Parameters:
predicates
Predicate[] | Predicate

Returns: Predicate

predicate.test(testObject)

Tests an object to see if it matches the predicate's filter conditions. Returns true if the object matches the filter.

Parameters:
testObject
Object

Returns: Boolean

predicate.parsePredicate(predicates)

Builds and returns a URL parameter string based on the predicate. The nested parameter is used for building the string.

Parameters:
nested
Boolean

Returns: Predicate