# mxd-heimdall

> [![Dependency Status](https://david-dm.org/dragonprojects/mxd-heimdall/status.svg)](https://david-dm.org/dragonprojects/mxd-heimdall) [![devDependency Status](https://david-dm.org/dragonprojects/mxd-heimdall/dev-status.svg)](https://david-dm.org/dragonpro

Latest version **3.3.0** (published 2017-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install mxd-heimdall
pnpm add mxd-heimdall
yarn add mxd-heimdall
bun add mxd-heimdall
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2017-02-06 |
| First published | 2016-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sharaal |
| Maintainers | dragonnodejs |

## Links

- npm: https://www.npmjs.com/package/mxd-heimdall
- Repository: https://github.com/dragonprojects/mxd-heimdall
- Homepage: http://github.com/dragonprojects/mxd-heimdall
- Issues: https://github.com/dragonprojects/mxd-heimdall/issues
- npm.io page: https://npm.io/package/mxd-heimdall

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.74.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.0.2

## Recent versions

- 3.3.0 (latest) — 2017-02-06
- 3.2.0 — 2017-02-02
- 3.1.3 — 2017-02-02
- 3.1.2 — 2017-02-02
- 3.1.1 — 2017-02-02
- 3.1.0 — 2017-02-01
- 3.0.3 — 2017-01-26
- 3.0.2 — 2017-01-26
- 3.0.1 — 2017-01-26
- 2.6.0 — 2017-01-05
- 2.4.0 — 2016-12-21
- 2.3.0 — 2016-10-11
- 2.2.0 — 2016-09-30
- 2.1.0 — 2016-09-20
- 2.0.0 — 2016-09-14
- … 4 more at https://npm.io/package/mxd-heimdall/versions

## README

[![Dependency Status](https://david-dm.org/dragonprojects/mxd-heimdall/status.svg)](https://david-dm.org/dragonprojects/mxd-heimdall)
[![devDependency Status](https://david-dm.org/dragonprojects/mxd-heimdall/dev-status.svg)](https://david-dm.org/dragonprojects/mxd-heimdall?type=dev)

# Installation

`npm i --save mxd-heimdall`


# Initialisation

```
const { AssetsQuery, Heimdall } = require('mxd-heimdall');

const heimdall = new Heimdall({ appid: '<appid>', apikey: '<apikey>' });
```

**Attention**: `mxd-heimdall` will use several information from the `package.json` and add them to the headers. This makes it easier to identify the source of the request in the logs of heimdall if there are issues.
The information which will be used:
* from: 
  * If the author is an object: `${author.name} <${author.email}> (${author.url})`
  * If not, the string will be used
* user-agent: `${appPkg.name} v${appPkg.version} via ${libPkg.name} v${libPkg.version}`


# Examples

## Get information for a specific asset by ID

```
const assetId = <assetId>;
const query = new AssetsQuery(assetId);
const assets = await heimdall.getAssets(query);
```


## Search assets by title and get the first 3 results

```
const title = '<title>';
const query = (new AssetsQuery())
  .filter('contentTypeSeriesOrMovies')
  .filter('search', title)
  .query('pageSize', 3);
const assets = await heimdall.getAssets(query);
```


## Get the 50 newest store movies

```
const query = (new AssetsQuery())
  .filter('availableWithoutPackage')
  .filter('movies')
  .filter('new')
  .filter('notUnlisted')
  .query('pageSize', 50)
  .sort('activeLicenseStart', 'desc');
const assets = await heimdall.getAssets(query);
```

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