new Query(query, sort [, sortModifier])
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
query |
string |
<nullable> |
(private) Initial query string to append to. |
|
sort |
string |
<nullable> |
(private) What to sort the query on |
|
sortModifier |
string |
<optional> |
'' | (private) Sort modifier. Either empty string or '-' |
Requires:
Example
import { where, field } from '@pikselpalette/sequoia-js-client-sdk/lib/query'; endpoint.browse(where(field('startedAt').greaterThanOrEqualTo(2015)) .and(field('tags').equalTo('showcase')) .fields('title', 'mediumSynopsis','duration', 'ref') .include('assets').page(1).perPage(24).orderByUpdatedAt().desc().count()) .then(json => { ... });
Requires
Methods
-
addRelatedThroughFields(relationships)
-
Look through the relationships of a criteria, and include fields from through relationships - this makes it so that the end user shouldn't know or care that through relationships exist.
Parameters:
Name Type Description relationships
relationships The relationship definitions that may require the addition of fields to support the graphical display of a through relationship
Returns:
- Type
- Query
-
and(query)
-
Concatenate a new query with the previous one
Parameters:
Name Type Description query
string A query string to append (without leading ampersand). Usually returned from a call to
field
Returns:
- Type
- Query
Example
where(field('startedAt').greaterThanOrEqualTo(2015)) .and(field('tags').equalTo('showcase'))
-
asc()
-
Set order to ascending
Returns:
- Type
- Query
-
continue()
-
Appends
continue=true
to the query to initiate continuation pagingReturns:
- Type
- Query
-
count()
-
Will return
totalCount
on the payloadReturns:
- Type
- Query
-
desc()
-
Set order to descending
Returns:
- Type
- Query
-
fields(fieldName)
-
Appends
fields=value1,value2
to the queryParameters:
Name Type Argument Description fieldName
string <repeatable>
field(s) to return in the json response
Returns:
- Type
- Query
Example
where().fields('title', 'mediumSynopsis','duration', 'ref') // appends `fields=title,mediumSynopsis,duration,ref` to the query
-
include(includes)
-
Appends
include=value1,value2
to the queryParameters:
Name Type Argument Description includes
string <repeatable>
includes(s) (linked resources) to return in the json response
Returns:
- Type
- Query
Example
where().include('assets', 'categories') // appends `include=assets,categories` to the query
-
lang(value)
-
Appends
lang=value
to the queryParameters:
Name Type Description value
string ISO 639-1 code for the language you want results returned in
Returns:
- Type
- Query
Example
where().lang('de') // appends `lang=de` to the query
-
orderBy()
-
Appends
sort=[-]fieldName
to the query, where[-]
is toggled depending on the call to Query#asc or Query#desc- Source:
- See:
Returns:
- Type
- Query
-
orderByCreatedAt()
-
Convenience method for ordering by 'createdAt'
- Source:
- See:
Returns:
- Type
- Query
-
orderByCreatedBy()
-
Convenience method for ordering by 'createdBy'
- Source:
- See:
Returns:
- Type
- Query
-
orderByName()
-
Convenience method for ordering by 'name'
- Source:
- See:
Returns:
- Type
- Query
-
orderByOwner()
-
Convenience method for ordering by 'owner'
- Source:
- See:
Returns:
- Type
- Query
-
orderByUpdatedAt()
-
Convenience method for ordering by 'updatedAt'
- Source:
- See:
Returns:
- Type
- Query
-
orderByUpdatedBy()
-
Convenience method for ordering by 'updatedBy'
- Source:
- See:
Returns:
- Type
- Query
-
page(value)
-
Appends
page=value
to the queryParameters:
Name Type Description value
string | number page of results to request
Returns:
- Type
- Query
Example
where().page(9) // appends `page=9` to the query
-
perPage(value)
-
Appends
perPage=value
to the queryParameters:
Name Type Description value
string | number how many items to return per page of results
Returns:
- Type
- Query
Example
where().perPage(24) // appends `perPage=24` to the query
-
toQueryString()
-
Turn the current Query into a string representation of a URI query
Returns:
- Type
- string