Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 795 Bytes

README.md

File metadata and controls

68 lines (48 loc) · 795 Bytes

oo-odata-query

This library provides an object oriented method of building OData queries.

Installation

Install via npm

npm install oo-odata-query

Examples

Select

The Select class is used to select specific fields. For example,

new Query({
  select: new Select(['id', 'name', 'age'])
}).toString();

returns

'$select=id,name,age'

Expand

The Expand class expands children. For example,

new Query({
  expand: new Expand()
}).toString();

returns

'$expand=address'

and

new Query({
  expand: new Expand([
    new Expansion(
      'contact',
      new Query({
        select: new Select(['id', 'name'])
      })
    )
  ])
).toString();

returns

'$expand=contact($select=id,name)'