# ngx-odata-v4

> Simple typescript library for generating odata queries using fluent api.

Latest version **1.1.1** (published 2018-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-odata-v4
pnpm add ngx-odata-v4
yarn add ngx-odata-v4
bun add ngx-odata-v4
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2018-04-14 |
| First published | 2018-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 235.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | xskydev |
| Keywords | odata, odata v4, odata client, typescript, javascript, fluent, fluent api, angular 5, angular 2, angular 4, angular |

## Links

- npm: https://www.npmjs.com/package/ngx-odata-v4
- Repository: https://github.com/skynet2/ngx-odata
- Issues: https://github.com/skynet2/ngx-odata/issues
- npm.io page: https://npm.io/package/ngx-odata-v4

## Dependencies (1)

- [ts-date](https://npm.io/package/ts-date.md) ^2.1.6

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2018-04-14
- 1.1.0 — 2018-04-13
- 1.0.1 — 2018-04-12
- 1.0.0 — 2018-02-12
- 0.0.4 — 2018-02-12
- 0.0.3 — 2018-02-01
- 0.0.2 — 2018-02-01
- 0.0.0 — 2018-02-01

## README

# ngx-odata
Simple typescript library for generating odata queries using fluent api.

[![NPM](https://nodei.co/npm/ngx-odata-v4.png)](https://nodei.co/npm/ngx-odata-v4/)

# Prerequisite
Can be used as typescript\javascript library. Angular is not required.

# Installation
#### npm
```
npm install ngx-odata-v4
```
#### yarn
```
yarn add ngx-odata-v4
```
# Integration
1. Install library
2. Import Query class 
```
import { Query } from "ngx-odata-v4";
```

# Examples
Simple query example
```ts
Query.create()
            .expand('Requester', o => o.select('Email', 'ID'))
            .expand('Responder', o => o.select('Email', 'ID'))
            .orderBy('Created', OrderBy.Desc)
            .orderBy('Status', OrderBy.Desc);
```
Complex query example
```ts
Query.create()
            .filter('Id', OperatorType.Greater, 1)
            .filter('ReferenceId', OperatorType.Eq, 'c8027a81-5f7a-4a24-87a4-eec9afe48751')
            .filterComplex(`Status eq 'Pending' or Status eq 'Approved'`)
            .filter('Name', OperatorType.NotEqual, 'qwerty').compile();
```
Complex expand query example
```ts
Query.create()
            .expand('Prop1')
            .expand('Prop2', o => {
                o.select('Id', 'Name', 'Value')
                    .orderBy('Id', OrderBy.Asc)
                    .top(5);
            })
            .expand('Complex', o => {
                o.select('Id', 'Name')
                    .expand('Internal', i => {
                        i.select('Description', 'Requester')
                            .skip(5)
                    });
            })
            .select('RootId', 'RootName').compile()
```
Angular usage Example
```ts
const query = Query.create()
            .expand('Requester', o => o.select('Email', 'ID'))
            .expand('Responder', o => o.select('Email', 'ID'))
            .orderBy('Created', OrderBy.Desc)
            .orderBy('Status', OrderBy.Desc);

        let x = new HttpHeaders();
        this.generatedUrl = `http://localhost/PrivateKey?${query.compile()}`;
        
        this.resp = await this.http.get(this.generatedUrl,
            { headers: x }).toPromise()
```

# GitHub
Please feel free to declare issues or contribute: https://github.com/skynet2/ngx-odata

---
_Source: https://npm.io/package/ngx-odata-v4 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
